Viewing Auto Scaling Policy Events
Function
This API is used to view the events (change history) of auto scaling policies for deployed services. Before calling this API, ensure that you have obtained a valid user project ID, service ID, and deployment ID. After the API is called, the policy event ID, event status, rule execution information, number of instances before and after scaling, number of preset target instances, and execution record time are returned. If the provided service ID is invalid, the parameter settings are incorrect, or the system resources are insufficient, an error message is displayed, prompting you to check the validity of the input data or contact technical support.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, the following identity policy-based permissions are required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
modelarts:service:listHpaEvents
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{service_id}/deployments/{deployment_id}/hpa/events
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. For details, see Obtaining a Project ID and Name. Constraints N/A Range Project ID. Default Value N/A |
| service_id | Yes | String | Definition: Service ID, which can be obtained from the response body during service creation or by querying the service list. The service_id field indicates the service ID. Constraints N/A Range Service ID. Default Value N/A |
| deployment_id | Yes | String | Definition Deployment ID, which you can obtain from the response body when adding the deployment or by obtaining service deployments. The deployment_id field indicates the deployment ID. Constraints N/A Range Deployment ID. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| limit | No | Integer | Definition Maximum number of records displayed on each page. Constraints N/A Range [1,500] Default Value 10. |
| offset | No | Integer | Definition Start page for pagination display. The value starts from 0. Constraints N/A Range N/A Default Value 0. |
| sort_key | No | String | Definition Sorting field. Separate multiple fields with commas (,). The value can be create_at or update_at. The default value is update_at. Constraints N/A Range Default Value update_at |
| sort_dir | No | String | Definition Sort order. Constraints N/A Range Default Value DESC |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. It can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token. For details about how to obtain the token, see Obtaining a User Token Through Password Authentication. Constraints N/A Range N/A Default Value N/A |
| Content-Type | Yes | String | Definition Message body type or format. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| current | Integer | Definition Current page number. Range N/A |
| pages | Integer | Definition Total number of pages. Range N/A |
| size | Integer | Definition Number of records on each page. Range N/A |
| total | Integer | Definition The total number of records. Range N/A |
| data | Array of HpaEventResponse objects | Definition Service event list. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Auto scaling policy event ID. Range Event ID |
| hpa_id | String | Definition Auto scaling policy ID. Range Policy ID |
| status | String | Definition Auto scaling event status. Range |
| message | String | Definition Auto scaling rule execution information. Range N/A |
| current_replicas | Integer | Definition Number of instances before scaling. Range N/A |
| target_replicas | Integer | Definition Target instances. Range N/A |
| final_replicas | Integer | Definition Number of instances after scaling. Range N/A |
| record_time | String | Definition Execution record time. Range 2025-05-20 10:05:55 |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A. |
| error_msg | String | Definition: Error message. Range: N/A. |
Status code: 404
Example Requests
None
Example Responses
Status code: 200
View auto scaling policy events.
{
"current" : 0,
"data" : [ {
"id" : "58865106-c6c6-427a-9e0b-1c9e3f5bac4f",
"hpa_id" : "1d7812a3-0032-4f7a-bf31-87849ed41577",
"status" : "SUCCESS",
"message" : "scale target replicas success, current replicas:1, target replicas:2, final replicas:2",
"current_replicas" : 1,
"target_replicas" : 2,
"final_replicas" : 2,
"record_time" : "2025-05-20 01:11:14"
}, {
"id" : "85b6562d-df8b-4fec-a646-a6c8fe348185",
"hpa_id" : "8e767bd5-ca5d-4e2f-af33-f944f15f1602",
"status" : "SUCCESS",
"message" : "skip scale target replicas, current replicas:2, target replicas:2, final replicas:2",
"current_replicas" : 2,
"target_replicas" : 2,
"final_replicas" : 2,
"record_time" : "2025-05-19 01:11:14"
} ],
"pages" : 1,
"size" : 10,
"total" : 2
} Status Codes
| Status Code | Description |
|---|---|
| 200 | View auto scaling policy events. |
| 400 | Invalid request parameter. |
| 404 | Resource not found. |
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