Skip to content

create_backup_plan

create_backup_plan(
    backup_plan: BackupPlanInput,
    *,
    config_overrides: Optional[BackupClientConfig] = None,
    backup_plan_tags: Optional[Tags] = None,
    creator_request_id: Optional[string] = None,
) -> CreateBackupPlanOutput

Creates a backup plan using a backup plan name and backup rules. A backup plan is a document that contains information that Backup uses to schedule tasks that create recovery points for resources.

If you call CreateBackupPlan with a plan that already exists, you receive an AlreadyExistsException exception.

Parameters:

  • backup_plan (BackupPlanInput) –

    The body of a backup plan. Includes a BackupPlanName and one or more sets of Rules.

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

    The tags to assign to the backup plan.

  • creator_request_id (Optional[string], default: None ) –

    Identifies the request and allows failed requests to be retried without the risk of running the operation twice. If the request includes a CreatorRequestId that matches an existing backup plan, that plan is returned. This parameter is optional.

    If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.

Raises:

Source code in docs_src/capo_backup/_services/backup.py
def create_backup_plan(
    self,
    backup_plan: "capo_backup.types.backup_plan_input.BackupPlanInput",
    *,
    config_overrides: Optional[BackupClientConfig] = None,
    backup_plan_tags: Optional["capo_backup.types.tags.Tags"] = None,
    creator_request_id: Optional["capo_backup.types.string.string"] = None,
) -> "capo_backup.types.create_backup_plan_output.CreateBackupPlanOutput":
    """<p>Creates a backup plan using a backup plan name and backup rules. A backup plan is a document that contains information that Backup uses to schedule tasks that create recovery points for resources.</p> <p>If you call <code>CreateBackupPlan</code> with a plan that already exists, you receive an <code>AlreadyExistsException</code> exception.</p>

    Args:
        backup_plan: <p>The body of a backup plan. Includes a <code>BackupPlanName</code> and one or more sets of <code>Rules</code>.</p>
        backup_plan_tags: <p>The tags to assign to the backup plan.</p>
        creator_request_id: <p>Identifies the request and allows failed requests to be retried without the risk of running the operation twice. If the request includes a <code>CreatorRequestId</code> that matches an existing backup plan, that plan is returned. This parameter is optional.</p> <p>If used, this parameter must contain 1 to 50 alphanumeric or '-_.' characters.</p>

    Raises:
        capo_backup.errors.already_exists_exception.AlreadyExistsException: <p>The required resource already exists.</p>
        capo_backup.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>Indicates that something is wrong with a parameter's value. For example, the value is out of range.</p>
        capo_backup.errors.limit_exceeded_exception.LimitExceededException: <p>A limit in the request has been exceeded; for example, a maximum number of items allowed in a request.</p>
        capo_backup.errors.missing_parameter_value_exception.MissingParameterValueException: <p>Indicates that a required parameter is missing.</p>
        capo_backup.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request failed due to a temporary failure of the server.</p>
        capo_backup.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_backup.types.create_backup_plan_input.CreateBackupPlanInput]",
    ) -> OperationResponse[
        "capo_backup.types.create_backup_plan_output.CreateBackupPlanOutput"
    ]:
        import capo_backup._operations.cryo_controller_user_manager.create_backup_plan

        output, http_response = (
            capo_backup._operations.cryo_controller_user_manager.create_backup_plan.create_backup_plan(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_backup.types.create_backup_plan_input.CreateBackupPlanInput",
    ) -> dict[str, Any]:
        import capo_backup.types.create_backup_plan_input

        return capo_backup.types.create_backup_plan_input.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateBackupPlan", redact_input=_redact_input),
    )
    input_: capo_backup.types.create_backup_plan_input.CreateBackupPlanInput = {
        "backup_plan": backup_plan
    }
    if backup_plan_tags is not None:
        input_["backup_plan_tags"] = backup_plan_tags
    if creator_request_id is None:
        creator_request_id = str(uuid.uuid4())
    input_["creator_request_id"] = creator_request_id

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