Querying Specific Built-in Policy
Function
This API is used to query a built-in policy by ID.
Calling Method
For details, see Calling APIs.
URI
GET /v1/resource-manager/policy-definitions/{policy_definition_id}
Parameter | Mandatory | Type | Description |
|---|---|---|---|
policy_definition_id | Yes | String | Specifies the policy ID. Maximum: 36 |
Request Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
X-Auth-Token | No | String | Specifies the invoker's token. |
X-Language | No | String | Specifies the language of the information to return. The default name is zh-cn, which can be zh-cn and en-us. Default: zh-cn |
X-Security-Token | No | String | Specifies a temporary security credential. This parameter is mandatory when you make an API call using a temporary security credential. |
Response Parameters
Status code: 200
Parameter | Type | Description |
|---|---|---|
id | String | Specifies the policy ID. |
name | String | Specifies the policy name. |
display_name | String | Specifies the policy display name. |
policy_type | String | Specifies the policy type. |
description | String | Specifies the description of the policy definition. |
policy_rule_type | String | Specifies the syntax type of the policy. |
policy_rule | Object | Specifies the policy rule. |
trigger_type | String | Specifies the trigger type. |
keywords | Array of strings | Specifies keywords. |
default_resource_types | Array of default_resource_types objects | Specifies the list of default resource types. |
parameters | Map<String,PolicyParameterDefinition> | Specifies the policy parameter. |
Parameter | Type | Description |
|---|---|---|
provider | String | Specifies the cloud service name. |
type | String | Specifies the resource type. |
Parameter | Type | Description |
|---|---|---|
name | String | Specifies the name of the policy parameter. |
description | String | Specifies the description of 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. |
minimum | Float | Specifies the minimum value of the policy parameter. This parameter is valid for Interger or Float parameters. |
maximum | Float | Specifies the maximum value of the policy parameter. This parameter is valid for Interger or Float parameters. |
min_items | Integer | Specifies the minimum number of the policy parameter. This parameter is valid for Array parameters. |
max_items | Integer | Specifies the maximum number of the policy parameter. This parameter is valid for Array parameters. |
min_length | Integer | Specifies the minimum string length for policy parameters or for each item. This parameter is valid for String or Array parameters. |
max_length | Integer | Specifies the maximum string length for policy parameters or for each item. This parameter is valid for String or Array parameters. |
pattern | String | Specifies the pattern for policy parameters or for each item. This parameter is valid for String or Array parameters. |
type | String | Specifies the type of the policy parameter. |
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 Requests
GET https://{endpoint}/v1/resource-manager/policy-definitions/5f8d5428ffeecc14f1fb5205 Example Responses
Status code: 200
Operation succeeded.
{
"id" : "5f8d5428ffeecc14f1fb5205",
"name" : "ecs-instance-no-public-ip",
"display_name" : "Enable encryption for the attached EVS volumes.",
"policy_type" : "builtin",
"description" : "An ECS is non-compliant if it has an EIP.",
"policy_rule_type" : "dsl",
"policy_rule" : {
"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
} ]
},
"keywords" : [ "ecs" ],
"parameters" : { }
} Status Codes
Status Code | Description |
|---|---|
200 | Operation succeeded. |
400 | Invalid parameters. |
403 | Authentication failed or you do not have the operation permissions. |
404 | Policy not found. |
500 | Server error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

