copyClusterSnapshot method
Copies the specified automated cluster snapshot to a new manual cluster snapshot. The source must be an automated snapshot and it must be in the available state.
When you delete a cluster, Amazon Redshift deletes any automated snapshots of the cluster. Also, when the retention period of the snapshot expires, Amazon Redshift automatically deletes it. If you want to keep an automated snapshot for a longer period, you can make a manual copy of the snapshot. Manual snapshots are retained until you delete them.
For more information about working with snapshots, go to Amazon Redshift Snapshots in the Amazon Redshift Cluster Management Guide.
May throw ClusterSnapshotAlreadyExistsFault. May throw ClusterSnapshotNotFoundFault. May throw InvalidClusterSnapshotStateFault. May throw ClusterSnapshotQuotaExceededFault. May throw InvalidRetentionPeriodFault.
Parameter sourceSnapshotIdentifier
:
The identifier for the source snapshot.
Constraints:
-
Must be the identifier for a valid automated snapshot whose state is
available
.
Parameter targetSnapshotIdentifier
:
The identifier given to the new manual snapshot.
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.
- Must be unique for the AWS account that is making the request.
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 sourceSnapshotClusterIdentifier
:
The identifier of the cluster the source snapshot was created from. This
parameter is required if your IAM user has a policy containing a snapshot
resource element that specifies anything other than * for the cluster
name.
Constraints:
- Must be the identifier for a valid cluster.
Implementation
Future<CopyClusterSnapshotResult> copyClusterSnapshot({
required String sourceSnapshotIdentifier,
required String targetSnapshotIdentifier,
int? manualSnapshotRetentionPeriod,
String? sourceSnapshotClusterIdentifier,
}) async {
ArgumentError.checkNotNull(
sourceSnapshotIdentifier, 'sourceSnapshotIdentifier');
_s.validateStringLength(
'sourceSnapshotIdentifier',
sourceSnapshotIdentifier,
0,
2147483647,
isRequired: true,
);
ArgumentError.checkNotNull(
targetSnapshotIdentifier, 'targetSnapshotIdentifier');
_s.validateStringLength(
'targetSnapshotIdentifier',
targetSnapshotIdentifier,
0,
2147483647,
isRequired: true,
);
_s.validateStringLength(
'sourceSnapshotClusterIdentifier',
sourceSnapshotClusterIdentifier,
0,
2147483647,
);
final $request = <String, dynamic>{};
$request['SourceSnapshotIdentifier'] = sourceSnapshotIdentifier;
$request['TargetSnapshotIdentifier'] = targetSnapshotIdentifier;
manualSnapshotRetentionPeriod
?.also((arg) => $request['ManualSnapshotRetentionPeriod'] = arg);
sourceSnapshotClusterIdentifier
?.also((arg) => $request['SourceSnapshotClusterIdentifier'] = arg);
final $result = await _protocol.send(
$request,
action: 'CopyClusterSnapshot',
version: '2012-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['CopyClusterSnapshotMessage'],
shapes: shapes,
resultWrapper: 'CopyClusterSnapshotResult',
);
return CopyClusterSnapshotResult.fromXml($result);
}