Assignments
Assignments are formed after you specify a compliance policy and the application scope of the compliance policy (for example, some resources in a region).
You can use a JSON expression to represent an assignment, as shown in Table 1.
| Parameter | Description | Limitations | Remarks |
|---|---|---|---|
| id | Specifies the ID that uniquely identifies an assignment. | N/A | N/A |
| name | Specifies the assignment name. | Its value must be a string with up to 128 characters. | By default, the assignment name is the same as the selected policy name. You can customize the assignment name. You can set a name of up to 128 characters. |
| description | Provides supplementary information about the assignment. | Its value must be a string with up to 512 characters. | By default, the assignment description is the same as the description of the selected policy. You can customize the assignment description. You can set the description of up to 512 characters. |
| policy_filter | Specifies the assignment filter, which is used to filter the resources that will be evaluated by this assignment. A filter has the following properties:
| policy_filter: Its value must be an object.
| NOTE: resource_provider is used to determine the filter type (Specific resources or All resources).
Therefore, no separate filter type property is set in policy_filter. |
| state | Specifies the assignment state. | N/A | Possible values are:
|
| created | Specifies the time when the assignment was created. | N/A | NOTE: The time is a UTC time in a fixed format that complies with ISO-8601 (for example, 2018-11-14T08:59:14Z). |
| updated | Specifies the time when the assignment was updated. | N/A | |
| policy_definition_id | Specifies the ID of the compliance policy bound to the assignment. | Its value must be a string with up to 64 characters. Only letters, digits, and hyphens (-) are allowed. | Each assignment must have a compliance policy bound. policy_definition_id specifies the ID of the compliance policy bound to the assignment. |
| parameters | Specifies the values of assignment parameters. | parameters: Its value must be an object.
| The compliance policy bound to the assignment has corresponding parameters. The number, type, and value range of those parameters depend on the selected compliance policy. |
The following JSON indicates an assignment used to check whether an ECS in region 1 has tag (env: production).
{
"id": "5fcd8696dfb78231e6f2f899",
"name": "required-tag-check",
"description": "A resource is non-compliant if it does not contain the specific tag.",
"policy_filter": {
"region_id": "regionid_1",
"resource_provider": "ecs",
"resource_type": "cloudservers",
"tag_key": "env",
"tag_value": "production"
},
"state": "Enabled",
"created": "2020-12-07T01:34:14.266Z",
"updated": "2020-12-07T01:34:14.266Z",
"policy_definition_id": "5fa9f89b6eed194ccb2c04db",
"parameters": {
"specifiedTagKey": {
"value": "a" },
"specifiedTagValue": {
"value": []
}
}
} Last Article: Compliance Policies
Next Article: Evaluation Results
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.