getAggregateDiscoveredResourceCounts method

Future<GetAggregateDiscoveredResourceCountsResponse> getAggregateDiscoveredResourceCounts({
  1. required String configurationAggregatorName,
  2. ResourceCountFilters? filters,
  3. ResourceCountGroupKey? groupByKey,
  4. int? limit,
  5. String? nextToken,
})

Returns the resource counts across accounts and regions that are present in your AWS Config aggregator. You can request the resource counts by providing filters and GroupByKey.

For example, if the input contains accountID 12345678910 and region us-east-1 in filters, the API returns the count of resources in account ID 12345678910 and region us-east-1. If the input contains ACCOUNT_ID as a GroupByKey, the API returns resource counts for all source accounts that are present in your aggregator.

May throw ValidationException. May throw InvalidLimitException. May throw InvalidNextTokenException. May throw NoSuchConfigurationAggregatorException.

Parameter configurationAggregatorName : The name of the configuration aggregator.

Parameter filters : Filters the results based on the ResourceCountFilters object.

Parameter groupByKey : The key to group the resource counts.

Parameter limit : The maximum number of GroupedResourceCount objects returned on each page. The default is 1000. You cannot specify a number greater than 1000. If you specify 0, AWS Config uses the default.

Parameter nextToken : The nextToken string returned on a previous page that you use to get the next page of results in a paginated response.

Implementation

Future<GetAggregateDiscoveredResourceCountsResponse>
    getAggregateDiscoveredResourceCounts({
  required String configurationAggregatorName,
  ResourceCountFilters? filters,
  ResourceCountGroupKey? groupByKey,
  int? limit,
  String? nextToken,
}) async {
  ArgumentError.checkNotNull(
      configurationAggregatorName, 'configurationAggregatorName');
  _s.validateStringLength(
    'configurationAggregatorName',
    configurationAggregatorName,
    1,
    256,
    isRequired: true,
  );
  _s.validateNumRange(
    'limit',
    limit,
    0,
    1000,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'StarlingDoveService.GetAggregateDiscoveredResourceCounts'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'ConfigurationAggregatorName': configurationAggregatorName,
      if (filters != null) 'Filters': filters,
      if (groupByKey != null) 'GroupByKey': groupByKey.toValue(),
      if (limit != null) 'Limit': limit,
      if (nextToken != null) 'NextToken': nextToken,
    },
  );

  return GetAggregateDiscoveredResourceCountsResponse.fromJson(
      jsonResponse.body);
}