decreaseReplicaCount method

Future<DecreaseReplicaCountResult> decreaseReplicaCount({
  1. required bool applyImmediately,
  2. required String replicationGroupId,
  3. int? newReplicaCount,
  4. List<ConfigureShard>? replicaConfiguration,
  5. List<String>? replicasToRemove,
})

Dynamically decreases the number of replicas in a Redis (cluster mode disabled) replication group or the number of replica nodes in one or more node groups (shards) of a Redis (cluster mode enabled) replication group. This operation is performed with no cluster down time.

May throw ReplicationGroupNotFoundFault. May throw InvalidReplicationGroupStateFault. May throw InvalidCacheClusterStateFault. May throw InvalidVPCNetworkStateFault. May throw InsufficientCacheClusterCapacityFault. May throw ClusterQuotaForCustomerExceededFault. May throw NodeGroupsPerReplicationGroupQuotaExceededFault. May throw NodeQuotaForCustomerExceededFault. May throw ServiceLinkedRoleNotFoundFault. May throw NoOperationFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

Parameter applyImmediately : If True, the number of replica nodes is decreased immediately. ApplyImmediately=False is not currently supported.

Parameter replicationGroupId : The id of the replication group from which you want to remove replica nodes.

Parameter newReplicaCount : The number of read replica nodes you want at the completion of this operation. For Redis (cluster mode disabled) replication groups, this is the number of replica nodes in the replication group. For Redis (cluster mode enabled) replication groups, this is the number of replica nodes in each of the replication group's node groups.

The minimum number of replicas in a shard or replication group is:

  • Redis (cluster mode disabled)
    • If Multi-AZ is enabled: 1
    • If Multi-AZ is not enabled: 0
  • Redis (cluster mode enabled): 0 (though you will not be able to failover to a replica if your primary node fails)

Parameter replicaConfiguration : A list of ConfigureShard objects that can be used to configure each shard in a Redis (cluster mode enabled) replication group. The ConfigureShard has three members: NewReplicaCount, NodeGroupId, and PreferredAvailabilityZones.

Parameter replicasToRemove : A list of the node ids to remove from the replication group or node group (shard).

Implementation

Future<DecreaseReplicaCountResult> decreaseReplicaCount({
  required bool applyImmediately,
  required String replicationGroupId,
  int? newReplicaCount,
  List<ConfigureShard>? replicaConfiguration,
  List<String>? replicasToRemove,
}) async {
  ArgumentError.checkNotNull(applyImmediately, 'applyImmediately');
  ArgumentError.checkNotNull(replicationGroupId, 'replicationGroupId');
  final $request = <String, dynamic>{};
  $request['ApplyImmediately'] = applyImmediately;
  $request['ReplicationGroupId'] = replicationGroupId;
  newReplicaCount?.also((arg) => $request['NewReplicaCount'] = arg);
  replicaConfiguration?.also((arg) => $request['ReplicaConfiguration'] = arg);
  replicasToRemove?.also((arg) => $request['ReplicasToRemove'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'DecreaseReplicaCount',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['DecreaseReplicaCountMessage'],
    shapes: shapes,
    resultWrapper: 'DecreaseReplicaCountResult',
  );
  return DecreaseReplicaCountResult.fromXml($result);
}