listDatabases method

Future<ListDatabasesOutput> listDatabases({
  1. required String catalogName,
  2. int? maxResults,
  3. String? nextToken,
  4. String? workGroup,
})

Lists the databases in the specified data catalog.

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

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

Parameter maxResults : Specifies the maximum number of results to return.

Parameter nextToken : A token generated by the Athena service that specifies where to continue pagination if a previous request was truncated. To obtain the next set of pages, pass in the NextToken from the response object of the previous page call.

Parameter workGroup : The name of the workgroup for which the metadata is being fetched. Required if requesting an IAM Identity Center enabled Glue Data Catalog.

Implementation

Future<ListDatabasesOutput> listDatabases({
  required String catalogName,
  int? maxResults,
  String? nextToken,
  String? workGroup,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    50,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AmazonAthena.ListDatabases'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CatalogName': catalogName,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (workGroup != null) 'WorkGroup': workGroup,
    },
  );

  return ListDatabasesOutput.fromJson(jsonResponse.body);
}