listFindings method

Future<ListFindingsResponse> listFindings({
  1. List<String>? assessmentRunArns,
  2. FindingFilter? filter,
  3. int? maxResults,
  4. String? nextToken,
})

Lists findings that are generated by the assessment runs that are specified by the ARNs of the assessment runs.

May throw InternalException. May throw InvalidInputException. May throw AccessDeniedException. May throw NoSuchEntityException.

Parameter assessmentRunArns : The ARNs of the assessment runs that generate the findings that you want to list.

Parameter filter : You can use this parameter to specify a subset of data to be included in the action's response.

For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

Parameter maxResults : You can use this parameter to indicate the maximum number of items you want in the response. The default value is 10. The maximum value is 500.

Parameter nextToken : You can use this parameter when paginating results. Set the value of this parameter to null on your first call to the ListFindings action. Subsequent calls to the action fill nextToken in the request with the value of NextToken from the previous response to continue listing data.

Implementation

Future<ListFindingsResponse> listFindings({
  List<String>? assessmentRunArns,
  FindingFilter? filter,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    300,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'InspectorService.ListFindings'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      if (assessmentRunArns != null) 'assessmentRunArns': assessmentRunArns,
      if (filter != null) 'filter': filter,
      if (maxResults != null) 'maxResults': maxResults,
      if (nextToken != null) 'nextToken': nextToken,
    },
  );

  return ListFindingsResponse.fromJson(jsonResponse.body);
}