createCacheSubnetGroup method

Future<CreateCacheSubnetGroupResult> createCacheSubnetGroup({
  1. required String cacheSubnetGroupDescription,
  2. required String cacheSubnetGroupName,
  3. required List<String> subnetIds,
  4. List<Tag>? tags,
})

Creates a new cache subnet group.

Use this parameter only when you are creating a cluster in an Amazon Virtual Private Cloud (Amazon VPC).

May throw CacheSubnetGroupAlreadyExistsFault. May throw CacheSubnetGroupQuotaExceededFault. May throw CacheSubnetQuotaExceededFault. May throw InvalidSubnet. May throw SubnetNotAllowedFault. May throw TagQuotaPerResourceExceeded.

Parameter cacheSubnetGroupDescription : A description for the cache subnet group.

Parameter cacheSubnetGroupName : A name for the cache subnet group. This value is stored as a lowercase string.

Constraints: Must contain no more than 255 alphanumeric characters or hyphens.

Example: mysubnetgroup

Parameter subnetIds : A list of VPC subnet IDs for the cache subnet group.

Parameter tags : A list of tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value, although null is accepted.

Implementation

Future<CreateCacheSubnetGroupResult> createCacheSubnetGroup({
  required String cacheSubnetGroupDescription,
  required String cacheSubnetGroupName,
  required List<String> subnetIds,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'CacheSubnetGroupDescription': cacheSubnetGroupDescription,
    'CacheSubnetGroupName': cacheSubnetGroupName,
    if (subnetIds.isEmpty)
      'SubnetIds': ''
    else
      for (var i1 = 0; i1 < subnetIds.length; i1++)
        'SubnetIds.SubnetIdentifier.${i1 + 1}': subnetIds[i1],
    if (tags != null)
      if (tags.isEmpty)
        'Tags': ''
      else
        for (var i1 = 0; i1 < tags.length; i1++)
          for (var e3 in tags[i1].toQueryMap().entries)
            'Tags.Tag.${i1 + 1}.${e3.key}': e3.value,
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateCacheSubnetGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateCacheSubnetGroupResult',
  );
  return CreateCacheSubnetGroupResult.fromXml($result);
}