copyDBClusterSnapshot method

Future<CopyDBClusterSnapshotResult> copyDBClusterSnapshot({
  1. required String sourceDBClusterSnapshotIdentifier,
  2. required String targetDBClusterSnapshotIdentifier,
  3. bool? copyTags,
  4. String? kmsKeyId,
  5. String? preSignedUrl,
  6. List<Tag>? tags,
})

Copies a snapshot of a DB cluster.

To copy a DB cluster snapshot from a shared manual DB cluster snapshot, SourceDBClusterSnapshotIdentifier must be the Amazon Resource Name (ARN) of the shared DB cluster snapshot.

May throw DBClusterSnapshotAlreadyExistsFault. May throw DBClusterSnapshotNotFoundFault. May throw InvalidDBClusterStateFault. May throw InvalidDBClusterSnapshotStateFault. May throw SnapshotQuotaExceededFault. May throw KMSKeyNotAccessibleFault.

Parameter sourceDBClusterSnapshotIdentifier : The identifier of the DB cluster snapshot to copy. This parameter is not case-sensitive.

You can't copy from one AWS Region to another.

Constraints:

  • Must specify a valid system snapshot in the "available" state.
  • Specify a valid DB snapshot identifier.
Example: my-cluster-snapshot1

Parameter targetDBClusterSnapshotIdentifier : The identifier of the new DB cluster snapshot to create from the source DB cluster snapshot. This parameter is not case-sensitive.

Constraints:

  • Must contain from 1 to 63 letters, numbers, or hyphens.
  • First character must be a letter.
  • Cannot end with a hyphen or contain two consecutive hyphens.
Example: my-cluster-snapshot2

Parameter copyTags : True to copy all tags from the source DB cluster snapshot to the target DB cluster snapshot, and otherwise false. The default is false.

Parameter kmsKeyId : The AWS AWS KMS key ID for an encrypted DB cluster snapshot. The KMS key ID is the Amazon Resource Name (ARN), KMS key identifier, or the KMS key alias for the KMS encryption key.

If you copy an encrypted DB cluster snapshot from your AWS account, you can specify a value for KmsKeyId to encrypt the copy with a new KMS encryption key. If you don't specify a value for KmsKeyId, then the copy of the DB cluster snapshot is encrypted with the same KMS key as the source DB cluster snapshot.

If you copy an encrypted DB cluster snapshot that is shared from another AWS account, then you must specify a value for KmsKeyId.

KMS encryption keys are specific to the AWS Region that they are created in, and you can't use encryption keys from one AWS Region in another AWS Region.

You cannot encrypt an unencrypted DB cluster snapshot when you copy it. If you try to copy an unencrypted DB cluster snapshot and specify a value for the KmsKeyId parameter, an error is returned.

Parameter preSignedUrl : Not currently supported.

Parameter tags : The tags to assign to the new DB cluster snapshot copy.

Implementation

Future<CopyDBClusterSnapshotResult> copyDBClusterSnapshot({
  required String sourceDBClusterSnapshotIdentifier,
  required String targetDBClusterSnapshotIdentifier,
  bool? copyTags,
  String? kmsKeyId,
  String? preSignedUrl,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(
      sourceDBClusterSnapshotIdentifier, 'sourceDBClusterSnapshotIdentifier');
  ArgumentError.checkNotNull(
      targetDBClusterSnapshotIdentifier, 'targetDBClusterSnapshotIdentifier');
  final $request = <String, dynamic>{};
  $request['SourceDBClusterSnapshotIdentifier'] =
      sourceDBClusterSnapshotIdentifier;
  $request['TargetDBClusterSnapshotIdentifier'] =
      targetDBClusterSnapshotIdentifier;
  copyTags?.also((arg) => $request['CopyTags'] = arg);
  kmsKeyId?.also((arg) => $request['KmsKeyId'] = arg);
  preSignedUrl?.also((arg) => $request['PreSignedUrl'] = arg);
  tags?.also((arg) => $request['Tags'] = arg);
  final $result = await _protocol.send(
    $request,
    action: 'CopyDBClusterSnapshot',
    version: '2014-10-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CopyDBClusterSnapshotMessage'],
    shapes: shapes,
    resultWrapper: 'CopyDBClusterSnapshotResult',
  );
  return CopyDBClusterSnapshotResult.fromXml($result);
}