Viewing an Auto Scaling Policy
Function
This API is used to view auto scaling policies for a deployed service. Before calling this API, ensure that the service has been deployed and a valid service ID has been obtained. After the query is successful, the policy information corresponding to the service is returned, such as the rule ID, rule name, scaling type, scaling status, scaling cron expression, and number of target instances. 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:getHpa
Read
service *
-
-
-
URI
GET /v2/{project_id}/services/{service_id}/deployments/{deployment_id}/hpa
| 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 |
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 |
|---|---|---|
| id | String | Definition Auto scaling policy ID. Range N/A |
| name | String | Definition Name of an auto scaling policy. Range N/A |
| target_resource_id | String | Definition ID of the target to which the auto scaling policy is bound. Range Instance group ID. |
| target_resource_type | String | Definition Type of the target to which the auto scaling policy is bound. Range |
| min_replicas | Integer | Definition Minimum number of instances for auto scaling. Range 1-128 |
| max_replicas | Integer | Definition Maximum number of instances for auto scaling. Range 1-128 |
| status | String | Definition Status of the auto scaling policy. Range |
| workspace_id | String | Definition Workspace ID. Range
|
| hpa_rules | Array of HpaRule objects | Definition Auto scaling rules. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Auto scaling rule ID. Range N/A |
| hpa_id | String | Definition ID of the policy associated with the auto scaling rule. Range N/A |
| name | String | Definition Auto scaling rule name. Range The value can contain 4 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. |
| type | String | Definition Auto scaling type. Range |
| schedule | String | Definition Cron expression for executing scheduled auto scaling. The value starts at a minute level and does not support seconds. Range N/A |
| target_replicas | Integer | Definition Number of target instances for auto scaling. Range 1 to 128 |
| disable | String | Definition Specifies whether to enable the auto scaling rule. Range |
| status | String | Definition Status of the auto scaling rule. Range |
Status code: 404
Example Requests
None
Example Responses
Status code: 200
View auto scaling policies.
{
"id" : "85b6562d-df8b-4fec-a646-a6c8fe348185",
"name" : "hpa_test",
"target_resource_id" : null,
"target_resource_type" : null,
"status" : "ACTIVE",
"min_replicas" : 1,
"max_replicas" : 10,
"hpa_rules" : [ {
"name" : "rule_test",
"type" : "CRON_HPA",
"status" : "CREATING",
"schedule" : "string",
"target_replicas" : 2,
"disable" : false
}, {
"name" : "rule_test1",
"type" : "CRON_HPA",
"status" : "CONFIG_SUCCESS",
"schedule" : "string",
"target_replicas" : 2,
"disable" : false
} ],
"workspace_id" : 0
} Status Codes
| Status Code | Description |
|---|---|
| 200 | View auto scaling policies. |
| 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