copyServerlessCacheSnapshot method

Future<CopyServerlessCacheSnapshotResponse> copyServerlessCacheSnapshot({
  1. required String sourceServerlessCacheSnapshotName,
  2. required String targetServerlessCacheSnapshotName,
  3. String? kmsKeyId,
  4. List<Tag>? tags,
})

Creates a copy of an existing serverless cache’s snapshot. Available for Valkey, Redis OSS and Serverless Memcached only.

May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidServerlessCacheSnapshotStateFault. May throw ServerlessCacheSnapshotAlreadyExistsFault. May throw ServerlessCacheSnapshotNotFoundFault. May throw ServerlessCacheSnapshotQuotaExceededFault. May throw ServiceLinkedRoleNotFoundFault. May throw TagQuotaPerResourceExceeded.

Parameter sourceServerlessCacheSnapshotName : The identifier of the existing serverless cache’s snapshot to be copied. Available for Valkey, Redis OSS and Serverless Memcached only.

Parameter targetServerlessCacheSnapshotName : The identifier for the snapshot to be created. Available for Valkey, Redis OSS and Serverless Memcached only. This value is stored as a lowercase string.

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

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

Implementation

Future<CopyServerlessCacheSnapshotResponse> copyServerlessCacheSnapshot({
  required String sourceServerlessCacheSnapshotName,
  required String targetServerlessCacheSnapshotName,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'SourceServerlessCacheSnapshotName': sourceServerlessCacheSnapshotName,
    'TargetServerlessCacheSnapshotName': targetServerlessCacheSnapshotName,
    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: 'CopyServerlessCacheSnapshot',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CopyServerlessCacheSnapshotResult',
  );
  return CopyServerlessCacheSnapshotResponse.fromXml($result);
}