Skip to content

delete_snapshot

delete_snapshot(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    snapshot_name: Optional[String] = None,
) -> DeleteSnapshotResult

Deletes an existing snapshot. When you receive a successful response from this operation, ElastiCache immediately begins deleting the snapshot; you cannot cancel or revert this operation.

This operation is valid for Valkey or Redis OSS only.

Parameters:

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

    The name of the snapshot to be deleted.

Raises:

Examples:

DeleteSnapshot Deletes the Redis snapshot snapshot-20160822.

>>> client.delete_snapshot(snapshot_name='snapshot-20161212')
Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def delete_snapshot(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    snapshot_name: Optional["capo_elasticache.types.string.String"] = None,
) -> "capo_elasticache.types.delete_snapshot_result.DeleteSnapshotResult":
    """<p>Deletes an existing snapshot. When you receive a successful response from this operation, ElastiCache immediately begins deleting the snapshot; you cannot cancel or revert this operation.</p> <note> <p>This operation is valid for Valkey or Redis OSS only.</p> </note>

    Args:
        snapshot_name: <p>The name of the snapshot to be deleted.</p>

    Raises:
        capo_elasticache.errors.invalid_parameter_combination_exception.InvalidParameterCombinationException: <p>Two or more incompatible parameters were specified.</p>
        capo_elasticache.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value for a parameter is invalid.</p>
        capo_elasticache.errors.invalid_snapshot_state_fault.InvalidSnapshotStateFault: <p>The current state of the snapshot does not allow the requested operation to occur.</p>
        capo_elasticache.errors.snapshot_not_found_fault.SnapshotNotFoundFault: <p>The requested snapshot name does not refer to an existing snapshot.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        DeleteSnapshot
        Deletes the Redis snapshot snapshot-20160822.

        >>> client.delete_snapshot(snapshot_name='snapshot-20161212')
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.delete_snapshot_message.DeleteSnapshotMessage]",
    ) -> OperationResponse[
        "capo_elasticache.types.delete_snapshot_result.DeleteSnapshotResult"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.delete_snapshot

        output, http_response = (
            capo_elasticache._operations.amazon_elasti_cache_v9.delete_snapshot.delete_snapshot(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteSnapshot")
    )
    input_: capo_elasticache.types.delete_snapshot_message.DeleteSnapshotMessage = {}
    if snapshot_name is not None:
        input_["snapshot_name"] = snapshot_name

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