getDatabases method

Future<GetDatabasesResponse> getDatabases({
  1. String? catalogId,
  2. int? maxResults,
  3. String? nextToken,
  4. ResourceShareType? resourceShareType,
})

Retrieves all databases defined in a given Data Catalog.

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

Parameter catalogId : The ID of the Data Catalog from which to retrieve Databases. If none is provided, the AWS account ID is used by default.

Parameter maxResults : The maximum number of databases to return in one response.

Parameter nextToken : A continuation token, if this is a continuation call.

Parameter resourceShareType : Allows you to specify that you want to list the databases shared with your account. The allowable values are FOREIGN or ALL.

  • If set to FOREIGN, will list the databases shared with your account.
  • If set to ALL, will list the databases shared with your account, as well as the databases in yor local account.

Implementation

Future<GetDatabasesResponse> getDatabases({
  String? catalogId,
  int? maxResults,
  String? nextToken,
  ResourceShareType? resourceShareType,
}) async {
  _s.validateStringLength(
    'catalogId',
    catalogId,
    1,
    255,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetDatabases'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (catalogId != null) 'CatalogId': catalogId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceShareType != null)
        'ResourceShareType': resourceShareType.toValue(),
    },
  );

  return GetDatabasesResponse.fromJson(jsonResponse.body);
}