copyBackupToRegion method

Future<CopyBackupToRegionResponse> copyBackupToRegion({
  1. required String backupId,
  2. required String destinationRegion,
  3. List<Tag>? tagList,
})

Copy an AWS CloudHSM cluster backup to a different region.

May throw CloudHsmAccessDeniedException. May throw CloudHsmInternalFailureException. May throw CloudHsmInvalidRequestException. May throw CloudHsmResourceNotFoundException. May throw CloudHsmServiceException. May throw CloudHsmTagException.

Parameter backupId : The ID of the backup that will be copied to the destination region.

Parameter destinationRegion : The AWS region that will contain your copied CloudHSM cluster backup.

Parameter tagList : Tags to apply to the destination backup during creation. If you specify tags, only these tags will be applied to the destination backup. If you do not specify tags, the service copies tags from the source backup to the destination backup.

Implementation

Future<CopyBackupToRegionResponse> copyBackupToRegion({
  required String backupId,
  required String destinationRegion,
  List<Tag>? tagList,
}) async {
  ArgumentError.checkNotNull(backupId, 'backupId');
  ArgumentError.checkNotNull(destinationRegion, 'destinationRegion');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'BaldrApiService.CopyBackupToRegion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BackupId': backupId,
      'DestinationRegion': destinationRegion,
      if (tagList != null) 'TagList': tagList,
    },
  );

  return CopyBackupToRegionResponse.fromJson(jsonResponse.body);
}