deleteDatabase method

Future<void> deleteDatabase({
  1. required String name,
  2. String? catalogId,
})

Removes a specified database from a Data Catalog.

To ensure the immediate deletion of all related resources, before calling DeleteDatabase, use DeleteTableVersion or BatchDeleteTableVersion, DeletePartition or BatchDeletePartition, DeleteUserDefinedFunction, and DeleteTable or BatchDeleteTable, to delete any resources that belong to the database.

May throw EntityNotFoundException. May throw InvalidInputException. May throw InternalServiceException. May throw OperationTimeoutException.

Parameter name : The name of the database to delete. For Hive compatibility, this must be all lowercase.

Parameter catalogId : The ID of the Data Catalog in which the database resides. If none is provided, the AWS account ID is used by default.

Implementation

Future<void> deleteDatabase({
  required String name,
  String? catalogId,
}) async {
  ArgumentError.checkNotNull(name, 'name');
  _s.validateStringLength(
    'name',
    name,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.DeleteDatabase'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (catalogId != null) 'CatalogId': catalogId,
    },
  );
}