decreaseNodeGroupsInGlobalReplicationGroup method

Future<DecreaseNodeGroupsInGlobalReplicationGroupResult> decreaseNodeGroupsInGlobalReplicationGroup({
  1. required bool applyImmediately,
  2. required String globalReplicationGroupId,
  3. required int nodeGroupCount,
  4. List<String>? globalNodeGroupsToRemove,
  5. List<String>? globalNodeGroupsToRetain,
})

Decreases the number of node groups in a Global datastore

May throw GlobalReplicationGroupNotFoundFault. May throw InvalidGlobalReplicationGroupStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException.

Parameter applyImmediately : Indicates that the shard reconfiguration process begins immediately. At present, the only permitted value for this parameter is true.

Parameter globalReplicationGroupId : The name of the Global datastore

Parameter nodeGroupCount : The number of node groups (shards) that results from the modification of the shard configuration

Parameter globalNodeGroupsToRemove : If the value of NodeGroupCount is less than the current number of node groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is required. GlobalNodeGroupsToRemove is a list of NodeGroupIds to remove from the cluster. ElastiCache will attempt to remove all node groups listed by GlobalNodeGroupsToRemove from the cluster.

Parameter globalNodeGroupsToRetain : If the value of NodeGroupCount is less than the current number of node groups (shards), then either NodeGroupsToRemove or NodeGroupsToRetain is required. GlobalNodeGroupsToRetain is a list of NodeGroupIds to retain from the cluster. ElastiCache will attempt to retain all node groups listed by GlobalNodeGroupsToRetain from the cluster.

Implementation

Future<DecreaseNodeGroupsInGlobalReplicationGroupResult>
    decreaseNodeGroupsInGlobalReplicationGroup({
  required bool applyImmediately,
  required String globalReplicationGroupId,
  required int nodeGroupCount,
  List<String>? globalNodeGroupsToRemove,
  List<String>? globalNodeGroupsToRetain,
}) async {
  final $request = <String, String>{
    'ApplyImmediately': applyImmediately.toString(),
    'GlobalReplicationGroupId': globalReplicationGroupId,
    'NodeGroupCount': nodeGroupCount.toString(),
    if (globalNodeGroupsToRemove != null)
      if (globalNodeGroupsToRemove.isEmpty)
        'GlobalNodeGroupsToRemove': ''
      else
        for (var i1 = 0; i1 < globalNodeGroupsToRemove.length; i1++)
          'GlobalNodeGroupsToRemove.GlobalNodeGroupId.${i1 + 1}':
              globalNodeGroupsToRemove[i1],
    if (globalNodeGroupsToRetain != null)
      if (globalNodeGroupsToRetain.isEmpty)
        'GlobalNodeGroupsToRetain': ''
      else
        for (var i1 = 0; i1 < globalNodeGroupsToRetain.length; i1++)
          'GlobalNodeGroupsToRetain.GlobalNodeGroupId.${i1 + 1}':
              globalNodeGroupsToRetain[i1],
  };
  final $result = await _protocol.send(
    $request,
    action: 'DecreaseNodeGroupsInGlobalReplicationGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'DecreaseNodeGroupsInGlobalReplicationGroupResult',
  );
  return DecreaseNodeGroupsInGlobalReplicationGroupResult.fromXml($result);
}