modifyServerlessCache method

Future<ModifyServerlessCacheResponse> modifyServerlessCache({
  1. required String serverlessCacheName,
  2. CacheUsageLimits? cacheUsageLimits,
  3. String? dailySnapshotTime,
  4. String? description,
  5. String? engine,
  6. String? majorEngineVersion,
  7. bool? removeUserGroup,
  8. List<String>? securityGroupIds,
  9. int? snapshotRetentionLimit,
  10. String? userGroupId,
})

This API modifies the attributes of a serverless cache.

May throw InvalidCredentialsException. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidServerlessCacheStateFault. May throw InvalidUserGroupStateFault. May throw ServerlessCacheNotFoundFault. May throw ServiceLinkedRoleNotFoundFault. May throw UserGroupNotFoundFault.

Parameter serverlessCacheName : User-provided identifier for the serverless cache to be modified.

Parameter cacheUsageLimits : Modify the cache usage limit for the serverless cache.

Parameter dailySnapshotTime : The daily time during which Elasticache begins taking a daily snapshot of the serverless cache. Available for Valkey, Redis OSS and Serverless Memcached only. The default is NULL, i.e. the existing snapshot time configured for the cluster is not removed.

Parameter description : User provided description for the serverless cache. Default = NULL, i.e. the existing description is not removed/modified. The description has a maximum length of 255 characters.

Parameter engine : Modifies the engine listed in a serverless cache request. The options are valkey, memcached or redis.

Parameter majorEngineVersion : Modifies the engine vesion listed in a serverless cache request.

Parameter removeUserGroup : The identifier of the UserGroup to be removed from association with the Valkey and Redis OSS serverless cache. Available for Valkey and Redis OSS only. Default is NULL.

Parameter securityGroupIds : The new list of VPC security groups to be associated with the serverless cache. Populating this list means the current VPC security groups will be removed. This security group is used to authorize traffic access for the VPC end-point (private-link). Default = NULL - the existing list of VPC security groups is not removed.

Parameter snapshotRetentionLimit : The number of days for which Elasticache retains automatic snapshots before deleting them. Available for Valkey, Redis OSS and Serverless Memcached only. Default = NULL, i.e. the existing snapshot-retention-limit will not be removed or modified. The maximum value allowed is 35 days.

Parameter userGroupId : The identifier of the UserGroup to be associated with the serverless cache. Available for Valkey and Redis OSS only. Default is NULL - the existing UserGroup is not removed.

Implementation

Future<ModifyServerlessCacheResponse> modifyServerlessCache({
  required String serverlessCacheName,
  CacheUsageLimits? cacheUsageLimits,
  String? dailySnapshotTime,
  String? description,
  String? engine,
  String? majorEngineVersion,
  bool? removeUserGroup,
  List<String>? securityGroupIds,
  int? snapshotRetentionLimit,
  String? userGroupId,
}) async {
  final $request = <String, String>{
    'ServerlessCacheName': serverlessCacheName,
    if (cacheUsageLimits != null)
      for (var e1 in cacheUsageLimits.toQueryMap().entries)
        'CacheUsageLimits.${e1.key}': e1.value,
    if (dailySnapshotTime != null) 'DailySnapshotTime': dailySnapshotTime,
    if (description != null) 'Description': description,
    if (engine != null) 'Engine': engine,
    if (majorEngineVersion != null) 'MajorEngineVersion': majorEngineVersion,
    if (removeUserGroup != null)
      'RemoveUserGroup': removeUserGroup.toString(),
    if (securityGroupIds != null)
      if (securityGroupIds.isEmpty)
        'SecurityGroupIds': ''
      else
        for (var i1 = 0; i1 < securityGroupIds.length; i1++)
          'SecurityGroupIds.SecurityGroupId.${i1 + 1}': securityGroupIds[i1],
    if (snapshotRetentionLimit != null)
      'SnapshotRetentionLimit': snapshotRetentionLimit.toString(),
    if (userGroupId != null) 'UserGroupId': userGroupId,
  };
  final $result = await _protocol.send(
    $request,
    action: 'ModifyServerlessCache',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'ModifyServerlessCacheResult',
  );
  return ModifyServerlessCacheResponse.fromXml($result);
}