createSnapshot method

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

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

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

Parameter snapshotName : A name for the snapshot being created.

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.

Implementation

Future<CreateSnapshotResult> createSnapshot({
  required String snapshotName,
  String? cacheClusterId,
  String? kmsKeyId,
  String? replicationGroupId,
}) async {
  ArgumentError.checkNotNull(snapshotName, 'snapshotName');
  final $request = <String, dynamic>{};
  $request['SnapshotName'] = snapshotName;
  cacheClusterId?.also((arg) => $request['CacheClusterId'] = arg);
  kmsKeyId?.also((arg) => $request['KmsKeyId'] = arg);
  replicationGroupId?.also((arg) => $request['ReplicationGroupId'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CreateSnapshot',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateSnapshotMessage'],
    shapes: shapes,
    resultWrapper: 'CreateSnapshotResult',
  );
  return CreateSnapshotResult.fromXml($result);
}