createSnapshot method

Future<CreateSnapshotResult> createSnapshot({
  1. required String snapshotName,
  2. String? cacheClusterId,
  3. String? kmsKeyId,
  4. String? replicationGroupId,
  5. List<Tag>? tags,
})

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

May throw CacheClusterNotFoundFault. May throw InvalidCacheClusterStateFault. May throw InvalidParameterCombinationException. May throw InvalidParameterValueException. May throw InvalidReplicationGroupStateFault. May throw ReplicationGroupNotFoundFault. May throw SnapshotAlreadyExistsFault. May throw SnapshotFeatureNotSupportedFault. May throw SnapshotQuotaExceededFault. May throw TagQuotaPerResourceExceeded.

Parameter snapshotName : A name for the snapshot being created. This value is stored as a lowercase string.

Parameter cacheClusterId : The identifier of an existing cluster. The snapshot is created from this cluster.

Parameter kmsKeyId : The ID of the KMS key used to encrypt the snapshot.

Parameter replicationGroupId : The identifier of an existing replication group. The snapshot is created from this replication group.

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<CreateSnapshotResult> createSnapshot({
  required String snapshotName,
  String? cacheClusterId,
  String? kmsKeyId,
  String? replicationGroupId,
  List<Tag>? tags,
}) async {
  final $request = <String, String>{
    'SnapshotName': snapshotName,
    if (cacheClusterId != null) 'CacheClusterId': cacheClusterId,
    if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
    if (replicationGroupId != null) 'ReplicationGroupId': replicationGroupId,
    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: 'CreateSnapshot',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateSnapshotResult',
  );
  return CreateSnapshotResult.fromXml($result);
}