createSnapshot method

Future<CreateSnapshotResponse> createSnapshot({
  1. required String clusterName,
  2. required String snapshotName,
  3. String? kmsKeyId,
  4. List<Tag>? tags,
})

Creates a copy of an entire cluster at a specific moment in time.

May throw ClusterNotFoundFault. May throw InvalidClusterStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw ServiceLinkedRoleNotFoundFault. May throw SnapshotAlreadyExistsFault. May throw SnapshotQuotaExceededFault. May throw TagQuotaPerResourceExceeded.

Parameter clusterName : The snapshot is created from this cluster.

Parameter snapshotName : A name for the snapshot being created.

Parameter kmsKeyId : The ID of the KMS key used to encrypt the 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.

Implementation

Future<CreateSnapshotResponse> createSnapshot({
  required String clusterName,
  required String snapshotName,
  String? kmsKeyId,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonMemoryDB.CreateSnapshot'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ClusterName': clusterName,
      'SnapshotName': snapshotName,
      if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateSnapshotResponse.fromJson(jsonResponse.body);
}