Skip to content

modify_backup_attributes async

modify_backup_attributes(
    backup_id: BackupId,
    never_expires: Boolean,
    *,
    config_overrides: Optional[AsyncCloudHSMV2ClientConfig] = None,
) -> ModifyBackupAttributesResponse

Modifies attributes for CloudHSM backup.

Cross-account use: No. You cannot perform this operation on an CloudHSM backup in a different Amazon Web Services account.

Parameters:

  • backup_id (BackupId) –

    The identifier (ID) of the backup to modify. To find the ID of a backup, use the DescribeBackups operation.

  • never_expires (Boolean) –

    Specifies whether the service should exempt a backup from the retention policy for the cluster. True exempts a backup from the retention policy. False means the service applies the backup retention policy defined at the cluster.

Raises:

Source code in docs_src/capo_cloudhsm_v2/_services/async_cloud_hsmv2.py
async def modify_backup_attributes(
    self,
    backup_id: "capo_cloudhsm_v2.types.backup_id.BackupId",
    never_expires: "capo_cloudhsm_v2.types.boolean.Boolean",
    *,
    config_overrides: Optional[AsyncCloudHSMV2ClientConfig] = None,
) -> "capo_cloudhsm_v2.types.modify_backup_attributes_response.ModifyBackupAttributesResponse":
    """<p>Modifies attributes for CloudHSM backup.</p> <p> <b>Cross-account use:</b> No. You cannot perform this operation on an CloudHSM backup in a different Amazon Web Services account.</p>

    Args:
        backup_id: <p>The identifier (ID) of the backup to modify. To find the ID of a backup, use the <a>DescribeBackups</a> operation.</p>
        never_expires: <p>Specifies whether the service should exempt a backup from the retention policy for the cluster. <code>True</code> exempts a backup from the retention policy. <code>False</code> means the service applies the backup retention policy defined at the cluster.</p>

    Raises:
        capo_cloudhsm_v2.errors.cloud_hsm_access_denied_exception.CloudHsmAccessDeniedException: <p>The request was rejected because the requester does not have permission to perform the requested operation.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_internal_failure_exception.CloudHsmInternalFailureException: <p>The request was rejected because of an CloudHSM internal failure. The request can be retried.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_invalid_request_exception.CloudHsmInvalidRequestException: <p>The request was rejected because it is not a valid request.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_resource_not_found_exception.CloudHsmResourceNotFoundException: <p>The request was rejected because it refers to a resource that cannot be found.</p>
        capo_cloudhsm_v2.errors.cloud_hsm_service_exception.CloudHsmServiceException: <p>The request was rejected because an error occurred.</p>
        capo_cloudhsm_v2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudhsm_v2.types.modify_backup_attributes_request.ModifyBackupAttributesRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudhsm_v2.types.modify_backup_attributes_response.ModifyBackupAttributesResponse"
    ]:
        import capo_cloudhsm_v2._operations.baldr_api_service.modify_backup_attributes

        (
            output,
            http_response,
        ) = await capo_cloudhsm_v2._operations.baldr_api_service.modify_backup_attributes.async_modify_backup_attributes(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ModifyBackupAttributes")
    )
    input_: capo_cloudhsm_v2.types.modify_backup_attributes_request.ModifyBackupAttributesRequest = {
        "backup_id": backup_id,
        "never_expires": never_expires,
    }

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