deleteCacheCluster method

Future<DeleteCacheClusterResult> deleteCacheCluster({
  1. required String cacheClusterId,
  2. String? finalSnapshotIdentifier,
})

Deletes a previously provisioned cluster. DeleteCacheCluster deletes all associated cache nodes, node endpoints and the cluster itself. When you receive a successful response from this operation, Amazon ElastiCache immediately begins deleting the cluster; you cannot cancel or revert this operation.

This operation is not valid for:

  • Redis (cluster mode enabled) clusters
  • A cluster that is the last read replica of a replication group
  • A node group (shard) that has Multi-AZ mode enabled
  • A cluster from a Redis (cluster mode enabled) replication group
  • A cluster that is not in the available state

May throw CacheClusterNotFoundFault. May throw InvalidCacheClusterStateFault. May throw SnapshotAlreadyExistsFault. May throw SnapshotFeatureNotSupportedFault. May throw SnapshotQuotaExceededFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

Parameter cacheClusterId : The cluster identifier for the cluster to be deleted. This parameter is not case sensitive.

Parameter finalSnapshotIdentifier : The user-supplied name of a final cluster snapshot. This is the unique name that identifies the snapshot. ElastiCache creates the snapshot, and then deletes the cluster immediately afterward.

Implementation

Future<DeleteCacheClusterResult> deleteCacheCluster({
  required String cacheClusterId,
  String? finalSnapshotIdentifier,
}) async {
  ArgumentError.checkNotNull(cacheClusterId, 'cacheClusterId');
  final $request = <String, dynamic>{};
  $request['CacheClusterId'] = cacheClusterId;
  finalSnapshotIdentifier
      ?.also((arg) => $request['FinalSnapshotIdentifier'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'DeleteCacheCluster',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DeleteCacheClusterMessage'],
    shapes: shapes,
    resultWrapper: 'DeleteCacheClusterResult',
  );
  return DeleteCacheClusterResult.fromXml($result);
}