modifyReplicationGroupShardConfiguration method
Modifies a replication group's shards (node groups) by allowing you to add shards, remove shards, or rebalance the keyspaces among existing shards.
May throw InsufficientCacheClusterCapacityFault.
May throw InvalidCacheClusterStateFault.
May throw InvalidKMSKeyFault.
May throw InvalidParameterCombinationException.
May throw InvalidParameterValueException.
May throw InvalidReplicationGroupStateFault.
May throw InvalidVPCNetworkStateFault.
May throw NodeGroupsPerReplicationGroupQuotaExceededFault.
May throw NodeQuotaForCustomerExceededFault.
May throw ReplicationGroupNotFoundFault.
Parameter applyImmediately :
Indicates that the shard reconfiguration process begins immediately. At
present, the only permitted value for this parameter is true.
Value: true
Parameter nodeGroupCount :
The number of node groups (shards) that results from the modification of
the shard configuration.
Parameter replicationGroupId :
The name of the Valkey or Redis OSS (cluster mode enabled) cluster
(replication group) on which the shards are to be configured.
Parameter nodeGroupsToRemove :
If the value of NodeGroupCount is less than the current
number of node groups (shards), then either
NodeGroupsToRemove or NodeGroupsToRetain is
required. NodeGroupsToRemove is a list of
NodeGroupIds to remove from the cluster.
ElastiCache will attempt to remove all node groups listed by
NodeGroupsToRemove from the cluster.
Parameter nodeGroupsToRetain :
If the value of NodeGroupCount is less than the current
number of node groups (shards), then either
NodeGroupsToRemove or NodeGroupsToRetain is
required. NodeGroupsToRetain is a list of
NodeGroupIds to retain in the cluster.
ElastiCache will attempt to remove all node groups except those listed by
NodeGroupsToRetain from the cluster.
Parameter reshardingConfiguration :
Specifies the preferred availability zones for each node group in the
cluster. If the value of NodeGroupCount is greater than the
current number of node groups (shards), you can use this parameter to
specify the preferred availability zones of the cluster's shards. If you
omit this parameter ElastiCache selects availability zones for you.
You can specify this parameter only if the value of
NodeGroupCount is greater than the current number of node
groups (shards).
Implementation
Future<ModifyReplicationGroupShardConfigurationResult>
modifyReplicationGroupShardConfiguration({
required bool applyImmediately,
required int nodeGroupCount,
required String replicationGroupId,
List<String>? nodeGroupsToRemove,
List<String>? nodeGroupsToRetain,
List<ReshardingConfiguration>? reshardingConfiguration,
}) async {
final $request = <String, String>{
'ApplyImmediately': applyImmediately.toString(),
'NodeGroupCount': nodeGroupCount.toString(),
'ReplicationGroupId': replicationGroupId,
if (nodeGroupsToRemove != null)
if (nodeGroupsToRemove.isEmpty)
'NodeGroupsToRemove': ''
else
for (var i1 = 0; i1 < nodeGroupsToRemove.length; i1++)
'NodeGroupsToRemove.NodeGroupToRemove.${i1 + 1}':
nodeGroupsToRemove[i1],
if (nodeGroupsToRetain != null)
if (nodeGroupsToRetain.isEmpty)
'NodeGroupsToRetain': ''
else
for (var i1 = 0; i1 < nodeGroupsToRetain.length; i1++)
'NodeGroupsToRetain.NodeGroupToRetain.${i1 + 1}':
nodeGroupsToRetain[i1],
if (reshardingConfiguration != null)
if (reshardingConfiguration.isEmpty)
'ReshardingConfiguration': ''
else
for (var i1 = 0; i1 < reshardingConfiguration.length; i1++)
for (var e3 in reshardingConfiguration[i1].toQueryMap().entries)
'ReshardingConfiguration.ReshardingConfiguration.${i1 + 1}.${e3.key}':
e3.value,
};
final $result = await _protocol.send(
$request,
action: 'ModifyReplicationGroupShardConfiguration',
version: '2015-02-02',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'ModifyReplicationGroupShardConfigurationResult',
);
return ModifyReplicationGroupShardConfigurationResult.fromXml($result);
}