listNamedQueries method

Future<ListNamedQueriesOutput> listNamedQueries({
  1. int? maxResults,
  2. String? nextToken,
  3. String? workGroup,
})

Provides a list of available query IDs only for queries saved in the specified workgroup. Requires that you have access to the specified workgroup. If a workgroup is not specified, lists the saved queries for the primary workgroup.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

May throw InternalServerException. May throw InvalidRequestException.

Parameter maxResults : The maximum number of queries to return in this request.

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 from which the named queries are being returned. If a workgroup is not specified, the saved queries for the primary workgroup are returned.

Implementation

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

  return ListNamedQueriesOutput.fromJson(jsonResponse.body);
}