Updates an auto scaling policy for an application.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request headers

This operation uses only common request headers. For more information, see the topic about common request parameters.

Request syntax

PUT /pop/v1/eam/scale/application_scaling_rule HTTP/1.1

Request parameters

Parameter Type Position Required Example Description
AppId String Query No 78194c76-3dca-418e-a263-cccd1ab4****

The ID of the application. You can call the ListApplication operation to query the application ID.

ScalingRuleName String Query No cpu-trigger

The name of the auto scaling policy.

ScalingRuleType String Query No trigger

The type of the auto scaling policy. Set the value to trigger.

ScalingRuleEnable Boolean Query No true

Specifies whether to enable the auto scaling policy.

  • true: enables the auto scaling policy.
  • false: disables the auto scaling policy.
ScalingRuleMetric String Query No 1

This parameter is deprecated.

ScalingRuleTimer String Query No 1

This parameter is deprecated.

ScalingRuleTrigger String Query No ScalingRuleTriggerDTO{......}

The trigger policy for the auto scaling policy. Set the value in the JSON format by using the ScalingRuleTriggerDTO class. For more information, see Additional description of request parameters.

Additional description of request parameters


public class ScalingRuleTriggerDTO {
    /**
     * The maximum number of replicas. Maximum value: 1000. 
     */
    Integer maxReplicas;
    /**
     * The minimum number of replicas. Minimum value: 0. 
     */
    Integer minReplicas;

    /**
     * The list of triggers. Multiple triggers are supported. 
     */
    List<Trigger> triggers;

    @Data
    @ToString
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class Trigger {
        /**
         * The type of the trigger. Valid values: cron and app_metric. 
         */
        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 metadata of the trigger. Set the value to a JSON string that consists of key-value pairs. The metadata varies based on the trigger type. 
          1. cron
           {"period":"weekly","dryRun":"false","timerInDay":[{"atTime":"08:00","targetReplicas":2},{"atTime":"20:00","targetReplicas":1}],"timerInWeek":["Sat","Thu"]}
          * period: the scaling cycle. Valid values: daily, weekly, and monthly. 
          * dryRun: A value of false indicates observation and scaling. A value of true indicates observation only. 
          * timerInDay: the daily scaling cycle, which specifies the number of replicas to be maintained from a specific point in time. 
         * timerInWeek: the week in the CRON expression. Example: Fri. 

         2. app_metric
         {\"metricName\":\"arms_appstat.incall_QPS\",\"dryRun\":\"false\",\"targetValAvg\":\"true\",\"targetAverageValue\":\"100\"}
         
         * metricName: the name of the metric. Valid values:
              * arms_appstat.incall_QPS: the queries per second (QPS).
              * arms_appstat.incall_rt: the response time (RT).
              * arms_appstat.system_CPU: the CPU utilization.
              * arms_appstat.system_MEM: the memory usage.
         * dryRun: A value of false indicates observation and scaling. A value of true indicates observation only. 
        * targetValAvg: A value of true indicates that the target value is an average value. A value of false indicates that the target value is not an average value. Set this parameter to true only for the arms_appstat.incall_QPS metric. 
        * targetAverageValue or targetValue: The targetAverageValue parameter can be used only when the targetValAvg parameter is set to true. The targetValue parameter can be used only when the targetValAvg parameter is set to false. 
        */
        String metadata;
    }
}
            

Response parameters

Parameter Type Example Description
AppScalingRule Struct N/A

The information about the auto scaling policy.

AppId String 78194c76-3dca-418e-a263-cccd1ab4****

The ID of the application to which the auto scaling policy belongs.

CreateTime Long 23212323123

The timestamp when the auto scaling policy was created.

LastDisableTime Long 23212323123

The timestamp when the auto scaling policy was last disabled.

MaxReplicas Integer 1

This parameter is deprecated.

Metric Struct N/A

This parameter is deprecated.

MaxReplicas Integer 1

This parameter is deprecated.

Metrics Array of Metric N/A

This parameter is deprecated.

MetricTargetAverageUtilization Integer 1

This parameter is deprecated.

MetricType String cpu

This parameter is deprecated.

MinReplicas Integer 1

This parameter is deprecated.

MinReplicas Integer 1

This parameter is deprecated.

ScaleRuleEnabled Boolean true

Indicates whether the auto scaling policy is enabled.

