createClusterSnapshot method

Future<CreateClusterSnapshotResult> createClusterSnapshot({
  1. required String clusterIdentifier,
  2. required String snapshotIdentifier,
  3. int? manualSnapshotRetentionPeriod,
  4. List<Tag>? tags,
})

Creates a manual snapshot of the specified cluster. The cluster must be in the available state.

For more information about working with snapshots, go to Amazon Redshift Snapshots in the Amazon Redshift Cluster Management Guide.

May throw ClusterSnapshotAlreadyExistsFault. May throw InvalidClusterStateFault. May throw ClusterNotFoundFault. May throw ClusterSnapshotQuotaExceededFault. May throw TagLimitExceededFault. May throw InvalidTagFault. May throw InvalidRetentionPeriodFault.

Parameter clusterIdentifier : The cluster identifier for which you want a snapshot.

Parameter snapshotIdentifier : A unique identifier for the snapshot that you are requesting. This identifier must be unique for all snapshots within the AWS account.

Constraints:

  • Cannot be null, empty, or blank
  • Must contain from 1 to 255 alphanumeric characters or hyphens
  • First character must be a letter
  • Cannot end with a hyphen or contain two consecutive hyphens
Example: my-snapshot-id

Parameter manualSnapshotRetentionPeriod : The number of days that a manual snapshot is retained. If the value is -1, the manual snapshot is retained indefinitely.

The value must be either -1 or an integer between 1 and 3,653.

The default value is -1.

Parameter tags : A list of tag instances.

Implementation

Future<CreateClusterSnapshotResult> createClusterSnapshot({
  required String clusterIdentifier,
  required String snapshotIdentifier,
  int? manualSnapshotRetentionPeriod,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(clusterIdentifier, 'clusterIdentifier');
  _s.validateStringLength(
    'clusterIdentifier',
    clusterIdentifier,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(snapshotIdentifier, 'snapshotIdentifier');
  _s.validateStringLength(
    'snapshotIdentifier',
    snapshotIdentifier,
    0,
    2147483647,
    isRequired: true,
  );
  final $request = <String, dynamic>{};
  $request['ClusterIdentifier'] = clusterIdentifier;
  $request['SnapshotIdentifier'] = snapshotIdentifier;
  manualSnapshotRetentionPeriod
      ?.also((arg) => $request['ManualSnapshotRetentionPeriod'] = arg);
  tags?.also((arg) => $request['Tags'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CreateClusterSnapshot',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateClusterSnapshotMessage'],
    shapes: shapes,
    resultWrapper: 'CreateClusterSnapshotResult',
  );
  return CreateClusterSnapshotResult.fromXml($result);
}