Skip to content

test_connection async

test_connection(
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    connection_name: Optional[NameString] = None,
    catalog_id: Optional[CatalogIdString] = None,
    test_connection_input: Optional[TestConnectionInput] = None,
) -> TestConnectionResponse

Tests a connection to a service to validate the service credentials that you provide.

You can either provide an existing connection name or a TestConnectionInput for testing a non-existing connection input. Providing both at the same time will cause an error.

If the action is successful, the service sends back an HTTP 200 response.

Parameters:

  • connection_name (Optional[NameString], default: None ) –

    Optional. The name of the connection to test. If only name is provided, the operation will get the connection and use that for testing.

  • catalog_id (Optional[CatalogIdString], default: None ) –

    The catalog ID where the connection resides.

  • test_connection_input (Optional[TestConnectionInput], default: None ) –

    A structure that is used to specify testing a connection to a service.

Raises:

Source code in docs_src/capo_glue/_services/async_glue.py
async def test_connection(
    self,
    *,
    config_overrides: Optional[AsyncGlueClientConfig] = None,
    connection_name: Optional["capo_glue.types.name_string.NameString"] = None,
    catalog_id: Optional[
        "capo_glue.types.catalog_id_string.CatalogIdString"
    ] = None,
    test_connection_input: Optional[
        "capo_glue.types.test_connection_input.TestConnectionInput"
    ] = None,
) -> "capo_glue.types.test_connection_response.TestConnectionResponse":
    """<p>Tests a connection to a service to validate the service credentials that you provide.</p> <p>You can either provide an existing connection name or a <code>TestConnectionInput</code> for testing a non-existing connection input. Providing both at the same time will cause an error.</p> <p>If the action is successful, the service sends back an HTTP 200 response.</p>

    Args:
        connection_name: <p>Optional. The name of the connection to test. If only name is provided, the operation will get the connection and use that for testing.</p>
        catalog_id: <p>The catalog ID where the connection resides.</p>
        test_connection_input: <p>A structure that is used to specify testing a connection to a service.</p>

    Raises:
        capo_glue.errors.access_denied_exception.AccessDeniedException: <p>Access to a resource was denied.</p>
        capo_glue.errors.conflict_exception.ConflictException: <p>The <code>CreatePartitions</code> API was called on a table that has indexes enabled. </p>
        capo_glue.errors.entity_not_found_exception.EntityNotFoundException: <p>A specified entity does not exist</p>
        capo_glue.errors.federation_source_exception.FederationSourceException: <p>A federation source failed.</p>
        capo_glue.errors.glue_encryption_exception.GlueEncryptionException: <p>An encryption operation failed.</p>
        capo_glue.errors.internal_service_exception.InternalServiceException: <p>An internal service error occurred.</p>
        capo_glue.errors.invalid_input_exception.InvalidInputException: <p>The input provided was not valid.</p>
        capo_glue.errors.operation_timeout_exception.OperationTimeoutException: <p>The operation timed out.</p>
        capo_glue.errors.resource_number_limit_exceeded_exception.ResourceNumberLimitExceededException: <p>A resource numerical limit was exceeded.</p>
        capo_glue.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_glue.types.test_connection_request.TestConnectionRequest]",
    ) -> AsyncOperationResponse[
        "capo_glue.types.test_connection_response.TestConnectionResponse"
    ]:
        import capo_glue._operations.aws_glue.test_connection

        (
            output,
            http_response,
        ) = await capo_glue._operations.aws_glue.test_connection.async_test_connection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_glue.types.test_connection_request.TestConnectionRequest",
    ) -> dict[str, Any]:
        import capo_glue.types.test_connection_request

        return capo_glue.types.test_connection_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("TestConnection", redact_input=_redact_input),
    )
    input_: capo_glue.types.test_connection_request.TestConnectionRequest = {}
    if connection_name is not None:
        input_["connection_name"] = connection_name
    if catalog_id is not None:
        input_["catalog_id"] = catalog_id
    if test_connection_input is not None:
        input_["test_connection_input"] = test_connection_input

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output