deleteReplicationGroup method
Deletes an existing replication group. By default, this operation deletes
the entire replication group, including the primary/primaries and all of
the read replicas. If the replication group has only one primary, you can
optionally delete only the read replicas, while retaining the primary by
setting RetainPrimaryCluster=true
.
When you receive a successful response from this operation, Amazon ElastiCache immediately begins deleting the selected resources; you cannot cancel or revert this operation.
May throw ReplicationGroupNotFoundFault. May throw InvalidReplicationGroupStateFault. May throw SnapshotAlreadyExistsFault. May throw SnapshotFeatureNotSupportedFault. May throw SnapshotQuotaExceededFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.
Parameter replicationGroupId
:
The identifier for the cluster to be deleted. This parameter is not case
sensitive.
Parameter finalSnapshotIdentifier
:
The name of a final node group (shard) snapshot. ElastiCache creates the
snapshot from the primary node in the cluster, rather than one of the
replicas; this is to ensure that it captures the freshest data. After the
final snapshot is taken, the replication group is immediately deleted.
Parameter retainPrimaryCluster
:
If set to true
, all of the read replicas are deleted, but the
primary node is retained.
Implementation
Future<DeleteReplicationGroupResult> deleteReplicationGroup({
required String replicationGroupId,
String? finalSnapshotIdentifier,
bool? retainPrimaryCluster,
}) async {
ArgumentError.checkNotNull(replicationGroupId, 'replicationGroupId');
final $request = <String, dynamic>{};
$request['ReplicationGroupId'] = replicationGroupId;
finalSnapshotIdentifier
?.also((arg) => $request['FinalSnapshotIdentifier'] = arg);
retainPrimaryCluster?.also((arg) => $request['RetainPrimaryCluster'] = arg);
final $result = await _protocol.send(
$request,
action: 'DeleteReplicationGroup',
version: '2015-02-02',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['DeleteReplicationGroupMessage'],
shapes: shapes,
resultWrapper: 'DeleteReplicationGroupResult',
);
return DeleteReplicationGroupResult.fromXml($result);
}