Skip to content

test_connection_function async

test_connection_function(
    id: ResourceId,
    if_match: string,
    connection_object: FunctionEventObject,
    *,
    config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
    stage: Optional[FunctionStage] = None,
) -> TestConnectionFunctionResult

Tests a connection function.

Parameters:

  • id (ResourceId) –

    The connection function ID.

  • if_match (string) –

    The current version (ETag value) of the connection function.

  • stage (Optional[FunctionStage], default: None ) –

    The connection function stage.

  • connection_object (FunctionEventObject) –

    The connection object.

Raises:

Source code in docs_src/capo_cloudfront/_services/async_cloud_front.py
async def test_connection_function(
    self,
    id: "capo_cloudfront.types.resource_id.ResourceId",
    if_match: "capo_cloudfront.types.string.string",
    connection_object: "capo_cloudfront.types.function_event_object.FunctionEventObject",
    *,
    config_overrides: Optional[AsyncCloudFrontClientConfig] = None,
    stage: Optional["capo_cloudfront.types.function_stage.FunctionStage"] = None,
) -> "capo_cloudfront.types.test_connection_function_result.TestConnectionFunctionResult":
    """<p>Tests a connection function.</p>

    Args:
        id: <p>The connection function ID.</p>
        if_match: <p>The current version (<code>ETag</code> value) of the connection function.</p>
        stage: <p>The connection function stage.</p>
        connection_object: <p>The connection object.</p>

    Raises:
        capo_cloudfront.errors.entity_not_found.EntityNotFound: <p>The entity was not found.</p>
        capo_cloudfront.errors.invalid_argument.InvalidArgument: <p>An argument is invalid.</p>
        capo_cloudfront.errors.invalid_if_match_version.InvalidIfMatchVersion: <p>The <code>If-Match</code> version is missing or not valid.</p>
        capo_cloudfront.errors.precondition_failed.PreconditionFailed: <p>The precondition in one or more of the request fields evaluated to <code>false</code>.</p>
        capo_cloudfront.errors.test_function_failed.TestFunctionFailed: <p>The CloudFront function failed.</p>
        capo_cloudfront.errors.unsupported_operation.UnsupportedOperation: <p>This operation is not supported in this Amazon Web Services Region.</p>
        capo_cloudfront.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudfront.types.test_connection_function_request.TestConnectionFunctionRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudfront.types.test_connection_function_result.TestConnectionFunctionResult"
    ]:
        import capo_cloudfront._operations.cloudfront2020_05_31.test_connection_function

        (
            output,
            http_response,
        ) = await capo_cloudfront._operations.cloudfront2020_05_31.test_connection_function.async_test_connection_function(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cloudfront.types.test_connection_function_request.TestConnectionFunctionRequest",
    ) -> dict[str, Any]:
        import capo_cloudfront.types.test_connection_function_request

        return (
            capo_cloudfront.types.test_connection_function_request.redact_sensitive(
                input_
            )
        )

    def _redact_output(
        output: "capo_cloudfront.types.test_connection_function_result.TestConnectionFunctionResult",
    ) -> dict[str, Any]:
        import capo_cloudfront.types.test_connection_function_result

        return (
            capo_cloudfront.types.test_connection_function_result.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "TestConnectionFunction",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_cloudfront.types.test_connection_function_request.TestConnectionFunctionRequest = {
        "id": id,
        "if_match": if_match,
        "connection_object": connection_object,
    }
    if stage is not None:
        input_["stage"] = stage

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