  • true: The auto scaling policy is enabled.
  • false: The auto scaling policy is disabled.
ScaleRuleName String cpu-trigger

The name of the auto scaling policy.

ScaleRuleType String trigger

The type of the auto scaling policy. The value is fixed to trigger.

Trigger Struct N/A

The configurations of the trigger.

MaxReplicas Integer 122

The maximum number of replicas. Maximum value: 1000.

MinReplicas Integer 1

The minimum number of replicas. Minimum value: 0.

Triggers Array of Trigger N/A

The list of triggers.

MetaData String {"dryRun":true}

The metadata of the trigger.

Name String cpu

The name of the trigger.

Type String cron

The type of the trigger. Valid values: cron and app_metric.

UpdateTime Long 23212323123

The timestamp when the auto scaling policy was last updated.

Code Integer 200

The HTTP status code.

Message String success

The returned message.

RequestId String a5281053-08e4-47a5-b2ab-5c0323de7b5a

The ID of the request.

Examples

Sample requests

PUT /pop/v1/eam/scale/application_scaling_rule HTTP/1.1
Common request headers

Sample success responses

XML format

<Message>success</Message>
<RequestId>a5281053-08e4-47a5-b2ab-5c0323de7b5a</RequestId>
<AppScalingRule>
    <ScaleRuleEnabled>true</ScaleRuleEnabled>
    <LastDisableTime>23212323123</LastDisableTime>
    <AppId>78194c76-3dca-418e-a263-cccd1ab4****</AppId>
    <MinReplicas>1</MinReplicas>
    <MaxReplicas>1</MaxReplicas>
    <CreateTime>23212323123</CreateTime>
    <UpdateTime>23212323123</UpdateTime>
    <ScaleRuleName>cpu-trigger</ScaleRuleName>
    <ScaleRuleType>trigger</ScaleRuleType>
    <Metric>
        <MinReplicas>1</MinReplicas>
        <MaxReplicas>1</MaxReplicas>
        <Metrics>
            <MetricType>cpu</MetricType>
            <MetricTargetAverageUtilization>1</MetricTargetAverageUtilization>
        </Metrics>
    </Metric>
    <Trigger>
        <MinReplicas>1</MinReplicas>
        <MaxReplicas>122</MaxReplicas>
        <Triggers>
            <Type>cron</Type>
            <MetaData>{"dryRun":true}</MetaData>
            <Name>cpu</Name>
        </Triggers>
    </Trigger>
</AppScalingRule>
<Code>200</Code>

JSON format

{
    "Message": "success",
    "RequestId": "a5281053-08e4-47a5-b2ab-5c0323de7b5a",
    "AppScalingRule": {
        "ScaleRuleEnabled": true,
        "LastDisableTime": 23212323123,
        "AppId": "78194c76-3dca-418e-a263-cccd1ab4****",
        "MinReplicas": 1,
        "MaxReplicas": 1,
        "CreateTime": 23212323123,
        "UpdateTime": 23212323123,
        "ScaleRuleName": "cpu-trigger",
        "ScaleRuleType": "trigger",
        "Metric": {
            "MinReplicas": 1,
            "MaxReplicas": 1,
            "Metrics": {
                "MetricType": "cpu",
                "MetricTargetAverageUtilization": 1
            }
        },
        "Trigger": {
            "MinReplicas": 1,
            "MaxReplicas": 122,
            "Triggers": {
                "Type": "cron",
                "MetaData": "{\"dryRun\":true}",
                "Name": "cpu"
            }
        }
    },
    "Code": 200
}

Error codes

For a list of error codes, visit the API Error Center.