createCacheSecurityGroup method

Future<CreateCacheSecurityGroupResult> createCacheSecurityGroup({
  1. required String cacheSecurityGroupName,
  2. required String description,
  3. List<Tag>? tags,
})

Creates a new cache security group. Use a cache security group to control access to one or more clusters.

Cache security groups are only used when you are creating a cluster outside of an Amazon Virtual Private Cloud (Amazon VPC). If you are creating a cluster inside of a VPC, use a cache subnet group instead. For more information, see CreateCacheSubnetGroup.

May throw CacheSecurityGroupAlreadyExistsFault. May throw CacheSecurityGroupQuotaExceededFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw TagQuotaPerResourceExceeded.

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

Constraints: Must contain no more than 255 alphanumeric characters. Cannot be the word "Default".

Example: mysecuritygroup

Parameter description : A description for the cache security 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<CreateCacheSecurityGroupResult> createCacheSecurityGroup({
  required String cacheSecurityGroupName,
  required String description,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'CacheSecurityGroupName': cacheSecurityGroupName,
    'Description': description,
    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: 'CreateCacheSecurityGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateCacheSecurityGroupResult',
  );
  return CreateCacheSecurityGroupResult.fromXml($result);
}