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 ClusterNotFoundFault. May throw ClusterSnapshotAlreadyExistsFault. May throw ClusterSnapshotQuotaExceededFault. May throw InvalidClusterStateFault. May throw InvalidRetentionPeriodFault. May throw InvalidTagFault. May throw TagLimitExceededFault.

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 Amazon Web Services 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 {
  final $request = <String, String>{
    'ClusterIdentifier': clusterIdentifier,
    'SnapshotIdentifier': snapshotIdentifier,
    if (manualSnapshotRetentionPeriod != null)
      'ManualSnapshotRetentionPeriod':
          manualSnapshotRetentionPeriod.toString(),
    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: 'CreateClusterSnapshot',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateClusterSnapshotResult',
  );
  return CreateClusterSnapshotResult.fromXml($result);
}