modifyReplicationGroupShardConfiguration method

Future<ModifyReplicationGroupShardConfigurationResult> modifyReplicationGroupShardConfiguration({
  1. required bool applyImmediately,
  2. required int nodeGroupCount,
  3. required String replicationGroupId,
  4. List<String>? nodeGroupsToRemove,
  5. List<String>? nodeGroupsToRetain,
  6. List<ReshardingConfiguration>? reshardingConfiguration,
})

Modifies a replication group's shards (node groups) by allowing you to add shards, remove shards, or rebalance the keyspaces among exisiting shards.

May throw ReplicationGroupNotFoundFault. May throw InvalidReplicationGroupStateFault. May throw InvalidCacheClusterStateFault. May throw InvalidVPCNetworkStateFault. May throw InsufficientCacheClusterCapacityFault. May throw NodeGroupsPerReplicationGroupQuotaExceededFault. May throw NodeQuotaForCustomerExceededFault. May throw InvalidKMSKeyFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

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 Redis (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 for Redis 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 for Redis 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 {
  ArgumentError.checkNotNull(applyImmediately, 'applyImmediately');
  ArgumentError.checkNotNull(nodeGroupCount, 'nodeGroupCount');
  ArgumentError.checkNotNull(replicationGroupId, 'replicationGroupId');
  final $request = <String, dynamic>{};
  $request['ApplyImmediately'] = applyImmediately;
  $request['NodeGroupCount'] = nodeGroupCount;
  $request['ReplicationGroupId'] = replicationGroupId;
  nodeGroupsToRemove?.also((arg) => $request['NodeGroupsToRemove'] = arg);
  nodeGroupsToRetain?.also((arg) => $request['NodeGroupsToRetain'] = arg);
  reshardingConfiguration
      ?.also((arg) => $request['ReshardingConfiguration'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'ModifyReplicationGroupShardConfiguration',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['ModifyReplicationGroupShardConfigurationMessage'],
    shapes: shapes,
    resultWrapper: 'ModifyReplicationGroupShardConfigurationResult',
  );
  return ModifyReplicationGroupShardConfigurationResult.fromXml($result);
}