getDiscoveredResourceCounts method
Returns the resource types, the number of each resource type, and the total number of resources that Config is recording in this region for your Amazon Web Services account.
Example
- Config is recording three resource types in the US East (Ohio) Region for your account: 25 EC2 instances, 20 IAM users, and 15 S3 buckets.
-
You make a call to the
GetDiscoveredResourceCountsaction and specify that you want all resource types. -
Config returns the following:
- The resource types (EC2 instances, IAM users, and S3 buckets).
- The number of each resource type (25, 20, and 15).
- The total number of all resources (60).
limit parameter. The response includes a
nextToken string. To get the next page of results, run the
request again and specify the string for the nextToken
parameter.
May throw InvalidLimitException.
May throw InvalidNextTokenException.
May throw ValidationException.
Parameter limit :
The maximum number of ResourceCount objects returned on each page.
The default is 100. You cannot specify a number greater than 100. If you
specify 0, 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.
Parameter resourceTypes :
The comma-separated list that specifies the resource types that you want
Config to return (for example, "AWS::EC2::Instance",
"AWS::IAM::User").
If a value for resourceTypes is not specified, Config returns
all resource types that Config is recording in the region for your
account.
Implementation
Future<GetDiscoveredResourceCountsResponse> getDiscoveredResourceCounts({
int? limit,
String? nextToken,
List<String>? resourceTypes,
}) async {
_s.validateNumRange(
'limit',
limit,
0,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'StarlingDoveService.GetDiscoveredResourceCounts'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (limit != null) 'limit': limit,
if (nextToken != null) 'nextToken': nextToken,
if (resourceTypes != null) 'resourceTypes': resourceTypes,
},
);
return GetDiscoveredResourceCountsResponse.fromJson(jsonResponse.body);
}