getDatabase method

Future<GetDatabaseOutput> getDatabase({
  1. required String catalogName,
  2. required String databaseName,
})

Returns a database object for the specfied database and data catalog.

May throw InternalServerException. May throw InvalidRequestException. May throw MetadataException.

Parameter catalogName : The name of the data catalog that contains the database to return.

Parameter databaseName : The name of the database to return.

Implementation

Future<GetDatabaseOutput> getDatabase({
  required String catalogName,
  required String databaseName,
}) async {
  ArgumentError.checkNotNull(catalogName, 'catalogName');
  _s.validateStringLength(
    'catalogName',
    catalogName,
    1,
    256,
    isRequired: true,
  );
  ArgumentError.checkNotNull(databaseName, 'databaseName');
  _s.validateStringLength(
    'databaseName',
    databaseName,
    1,
    128,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonAthena.GetDatabase'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CatalogName': catalogName,
      'DatabaseName': databaseName,
    },
  );

  return GetDatabaseOutput.fromJson(jsonResponse.body);
}