listLogGroupsForQuery method

Future<ListLogGroupsForQueryResponse> listLogGroupsForQuery({
  1. required String queryId,
  2. int? maxResults,
  3. String? nextToken,
})

Returns a list of the log groups that were analyzed during a single CloudWatch Logs Insights query. This can be useful for queries that use log group name prefixes or the filterIndex command, because the log groups are dynamically selected in these cases.

For more information about field indexes, see Create field indexes to improve query performance and reduce costs.

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

Parameter queryId : The ID of the query to use. This query ID is from the response to your StartQuery operation.

Parameter maxResults : Limits the number of returned log groups to the specified number.

Implementation

Future<ListLogGroupsForQueryResponse> listLogGroupsForQuery({
  required String queryId,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    50,
    500,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'Logs_20140328.ListLogGroupsForQuery'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'queryId': queryId,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListLogGroupsForQueryResponse.fromJson(jsonResponse.body);
}