listQueries method

Future<ListQueriesResponse> listQueries({
  1. required String eventDataStore,
  2. DateTime? endTime,
  3. int? maxResults,
  4. String? nextToken,
  5. QueryStatus? queryStatus,
  6. DateTime? startTime,
})

Returns a list of queries and query statuses for the past seven days. You must specify an ARN value for EventDataStore. Optionally, to shorten the list of results, you can specify a time range, formatted as timestamps, by adding StartTime and EndTime parameters, and a QueryStatus value. Valid values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

May throw EventDataStoreARNInvalidException. May throw EventDataStoreNotFoundException. May throw InactiveEventDataStoreException. May throw InvalidDateRangeException. May throw InvalidMaxResultsException. May throw InvalidNextTokenException. May throw InvalidParameterException. May throw InvalidQueryStatusException. May throw NoManagementAccountSLRExistsException. May throw OperationNotPermittedException. May throw UnsupportedOperationException.

Parameter eventDataStore : The ARN (or the ID suffix of the ARN) of an event data store on which queries were run.

Parameter endTime : Use with StartTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.

Parameter maxResults : The maximum number of queries to show on a page.

Parameter nextToken : A token you can use to get the next page of results.

Parameter queryStatus : The status of queries that you want to return in results. Valid values for QueryStatus include QUEUED, RUNNING, FINISHED, FAILED, TIMED_OUT, or CANCELLED.

Parameter startTime : Use with EndTime to bound a ListQueries request, and limit its results to only those queries run within a specified time period.

Implementation

Future<ListQueriesResponse> listQueries({
  required String eventDataStore,
  DateTime? endTime,
  int? maxResults,
  String? nextToken,
  QueryStatus? queryStatus,
  DateTime? startTime,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.ListQueries'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'EventDataStore': eventDataStore,
      if (endTime != null) 'EndTime': unixTimestampToJson(endTime),
      if (maxResults != null) 'MaxResults': maxResults,
      if (nextToken != null) 'NextToken': nextToken,
      if (queryStatus != null) 'QueryStatus': queryStatus.value,
      if (startTime != null) 'StartTime': unixTimestampToJson(startTime),
    },
  );

  return ListQueriesResponse.fromJson(jsonResponse.body);
}