Skip to content

create_backup_selection async

create_backup_selection(
    backup_plan_id: string,
    backup_selection: BackupSelection,
    *,
    config_overrides: Optional[AsyncBackupClientConfig] = None,
    creator_request_id: Optional[string] = None,
) -> CreateBackupSelectionOutput

Creates a JSON document that specifies a set of resources to assign to a backup plan. For examples, see Assigning resources programmatically.

Parameters:

  • backup_plan_id (string) –

    The ID of the backup plan.

  • backup_selection (BackupSelection) –

    The body of a request to assign a set of resources to a backup plan.

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

    A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice. 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/async_backup.py
async def create_backup_selection(
    self,
    backup_plan_id: "capo_backup.types.string.string",
    backup_selection: "capo_backup.types.backup_selection.BackupSelection",
    *,
    config_overrides: Optional[AsyncBackupClientConfig] = None,
    creator_request_id: Optional["capo_backup.types.string.string"] = None,
) -> "capo_backup.types.create_backup_selection_output.CreateBackupSelectionOutput":
    """<p>Creates a JSON document that specifies a set of resources to assign to a backup plan. For examples, see <a href="https://docs.aws.amazon.com/aws-backup/latest/devguide/assigning-resources.html#assigning-resources-json">Assigning resources programmatically</a>. </p>

    Args:
        backup_plan_id: <p>The ID of the backup plan.</p>
        backup_selection: <p>The body of a request to assign a set of resources to a backup plan.</p>
        creator_request_id: <p>A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice. 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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_backup.types.create_backup_selection_input.CreateBackupSelectionInput]",
    ) -> AsyncOperationResponse[
        "capo_backup.types.create_backup_selection_output.CreateBackupSelectionOutput"
    ]:
        import capo_backup._operations.cryo_controller_user_manager.create_backup_selection

        (
            output,
            http_response,
        ) = await capo_backup._operations.cryo_controller_user_manager.create_backup_selection.async_create_backup_selection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateBackupSelection")
    )
    input_: capo_backup.types.create_backup_selection_input.CreateBackupSelectionInput = {
        "backup_plan_id": backup_plan_id,
        "backup_selection": backup_selection,
    }
    if creator_request_id is None:
        creator_request_id = str(uuid.uuid4())
    input_["creator_request_id"] = creator_request_id

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