deleteFileSystem method

Future<DeleteFileSystemResponse> deleteFileSystem({
  1. required String fileSystemId,
  2. String? clientRequestToken,
  3. DeleteFileSystemLustreConfiguration? lustreConfiguration,
  4. DeleteFileSystemWindowsConfiguration? windowsConfiguration,
})

Deletes a file system, deleting its contents. After deletion, the file system no longer exists, and its data is gone. Any existing automatic backups will also be deleted.

By default, when you delete an Amazon FSx for Windows File Server file system, a final backup is created upon deletion. This final backup is not subject to the file system's retention policy, and must be manually deleted.

The DeleteFileSystem action returns while the file system has the DELETING status. You can check the file system deletion status by calling the DescribeFileSystems action, which returns a list of file systems in your account. If you pass the file system ID for a deleted file system, the DescribeFileSystems returns a FileSystemNotFound error.

May throw BadRequest. May throw IncompatibleParameterError. May throw FileSystemNotFound. May throw ServiceLimitExceeded. May throw InternalServerError.

Parameter fileSystemId : The ID of the file system 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<DeleteFileSystemResponse> deleteFileSystem({
  required String fileSystemId,
  String? clientRequestToken,
  DeleteFileSystemLustreConfiguration? lustreConfiguration,
  DeleteFileSystemWindowsConfiguration? windowsConfiguration,
}) async {
  ArgumentError.checkNotNull(fileSystemId, 'fileSystemId');
  _s.validateStringLength(
    'fileSystemId',
    fileSystemId,
    11,
    21,
    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.DeleteFileSystem'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'FileSystemId': fileSystemId,
      'ClientRequestToken':
          clientRequestToken ?? _s.generateIdempotencyToken(),
      if (lustreConfiguration != null)
        'LustreConfiguration': lustreConfiguration,
      if (windowsConfiguration != null)
        'WindowsConfiguration': windowsConfiguration,
    },
  );

  return DeleteFileSystemResponse.fromJson(jsonResponse.body);
}