deleteBackup method

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

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

The DeleteBackup call returns instantly. The backup will not show up in later DescribeBackups calls.

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

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

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

Implementation

Future<DeleteBackupResponse> deleteBackup({
  required String backupId,
  String? clientRequestToken,
}) async {
  ArgumentError.checkNotNull(backupId, 'backupId');
  _s.validateStringLength(
    'backupId',
    backupId,
    12,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'clientRequestToken',
    clientRequestToken,
    1,
    63,
  );
  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);
}