All Products
Search
Document Center

Resource Management:ListConfigRulesForTarget

Last Updated:Mar 03, 2024

Queries a list of tag detection tasks for an object.

Operation description

If you use the Tag Policy feature in single-account mode, you can use the current logon account to call this API operation to query the tag detection tasks for the account. If you use the Tag Policy feature in multi-account mode, you can use the management account of a resource directory to call this API operation to query the tag detection tasks for the Root folder, a folder other than the Root folder, or a member in the resource directory. For more information about the modes of the Tag Policy feature, see Modes of the Tag Policy feature.

This topic provides an example on how to call the API operation to query the tag detection tasks for the current logon account. In this example, the Tag Policy feature in single-account mode is used. The response shows that only one tag detection task exists.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The region ID. Set the value to cn-shanghai.

cn-shanghai
TargetIdstringNo

The ID of the object. This parameter specifies a filter condition for the query.

134254031178****
MaxResultintegerNo

The number of entries to return on each page.

Default value: 50. Maximum value: 1000.

50
NextTokenstringNo

The token that is used to start the next query.

caeba0bbb2be03f84eb48b699f0a****
TagKeystringNo

The tag key. This parameter specifies a filter condition for the query.

CostCenter
TargetTypestringNo

The type of the object. This parameter specifies a filter condition for the query. Valid values:

  • USER: the current logon account. This value is available if you use the Tag Policy feature in single-account mode.
  • ROOT: the Root folder in a resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
  • FOLDER: a folder other than the Root folder in a resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
  • ACCOUNT: a member in a resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
Note The value of this parameter is not case-sensitive.
ACCOUNT
PolicyTypestringNo

The use scenario of the tag policy. This parameter specifies a filter condition for the query. Valid values:

  • tags: enables tags with specified tag values to be added to resources.
  • rg_inherit: enables resources in a resource group to automatically inherit tags from the resource group.
tags
UserTypestringNo

The mode of the Tag Policy feature. This parameter specifies a filter condition for the query. Valid values:

  • USER: single-account mode
  • RD: multi-account mode

For more information about the modes of the Tag Policy feature, see Modes of the Tag Policy feature.

Note The value of this parameter is not case-sensitive.
USER

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

Dataobject []

The tag detection tasks.

TargetIdstring

The ID of the object.

134254031178****
TargetTypestring

The type of the object. Valid values:

  • USER: the current logon account. This value is available if you use the Tag Policy feature in single-account mode.
  • ROOT: the Root folder in the resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
  • FOLDER: a folder other than the Root folder in the resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
  • ACCOUNT: a member in the resource directory. This value is available if you use the Tag Policy feature in multi-account mode.
USER
ConfigRuleIdstring

The ID of the rule.

cr-0lb4866180880069****
AggregatorIdstring

The ID of the account group.

You can use the ID to query the content of the related resource non-compliance report in Cloud Config.

Note This parameter is returned only if you use the Tag Policy feature in multi-account mode.
ca-efdc33dc9b37002d****
TagKeystring

The tag key.

CostCenter
Remediationboolean

Indicates whether automatic remediation is enabled. Valid values:

  • true
  • false
false
PolicyTypestring

The use scenario of the tag policy. Valid values:

  • tags: enables tags with specified tag values to be added to resources.
  • rg_inherit: enables resources in a resource group to automatically inherit tags from the resource group.
tags
TagValuestring

The tag value for automatic remediation.

Project
RequestIdstring

The ID of the request.

7126AECD-D7AD-5073-8E88-DD2BD1FC139E
NextTokenstring

Indicates whether the next query is required.

  • If the value of this parameter is empty ("NextToken": ""), all results are returned, and the next query is not required.
  • If the value of this parameter is not empty, the next query is required, and the value is the token used to start the next query.
caeba0bbb2be03f84eb48b699f0a****

Examples

Sample success responses

JSONformat

{
  "Data": [
    {
      "TargetId": "134254031178****",
      "TargetType": "USER",
      "ConfigRuleId": "cr-0lb4866180880069****",
      "AggregatorId": "ca-efdc33dc9b37002d****",
      "TagKey": "CostCenter",
      "Remediation": false,
      "PolicyType": "tags",
      "TagValue": "Project"
    }
  ],
  "RequestId": "7126AECD-D7AD-5073-8E88-DD2BD1FC139E",
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-09-01The response structure of the API has changedsee changesets
Change itemChange content
Output ParametersThe response structure of the API has changed.