Skip to content

delete_db_snapshot

delete_db_snapshot(
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_snapshot_identifier: Optional[String] = None,
) -> DeleteDBSnapshotResult

Deletes a DB snapshot. If the snapshot is being copied, the copy operation is terminated.

The DB snapshot must be in the available state to be deleted.

Parameters:

  • db_snapshot_identifier (Optional[String], default: None ) –

    The DB snapshot identifier.

    Constraints: Must be the name of an existing DB snapshot in the available state.

Raises:

Examples:

To delete a DB snapshot The following example deletes the specified DB snapshot.

>>> client.delete_db_snapshot(db_snapshot_identifier='mydbsnapshot')
Source code in docs_src/capo_rds/_services/rds.py
def delete_db_snapshot(
    self,
    *,
    config_overrides: Optional[RDSClientConfig] = None,
    db_snapshot_identifier: Optional["capo_rds.types.string.String"] = None,
) -> "capo_rds.types.delete_db_snapshot_result.DeleteDBSnapshotResult":
    """<p>Deletes a DB snapshot. If the snapshot is being copied, the copy operation is terminated.</p> <note> <p>The DB snapshot must be in the <code>available</code> state to be deleted.</p> </note>

    Args:
        db_snapshot_identifier: <p>The DB snapshot identifier.</p> <p>Constraints: Must be the name of an existing DB snapshot in the <code>available</code> state.</p>

    Raises:
        capo_rds.errors.db_snapshot_not_found_fault.DBSnapshotNotFoundFault: <p> <code>DBSnapshotIdentifier</code> doesn't refer to an existing DB snapshot.</p>
        capo_rds.errors.invalid_db_snapshot_state_fault.InvalidDBSnapshotStateFault: <p>The state of the DB snapshot doesn't allow deletion.</p>
        capo_rds.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a DB snapshot
        The following example deletes the specified DB snapshot.

        >>> client.delete_db_snapshot(db_snapshot_identifier='mydbsnapshot')
    """

    def _handler(
        req: "OperationRequest[capo_rds.types.delete_db_snapshot_message.DeleteDBSnapshotMessage]",
    ) -> OperationResponse[
        "capo_rds.types.delete_db_snapshot_result.DeleteDBSnapshotResult"
    ]:
        import capo_rds._operations.amazon_rd_sv19.delete_db_snapshot

        output, http_response = (
            capo_rds._operations.amazon_rd_sv19.delete_db_snapshot.delete_db_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteDBSnapshot")
    )
    input_: capo_rds.types.delete_db_snapshot_message.DeleteDBSnapshotMessage = {}
    if db_snapshot_identifier is not None:
        input_["db_snapshot_identifier"] = db_snapshot_identifier

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