describeQueryDefinitions method

Future<DescribeQueryDefinitionsResponse> describeQueryDefinitions({
  1. int? maxResults,
  2. String? nextToken,
  3. String? queryDefinitionNamePrefix,
  4. QueryLanguage? queryLanguage,
})

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.

You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names that start with a certain string.

May throw InvalidParameterException. May throw ServiceUnavailableException.

Parameter maxResults : Limits the number of returned query definitions to the specified number.

Parameter queryDefinitionNamePrefix : Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.

Parameter queryLanguage : The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

Implementation

Future<DescribeQueryDefinitionsResponse> describeQueryDefinitions({
  int? maxResults,
  String? nextToken,
  String? queryDefinitionNamePrefix,
  QueryLanguage? queryLanguage,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.DescribeQueryDefinitions'
  };
  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 (queryDefinitionNamePrefix != null)
        'queryDefinitionNamePrefix': queryDefinitionNamePrefix,
      if (queryLanguage != null) 'queryLanguage': queryLanguage.value,
    },
  );

  return DescribeQueryDefinitionsResponse.fromJson(jsonResponse.body);
}