getQueryResults method

Future<GetQueryResultsResponse> getQueryResults({
  1. required String queryId,
  2. String? eventDataStore,
  3. String? eventDataStoreOwnerAccountId,
  4. int? maxQueryResults,
  5. String? nextToken,
})

Gets event data results of a query. You must specify the QueryID value returned by the StartQuery operation.

May throw EventDataStoreARNInvalidException. May throw EventDataStoreNotFoundException. May throw InactiveEventDataStoreException. May throw InsufficientEncryptionPolicyException. May throw InvalidMaxResultsException. May throw InvalidNextTokenException. May throw InvalidParameterException. May throw NoManagementAccountSLRExistsException. May throw OperationNotPermittedException. May throw QueryIdNotFoundException. May throw UnsupportedOperationException.

Parameter queryId : The ID of the query for which you want to get results.

Parameter eventDataStore : The ARN (or ID suffix of the ARN) of the event data store against which the query was run.

Parameter eventDataStoreOwnerAccountId : The account ID of the event data store owner.

Parameter maxQueryResults : The maximum number of query results to display on a single page.

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

Implementation

Future<GetQueryResultsResponse> getQueryResults({
  required String queryId,
  String? eventDataStore,
  String? eventDataStoreOwnerAccountId,
  int? maxQueryResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxQueryResults',
    maxQueryResults,
    1,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'CloudTrail_20131101.GetQueryResults'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'QueryId': queryId,
      if (eventDataStore != null) 'EventDataStore': eventDataStore,
      if (eventDataStoreOwnerAccountId != null)
        'EventDataStoreOwnerAccountId': eventDataStoreOwnerAccountId,
      if (maxQueryResults != null) 'MaxQueryResults': maxQueryResults,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetQueryResultsResponse.fromJson(jsonResponse.body);
}