decreaseReplicationFactor method

Future<DecreaseReplicationFactorResponse> decreaseReplicationFactor({
  1. required String clusterName,
  2. required int newReplicationFactor,
  3. List<String>? availabilityZones,
  4. List<String>? nodeIdsToRemove,
})

Removes one or more nodes from a DAX cluster.

May throw ClusterNotFoundFault. May throw NodeNotFoundFault. May throw InvalidClusterStateFault. May throw ServiceLinkedRoleNotFoundFault. May throw InvalidParameterValueException. May throw InvalidParameterCombinationException.

Parameter clusterName : The name of the DAX cluster from which you want to remove nodes.

Parameter newReplicationFactor : The new number of nodes for the DAX cluster.

Parameter availabilityZones : The Availability Zone(s) from which to remove nodes.

Parameter nodeIdsToRemove : The unique identifiers of the nodes to be removed from the cluster.

Implementation

Future<DecreaseReplicationFactorResponse> decreaseReplicationFactor({
  required String clusterName,
  required int newReplicationFactor,
  List<String>? availabilityZones,
  List<String>? nodeIdsToRemove,
}) async {
  ArgumentError.checkNotNull(clusterName, 'clusterName');
  ArgumentError.checkNotNull(newReplicationFactor, 'newReplicationFactor');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonDAXV3.DecreaseReplicationFactor'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      'NewReplicationFactor': newReplicationFactor,
      if (availabilityZones != null) 'AvailabilityZones': availabilityZones,
      if (nodeIdsToRemove != null) 'NodeIdsToRemove': nodeIdsToRemove,
    },
  );

  return DecreaseReplicationFactorResponse.fromJson(jsonResponse.body);
}