getDatabases method

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

Retrieves all databases defined in a given Data Catalog.

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

Parameter attributesToGet : Specifies the database fields returned by the GetDatabases call. This parameter doesn’t accept an empty list. The request must include the NAME.

Parameter catalogId : The ID of the Data Catalog from which to retrieve Databases. If none is provided, the Amazon Web Services 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 FEDERATED, FOREIGN or ALL.

  • If set to FEDERATED, will list the federated databases (referencing an external entity) shared with your account.
  • 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({
  List<DatabaseAttributes>? attributesToGet,
  String? catalogId,
  int? maxResults,
  String? nextToken,
  ResourceShareType? resourceShareType,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  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 (attributesToGet != null)
        'AttributesToGet': attributesToGet.map((e) => e.value).toList(),
      if (catalogId != null) 'CatalogId': catalogId,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (resourceShareType != null)
        'ResourceShareType': resourceShareType.value,
    },
  );

  return GetDatabasesResponse.fromJson(jsonResponse.body);
}