Modifying an AS Policy
Function
This API is used to modify a specified AS policy.
Authorization
Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.
- If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
- If you are using identity policy-based authorization, the permission listed below is required.
Action
Access Level
Resource Type (*: required)
Condition Key
Alias
Dependencies
as:scalingPolicy:update
write
-
as:policies:update
-
URI
PUT /autoscaling-api/v1/{project_id}/scaling_policy/{scaling_policy_id}
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Specifies the project ID. For details, see Obtaining a Project ID. Constraints N/A Range N/A Default Value N/A |
| scaling_policy_id | Yes | String | Definition Specifies an AS policy ID. For details, see Querying AS Policies Bound to an AS Group. Constraints N/A Range N/A Default Value N/A |
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| scaling_policy_name | No | String | Definition Specifies the AS policy name. Constraints N/A Range The value can contain 1 to 64 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. Default Value N/A |
| scaling_policy_type | No | String | Definition Specifies the AS policy type. Constraints N/A Range
Default Value N/A |
| alarm_id | No | String | Definition Specifies the alarm rule ID. After you modify an alarm policy, the system automatically adds an alarm triggering activity of the autoscaling type to the alarm_actions field in the alarm rule specified by the parameter value. You can obtain the parameter value by querying Cloud Eye alarm rules. For details, see Querying the Alarm Rule List in Cloud Eye API Reference. Constraints This parameter is mandatory when scaling_policy_type is set to ALARM. After this parameter is specified, the value of scheduled_policy does not take effect. Range N/A Default Value N/A |
| scheduled_policy | No | scheduled_policy object | Definition Specifies the periodic or scheduled AS policy. For details, see Table 3. Constraints This parameter is mandatory when scaling_policy_type is set to SCHEDULED or RECURRENCE. After this parameter is specified, the value of alarm_id does not take effect. |
| scaling_policy_action | No | scaling_policy_action object | Definition Specifies the scaling action of the AS policy. For details, see Table 4. Constraints N/A |
| cool_down_time | No | Integer | Definition Specifies the cooldown period, in seconds. Constraints During the cooldown period, AS denies all scaling requests triggered by alarm-based policies. Scaling requests triggered manually or by scheduled or periodic policies are not affected. Range 0s to 86,400s Default Value 300 |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| launch_time | Yes | String | Definition Specifies the time when the scaling action is triggered. The time format complies with UTC. Constraints
Range N/A Default Value N/A |
| recurrence_type | No | String | Definition Specifies the type of a periodically triggered scaling action. Constraints This parameter is mandatory when scaling_policy_type is set to RECURRENCE. Range
Default Value N/A |
| recurrence_value | No | String | Definition Specifies the day when a periodic scaling action is triggered. Constraints This parameter is mandatory when scaling_policy_type is set to RECURRENCE. Range
Default Value N/A |
| start_time | No | String | Definition Specifies the start time of the scaling action triggered periodically. The time format complies with UTC. The time format is YYYY-MM-DDThh:mmZ. Constraints N/A Range N/A Default Value The default value is the current time. |
| end_time | No | String | Definition Specifies the end time of the scaling action triggered periodically. The time format complies with UTC. The time format is YYYY-MM-DDThh:mmZ. Constraints
Range N/A Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| operation | No | String | Definition Specifies the operation to be performed. Constraints N/A Range
Default Value ADD |
| instance_number | No | Integer | Definition Specifies the number of instances to be operated. Constraints Either instance_number or instance_percentage is required. Range
Default Value 1 |
| instance_percentage | No | Integer | Definition Specifies the percentage of instances to be operated. You can increase, decrease, or set the number of instances in an AS group to the specified percentage of the current number of instances. Either instance_number or instance_percentage is required. Constraints
Range
Default Value N/A |
Example Request
This example modifies the periodic AS policy with ID 0h327883-324n-4dzd-9c61-68d03ee191dd for an AS group with two instances. The modification is as follows: The AS policy name is changed to policy_01, and the policy is executed at 16:00 every day from 2016-01-08T17:31Z to 2016-02-08T17:31Z.
PUT https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_policy/0h327883-324n-4dzd-9c61-68d03ee191dd
{
"scaling_policy_type": "RECURRENCE",
"scaling_policy_name": "policy_01",
"scheduled_policy": {
"launch_time": "16:00",
"recurrence_type": "Daily",
"end_time": "2016-02-08T17:31Z",
"start_time": "2016-01-08T17:31Z"
},
"scaling_policy_action": {
"operation": "SET",
"instance_number": 2
}
} Response
| Parameter | Type | Description |
|---|---|---|
| scaling_policy_id | String | Definition Specifies the AS policy ID. Range N/A |
Example Response
{
"scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"
} Returned Values
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
The server failed to process the request.
401 Unauthorized
You must enter the username and password to access the requested page.
403 Forbidden
You are forbidden to access the requested page.
404 Not Found
The server could not find the requested page.
405 Method Not Allowed
You are not allowed to use the method specified in the request.
406 Not Acceptable
The response generated by the server could not be accepted by the client.
407 Proxy Authentication Required
You must use the proxy server for authentication to process the request.
408 Request Timeout
The request timed out.
409 Conflict
The request could not be processed due to a conflict.
500 Internal Server Error
Failed to complete the request because of an internal service error.
501 Not Implemented
Failed to complete the request because the server does not support the requested function.
502 Bad Gateway
Failed to complete the request because the request is invalid.
503 Service Unavailable
Failed to complete the request because the system is unavailable.
504 Gateway Timeout
A gateway timeout error occurred.
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank 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