Skip to content

get_compliance_summary async

get_compliance_summary(
    *,
    config_overrides: Optional[AsyncResourceGroupsTaggingAPIClientConfig] = None,
    target_id_filters: Optional[TargetIdFilterList] = None,
    region_filters: Optional[RegionFilterList] = None,
    resource_type_filters: Optional[ResourceTypeFilterList] = None,
    tag_key_filters: Optional[TagKeyFilterList] = None,
    group_by: Optional[GroupBy] = None,
    max_results: Optional[MaxResultsGetComplianceSummary] = None,
    pagination_token: Optional[PaginationToken] = None,
) -> GetComplianceSummaryOutput

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 Organizations User Guide.

You can call this operation only from the organization's management account and from the us-east-1 Region.

This operation supports pagination, where the response can be sent in multiple pages. You should check the PaginationToken response parameter to determine if there are additional results available to return. Repeat the query, passing the PaginationToken response parameter value as an input to the next request until you recieve a null value. A null value for PaginationToken indicates that there are no more results waiting to be returned.

Parameters:

  • target_id_filters (Optional[TargetIdFilterList], default: None ) –

    Specifies 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.

  • region_filters (Optional[RegionFilterList], default: None ) –

    Specifies a list of Amazon Web Services Regions to limit the output to. If you use this parameter, the count of returned noncompliant resources includes only resources in the specified Regions.

  • resource_type_filters (Optional[ResourceTypeFilterList], default: None ) –

    Specifies that you want the response to include information for only resources of the specified types. The format of each resource type is service[:resourceType]. For example, specifying a resource type of 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 Amazon Web Services General Reference for the following:

    For the list of services whose resources you can tag using the Resource Groups Tagging API, see Services that support the Resource Groups Tagging API. If an Amazon Web Services service isn't listed on that page, you might still be able to tag that service's resources by using that service's native tagging operations instead of using Resource Groups Tagging API operations. All tagged resources, whether the tagging used the Resource Groups Tagging API or not, are returned by the Get* operation.

    You can specify multiple resource types by using a comma separated array. The array can include up to 100 items. Note that the length constraint requirement applies to each resource type filter.

  • tag_key_filters (Optional[TagKeyFilterList], default: None ) –

    Specifies that you want the response to include information for only resources that have tags with the specified tag keys. If you use this parameter, the count of returned noncompliant resources includes only resources that have the specified tag keys.

  • group_by (Optional[GroupBy], default: None ) –

    Specifies a list of attributes to group the counts of noncompliant resources by. If supplied, the counts are sorted by those attributes.

  • max_results (Optional[MaxResultsGetComplianceSummary], default: None ) –

    Specifies the maximum number of results to be returned in each page. A query can return fewer than this maximum, even if there are more results still to return. You should always check the PaginationToken response value to see if there are more results. You can specify a minimum of 1 and a maximum value of 100.

  • pagination_token (Optional[PaginationToken], default: None ) –

    Specifies a PaginationToken response value from a previous request to indicate that you want the next page of results. Leave this parameter empty in your initial request.

Raises:

  • ConstraintViolationException –

    The request failed because performing the operation would violate a constraint.

    Some of the reasons in the following list might not apply to this specific operation.

    • You must meet the prerequisites for using tag policies. For information, see Prerequisites and permissions in the Tagging Amazon Web Services resources and Tag Editor user guide.

    • You must enable the tag policies service principal (tagpolicies.tag.amazonaws.com) to integrate with Organizations For information, see EnableAWSServiceAccess.

    • You must have a tag policy attached to the organization root, an OU, or an account.

  • InternalServiceException –

    The request processing failed because of an unknown error, exception, or failure. You can retry the request.

  • InvalidParameterException –

    The request failed because of one of the following reasons:

    • A required parameter is missing.

    • A provided string parameter is malformed.

    • An provided parameter value is out of range.

    • The target ID is invalid, unsupported, or doesn't exist.

    • You can't access the Amazon S3 bucket for report storage. For more information, see Amazon S3 bucket policy for report storage in the Tagging Amazon Web Services resources and Tag Editor user guide.

    • The partition specified in an ARN parameter in the request doesn't match the partition where you invoked the operation. The partition is specified by the second field of the ARN.

  • ThrottledException –

    The request failed because it exceeded the allowed frequency of submitted requests.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_resource_groups_tagging_api/_services/async_resource_groups_tagging_api.py
