Calls the UpdateApplicationScalingRule operation to update the Auto Scaling rule for an application.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
edas:ManageApplication |
update |
*Application
|
None | None |
Request syntax
PUT /pop/v1/eam/scale/application_scaling_rule HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| AppId |
string |
No |
The ID of the application. Call the ListApplication operation to obtain this ID. |
78194c76-3dca-418e-a263-cccd1ab4**** |
| ScalingRuleName |
string |
No |
The name of the Auto Scaling policy. |
cpu-trigger |
| ScalingRuleType |
string |
No |
The type of the Auto Scaling policy. Only the following type is supported:
|
trigger |
| ScalingRuleEnable |
boolean |
No |
The status of the Auto Scaling policy.
|
true |
| ScalingRuleMetric |
string |
No |
This parameter is deprecated. |
1 |
| ScalingRuleTimer |
string |
No |
This parameter is deprecated. |
1 |
| ScalingRuleTrigger |
string |
No |
The trigger policy, which is a JSON string of a ScalingRuleTriggerDTO object. For more information about the format, see the Additional information about request parameters section. |
ScalingRuleTriggerDTO{......} |
| ScalingBehaviour |
string |
No |
The configuration of custom scaling behaviors. For more information about the data structure, see the example. |
{"scaleUp":{"stabilizationWindowSeconds":"0","selectPolicy":"Max","policies":[{"type":"Pods","value":5,"periodSeconds":15}]},"scaleDown":{"stabilizationWindowSeconds":"300","selectPolicy":"Max","policies":[{"type":"Percent","value":200,"periodSeconds":15}]}} |
Additional information about request parameters
public class ScalingRuleTriggerDTO {
/**
* The maximum number of instances. The value cannot exceed 1,000.
*/
Integer maxReplicas;
/**
* The minimum number of instances. The value cannot be less than 0.
*/
Integer minReplicas;
/**
* The list of triggers. Multiple triggers are supported.
*/
List<Trigger> triggers;
@Data
@ToString
@Builder
@AllArgsConstructor
@NoArgsConstructor
public static class Trigger {
/**
* The trigger type. Valid values: cron (scheduled) and app_metric (application monitoring).
*/
String type;
/**
* The name of the trigger. The name must start with a letter and can contain digits, letters, hyphens (-), and underscores (_). The name can be up to 30 characters in length.
*/
String name;
/**
The trigger metadata. This is a JSON map of the string-to-string type. The supported metadata varies by trigger type.
1. cron
{"period":"weekly","dryRun":"false","timerInDay":[{"atTime":"08:00","targetReplicas":2},{"atTime":"20:00","targetReplicas":1}],"timerInWeek":["Sat","Thu"]}
* period: The period. Valid values: daily, weekly, and monthly.
* dryRun: If set to false, the system monitors and performs scaling. If set to true, the system only monitors metrics.
* timerInDay: The daily scaling cycle. Specifies when to maintain a specific number of replicas.
* timerInWeek: The day of the week in a cron expression. For example, Fri.
2. app_metric
{\"metricName\":\"arms_appstat.incall_QPS\",\"dryRun\":\"false\",\"targetValAvg\":\"true\",\"targetAverageValue\":\"100\"}
* metricName:
* arms_appstat.incall_QPS (queries per second (QPS))
* arms_appstat.incall_rt (response time)
* arms_appstat.system_CPU (CPU usage)
* arms_appstat.system_MEM (memory usage)
* dryRun: Same as the dryRun parameter for the cron trigger type.
* targetValAvg: Specifies whether to calculate the average value. Set to true for QPS and false for other metrics.
* targetAverageValue/targetValue: If targetValAvg is set to true, use targetAverageValue. If targetValAvg is set to false, use targetValue.
*/
String metadata;
}
}
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| Code |
integer |
The HTTP status code. |
200 |
| Message |
string |
The returned message. |
success |
| RequestId |
string |
The request ID. |
a5281053-08e4-47a5-b2ab-5c0323de7b5a |
| AppScalingRule |
object |
The Auto Scaling policy. |
|
| UpdateTime |
integer |
The UNIX timestamp when the Auto Scaling policy was updated. Unit: milliseconds. |
1574251601785 |
| CreateTime |
integer |
The UNIX timestamp when the Auto Scaling policy was created. Unit: milliseconds. |
1574251601785 |
| AppId |
string |
The ID of the application to which the Auto Scaling policy belongs. |
78194c76-3dca-418e-a263-cccd1ab4**** |
| LastDisableTime |
integer |
The UNIX timestamp when the Auto Scaling policy was last disabled. Unit: milliseconds. |
1574251601785 |
| MaxReplicas |
integer |
This parameter is deprecated. |
1 |
| ScaleRuleEnabled |
boolean |
The status of the Auto Scaling policy.
|
true |
| ScaleRuleType |
string |
The type of the Auto Scaling policy. Only the trigger type is supported. |
trigger |
| MinReplicas |
integer |
This parameter is deprecated. |
1 |
| ScaleRuleName |
string |
The name of the Auto Scaling policy. |
cpu-trigger |
| Metric |
object |
This parameter is deprecated. |
|
| MinReplicas |
integer |
This parameter is deprecated. |
1 |
| MaxReplicas |
integer |
This parameter is deprecated. |
1 |
| Metrics |
array<object> |
This parameter is deprecated. |
|
|
object |
|||
| MetricTargetAverageUtilization |
integer |
This parameter is deprecated. |
1 |
| MetricType |
string |
This parameter is deprecated. |
cpu |
| Trigger |
object |
The trigger configuration. |
|
| MinReplicas |
integer |
The minimum number of replicas. The value cannot be less than 0. |
1 |
| MaxReplicas |
integer |
The maximum number of replicas. The value cannot exceed 1,000. |
122 |
| Triggers |
array<object> |
The list of trigger configurations. |
|
|
object |
|||
| Type |
string |
The trigger type. Only cron and app_metric are supported. |
cron |
| MetaData |
string |
The metadata of the trigger. |
{"dryRun":true} |
| Name |
string |
The name of the trigger. |
cpu |
| Behaviour |
object |
The scaling behavior configuration. |
|
| ScaleUp |
object |
The scale-out behavior configuration. |
|
| StabilizationWindowSeconds |
integer |
The cooldown time for scale-outs. Valid values: 0 to 3,600. Unit: seconds. Default value: 0. |
0 |
| SelectPolicy |
string |
The policy for the scale-out step size. Valid values: Max, Min, and Disable. |
Max |
| Policies |
array<object> |
The policy configurations. |
|
|
object |
|||
| PeriodSeconds |
integer |
The check period. Valid values: 0 to 1,800. Unit: seconds. |
15 |
| Type |
string |
The policy type. Valid values: Pods and Percent. |
Pods |
| Value |
string |
The value of the policy for the scaling behavior. The value must be an integer greater than 0. If the policy type is Pods, the value indicates the number of pods. If the policy type is Percent, the value indicates a percentage, which can exceed 100%. |
10 |
| ScaleDown |
object |
The scale-in behavior configuration. |
|
| StabilizationWindowSeconds |
integer |
The cooldown time for scale-ins. Valid values: 0 to 3,600. Unit: seconds. Default value: 300. |
300 |
| SelectPolicy |
string |
The policy for the scale-in step size. Valid values: Max, Min, and Disable. |
Max |
| Policies |
array<object> |
The policy configurations. |
|
|
object |
|||
| PeriodSeconds |
integer |
The check period. Valid values: 0 to 1,800. Unit: seconds. |
15 |
| Type |
string |
The policy type. Valid values: Pods and Percent. |
Pods |
| Value |
string |
The value of the policy for the scaling behavior. The value must be an integer greater than 0. If the policy type is Pods, the value indicates the number of pods. If the policy type is Percent, the value indicates a percentage, which can exceed 100%. |
10 |
Examples
Success response
JSON format
{
"Code": 200,
"Message": "success",
"RequestId": "a5281053-08e4-47a5-b2ab-5c0323de7b5a",
"AppScalingRule": {
"UpdateTime": 1574251601785,
"CreateTime": 1574251601785,
"AppId": "78194c76-3dca-418e-a263-cccd1ab4****",
"LastDisableTime": 1574251601785,
"MaxReplicas": 1,
"ScaleRuleEnabled": true,
"ScaleRuleType": "trigger",
"MinReplicas": 1,
"ScaleRuleName": "cpu-trigger",
"Metric": {
"MinReplicas": 1,
"MaxReplicas": 1,
"Metrics": [
{
"MetricTargetAverageUtilization": 1,
"MetricType": "cpu"
}
]
},
"Trigger": {
"MinReplicas": 1,
"MaxReplicas": 122,
"Triggers": [
{
"Type": "cron",
"MetaData": "{\"dryRun\":true}",
"Name": "cpu"
}
]
},
"Behaviour": {
"ScaleUp": {
"StabilizationWindowSeconds": 0,
"SelectPolicy": "Max",
"Policies": [
{
"PeriodSeconds": 15,
"Type": "Pods",
"Value": "10"
}
]
},
"ScaleDown": {
"StabilizationWindowSeconds": 300,
"SelectPolicy": "Max",
"Policies": [
{
"PeriodSeconds": 15,
"Type": "Pods",
"Value": "10"
}
]
}
}
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.