Skip to content

create_plan

create_plan(
    workflows: WorkflowList,
    execution_role: IamRoleArn,
    name: PlanName,
    regions: RegionList,
    recovery_approach: RecoveryApproach,
    *,
    config_overrides: Optional[ARCRegionswitchClientConfig] = None,
    description: Optional[str] = None,
    recovery_time_objective_minutes: Optional[int] = None,
    associated_alarms: Optional[AssociatedAlarmMap] = None,
    triggers: Optional[TriggerList] = None,
    report_configuration: Optional[ReportConfiguration] = None,
    service_quota_checks_enabled: Optional[bool] = None,
    primary_region: Optional[Region] = None,
    tags: Optional[Tags] = None,
) -> CreatePlanResponse

Creates a new Region switch plan. A plan defines the steps required to shift traffic from one Amazon Web Services Region to another.

You must specify a name for the plan, the primary Region, and at least one additional Region. You can also provide a description, execution role, recovery time objective, associated alarms, triggers, and workflows that define the steps to execute during a Region switch.

Parameters:

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

    The description of a Region switch plan.

  • workflows (WorkflowList) –

    An array of workflows included in a Region switch plan.

  • execution_role (IamRoleArn) –

    An execution role is a way to categorize a Region switch plan.

  • recovery_time_objective_minutes (Optional[int], default: None ) –

    Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.

  • associated_alarms (Optional[AssociatedAlarmMap], default: None ) –

    The alarms associated with a Region switch plan.

  • triggers (Optional[TriggerList], default: None ) –

    The triggers associated with a Region switch plan.

  • service_quota_checks_enabled (Optional[bool], default: None ) –

    Specifies whether to enable service quota checks for the Region switch plan.

  • name (PlanName) –

    The name of a Region switch plan.

  • regions (RegionList) –

    An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.

  • recovery_approach (RecoveryApproach) –

    The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).

  • primary_region (Optional[Region], default: None ) –

    The primary Amazon Web Services Region for the application. This is the Region where the application normally runs before any Region switch occurs.

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

    The tags to apply to the Region switch plan.

Raises:

Source code in docs_src/capo_arc_region_switch/_services/arc_regionswitch.py
def create_plan(
    self,
    workflows: "capo_arc_region_switch.types.workflow_list.WorkflowList",
    execution_role: "capo_arc_region_switch.types.iam_role_arn.IamRoleArn",
    name: "capo_arc_region_switch.types.plan_name.PlanName",
    regions: "capo_arc_region_switch.types.region_list.RegionList",
    recovery_approach: "capo_arc_region_switch.types.recovery_approach.RecoveryApproach",
    *,
    config_overrides: Optional[ARCRegionswitchClientConfig] = None,
    description: Optional[str] = None,
    recovery_time_objective_minutes: Optional[int] = None,
    associated_alarms: Optional[
        "capo_arc_region_switch.types.associated_alarm_map.AssociatedAlarmMap"
    ] = None,
    triggers: Optional[
        "capo_arc_region_switch.types.trigger_list.TriggerList"
    ] = None,
    report_configuration: Optional[
        "capo_arc_region_switch.types.report_configuration.ReportConfiguration"
    ] = None,
    service_quota_checks_enabled: Optional[bool] = None,
    primary_region: Optional["capo_arc_region_switch.types.region.Region"] = None,
    tags: Optional["capo_arc_region_switch.types.tags.Tags"] = None,
) -> "capo_arc_region_switch.types.create_plan_response.CreatePlanResponse":
    """<p>Creates a new Region switch plan. A plan defines the steps required to shift traffic from one Amazon Web Services Region to another.</p> <p>You must specify a name for the plan, the primary Region, and at least one additional Region. You can also provide a description, execution role, recovery time objective, associated alarms, triggers, and workflows that define the steps to execute during a Region switch.</p>

    Args:
        description: <p>The description of a Region switch plan.</p>
        workflows: <p>An array of workflows included in a Region switch plan.</p>
        execution_role: <p>An execution role is a way to categorize a Region switch plan.</p>
        recovery_time_objective_minutes: <p>Optionally, you can specify an recovery time objective for a Region switch plan, in minutes.</p>
        associated_alarms: <p>The alarms associated with a Region switch plan.</p>
        triggers: <p>The triggers associated with a Region switch plan.</p>
        service_quota_checks_enabled: <p>Specifies whether to enable service quota checks for the Region switch plan.</p>
        name: <p>The name of a Region switch plan.</p>
        regions: <p>An array that specifies the Amazon Web Services Regions for a Region switch plan. Specify two Regions.</p>
        recovery_approach: <p>The recovery approach for a Region switch plan, which can be active/active (activeActive) or active/passive (activePassive).</p>
        primary_region: <p>The primary Amazon Web Services Region for the application. This is the Region where the application normally runs before any Region switch occurs.</p>
        tags: <p>The tags to apply to the Region switch plan.</p>

    Raises:
        capo_arc_region_switch.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_arc_region_switch.types.create_plan_request.CreatePlanRequest]",
    ) -> OperationResponse[
        "capo_arc_region_switch.types.create_plan_response.CreatePlanResponse"
    ]:
        import capo_arc_region_switch._operations.arc_region_switch.create_plan

        output, http_response = (
            capo_arc_region_switch._operations.arc_region_switch.create_plan.create_plan(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_arc_region_switch.types.create_plan_request.CreatePlanRequest",
    ) -> dict[str, Any]:
        import capo_arc_region_switch.types.create_plan_request

        return capo_arc_region_switch.types.create_plan_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_arc_region_switch.types.create_plan_response.CreatePlanResponse",
    ) -> dict[str, Any]:
        import capo_arc_region_switch.types.create_plan_response

        return capo_arc_region_switch.types.create_plan_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreatePlan", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_arc_region_switch.types.create_plan_request.CreatePlanRequest = {
        "workflows": workflows,
        "execution_role": execution_role,
        "name": name,
        "regions": regions,
        "recovery_approach": recovery_approach,
    }
    if description is not None:
        input_["description"] = description
    if recovery_time_objective_minutes is not None:
        input_["recovery_time_objective_minutes"] = recovery_time_objective_minutes
    if associated_alarms is not None:
        input_["associated_alarms"] = associated_alarms
    if triggers is not None:
        input_["triggers"] = triggers
    if report_configuration is not None:
        input_["report_configuration"] = report_configuration
    if service_quota_checks_enabled is not None:
        input_["service_quota_checks_enabled"] = service_quota_checks_enabled
    if primary_region is not None:
        input_["primary_region"] = primary_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