Skip to content

create_environment_connection async

create_environment_connection(
    environment_arn: EnvironmentArn,
    provider_config: ConnectionProviderConfig,
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> CreateEnvironmentConnectionOutput

Creates a connection between a governance environment and an evidence source. Specify the source in providerConfig.

If you call this operation again for a source that is already connected, AWS Assurance returns the current status of the connection and doesn't create a second one.

Parameters:

Raises:

Examples:

Create an S3 evidence connection Creates an Amazon S3 connection so the payments team can collect PCI-DSS evidence from a bucket into the governance environment.

>>> await client.create_environment_connection(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', provider_config={'s3': {'sourceUri': 's3://payments-prod-evidence/pci-dss/', 'expectedBucketOwner': '111122223333'}})
Source code in docs_src/capo_assurance/_services/async_assurance.py
async def create_environment_connection(
    self,
    environment_arn: "capo_assurance.types.environment_arn.EnvironmentArn",
    provider_config: "capo_assurance.types.connection_provider_config.ConnectionProviderConfig",
    *,
    config_overrides: Optional[AsyncAssuranceClientConfig] = None,
) -> "capo_assurance.types.create_environment_connection_output.CreateEnvironmentConnectionOutput":
    """<p>Creates a connection between a governance environment and an evidence source. Specify the source in <code>providerConfig</code>.</p> <p>If you call this operation again for a source that is already connected, AWS Assurance returns the current status of the connection and doesn't create a second one.</p>

    Args:
        environment_arn: <p>The ARN of this governance environment.</p>
        provider_config: <p>The evidence source to connect. Set exactly one member.</p>

    Raises:
        capo_assurance.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action. This error occurs when the request is unauthenticated, or is authenticated but lacks permission to invoke the operation.</p>
        capo_assurance.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred.</p>
        capo_assurance.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_assurance.errors.throttling_exception.ThrottlingException: <p>The request was throttled.</p>
        capo_assurance.errors.validation_exception.ValidationException: <p>The request failed validation.</p>
        capo_assurance.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Create an S3 evidence connection
        Creates an Amazon S3 connection so the payments team can collect PCI-DSS evidence from a bucket into the governance environment.

        >>> await client.create_environment_connection(environment_arn='arn:aws:assurance:us-east-1:111122223333:environment/a1b2c3d4-5678-90ab-cdef-EXAMPLE11111', provider_config={'s3': {'sourceUri': 's3://payments-prod-evidence/pci-dss/', 'expectedBucketOwner': '111122223333'}})
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_assurance.types.create_environment_connection_input.CreateEnvironmentConnectionInput]",
    ) -> AsyncOperationResponse[
        "capo_assurance.types.create_environment_connection_output.CreateEnvironmentConnectionOutput"
    ]:
        import capo_assurance._operations.assurance.create_environment_connection

        (
            output,
            http_response,
        ) = await capo_assurance._operations.assurance.create_environment_connection.async_create_environment_connection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_assurance.types.create_environment_connection_output.CreateEnvironmentConnectionOutput",
    ) -> dict[str, Any]:
        import capo_assurance.types.create_environment_connection_output

        return capo_assurance.types.create_environment_connection_output.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateEnvironmentConnection", redact_output=_redact_output
        ),
    )
    input_: capo_assurance.types.create_environment_connection_input.CreateEnvironmentConnectionInput = {
        "environment_arn": environment_arn,
        "provider_config": provider_config,
    }

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