tencent cloud

Feedback

Policy Syntax

Last updated: 2023-07-20 15:51:10
    A policy is composed of several sub-statements. Each sub-statement contains the following elements: policy_key, tag_key, tag_value, effective scope, etc.

    Syntax Format

    The policy syntax is based on the JSON format. If a created or updated policy does not meet the JSON format requirement, it cannot be successfully submitted and cannot take effect. Therefore, you must ensure that the JSON format is correct.

    Syntax Conventions

    The following is the general syntax of tag policies:
    {
    "tags": {
    "principal": {
    "tag_key": {"@@assign": "principal"},
    "tag_value": {"@@assign": ["name 1"]},
    "resource_type_scope":{"@@assign": ["ecs:instance","ecs:disk"]},
    "correction": {"@@assign": "on"}
    }
    }
    }
    Elements
    Element
    Required
    Description
    Description in above example
    tags
    Yes
    A tag policy always starts with tags. tags is always on the first line of a tag policy and is fixed.
    tags, which is fixed
    policy_key
    Yes
    Tag key, which identifies a compliant tag key and takes the same value as the policy key. Tag keys are case sensitive. You can define multiple tag keys in a tag policy.
    principal is the tag key.
    tag_key
    Yes
    Tag key, which identifies a compliant tag key and takes the same value as the policy key (case-sensitive). You can define multiple tag keys in a tag policy.
    principal
    tag_value
    Yes
    Tag value, which identifies a compliant tag value.
    Tag value is set to name1 and use principal as a valid value
    resource_type_scope
    Yes
    The effective scope of resource types, which is specified by the tag key-value pair.
    Effective scope is limited to ecs:instance,ecs:disk
    correction
    No
    Indicates whether the tag key value needs to be automatically corrected.
    on indicates that the correction feature is enabled for the resources within the effective scope of resource types.

    Syntax Effective Rules

    Object

    You can bind a tag policy to multiple user entities (such as the root account and sub-users under the root account), but it will only be valid for the bound user.
    When you bind a tag policy to the root account, it will only affect that root account.
    When you bind a tag policy to a sub-user, it will only affect that sub-user.

    Latency

    When operating on resource tags, the effective object will check whether the resources are bound to the corresponding key-value pair in real time according to the tag policy. The latency in this process will be within 10 seconds.

    Priority

    You can bind multiple tag policies to a single user entity, but the earliest bound policy will take effect.

    Operators

    You can use operators to control the calculation rules in the tag policy. Only the assignment operator are currently supported.
    Operator
    Required
    Description
    Description in above example
    @@assign
    Yes
    This operator is used to assign the specified content to the specified element.
    Assign principal to the policy key and tag key
    Assign name 1 to the tag value
    Assign ecs:instance,ecs:disk to the effective scope of resource types
    Assign on to whether the correction feature is enabled
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support