Skip to content

put_backup_policy async

put_backup_policy(
    file_system_id: FileSystemId,
    backup_policy: BackupPolicy,
    *,
    config_overrides: Optional[AsyncEFSClientConfig] = None,
) -> BackupPolicyDescription

Updates the file system's backup policy. Use this action to start or stop automatic backups of the file system.

Parameters:

  • file_system_id (FileSystemId) –

    Specifies which EFS file system to update the backup policy for.

  • backup_policy (BackupPolicy) –

    The backup policy included in the PutBackupPolicy request.

Raises:

  • BadRequest –

    Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.

  • FileSystemNotFound –

    Returned if the specified FileSystemId value doesn't exist in the requester's Amazon Web Services account.

  • IncorrectFileSystemLifeCycleState –

    Returned if the file system's lifecycle state is not "available".

  • InternalServerError –

    Returned if an error occurred on the server side.

  • ValidationException –

    Returned if the Backup service is not available in the Amazon Web Services Region in which the request was made.

  • UnknownServiceError –

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

Source code in docs_src/capo_efs/_services/async_efs.py
async def put_backup_policy(
    self,
    file_system_id: "capo_efs.types.file_system_id.FileSystemId",
    backup_policy: "capo_efs.types.backup_policy.BackupPolicy",
    *,
    config_overrides: Optional[AsyncEFSClientConfig] = None,
) -> "capo_efs.types.backup_policy_description.BackupPolicyDescription":
    """<p>Updates the file system's backup policy. Use this action to start or stop automatic backups of the file system. </p>

    Args:
        file_system_id: <p>Specifies which EFS file system to update the backup policy for.</p>
        backup_policy: <p>The backup policy included in the <code>PutBackupPolicy</code> request.</p>

    Raises:
        capo_efs.errors.bad_request.BadRequest: <p>Returned if the request is malformed or contains an error such as an invalid parameter value or a missing required parameter.</p>
        capo_efs.errors.file_system_not_found.FileSystemNotFound: <p>Returned if the specified <code>FileSystemId</code> value doesn't exist in the requester's Amazon Web Services account.</p>
        capo_efs.errors.incorrect_file_system_life_cycle_state.IncorrectFileSystemLifeCycleState: <p>Returned if the file system's lifecycle state is not "available".</p>
        capo_efs.errors.internal_server_error.InternalServerError: <p>Returned if an error occurred on the server side.</p>
        capo_efs.errors.validation_exception.ValidationException: <p>Returned if the Backup service is not available in the Amazon Web Services Region in which the request was made.</p>
        capo_efs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_efs.types.put_backup_policy_request.PutBackupPolicyRequest]",
    ) -> AsyncOperationResponse[
        "capo_efs.types.backup_policy_description.BackupPolicyDescription"
    ]:
        import capo_efs._operations.magnolio_api_service_v20150201.put_backup_policy

        (
            output,
            http_response,
        ) = await capo_efs._operations.magnolio_api_service_v20150201.put_backup_policy.async_put_backup_policy(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutBackupPolicy")
    )
    input_: capo_efs.types.put_backup_policy_request.PutBackupPolicyRequest = {
        "file_system_id": file_system_id,
        "backup_policy": backup_policy,
    }

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