async def get_compliance_summary(
    self,
    *,
    config_overrides: Optional[AsyncResourceGroupsTaggingAPIClientConfig] = None,
    target_id_filters: Optional[
        "capo_resource_groups_tagging_api.types.target_id_filter_list.TargetIdFilterList"
    ] = None,
    region_filters: Optional[
        "capo_resource_groups_tagging_api.types.region_filter_list.RegionFilterList"
    ] = None,
    resource_type_filters: Optional[
        "capo_resource_groups_tagging_api.types.resource_type_filter_list.ResourceTypeFilterList"
    ] = None,
    tag_key_filters: Optional[
        "capo_resource_groups_tagging_api.types.tag_key_filter_list.TagKeyFilterList"
    ] = None,
    group_by: Optional[
        "capo_resource_groups_tagging_api.types.group_by.GroupBy"
    ] = None,
    max_results: Optional[
        "capo_resource_groups_tagging_api.types.max_results_get_compliance_summary.MaxResultsGetComplianceSummary"
    ] = None,
    pagination_token: Optional[
        "capo_resource_groups_tagging_api.types.pagination_token.PaginationToken"
    ] = None,
) -> "capo_resource_groups_tagging_api.types.get_compliance_summary_output.GetComplianceSummaryOutput":
    """<p>Returns a table that shows counts of resources that are noncompliant with their tag policies.</p> <p>For more information on tag policies, see <a href="https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_tag-policies.html">Tag Policies</a> in the <i>Organizations User Guide.</i> </p> <p>You can call this operation only from the organization's management account and from the us-east-1 Region.</p> <p>This operation supports pagination, where the response can be sent in multiple pages. You should check the <code>PaginationToken</code> response parameter to determine if there are additional results available to return. Repeat the query, passing the <code>PaginationToken</code> response parameter value as an input to the next request until you recieve a <code>null</code> value. A null value for <code>PaginationToken</code> indicates that there are no more results waiting to be returned.</p>

    Args:
        target_id_filters: <p>Specifies 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.</p>
        region_filters: <p>Specifies a list of Amazon Web Services Regions to limit the output to. If you use this parameter, the count of returned noncompliant resources includes only resources in the specified Regions.</p>
        resource_type_filters: <p>Specifies that you want the response to include information for only resources of the specified types. The format of each resource type is <code>service[:resourceType]</code>. For example, specifying a resource type of <code>ec2</code> returns all Amazon EC2 resources (which includes EC2 instances). Specifying a resource type of <code>ec2:instance</code> returns only EC2 instances.</p> <p>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 <i> <a href="https://docs.aws.amazon.com/general/latest/gr/">Amazon Web Services General Reference</a> </i> for the following:</p> <ul> <li> <p>For a list of service name strings, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#genref-aws-service-namespaces">Amazon Web Services Service Namespaces</a>.</p> </li> <li> <p>For resource type strings, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arns-syntax">Example ARNs</a>.</p> </li> <li> <p>For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces</a>.</p> </li> </ul> <note> <p>For the list of services whose resources you can tag using the Resource Groups Tagging API, see <a href="https://docs.aws.amazon.com/resourcegroupstagging/latest/APIReference/supported-services.html">Services that support the Resource Groups Tagging API</a>. If an Amazon Web Services service isn't listed on that page, you might still be able to tag that service's resources by using that service's native tagging operations instead of using Resource Groups Tagging API operations. All tagged resources, whether the tagging used the Resource Groups Tagging API or not, are returned by the <code>Get*</code> operation.</p> </note> <p>You can specify multiple resource types by using a comma separated array. The array can include up to 100 items. Note that the length constraint requirement applies to each resource type filter. </p>
        tag_key_filters: <p>Specifies that you want the response to include information for only resources that have tags with the specified tag keys. If you use this parameter, the count of returned noncompliant resources includes only resources that have the specified tag keys.</p>
        group_by: <p>Specifies a list of attributes to group the counts of noncompliant resources by. If supplied, the counts are sorted by those attributes.</p>
        max_results: <p>Specifies the maximum number of results to be returned in each page. A query can return fewer than this maximum, even if there are more results still to return. You should always check the <code>PaginationToken</code> response value to see if there are more results. You can specify a minimum of 1 and a maximum value of 100.</p>
        pagination_token: <p>Specifies a <code>PaginationToken</code> response value from a previous request to indicate that you want the next page of results. Leave this parameter empty in your initial request.</p>

    Raises:
        capo_resource_groups_tagging_api.errors.constraint_violation_exception.ConstraintViolationException: <p>The request failed because performing the operation would violate a constraint.</p> <p>Some of the reasons in the following list might not apply to this specific operation.</p> <ul> <li> <p>You must meet the prerequisites for using tag policies. For information, see <a href="https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-policies-orgs.html#tag-policies-prereqs">Prerequisites and permissions</a> in the <i>Tagging Amazon Web Services resources and Tag Editor</i> user guide. </p> </li> <li> <p>You must enable the tag policies service principal (<code>tagpolicies.tag.amazonaws.com</code>) to integrate with Organizations For information, see <a href="https://docs.aws.amazon.com/organizations/latest/APIReference/API_EnableAWSServiceAccess.html">EnableAWSServiceAccess</a>.</p> </li> <li> <p>You must have a tag policy attached to the organization root, an OU, or an account.</p> </li> </ul>
        capo_resource_groups_tagging_api.errors.internal_service_exception.InternalServiceException: <p>The request processing failed because of an unknown error, exception, or failure. You can retry the request.</p>
        capo_resource_groups_tagging_api.errors.invalid_parameter_exception.InvalidParameterException: <p>The request failed because of one of the following reasons:</p> <ul> <li> <p>A required parameter is missing.</p> </li> <li> <p>A provided string parameter is malformed.</p> </li> <li> <p>An provided parameter value is out of range.</p> </li> <li> <p>The target ID is invalid, unsupported, or doesn't exist.</p> </li> <li> <p>You can't access the Amazon S3 bucket for report storage. For more information, see <a href="https://docs.aws.amazon.com/tag-editor/latest/userguide/tag-policies-orgs.html#bucket-policy">Amazon S3 bucket policy for report storage</a> in the <i>Tagging Amazon Web Services resources and Tag Editor</i> user guide. </p> </li> <li> <p>The partition specified in an ARN parameter in the request doesn't match the partition where you invoked the operation. The partition is specified by the second field of the ARN.</p> </li> </ul>
        capo_resource_groups_tagging_api.errors.throttled_exception.ThrottledException: <p>The request failed because it exceeded the allowed frequency of submitted requests.</p>
        capo_resource_groups_tagging_api.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_resource_groups_tagging_api.types.get_compliance_summary_input.GetComplianceSummaryInput]",
    ) -> AsyncOperationResponse[
        "capo_resource_groups_tagging_api.types.get_compliance_summary_output.GetComplianceSummaryOutput"
    ]:
        import capo_resource_groups_tagging_api._operations.resource_groups_tagging_api_20170126.get_compliance_summary

        (
            output,
            http_response,
        ) = await capo_resource_groups_tagging_api._operations.resource_groups_tagging_api_20170126.get_compliance_summary.async_get_compliance_summary(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("GetComplianceSummary")
    )
    input_: capo_resource_groups_tagging_api.types.get_compliance_summary_input.GetComplianceSummaryInput = {}
    if target_id_filters is not None:
        input_["target_id_filters"] = target_id_filters
    if region_filters is not None:
        input_["region_filters"] = region_filters
    if resource_type_filters is not None:
        input_["resource_type_filters"] = resource_type_filters
    if tag_key_filters is not None:
        input_["tag_key_filters"] = tag_key_filters
    if group_by is not None:
        input_["group_by"] = group_by
    if max_results is not None:
        input_["max_results"] = max_results
    if pagination_token is not None:
        input_["pagination_token"] = pagination_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output