createServerlessCacheSnapshot method

Future<CreateServerlessCacheSnapshotResponse> createServerlessCacheSnapshot({
  1. required String serverlessCacheName,
  2. required String serverlessCacheSnapshotName,
  3. String? kmsKeyId,
  4. List<Tag>? tags,
})

This API creates a copy of an entire ServerlessCache at a specific moment in time. Available for Valkey, Redis OSS and Serverless Memcached only.

May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidServerlessCacheStateFault. May throw ServerlessCacheNotFoundFault. May throw ServerlessCacheSnapshotAlreadyExistsFault. May throw ServerlessCacheSnapshotQuotaExceededFault. May throw ServiceLinkedRoleNotFoundFault. May throw TagQuotaPerResourceExceeded.

Parameter serverlessCacheName : The name of an existing serverless cache. The snapshot is created from this cache. Available for Valkey, Redis OSS and Serverless Memcached only.

Parameter serverlessCacheSnapshotName : The name for the snapshot being created. Must be unique for the customer account. Available for Valkey, Redis OSS and Serverless Memcached only. Must be between 1 and 255 characters. This value is stored as a lowercase string.

Parameter kmsKeyId : The ID of the KMS key used to encrypt the snapshot. Available for Valkey, Redis OSS and Serverless Memcached only. Default: NULL

Parameter tags : A list of tags to be added to the snapshot resource. A tag is a key-value pair. Available for Valkey, Redis OSS and Serverless Memcached only.

Implementation

Future<CreateServerlessCacheSnapshotResponse> createServerlessCacheSnapshot({
  required String serverlessCacheName,
  required String serverlessCacheSnapshotName,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'ServerlessCacheName': serverlessCacheName,
    'ServerlessCacheSnapshotName': serverlessCacheSnapshotName,
    if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
    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: 'CreateServerlessCacheSnapshot',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateServerlessCacheSnapshotResult',
  );
  return CreateServerlessCacheSnapshotResponse.fromXml($result);
}