getDatabase method

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

Retrieves the definition of a specified database.

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

Parameter name : The name of the database to retrieve. For Hive compatibility, this should 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<GetDatabaseResponse> getDatabase({
  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.GetDatabase'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Name': name,
      if (catalogId != null) 'CatalogId': catalogId,
    },
  );

  return GetDatabaseResponse.fromJson(jsonResponse.body);
}