Querying the Policy List
Function
This API is used to query details about all policies in a specified project.
URI
GET /v1/{project_id}/pe/policy
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
User token obtained from IAM. |
Content-Type |
Yes |
String |
Content type, which is application/json. Enumeration values:
|
resourcetype |
Yes |
String |
Resource type. Value: nod or app. Enumeration values:
|
Cluster-Id |
Yes |
String |
Cluster ID. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Error code. |
errorMessage |
String |
Details. |
policies |
Array of AllPolicyContext objects |
Details about a modified policy. |
Parameter |
Type |
Description |
---|---|---|
id |
String |
Policy ID. |
group_id |
String |
Policy group ID. |
name |
String |
Policy name. |
policy_type |
String |
Policy type. |
rule |
AllRule object |
Policy trigger rule. |
create_time |
String |
Creation time. |
update_time |
String |
Update time. |
status |
String |
Status. |
Parameter |
Type |
Description |
---|---|---|
conditions |
Array of AllConditions objects |
Condition contents. When an alarm policy is used, its conditions cannot conflict. Example: You cannot set a metric greater than 10% in one condition and smaller than 20% in another condition. |
actions |
Array of Action objects |
Action executed after a specified policy is matched. |
name |
String |
Policy name. |
Parameter |
Type |
Description |
---|---|---|
launch_time |
String |
Time when the policy is triggered. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
recurrence_type |
String |
Period type. This parameter is left blank for scheduled policies. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
recurrence_value |
String |
Specific trigger time of a periodic policy. This parameter is left blank for scheduled policies. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
start_time |
Integer |
Start time of the periodic policy. This parameter is left blank for the scheduled policy. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
end_time |
Integer |
End time of the periodic policy. This parameter is left blank for the scheduled policy. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
time_zone |
String |
Time zone. This parameter is available when policy_type is set to SCHEDULED or RECURRENCE. |
metric_namespace |
String |
Metric namespace. This parameter is available when policy_type is set to ALARM. Enumeration values:
|
metric_name |
String |
Metric name. This parameter is available when policy_type is set to ALARM. Enumeration values:
|
metric_unit |
String |
Unit. Note: The value is retrieved from an AMS API and varies with the metric name. This parameter is available when policy_type is set to ALARM. |
period |
Integer |
Statistical period (unit: s). This parameter is available when policy_type is set to ALARM. Enumeration values:
|
evaluation_periods |
Integer |
Number of consecutive periods. This parameter is available when policy_type is set to ALARM. Enumeration values:
|
statistic |
String |
Statistic. This parameter is available when policy_type is set to ALARM. Enumeration values:
|
metric_operation |
String |
Metric operator. Option: > or <. For example, you can use > in a threshold criterion (when the value of a metric is greater than metric_thresholdUpdate) to trigger actions. This parameter is available when policy_type is set to ALARM. Enumeration values:
|
metric_threshold |
Integer |
Threshold condition. This parameter is available when policy_type is set to ALARM. |
Parameter |
Type |
Description |
---|---|---|
type |
String |
scale_out_k8s and scale_out_vm indicate a scale-out. scale_in_k8s and scale_in_vm indicate a scale-in. Note: The value containing k8s indicates a scale-in or -out for containerized applications and that containing vm indicates a scale-in or -out for process applications. Enumeration values:
|
parameters |
Array of Parameter objects |
Number of scale-in or -out instances. |
Example Requests
None
Example Responses
Status code: 200
OK
The request is successful.
{ "errorCode" : "SVCSTG.PE.0", "errorMessage" : "", "policies" : [ { "id" : "8accffb6-e0ed-4433-b216-ccf6960eb1ad", "name" : "alarm", "group_id" : "77c37e1f-aa0c-438d-8445-39b3997786a2", "policy_type" : "ALARM", "rule" : { "name" : "", "conditions" : [ { "metric_namespace" : "PAAS.CONTAINER", "metric_name" : "cpuCoreLimit", "metric_unit" : "Percent", "period" : 60, "evaluation_periods" : 1, "statistic" : "average", "metric_operation" : ">", "metric_threshold" : 100, "metric_dimensions" : null } ], "actions" : [ { "type" : "scale_out_k8s", "parameters" : { "scale_unit" : 1 } } ] }, "create_time" : "2017-12-21T09:13:42Z", "update_time" : "2017-12-21T09:13:42Z", "status" : "enabled" }, { "id" : "9aafbd3d-eac4-4a92-a342-5b6f8d60fff2", "name" : "dingshi2", "group_id" : "77c37e1f-aa0c-438d-8445-39b3997786a2", "policy_type" : "SCHEDULED", "rule" : { "name" : "", "conditions" : [ { "launch_time" : "2017-12-22T06:30Z", "recurrence_type" : "", "recurrence_value" : "", "start_time" : "", "end_time" : "" } ], "actions" : [ { "type" : "scale_set_k8s", "parameters" : { "scale_unit" : 1 } } ] }, "create_time" : "2017-12-21T09:14:00Z", "update_time" : "2017-12-21T09:14:00Z", "status" : "enabled" } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK The request is successful. |
400 |
Bad Request Invalid request. The client should not repeat the request without modifications. |
401 |
Unauthorized The authorization information is incorrect or invalid. |
403 |
ForbiddenThe request is rejected. The server has received the request and understood it, but the server refuses to respond to it. The client should not repeat the request without modifications. |
500 |
Internal Server Error The server is able to receive the request but unable to understand the request. |
503 |
Service Unavailable The requested service is invalid. The client should not repeat the request without modifications. |
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot