copySnapshot method
Makes a copy of an existing snapshot.
May throw InvalidParameterCombinationException.
May throw InvalidParameterValueException.
May throw InvalidSnapshotStateFault.
May throw ServiceLinkedRoleNotFoundFault.
May throw SnapshotAlreadyExistsFault.
May throw SnapshotNotFoundFault.
May throw SnapshotQuotaExceededFault.
May throw TagQuotaPerResourceExceeded.
Parameter sourceSnapshotName :
The name of an existing snapshot from which to make a copy.
Parameter targetSnapshotName :
A name for the snapshot copy. MemoryDB does not permit overwriting a
snapshot, therefore this name must be unique within its context - MemoryDB
or an Amazon S3 bucket if exporting.
Parameter kmsKeyId :
The ID of the KMS key used to encrypt the target snapshot.
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.
Parameter targetBucket :
The Amazon S3 bucket to which the snapshot is exported. This parameter is
used only when exporting a snapshot for external access. When using this
parameter to export a snapshot, be sure MemoryDB has the needed
permissions to this S3 bucket. For more information, see Step
2: Grant MemoryDB Access to Your Amazon S3 Bucket.
Implementation
Future<CopySnapshotResponse> copySnapshot({
required String sourceSnapshotName,
required String targetSnapshotName,
String? kmsKeyId,
List<Tag>? tags,
String? targetBucket,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonMemoryDB.CopySnapshot'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'SourceSnapshotName': sourceSnapshotName,
'TargetSnapshotName': targetSnapshotName,
if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
if (tags != null) 'Tags': tags,
if (targetBucket != null) 'TargetBucket': targetBucket,
},
);
return CopySnapshotResponse.fromJson(jsonResponse.body);
}