deleteBackup method

Future<DeleteBackupResponse> deleteBackup({
  1. required String backupId,
  2. String? clientRequestToken,
})

Deletes an Amazon FSx backup. After deletion, the backup no longer exists, and its data is gone.

The DeleteBackup call returns instantly. The backup won't show up in later DescribeBackups calls.

May throw BackupBeingCopied. May throw BackupInProgress. May throw BackupNotFound. May throw BackupRestoring. May throw BadRequest. May throw IncompatibleParameterError. May throw InternalServerError.

Parameter backupId : The ID of the backup that you want to delete.

Parameter clientRequestToken : A string of up to 63 ASCII characters that Amazon FSx uses to ensure idempotent deletion. This parameter is automatically filled on your behalf when using the CLI or SDK.

Implementation

Future<DeleteBackupResponse> deleteBackup({
  required String backupId,
  String? clientRequestToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSSimbaAPIService_v20180301.DeleteBackup'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'BackupId': backupId,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
    },
  );

  return DeleteBackupResponse.fromJson(jsonResponse.body);
}