Querying a Built-in Policy
Function
This API is used to query a built-in policy based on its ID.
URI
GET /v1/resource-manager/policy-definitions/{policy_definition_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| policy_definition_id | Yes | String | Specifies the policy ID. Maximum length: 36 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Language | No | String | Specifies the language of the information to return. Default value: zh-cn |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| id | String | Specifies the policy ID. |
| name | String | Specifies the policy name. |
| policy_type | String | Specifies the policy type. |
| description | String | Provides supplementary information about the policy. |
| policy_rule_type | String | Specifies the syntax type of the policy. |
| policy_rule | Object | Specifies how the policy is executed. |
| keywords | Array of strings | Specifies the list of key words. |
| parameters | Map<String,PolicyParameterDefinition> | Specifies the policy parameters. |
| Parameter | Type | Description |
|---|---|---|
| name | String | Specifies the policy parameter name. |
| description | String | Provides supplementary information about the policy parameter. |
| allowed_values | Array of objects | Specifies the allowed values of the policy parameter. |
| default_value | String | Specifies the default value of the policy parameter. |
| type | String | Specifies the type of the policy parameter. Possible values are as follows: |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Specifies the error code. |
| error_msg | String | Specifies the error message. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Specifies the error code. |
| error_msg | String | Specifies the error message. |
Status code: 404
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Specifies the error code. |
| error_msg | String | Specifies the error message. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Specifies the error code. |
| error_msg | String | Specifies the error message. |
Example Request
GET https://{endpoint}/v1/resource-manager/policy-definitions/5f8d5428ffeecc14f1fb5205 Example Response
Status code: 200
Built-in policy
-
"5f8d5428ffeecc14f1fb5205"
-
"ecs-instance-no-public-ip"
-
"builtin"
-
"An ECS is non-compliant if it has a public IP address."
-
"dsl"
-
{ "allOf" : [ { "value" : "${resource().provider}", "comparator" : "equals", "pattern" : "ecs" }, { "value" : "${resource().type}", "comparator" : "equals", "pattern" : "cloudservers" }, { "value" : "${length(filter(resource().properties.addresses, lambda x: equals(x.OsExtIpsType, 'floating')))}", "comparator" : "greater", "pattern" : 0 } ] } -
[ "ecs" ]
-
{ }
Status Codes
| Status Code | Description |
|---|---|
| 200 | Operation succeeded. |
| 400 | Invalid parameter. |
| 403 | Authentication failed or you do not have the operation permission. |
| 404 | Policy not found. |
| 500 | Internal server error. |
Error Codes
See Error Codes.
Last Article: Querying All Built-in Policies
Next Article: Adding an Assignment
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.