getCatalogs method

Future<GetCatalogsResponse> getCatalogs({
  1. bool? hasDatabases,
  2. bool? includeRoot,
  3. int? maxResults,
  4. String? nextToken,
  5. String? parentCatalogId,
  6. bool? recursive,
})

Retrieves all catalogs defined in a catalog in the Glue Data Catalog. For a Redshift-federated catalog use case, this operation returns the list of catalogs mapped to Redshift databases in the Redshift namespace catalog.

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

Parameter hasDatabases : When true, the response only includes catalogs that can contain databases. Some catalogs are organizational containers that hold only other catalogs, not databases. When this parameter is set to true, those container-only catalogs are excluded, and only catalogs capable of containing databases are returned. Defaults to false.

Parameter includeRoot : Whether to list the default catalog in the account and region in the response. Defaults to false. When true and ParentCatalogId = NULL | Amazon Web Services Account ID, all catalogs and the default catalog are enumerated in the response.

When the ParentCatalogId is not equal to null, and this attribute is passed as false or true, an InvalidInputException is thrown.

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

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

Parameter parentCatalogId : The ID of the parent catalog in which the catalog resides. If none is provided, the Amazon Web Services Account Number is used by default.

Parameter recursive : Whether to list all catalogs across the catalog hierarchy, starting from the ParentCatalogId. Defaults to false . When true, all catalog objects in the ParentCatalogID hierarchy are enumerated in the response.

Implementation

Future<GetCatalogsResponse> getCatalogs({
  bool? hasDatabases,
  bool? includeRoot,
  int? maxResults,
  String? nextToken,
  String? parentCatalogId,
  bool? recursive,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSGlue.GetCatalogs'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (hasDatabases != null) 'HasDatabases': hasDatabases,
      if (includeRoot != null) 'IncludeRoot': includeRoot,
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (parentCatalogId != null) 'ParentCatalogId': parentCatalogId,
      if (recursive != null) 'Recursive': recursive,
    },
  );

  return GetCatalogsResponse.fromJson(jsonResponse.body);
}