createCacheParameterGroup method

Future<CreateCacheParameterGroupResult> createCacheParameterGroup({
  1. required String cacheParameterGroupFamily,
  2. required String cacheParameterGroupName,
  3. required String description,
  4. List<Tag>? tags,
})

Creates a new Amazon ElastiCache cache parameter group. An ElastiCache cache parameter group is a collection of parameters and their values that are applied to all of the nodes in any cluster or replication group using the CacheParameterGroup.

A newly created CacheParameterGroup is an exact duplicate of the default parameter group for the CacheParameterGroupFamily. To customize the newly created CacheParameterGroup you can change the values of specific parameters. For more information, see:

May throw CacheParameterGroupAlreadyExistsFault. May throw CacheParameterGroupQuotaExceededFault. May throw InvalidCacheParameterGroupStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw TagQuotaPerResourceExceeded.

Parameter cacheParameterGroupFamily : The name of the cache parameter group family that the cache parameter group can be used with.

Valid values are: valkey8 | valkey7 | memcached1.4 | memcached1.5 | memcached1.6 | redis2.6 | redis2.8 | redis3.2 | redis4.0 | redis5.0 | redis6.x | redis7

Parameter cacheParameterGroupName : A user-specified name for the cache parameter group. This value is stored as a lowercase string.

Parameter description : A user-specified description for the cache parameter 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<CreateCacheParameterGroupResult> createCacheParameterGroup({
  required String cacheParameterGroupFamily,
  required String cacheParameterGroupName,
  required String description,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'CacheParameterGroupFamily': cacheParameterGroupFamily,
    'CacheParameterGroupName': cacheParameterGroupName,
    '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: 'CreateCacheParameterGroup',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateCacheParameterGroupResult',
  );
  return CreateCacheParameterGroupResult.fromXml($result);
}