getFindingsV2 method

Future<GetFindingsV2Response> getFindingsV2({
  1. OcsfFindingFilters? filters,
  2. int? maxResults,
  3. String? nextToken,
  4. FindingScopes? scopes,
  5. List<SortCriterion>? sortCriteria,
})

Returns a list of findings that match the specified criteria.

You can use the Scopes parameter to define the data boundary for the query. Currently, Scopes supports AwsOrganizations, which lets you retrieve findings from your entire organization or from specific organizational units. Only the delegated administrator account can use Scopes.

You can use the Filters parameter to refine results based on finding attributes. You can use Scopes and Filters independently or together. When both are provided, Scopes narrows the data set first, and then Filters refines results within that scoped data set.

GetFindings and GetFindingsV2 both use securityhub:GetFindings in the Action element of an IAM policy statement. You must have permission to perform the securityhub:GetFindings action.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw OrganizationalUnitNotFoundException. May throw OrganizationNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter filters : The finding attributes used to define a condition to filter the returned OCSF findings. You can filter up to 10 composite filters. For each filter type inside of a composite filter, you can provide up to 20 filters.

Parameter maxResults : The maximum number of results to return.

Parameter nextToken : The token required for pagination. On your first call, set the value of this parameter to NULL. For subsequent calls, to continue listing data, set the value of this parameter to the value returned in the previous response.

Parameter scopes : Limits the results to findings from specific organizational units or from the delegated administrator's organization. Only the delegated administrator account can use this parameter. Other accounts receive an AccessDeniedException.

This parameter is optional. If you omit it, the delegated administrator sees findings from all accounts across the entire organization. Other accounts see only their own findings.

You can specify up to 10 entries in Scopes.AwsOrganizations. If multiple entries are specified, the entries are combined using OR logic.

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

Implementation

Future<GetFindingsV2Response> getFindingsV2({
  OcsfFindingFilters? filters,
  int? maxResults,
  String? nextToken,
  FindingScopes? scopes,
  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 (scopes != null) 'Scopes': scopes,
    if (sortCriteria != null) 'SortCriteria': sortCriteria,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/findingsv2',
    exceptionFnMap: _exceptionFns,
  );
  return GetFindingsV2Response.fromJson(response);
}