getFindings method

Future<GetFindingsResponse> getFindings({
  1. AwsSecurityFindingFilters? filters,
  2. int? maxResults,
  3. String? nextToken,
  4. List<SortCriterion>? sortCriteria,
})

Returns a list of findings that match the specified criteria.

If cross-Region aggregation is enabled, then when you call GetFindings from the home Region, the results include all of the matching findings from both the home Region and linked Regions.

May throw InternalException. May throw InvalidAccessException. May throw InvalidInputException. May throw LimitExceededException.

Parameter filters : The finding attributes used to define a condition to filter the returned findings.

You can filter by up to 10 finding attributes. For each attribute, you can provide up to 20 filter values.

Note that in the available filter fields, WorkflowState is deprecated. To search for a finding based on its workflow status, use WorkflowStatus.

Parameter maxResults : The maximum number of findings to return.

Parameter nextToken : The token that is required for pagination. On your first call to the GetFindings operation, set the value of this parameter to NULL.

For subsequent calls to the operation, to continue listing data, set the value of this parameter to the value returned from the previous response.

Parameter sortCriteria : The finding attributes used to sort the list of returned findings.

Implementation

Future<GetFindingsResponse> getFindings({
  AwsSecurityFindingFilters? filters,
  int? maxResults,
  String? nextToken,
  List<SortCriterion>? sortCriteria,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $payload = <String, dynamic>{
    if (filters != null) 'Filters': filters,
    if (maxResults != null) 'MaxResults': maxResults,
    if (nextToken != null) 'NextToken': nextToken,
    if (sortCriteria != null) 'SortCriteria': sortCriteria,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/findings',
    exceptionFnMap: _exceptionFns,
  );
  return GetFindingsResponse.fromJson(response);
}