enableSnapshotCopy method
Enables the automatic copy of snapshots from one region to another region for a specified cluster.
May throw IncompatibleOrderableOptions. May throw InvalidClusterStateFault. May throw ClusterNotFoundFault. May throw CopyToRegionDisabledFault. May throw SnapshotCopyAlreadyEnabledFault. May throw UnknownSnapshotCopyRegionFault. May throw UnauthorizedOperation. May throw SnapshotCopyGrantNotFoundFault. May throw LimitExceededFault. May throw DependentServiceRequestThrottlingFault. May throw InvalidRetentionPeriodFault.
Parameter clusterIdentifier
:
The unique identifier of the source cluster to copy snapshots from.
Constraints: Must be the valid name of an existing cluster that does not already have cross-region snapshot copy enabled.
Parameter destinationRegion
:
The destination AWS Region that you want to copy snapshots to.
Constraints: Must be the name of a valid AWS Region. For more information, see Regions and Endpoints in the Amazon Web Services General Reference.
Parameter manualSnapshotRetentionPeriod
:
The number of days to retain newly copied snapshots in the destination AWS
Region after they are copied from the source AWS Region. 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.
Parameter retentionPeriod
:
The number of days to retain automated snapshots in the destination region
after they are copied from the source region.
Default: 7.
Constraints: Must be at least 1 and no more than 35.
Parameter snapshotCopyGrantName
:
The name of the snapshot copy grant to use when snapshots of an AWS
KMS-encrypted cluster are copied to the destination region.
Implementation
Future<EnableSnapshotCopyResult> enableSnapshotCopy({
required String clusterIdentifier,
required String destinationRegion,
int? manualSnapshotRetentionPeriod,
int? retentionPeriod,
String? snapshotCopyGrantName,
}) async {
ArgumentError.checkNotNull(clusterIdentifier, 'clusterIdentifier');
_s.validateStringLength(
'clusterIdentifier',
clusterIdentifier,
0,
2147483647,
isRequired: true,
);
ArgumentError.checkNotNull(destinationRegion, 'destinationRegion');
_s.validateStringLength(
'destinationRegion',
destinationRegion,
0,
2147483647,
isRequired: true,
);
_s.validateStringLength(
'snapshotCopyGrantName',
snapshotCopyGrantName,
0,
2147483647,
);
final $request = <String, dynamic>{};
$request['ClusterIdentifier'] = clusterIdentifier;
$request['DestinationRegion'] = destinationRegion;
manualSnapshotRetentionPeriod
?.also((arg) => $request['ManualSnapshotRetentionPeriod'] = arg);
retentionPeriod?.also((arg) => $request['RetentionPeriod'] = arg);
snapshotCopyGrantName
?.also((arg) => $request['SnapshotCopyGrantName'] = arg);
final $result = await _protocol.send(
$request,
action: 'EnableSnapshotCopy',
version: '2012-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['EnableSnapshotCopyMessage'],
shapes: shapes,
resultWrapper: 'EnableSnapshotCopyResult',
);
return EnableSnapshotCopyResult.fromXml($result);
}