Skip to content

delete_serverless_cache

delete_serverless_cache(
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_name: Optional[String] = None,
    final_snapshot_name: Optional[String] = None,
) -> DeleteServerlessCacheResponse

Deletes a specified existing serverless cache.

CreateServerlessCacheSnapshot permission is required to create a final snapshot. Without this permission, the API call will fail with an Access Denied exception.

Parameters:

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

    The identifier of the serverless cache to be deleted.

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

    Name of the final snapshot to be taken before the serverless cache is deleted. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL, i.e. a final snapshot is not taken.

Raises:

Source code in docs_src/capo_elasticache/_services/elasti_cache.py
def delete_serverless_cache(
    self,
    *,
    config_overrides: Optional[ElastiCacheClientConfig] = None,
    serverless_cache_name: Optional["capo_elasticache.types.string.String"] = None,
    final_snapshot_name: Optional["capo_elasticache.types.string.String"] = None,
) -> "capo_elasticache.types.delete_serverless_cache_response.DeleteServerlessCacheResponse":
    """<p>Deletes a specified existing serverless cache.</p> <note> <p> <code>CreateServerlessCacheSnapshot</code> permission is required to create a final snapshot. Without this permission, the API call will fail with an <code>Access Denied</code> exception.</p> </note>

    Args:
        serverless_cache_name: <p>The identifier of the serverless cache to be deleted.</p>
        final_snapshot_name: <p>Name of the final snapshot to be taken before the serverless cache is deleted. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL, i.e. a final snapshot is not taken.</p>

    Raises:
        capo_elasticache.errors.invalid_credentials_exception.InvalidCredentialsException: <p>You must enter valid credentials.</p>
        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_serverless_cache_state_fault.InvalidServerlessCacheStateFault: <p>The account for these credentials is not currently active.</p>
        capo_elasticache.errors.serverless_cache_not_found_fault.ServerlessCacheNotFoundFault: <p>The serverless cache was not found or does not exist.</p>
        capo_elasticache.errors.serverless_cache_snapshot_already_exists_fault.ServerlessCacheSnapshotAlreadyExistsFault: <p>A serverless cache snapshot with this name already exists. Available for Valkey, Redis OSS and Serverless Memcached only.</p>
        capo_elasticache.errors.service_linked_role_not_found_fault.ServiceLinkedRoleNotFoundFault: <p>The specified service linked role (SLR) was not found.</p>
        capo_elasticache.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_elasticache.types.delete_serverless_cache_request.DeleteServerlessCacheRequest]",
    ) -> OperationResponse[
        "capo_elasticache.types.delete_serverless_cache_response.DeleteServerlessCacheResponse"
    ]:
        import capo_elasticache._operations.amazon_elasti_cache_v9.delete_serverless_cache

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

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteServerlessCache")
    )
    input_: capo_elasticache.types.delete_serverless_cache_request.DeleteServerlessCacheRequest = {}
    if serverless_cache_name is not None:
        input_["serverless_cache_name"] = serverless_cache_name
    if final_snapshot_name is not None:
        input_["final_snapshot_name"] = final_snapshot_name

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