getResourcesStatisticsV2 method

Future<GetResourcesStatisticsV2Response> getResourcesStatisticsV2({
  1. required List<ResourceGroupByRule> groupByRules,
  2. int? maxStatisticResults,
  3. ResourceScopes? scopes,
  4. SortOrder? sortOrder,
})

Retrieves statistical information about Amazon Web Services resources and their associated security findings.

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

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

Parameter groupByRules : How resource statistics should be aggregated and organized in the response.

Parameter maxStatisticResults : The maximum number of results to be returned.

Parameter scopes : Limits the results to resources 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 statistics from all accounts across the entire organization. Other accounts see only statistics for their own resources.

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

Parameter sortOrder : Sorts aggregated statistics.

Implementation

Future<GetResourcesStatisticsV2Response> getResourcesStatisticsV2({
  required List<ResourceGroupByRule> groupByRules,
  int? maxStatisticResults,
  ResourceScopes? scopes,
  SortOrder? sortOrder,
}) async {
  _s.validateNumRange(
    'maxStatisticResults',
    maxStatisticResults,
    1,
    400,
  );
  final $payload = <String, dynamic>{
    'GroupByRules': groupByRules,
    if (maxStatisticResults != null)
      'MaxStatisticResults': maxStatisticResults,
    if (scopes != null) 'Scopes': scopes,
    if (sortOrder != null) 'SortOrder': sortOrder.value,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/resourcesv2/statistics',
    exceptionFnMap: _exceptionFns,
  );
  return GetResourcesStatisticsV2Response.fromJson(response);
}