Skip to content

start_plan_execution async

start_plan_execution(
    plan_arn: PlanArn,
    target_region: str,
    action: ExecutionAction,
    *,
    config_overrides: Optional[AsyncARCRegionswitchClientConfig] = None,
    mode: Optional[ExecutionMode] = None,
    comment: Optional[ExecutionComment] = None,
    latest_version: Optional[str] = None,
    recovery_execution_id: Optional[RecoveryExecutionId] = None,
    client_token: Optional[str] = None,
) -> StartPlanExecutionResponse

Starts the execution of a Region switch plan. You can execute a plan in either graceful or ungraceful mode.

Specifing ungraceful mode either changes the behavior of the execution blocks in a workflow or skips specific execution blocks.

Parameters:

  • plan_arn (PlanArn) –

    The Amazon Resource Name (ARN) of the plan to execute.

  • target_region (str) –

    The Amazon Web Services Region to target with this execution. This is the Region that traffic will be shifted to or from, depending on the action.

  • action (ExecutionAction) –

    The action to perform. Valid values are activate (to shift traffic to the target Region) or deactivate (to shift traffic away from the target Region).

  • mode (Optional[ExecutionMode], default: None ) –

    The plan execution mode. Valid values are graceful, for starting the execution in graceful mode, or ungraceful, for starting the execution in ungraceful mode.

  • comment (Optional[ExecutionComment], default: None ) –

    An optional comment explaining why the plan execution is being started.

  • latest_version (Optional[str], default: None ) –

    A boolean value indicating whether to use the latest version of the plan. If set to false, you must specify a specific version.

  • recovery_execution_id (Optional[RecoveryExecutionId], default: None ) –

    The execution identifier of the recovery execution that ran in the opposite region post-recovery is ran in. Required when starting a post-recovery execution.

  • client_token (Optional[str], default: None ) –

    A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request and returns the result of the original successful request. If you don't provide a client token, the service automatically generates one. For more information about idempotency, see Making retries safe with idempotent APIs.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

    HTTP Status Code: 403

  • ConflictException –

    The client token was already used with different request parameters. A client token must map to the same parameters for every request. To retry this operation, provide a new client token.

  • IllegalArgumentException –

    The request processing has an invalid argument.

  • IllegalStateException –

    The operation failed because the current state of the resource doesn't allow the operation to proceed.

    HTTP Status Code: 400

  • ResourceNotFoundException –

    The specified resource was not found.

    HTTP Status Code: 404

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_arc_region_switch/_services/async_arc_regionswitch.py
async def start_plan_execution(
    self,
    plan_arn: "capo_arc_region_switch.types.plan_arn.PlanArn",
    target_region: str,
    action: "capo_arc_region_switch.types.execution_action.ExecutionAction",
    *,
    config_overrides: Optional[AsyncARCRegionswitchClientConfig] = None,
    mode: Optional[
        "capo_arc_region_switch.types.execution_mode.ExecutionMode"
    ] = None,
    comment: Optional[
        "capo_arc_region_switch.types.execution_comment.ExecutionComment"
    ] = None,
    latest_version: Optional[str] = None,
    recovery_execution_id: Optional[
        "capo_arc_region_switch.types.recovery_execution_id.RecoveryExecutionId"
    ] = None,
    client_token: Optional[str] = None,
) -> "capo_arc_region_switch.types.start_plan_execution_response.StartPlanExecutionResponse":
    """<p>Starts the execution of a Region switch plan. You can execute a plan in either <code>graceful</code> or <code>ungraceful</code> mode.</p> <p>Specifing <code>ungraceful</code> mode either changes the behavior of the execution blocks in a workflow or skips specific execution blocks.</p>

    Args:
        plan_arn: <p>The Amazon Resource Name (ARN) of the plan to execute.</p>
        target_region: <p>The Amazon Web Services Region to target with this execution. This is the Region that traffic will be shifted to or from, depending on the action.</p>
        action: <p>The action to perform. Valid values are <code>activate</code> (to shift traffic to the target Region) or <code>deactivate</code> (to shift traffic away from the target Region).</p>
        mode: <p>The plan execution mode. Valid values are <code>graceful</code>, for starting the execution in graceful mode, or <code>ungraceful</code>, for starting the execution in ungraceful mode.</p>
        comment: <p>An optional comment explaining why the plan execution is being started.</p>
        latest_version: <p>A boolean value indicating whether to use the latest version of the plan. If set to false, you must specify a specific version.</p>
        recovery_execution_id: <p>The execution identifier of the recovery execution that ran in the opposite region post-recovery is ran in. Required when starting a post-recovery execution.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the operation completes no more than one time. If this token matches a previous request, the service ignores the request and returns the result of the original successful request. If you don't provide a client token, the service automatically generates one. For more information about idempotency, see <a href="https://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>.</p>

    Raises:
        capo_arc_region_switch.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p> <p>HTTP Status Code: 403</p>
        capo_arc_region_switch.errors.conflict_exception.ConflictException: <p>The client token was already used with different request parameters. A client token must map to the same parameters for every request. To retry this operation, provide a new client token.</p>
        capo_arc_region_switch.errors.illegal_argument_exception.IllegalArgumentException: <p>The request processing has an invalid argument.</p>
        capo_arc_region_switch.errors.illegal_state_exception.IllegalStateException: <p>The operation failed because the current state of the resource doesn't allow the operation to proceed.</p> <p>HTTP Status Code: 400</p>
        capo_arc_region_switch.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource was not found.</p> <p>HTTP Status Code: 404</p>
        capo_arc_region_switch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_arc_region_switch.types.start_plan_execution_request.StartPlanExecutionRequest]",
    ) -> AsyncOperationResponse[
        "capo_arc_region_switch.types.start_plan_execution_response.StartPlanExecutionResponse"
    ]:
        import capo_arc_region_switch._operations.arc_region_switch.start_plan_execution

        (
            output,
            http_response,
        ) = await capo_arc_region_switch._operations.arc_region_switch.start_plan_execution.async_start_plan_execution(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartPlanExecution")
    )
    input_: capo_arc_region_switch.types.start_plan_execution_request.StartPlanExecutionRequest = {
        "plan_arn": plan_arn,
        "target_region": target_region,
        "action": action,
    }
    if mode is not None:
        input_["mode"] = mode
    if comment is not None:
        input_["comment"] = comment
    if latest_version is not None:
        input_["latest_version"] = latest_version
    if recovery_execution_id is not None:
        input_["recovery_execution_id"] = recovery_execution_id
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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