Skip to content

create_source_network

create_source_network(
    vpc_id: VpcID,
    origin_account_id: AccountID,
    origin_region: AwsRegion,
    *,
    config_overrides: Optional[drsClientConfig] = None,
    tags: Optional[TagsMap] = None,
) -> CreateSourceNetworkResponse

Create a new Source Network resource for a provided VPC ID.

Parameters:

  • vpc_id (VpcID) –

    Which VPC ID to protect.

  • origin_account_id (AccountID) –

    Account containing the VPC to protect.

  • origin_region (AwsRegion) –

    Region containing the VPC to protect.

  • tags (Optional[TagsMap], default: None ) –

    A set of tags to be associated with the Source Network resource.

Raises:

Source code in docs_src/capo_drs/_services/drs.py
def create_source_network(
    self,
    vpc_id: "capo_drs.types.vpc_id.VpcID",
    origin_account_id: "capo_drs.types.account_id.AccountID",
    origin_region: "capo_drs.types.aws_region.AwsRegion",
    *,
    config_overrides: Optional[drsClientConfig] = None,
    tags: Optional["capo_drs.types.tags_map.TagsMap"] = None,
) -> "capo_drs.types.create_source_network_response.CreateSourceNetworkResponse":
    """<p>Create a new Source Network resource for a provided VPC ID.</p>

    Args:
        vpc_id: <p>Which VPC ID to protect.</p>
        origin_account_id: <p>Account containing the VPC to protect.</p>
        origin_region: <p>Region containing the VPC to protect.</p>
        tags: <p>A set of tags to be associated with the Source Network resource.</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.
    """

    def _handler(
        req: "OperationRequest[capo_drs.types.create_source_network_request.CreateSourceNetworkRequest]",
    ) -> OperationResponse[
        "capo_drs.types.create_source_network_response.CreateSourceNetworkResponse"
    ]:
        import capo_drs._operations.elastic_disaster_recovery_service.create_source_network

        output, http_response = (
            capo_drs._operations.elastic_disaster_recovery_service.create_source_network.create_source_network(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_drs.types.create_source_network_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateSourceNetwork", redact_input=_redact_input),
    )
    input_: capo_drs.types.create_source_network_request.CreateSourceNetworkRequest = {
        "vpc_id": vpc_id,
        "origin_account_id": origin_account_id,
        "origin_region": origin_region,
    }
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output