Skip to content

associate_source_network_stack async

associate_source_network_stack(
    source_network_id: SourceNetworkID,
    cfn_stack_name: CfnStackName,
    *,
    config_overrides: Optional[AsyncdrsClientConfig] = None,
) -> AssociateSourceNetworkStackResponse

Associate a Source Network to an existing CloudFormation Stack and modify launch templates to use this network. Can be used for reverting to previously deployed CloudFormation stacks.

Parameters:

  • source_network_id (SourceNetworkID) –

    The Source Network ID to associate with CloudFormation template.

  • cfn_stack_name (CfnStackName) –

    CloudFormation template to associate with a Source Network.

Raises:

Source code in docs_src/capo_drs/_services/async_drs.py
async def associate_source_network_stack(
    self,
    source_network_id: "capo_drs.types.source_network_id.SourceNetworkID",
    cfn_stack_name: "capo_drs.types.cfn_stack_name.CfnStackName",
    *,
    config_overrides: Optional[AsyncdrsClientConfig] = None,
) -> "capo_drs.types.associate_source_network_stack_response.AssociateSourceNetworkStackResponse":
    """<p>Associate a Source Network to an existing CloudFormation Stack and modify launch templates to use this network. Can be used for reverting to previously deployed CloudFormation stacks.</p>

    Args:
        source_network_id: <p>The Source Network ID to associate with CloudFormation template.</p>
        cfn_stack_name: <p>CloudFormation template to associate with a Source Network.</p>

    Raises:
        capo_drs.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the target resource.</p>
        capo_drs.errors.internal_server_exception.InternalServerException: <p>The request processing has failed because of an unknown error, exception or failure.</p>
        capo_drs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource for this operation was not found.</p>
        capo_drs.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request could not be completed because its exceeded the service quota.</p>
        capo_drs.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_drs.errors.uninitialized_account_exception.UninitializedAccountException: <p>The account performing the request has not been initialized.</p>
        capo_drs.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by the AWS service.</p>
        capo_drs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_drs.types.associate_source_network_stack_request.AssociateSourceNetworkStackRequest]",
    ) -> AsyncOperationResponse[
        "capo_drs.types.associate_source_network_stack_response.AssociateSourceNetworkStackResponse"
    ]:
        import capo_drs._operations.elastic_disaster_recovery_service.associate_source_network_stack

        (
            output,
            http_response,
        ) = await capo_drs._operations.elastic_disaster_recovery_service.associate_source_network_stack.async_associate_source_network_stack(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_drs.types.associate_source_network_stack_request.AssociateSourceNetworkStackRequest",
    ) -> dict[str, Any]:
        import capo_drs.types.associate_source_network_stack_request

        return (
            capo_drs.types.associate_source_network_stack_request.redact_sensitive(
                input_
            )
        )

    def _redact_output(
        output: "capo_drs.types.associate_source_network_stack_response.AssociateSourceNetworkStackResponse",
    ) -> dict[str, Any]:
        import capo_drs.types.associate_source_network_stack_response

        return (
            capo_drs.types.associate_source_network_stack_response.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "AssociateSourceNetworkStack",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_drs.types.associate_source_network_stack_request.AssociateSourceNetworkStackRequest = {
        "source_network_id": source_network_id,
        "cfn_stack_name": cfn_stack_name,
    }

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