describeQueries method

Future<DescribeQueriesResponse> describeQueries({
  1. String? logGroupName,
  2. int? maxResults,
  3. String? nextToken,
  4. QueryStatus? status,
})

Returns a list of CloudWatch Logs Insights queries that are scheduled, executing, or have been executed recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status.

May throw InvalidParameterException. May throw ResourceNotFoundException. May throw ServiceUnavailableException.

Parameter logGroupName : Limits the returned queries to only those for the specified log group.

Parameter maxResults : Limits the number of returned queries to the specified number.

Parameter status : Limits the returned queries to only those that have the specified status. Valid values are Cancelled, Complete, Failed, Running, and Scheduled.

Implementation

Future<DescribeQueriesResponse> describeQueries({
  String? logGroupName,
  int? maxResults,
  String? nextToken,
  QueryStatus? status,
}) async {
  _s.validateStringLength(
    'logGroupName',
    logGroupName,
    1,
    512,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.DescribeQueries'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (logGroupName != null) 'logGroupName': logGroupName,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
      if (status != null) 'status': status.toValue(),
    },
  );

  return DescribeQueriesResponse.fromJson(jsonResponse.body);
}