getComplianceSummary method
Returns a table that shows counts of resources that are noncompliant with their tag policies.
For more information on tag policies, see Tag Policies in the AWS Organizations User Guide.
You can call this operation only from the organization's master account and from the us-east-1 Region.
May throw ConstraintViolationException. May throw InternalServiceException. May throw InvalidParameterException. May throw ThrottledException.
Parameter groupBy
:
A list of attributes to group the counts of noncompliant resources by. If
supplied, the counts are sorted by those attributes.
Parameter maxResults
:
A limit that restricts the number of results that are returned per page.
Parameter paginationToken
:
A string that indicates that additional data is available. Leave this
value empty for your initial request. If the response includes a
PaginationToken
, use that string for this value to request an
additional page of data.
Parameter regionFilters
:
A list of Regions to limit the output by. If you use this parameter, the
count of returned noncompliant resources includes only resources in the
specified Regions.
Parameter resourceTypeFilters
:
The constraints on the resources that you want returned. The format of
each resource type is service
. For example,
specifying a resource type of :resourceType
ec2
returns all Amazon EC2
resources (which includes EC2 instances). Specifying a resource type of
ec2:instance
returns only EC2 instances.
The string for each service name and resource type is the same as that embedded in a resource's Amazon Resource Name (ARN). Consult the AWS General Reference for the following:
- For a list of service name strings, see AWS Service Namespaces.
- For resource type strings, see Example ARNs.
- For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces.
Parameter tagKeyFilters
:
A list of tag keys to limit the output by. If you use this parameter, the
count of returned noncompliant resources includes only resources that have
the specified tag keys.
Parameter targetIdFilters
:
The target identifiers (usually, specific account IDs) to limit the output
by. If you use this parameter, the count of returned noncompliant
resources includes only resources with the specified target IDs.
Implementation
Future<GetComplianceSummaryOutput> getComplianceSummary({
List<GroupByAttribute>? groupBy,
int? maxResults,
String? paginationToken,
List<String>? regionFilters,
List<String>? resourceTypeFilters,
List<String>? tagKeyFilters,
List<String>? targetIdFilters,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
1000,
);
_s.validateStringLength(
'paginationToken',
paginationToken,
0,
2048,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'ResourceGroupsTaggingAPI_20170126.GetComplianceSummary'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
if (groupBy != null)
'GroupBy': groupBy.map((e) => e.toValue()).toList(),
if (maxResults != null) 'MaxResults': maxResults,
if (paginationToken != null) 'PaginationToken': paginationToken,
if (regionFilters != null) 'RegionFilters': regionFilters,
if (resourceTypeFilters != null)
'ResourceTypeFilters': resourceTypeFilters,
if (tagKeyFilters != null) 'TagKeyFilters': tagKeyFilters,
if (targetIdFilters != null) 'TargetIdFilters': targetIdFilters,
},
);
return GetComplianceSummaryOutput.fromJson(jsonResponse.body);
}