Skip to content

create_recovery_plan async

create_recovery_plan(
    name: RecoveryPlanName,
    *,
    config_overrides: Optional[AsyncdrsClientConfig] = None,
    description: Optional[RecoveryPlanDescription] = None,
    client_token: Optional[ClientIdempotencyToken] = None,
    tags: Optional[TagsMap] = None,
) -> CreateRecoveryPlanResponse

Creates a Recovery Plan to orchestrate multi-server disaster recovery.

Parameters:

Raises:

Source code in docs_src/capo_drs/_services/async_drs.py
async def create_recovery_plan(
    self,
    name: "capo_drs.types.recovery_plan_name.RecoveryPlanName",
    *,
    config_overrides: Optional[AsyncdrsClientConfig] = None,
    description: Optional[
        "capo_drs.types.recovery_plan_description.RecoveryPlanDescription"
    ] = None,
    client_token: Optional[
        "capo_drs.types.client_idempotency_token.ClientIdempotencyToken"
    ] = None,
    tags: Optional["capo_drs.types.tags_map.TagsMap"] = None,
) -> "capo_drs.types.create_recovery_plan_response.CreateRecoveryPlanResponse":
    """<p>Creates a Recovery Plan to orchestrate multi-server disaster recovery.</p>

    Args:
        client_token: <p>A unique string provided to ensure request idempotency.</p>
        tags: <p>The tags to apply to the Recovery Plan.</p>

    Raises:
        capo_drs.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        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.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.create_recovery_plan_request.CreateRecoveryPlanRequest]",
    ) -> AsyncOperationResponse[
        "capo_drs.types.create_recovery_plan_response.CreateRecoveryPlanResponse"
    ]:
        import capo_drs._operations.elastic_disaster_recovery_service.create_recovery_plan

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

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

        return capo_drs.types.create_recovery_plan_request.redact_sensitive(input_)

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

        return capo_drs.types.create_recovery_plan_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateRecoveryPlan",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_drs.types.create_recovery_plan_request.CreateRecoveryPlanRequest = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if tags is not None:
        input_["tags"] = tags

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