deleteCluster method

Future<DeleteClusterResponse> deleteCluster({
  1. required String clusterName,
  2. String? finalSnapshotName,
  3. String? multiRegionClusterName,
})

Deletes a cluster. It also deletes all associated nodes and node endpoints.

May throw ClusterNotFoundFault. May throw InvalidClusterStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw ServiceLinkedRoleNotFoundFault. May throw SnapshotAlreadyExistsFault.

Parameter clusterName : The name of the cluster to be deleted

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

Parameter multiRegionClusterName : The name of the multi-Region cluster to be deleted.

Implementation

Future<DeleteClusterResponse> deleteCluster({
  required String clusterName,
  String? finalSnapshotName,
  String? multiRegionClusterName,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonMemoryDB.DeleteCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      if (finalSnapshotName != null) 'FinalSnapshotName': finalSnapshotName,
      if (multiRegionClusterName != null)
        'MultiRegionClusterName': multiRegionClusterName,
    },
  );

  return DeleteClusterResponse.fromJson(jsonResponse.body);
}