createSnapshotCopyConfiguration method

Future<CreateSnapshotCopyConfigurationResponse> createSnapshotCopyConfiguration({
  1. required String destinationRegion,
  2. required String namespaceName,
  3. String? destinationKmsKeyId,
  4. int? snapshotRetentionPeriod,
})

Creates a snapshot copy configuration that lets you copy snapshots to another Amazon Web Services Region.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter destinationRegion : The destination Amazon Web Services Region that you want to copy snapshots to.

Parameter namespaceName : The name of the namespace to copy snapshots from.

Parameter destinationKmsKeyId : The KMS key to use to encrypt your snapshots in the destination Amazon Web Services Region.

Parameter snapshotRetentionPeriod : The retention period of the snapshots that you copy to the destination Amazon Web Services Region.

Implementation

Future<CreateSnapshotCopyConfigurationResponse>
    createSnapshotCopyConfiguration({
  required String destinationRegion,
  required String namespaceName,
  String? destinationKmsKeyId,
  int? snapshotRetentionPeriod,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.CreateSnapshotCopyConfiguration'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'destinationRegion': destinationRegion,
      'namespaceName': namespaceName,
      if (destinationKmsKeyId != null)
        'destinationKmsKeyId': destinationKmsKeyId,
      if (snapshotRetentionPeriod != null)
        'snapshotRetentionPeriod': snapshotRetentionPeriod,
    },
  );

  return CreateSnapshotCopyConfigurationResponse.fromJson(jsonResponse.body);
}