Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Querying the Policy List

Updated on 2022-06-01 GMT+08:00

Function

This API is used to query details about all policies of a specified project. [It is not supported in versions later than 1.8.0.] (tag:hcs)

URI

GET /v1/{project_id}/pe/policy

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

Request Parameters

Table 2 Request header 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:

  • application/json

resourcetype

Yes

String

Resource type. Value: nod or app.

Enumeration values:

  • node

  • app

Cluster-Id

Yes

String

Cluster ID.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Details.

policies

Array of AllPolicyContext objects

Details about a modified policy.

Table 4 AllPolicyContext

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.

Table 5 AllRule

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.

Table 6 AllConditions

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:

  • PAAS.CONTAINER

  • PAAS.CUSTOMMETRICS

metric_name

String

Metric name. This parameter is available when policy_type is set to ALARM.

Enumeration values:

  • ^[a-zA-Z_:][a-zA-Z0-9_:]{0

  • 254}$

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:

  • 20

  • 60

  • 300

  • 900

  • 1800

  • 3600

evaluation_periods

Integer

Number of consecutive periods. This parameter is available when policy_type is set to ALARM.

Enumeration values:

  • 1

  • 2

  • 3

  • 4

  • 5

statistic

String

Statistic. This parameter is available when policy_type is set to ALARM.

Enumeration values:

  • average

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.

Table 7 Action

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:

  • scale_out_k8s

  • scale_out_vm

  • scale_in_k8s

  • scale_in_vm

parameters

Array of Parameter objects

Number of scale-in or -out instances.

Table 8 Parameter

Parameter

Type

Description

scale_unit

Integer

Number of scale-in or -out instances. The value is between the minimum number of instances to the maximum number of instances in a policy group.

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

Forbidden: The 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.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback