createCluster method

Future<CreateClusterResponse> createCluster({
  1. required String aCLName,
  2. required String clusterName,
  3. required String nodeType,
  4. bool? autoMinorVersionUpgrade,
  5. bool? dataTiering,
  6. String? description,
  7. String? engine,
  8. String? engineVersion,
  9. IpDiscovery? ipDiscovery,
  10. String? kmsKeyId,
  11. String? maintenanceWindow,
  12. String? multiRegionClusterName,
  13. NetworkType? networkType,
  14. int? numReplicasPerShard,
  15. int? numShards,
  16. String? parameterGroupName,
  17. int? port,
  18. List<String>? securityGroupIds,
  19. List<String>? snapshotArns,
  20. String? snapshotName,
  21. int? snapshotRetentionLimit,
  22. String? snapshotWindow,
  23. String? snsTopicArn,
  24. String? subnetGroupName,
  25. bool? tLSEnabled,
  26. List<Tag>? tags,
})

Creates a cluster. All nodes in the cluster run the same protocol-compliant engine software.

May throw ACLNotFoundFault. May throw ClusterAlreadyExistsFault. May throw ClusterQuotaForCustomerExceededFault. May throw InsufficientClusterCapacityFault. May throw InvalidACLStateFault. May throw InvalidCredentialsException. May throw InvalidMultiRegionClusterStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidVPCNetworkStateFault. May throw MultiRegionClusterNotFoundFault. May throw NodeQuotaForClusterExceededFault. May throw NodeQuotaForCustomerExceededFault. May throw ParameterGroupNotFoundFault. May throw ServiceLinkedRoleNotFoundFault. May throw ShardsPerClusterQuotaExceededFault. May throw SubnetGroupNotFoundFault. May throw TagQuotaPerResourceExceeded.

Parameter aCLName : The name of the Access Control List to associate with the cluster.

Parameter clusterName : The name of the cluster. This value must be unique as it also serves as the cluster identifier.

Parameter nodeType : The compute and memory capacity of the nodes in the cluster.

Parameter autoMinorVersionUpgrade : When set to true, the cluster will automatically receive minor engine version upgrades after launch.

Parameter dataTiering : Enables data tiering. Data tiering is only supported for clusters using the r6gd node type. This parameter must be set when using r6gd nodes. For more information, see Data tiering.

Parameter description : An optional description of the cluster.

Parameter engine : The name of the engine to be used for the cluster.

Parameter engineVersion : The version number of the Redis OSS engine to be used for the cluster.

Parameter ipDiscovery : The mechanism for discovering IP addresses for the cluster discovery protocol. Valid values are 'ipv4' or 'ipv6'. When set to 'ipv4', cluster discovery functions such as cluster slots, cluster shards, and cluster nodes return IPv4 addresses for cluster nodes. When set to 'ipv6', the cluster discovery functions return IPv6 addresses for cluster nodes. The value must be compatible with the NetworkType parameter. If not specified, the default is 'ipv4'.

Parameter kmsKeyId : The ID of the KMS key used to encrypt the cluster.

Parameter maintenanceWindow : Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.

Valid values for ddd are:

  • sun
  • mon
  • tue
  • wed
  • thu
  • fri
  • sat
Example: sun:23:00-mon:01:30

Parameter multiRegionClusterName : The name of the multi-Region cluster to be created.

Parameter networkType : Specifies the IP address type for the cluster. Valid values are 'ipv4', 'ipv6', or 'dual_stack'. When set to 'ipv4', the cluster will only be accessible via IPv4 addresses. When set to 'ipv6', the cluster will only be accessible via IPv6 addresses. When set to 'dual_stack', the cluster will be accessible via both IPv4 and IPv6 addresses. If not specified, the default is 'ipv4'.

Parameter numReplicasPerShard : The number of replicas to apply to each shard. The default value is 1. The maximum is 5.

Parameter numShards : The number of shards the cluster will contain. The default value is 1.

Parameter parameterGroupName : The name of the parameter group associated with the cluster.

Parameter port : The port number on which each of the nodes accepts connections.

Parameter securityGroupIds : A list of security group names to associate with this cluster.

Parameter snapshotArns : A list of Amazon Resource Names (ARN) that uniquely identify the RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new cluster. The Amazon S3 object name in the ARN cannot contain any commas.

Parameter snapshotName : The name of a snapshot from which to restore data into the new cluster. The snapshot status changes to restoring while the new cluster is being created.

Parameter snapshotRetentionLimit : The number of days for which MemoryDB retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.

Parameter snapshotWindow : The daily time range (in UTC) during which MemoryDB begins taking a daily snapshot of your shard.

Example: 05:00-09:00

If you do not specify this parameter, MemoryDB automatically chooses an appropriate time range.

Parameter snsTopicArn : The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.

Parameter subnetGroupName : The name of the subnet group to be used for the cluster.

Parameter tLSEnabled : A flag to enable in-transit encryption on the cluster.

Parameter tags : A list of tags to be added to this resource. Tags are comma-separated key,value pairs (e.g. Key=myKey, Value=myKeyValue. You can include multiple tags as shown following: Key=myKey, Value=myKeyValue Key=mySecondKey, Value=mySecondKeyValue.

Implementation

Future<CreateClusterResponse> createCluster({
  required String aCLName,
  required String clusterName,
  required String nodeType,
  bool? autoMinorVersionUpgrade,
  bool? dataTiering,
  String? description,
  String? engine,
  String? engineVersion,
  IpDiscovery? ipDiscovery,
  String? kmsKeyId,
  String? maintenanceWindow,
  String? multiRegionClusterName,
  NetworkType? networkType,
  int? numReplicasPerShard,
  int? numShards,
  String? parameterGroupName,
  int? port,
  List<String>? securityGroupIds,
  List<String>? snapshotArns,
  String? snapshotName,
  int? snapshotRetentionLimit,
  String? snapshotWindow,
  String? snsTopicArn,
  String? subnetGroupName,
  bool? tLSEnabled,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonMemoryDB.CreateCluster'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ACLName': aCLName,
      'ClusterName': clusterName,
      'NodeType': nodeType,
      if (autoMinorVersionUpgrade != null)
        'AutoMinorVersionUpgrade': autoMinorVersionUpgrade,
      if (dataTiering != null) 'DataTiering': dataTiering,
      if (description != null) 'Description': description,
      if (engine != null) 'Engine': engine,
      if (engineVersion != null) 'EngineVersion': engineVersion,
      if (ipDiscovery != null) 'IpDiscovery': ipDiscovery.value,
      if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
      if (maintenanceWindow != null) 'MaintenanceWindow': maintenanceWindow,
      if (multiRegionClusterName != null)
        'MultiRegionClusterName': multiRegionClusterName,
      if (networkType != null) 'NetworkType': networkType.value,
      if (numReplicasPerShard != null)
        'NumReplicasPerShard': numReplicasPerShard,
      if (numShards != null) 'NumShards': numShards,
      if (parameterGroupName != null)
        'ParameterGroupName': parameterGroupName,
      if (port != null) 'Port': port,
      if (securityGroupIds != null) 'SecurityGroupIds': securityGroupIds,
      if (snapshotArns != null) 'SnapshotArns': snapshotArns,
      if (snapshotName != null) 'SnapshotName': snapshotName,
      if (snapshotRetentionLimit != null)
        'SnapshotRetentionLimit': snapshotRetentionLimit,
      if (snapshotWindow != null) 'SnapshotWindow': snapshotWindow,
      if (snsTopicArn != null) 'SnsTopicArn': snsTopicArn,
      if (subnetGroupName != null) 'SubnetGroupName': subnetGroupName,
      if (tLSEnabled != null) 'TLSEnabled': tLSEnabled,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateClusterResponse.fromJson(jsonResponse.body);
}