doc-exports/docs/as/api-ref/as_06_0401.html
guoyanyan 31704f0318 as_api_0325
Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2023-04-13 08:59:32 +00:00

362 lines
33 KiB
HTML

<a name="as_06_0401"></a><a name="as_06_0401"></a>
<h1 class="topictitle1">Creating an AS Policy</h1>
<div id="body55167604"><div class="section" id="as_06_0401__section46628683"><h4 class="sectiontitle">Function</h4><p id="as_06_0401__p39390935">This API is used to create an AS policy.</p>
<ul id="as_06_0401__ul1246414913236"><li id="as_06_0401__li1546439202319">An AS policy defines whether to increase or decrease the number of instances in an AS group. If the number and the expected number of instances in an AS group are different due to the execution of the AS policy, AS automatically adjusts the number of instances to the expected.</li><li id="as_06_0401__li125028268333">AS supports the following policies: alarm-triggered policy, periodic policy, and scheduled policy.</li><li id="as_06_0401__li16692131663015">In the execution of the AS policy, you can set the number of instances to be scaled or perform a scaling action according to a percentage specified in the AS policy.</li></ul>
</div>
<div class="section" id="as_06_0401__section17004965"><h4 class="sectiontitle">URI</h4><p id="as_06_0401__p2129750">POST /autoscaling-api/v1/{project_id}/scaling_policy</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table38292076" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="as_06_0401__row61695723"><th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.2.3.2.5.1.1"><p id="as_06_0401__p31297682"><strong id="as_06_0401__b451615735317">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19%" id="mcps1.3.2.3.2.5.1.2"><p id="as_06_0401__p52084342">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.2.3.2.5.1.3"><p id="as_06_0401__p58082174">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.2.3.2.5.1.4"><p id="as_06_0401__p7035667"><strong id="as_06_0401__b09691576532">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__row33018140"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.2.3.2.5.1.1 "><p id="as_06_0401__p57223682">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.2.3.2.5.1.2 "><p id="as_06_0401__p4606636">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.2.5.1.3 "><p id="as_06_0401__p37593218">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.3.2.5.1.4 "><p id="as_06_0401__p36520930">Specifies the project ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="as_06_0401__section18826965"><h4 class="sectiontitle">Request Message</h4><ul id="as_06_0401__ul14981763"><li id="as_06_0401__li618145">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table5563313" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="as_06_0401__row20109663"><th align="left" class="cellrowborder" valign="top" width="22.222222222222225%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="as_06_0401__p18270010"><strong id="as_06_0401__b128046811534">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.181818181818183%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="as_06_0401__p3475817">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.141414141414144%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="as_06_0401__p13105749">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.45454545454546%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="as_06_0401__p54932709"><strong id="as_06_0401__b19644199185318">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__row46564252"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p13608105">scaling_policy_name</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p28514710">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p27990155">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p52610097">Specifies the AS policy name. The name contains only letters, digits, underscores (_), and hyphens (-), and cannot exceed 64 characters.</p>
</td>
</tr>
<tr id="as_06_0401__row62813139112932"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p50487343112944">scaling_group_id</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p62942986112944">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p65217081112944">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p48092197112944">Specifies the AS group ID, which can be obtained using the API for querying AS groups. For details, see <a href="as_06_0102.html">Querying AS Groups</a>.</p>
</td>
</tr>
<tr id="as_06_0401__row3728830"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p33599791">scaling_policy_type</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p37228582">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p62725128">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p47570623">Specifies the AS policy type.</p>
<ul id="as_06_0401__ul10238415193016"><li id="as_06_0401__li36834275193016"><strong id="as_06_0401__b50338569152840">ALARM</strong> (corresponding to <strong id="as_06_0401__b50393943152840">alarm_id</strong>): indicates that the scaling action is triggered by an alarm.</li><li id="as_06_0401__li10660561193016"><strong id="as_06_0401__b4853647152840">SCHEDULED</strong> (corresponding to <strong id="as_06_0401__b43682830152840">scheduled_policy</strong>): indicates that the scaling action is triggered as scheduled.</li><li id="as_06_0401__li14354576193016"><strong id="as_06_0401__b11927655152840">RECURRENCE</strong> (corresponding to <strong id="as_06_0401__b40240031152840">scheduled_policy</strong>): indicates that the scaling action is triggered periodically.</li></ul>
</td>
</tr>
<tr id="as_06_0401__row54645451"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p64205424">alarm_id</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p33256841">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p9449599">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p2176687103755">Specifies the alarm rule ID. This parameter is mandatory when <strong id="as_06_0401__b842352706153331">scaling_policy_type</strong> is set to <strong id="as_06_0401__b842352706153340">ALARM</strong>. After this parameter is specified, the value of <strong id="as_06_0401__b842352706153543">scheduled_policy</strong> does not take effect.</p>
<p id="as_06_0401__p280497851247">After you create an alarm policy, the system automatically adds an alarm triggering activity of the autoscaling type to the <strong id="as_06_0401__b84235270619718">alarm_actions</strong> field in the alarm rule specified by the parameter value.</p>
</td>
</tr>
<tr id="as_06_0401__row43653635"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p46283551">scheduled_policy</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p57980147">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__a4c03d226ca78442f99e13b8d363cd51d"><a href="#as_06_0401__table1736886710241">scheduled_policy</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p34708966">Specifies the periodic or scheduled AS policy. This parameter is mandatory when <strong id="as_06_0401__b842352706171742">scaling_policy_type</strong> is set to <strong id="as_06_0401__b842352706171747">SCHEDULED</strong> or <strong id="as_06_0401__b842352706171752">RECURRENCE</strong>. After this parameter is specified, the value of <strong id="as_06_0401__b84235270614268">alarm_id</strong> does not take effect. For details, see <a href="#as_06_0401__table1736886710241">Table 3</a>.</p>
</td>
</tr>
<tr id="as_06_0401__row43945239"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p2794612">scaling_policy_action</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p25037038">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p153681238184114"><a href="#as_06_0401__table2371051010342">scaling_policy_action</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p52618583">Specifies the scaling action of the AS policy. For details, see <a href="#as_06_0401__table2371051010342">Table 4</a>.</p>
</td>
</tr>
<tr id="as_06_0401__row3805200"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0401__p39785801">cool_down_time</p>
</td>
<td class="cellrowborder" valign="top" width="18.181818181818183%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0401__p1424418">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0401__p48268995">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0401__p2033614820549">Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="as_06_0401__table1736886710241"></a><a name="table1736886710241"></a><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table1736886710241" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="as_06_0401__b73373584411">scheduled_policy</strong> field description</caption><thead align="left"><tr id="as_06_0401__r71a1a0c14b8449ae9c19a6c4f3a27f2a"><th align="left" class="cellrowborder" valign="top" width="20.792079207920793%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="as_06_0401__a103344d6752d4ce2a271ee3f63ead9e0">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.801980198019802%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="as_06_0401__p366931181079">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.861386138613863%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="as_06_0401__afef6d9584333496a8c5ffbc00c9697dd">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.54455445544555%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="as_06_0401__en-us_topic_0021400636_p361788155424">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__r9d26d183ebcb408d8b6873deab234856"><td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0401__ae60918cef42b4e0894459d8e5a8b586c">launch_time</p>
</td>
<td class="cellrowborder" valign="top" width="19.801980198019802%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0401__p193525921079">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0401__a600202acd6db495281de660f1221973d">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0401__a8acac5089bd3423da0d691e85a2b06a4">Specifies the time when the scaling action is triggered. The time format complies with UTC.</p>
<ul id="as_06_0401__u17ff5ce1e7d24df8b69d30baeb489534"><li id="as_06_0401__l529c44f79c834e2d9fb205bbc002abb3">If <strong>scaling_policy_type</strong> is set to <strong>SCHEDULED</strong>, the time format is <strong>YYYY-MM-DDThh:mmZ</strong>.</li><li id="as_06_0401__l693d2fb16ca04f209f0be0e4abc0243c">If <strong>scaling_policy_type</strong> is set to <strong>RECURRENCE</strong>, the time format is <strong>hh:mm</strong>.</li></ul>
</td>
</tr>
<tr id="as_06_0401__r71db331768414f028a65da7aaf7f9814"><td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0401__a2e081bd068fa4052822b23fe468c6f00">recurrence_type</p>
</td>
<td class="cellrowborder" valign="top" width="19.801980198019802%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0401__p240561431079">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0401__a89ed2a5e669f4fc7941e232ed3d33370">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0401__a98a0b043879341a4a678b7fbb4e068d9">Specifies the periodic triggering type. This parameter is mandatory when <strong id="as_06_0401__b842352706172110">scaling_policy_type</strong> is set to <strong id="as_06_0401__b842352706172115">RECURRENCE</strong>.</p>
<ul id="as_06_0401__ul17833134534913"><li id="as_06_0401__li3833194554917"><strong>Daily</strong>: indicates that the scaling action is triggered once a day.</li><li id="as_06_0401__li17833104513495"><strong>Weekly</strong>: indicates that the scaling action is triggered once a week.</li><li id="as_06_0401__li1983334516495"><strong>Monthly</strong>: indicates that the scaling action is triggered once a month.</li></ul>
</td>
</tr>
<tr id="as_06_0401__r5b4081bb97fe4c749ec56bf067b3d37e"><td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0401__ab0c3d939c02d4f0e892ef0ae889f33c6">recurrence_value</p>
</td>
<td class="cellrowborder" valign="top" width="19.801980198019802%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0401__p23905621079">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0401__a5c08ed2e549149c9b609e1e11dd8b49d">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0401__a07f48cfcdafa4ffd87bba3b4e90c0111">Specifies the day when a periodic scaling action is triggered. This parameter is mandatory when <strong id="as_06_0401__b1036092925">scaling_policy_type</strong> is set to <strong id="as_06_0401__b423813601">RECURRENCE</strong>.</p>
<ul id="as_06_0401__uaaa702fc2e874c3a9cad601322271ee0"><li id="as_06_0401__lb252590a28cd4c4b9619fda3bfc1cf95">If <strong>recurrence_type</strong> is set to <strong>Daily</strong>, the value is <strong>null</strong>, indicating that the scaling action is triggered once a day.</li><li id="as_06_0401__l9d5383090b534424b9b771a83db03ac9">If <strong id="as_06_0401__b725811717598">recurrence_type</strong> is set to <strong id="as_06_0401__b8259171711596">Weekly</strong>, the value ranges from <strong id="as_06_0401__b92601117135912">1</strong> (Sunday) to <strong id="as_06_0401__b18260171716595">7</strong> (Saturday). The digits refer to dates in each week and separated by a comma, such as <strong id="as_06_0401__b15260517115915">1,3,5</strong>.</li><li id="as_06_0401__l541bbf396e3144f79b067bf10b2b7df9">If <strong id="as_06_0401__b84235270617528">recurrence_type</strong> is set to <strong>Monthly</strong>, the value ranges from <strong>1</strong> to <strong>31</strong>. The digits refer to the dates in each month and separated by a comma, such as <strong>1,10,13,28</strong>.</li></ul>
</td>
</tr>
<tr id="as_06_0401__r60fb8a7a17c346f8928b404e0b93db76"><td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0401__ad9da8c2101cb4ad6b314e73f107cc4c4">start_time</p>
</td>
<td class="cellrowborder" valign="top" width="19.801980198019802%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0401__p594178421079">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0401__a0a2523d6aba94e1586e2c505a81da73c">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0401__a34f741f8f41f49bda82f908ffb12b680">Specifies the start time of the scaling action triggered periodically. The time format complies with UTC. The default value is the local time.</p>
<p id="as_06_0401__a7271cbc17afb4bacb091905b4655e705">The time format is <strong>YYYY-MM-DDThh:mmZ</strong>.</p>
</td>
</tr>
<tr id="as_06_0401__r45c085bdc7ba45079851ba1d2ef8d897"><td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0401__a9aad49cfc3274586976001f3bfdf5719">end_time</p>
</td>
<td class="cellrowborder" valign="top" width="19.801980198019802%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0401__p481158781079">No</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0401__acee7a98428ea4dba93a7020ef11dd7b9">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0401__a57b435fb6ab3467bafe191d8ac989e2d">Specifies the end time of the scaling action triggered periodically. The time format complies with UTC. This parameter is mandatory when <strong id="as_06_0401__b842352706173440">scaling_policy_type</strong> is set to <strong id="as_06_0401__b842352706173444">RECURRENCE</strong>.</p>
<p id="as_06_0401__aab98d253597346778f2f046a5e022aa9">When the scaling action is triggered periodically, the end time cannot be earlier than the current and start time.</p>
<p id="as_06_0401__a06fe304a198d4e069ddd3946c5f1179d">The time format is <strong>YYYY-MM-DDThh:mmZ</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="as_06_0401__table2371051010342"></a><a name="table2371051010342"></a><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table2371051010342" frame="border" border="1" rules="all"><caption><b>Table 4 </b><strong id="as_06_0401__b12659161334419">scaling_policy_action</strong> field description</caption><thead align="left"><tr id="as_06_0401__re1f0786afb8b4e88a8fc1ea46d03b82a"><th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.3.2.1.3.2.5.1.1"><p id="as_06_0401__aec3e6ac917d14dfeb7ffb65860bb1306">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19%" id="mcps1.3.3.2.1.3.2.5.1.2"><p id="as_06_0401__p161699610619">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.1.3.2.5.1.3"><p id="as_06_0401__adf1eacf282f34f0c87a7f239f00b4faf">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.3.2.1.3.2.5.1.4"><p id="as_06_0401__adbb947caa2164ef080b97285f51e2ca4">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__r6132212f59bc42529826e44935a5cfaf"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0401__ae05d19776675443bb90e03221ee13658">operation</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0401__p6386788410619">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0401__ab3f64183c0044f0cb0c72b8b7c381c66">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0401__a5c8d1942ad2246beaa196587336c303e">Specifies the operation to be performed. The default operation is <strong>ADD</strong>.</p>
<ul id="as_06_0401__ul17377291387"><li id="as_06_0401__li47372296812"><strong>ADD</strong>: adds specified number of instances to the AS group.</li><li id="as_06_0401__li1473712297814"><strong id="as_06_0401__b84235270611343">REMOVE/REDUCE</strong>: removes or reduces specified number of instances from the AS group.</li><li id="as_06_0401__li14737152919813"><strong>SET</strong>: sets the number of instances in the AS group.</li></ul>
</td>
</tr>
<tr id="as_06_0401__rd780cce224684db9a0a0fff71c2cc5ce"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0401__p26677605172946">instance_number</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0401__p13402436172946">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0401__p11855564172946">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0401__p20776612172946">Specifies the number of instances to be operated. The default number is <strong>1</strong>. The value range is as follows for a default quota:</p>
<ul id="as_06_0401__ul897214318562"><li id="as_06_0401__li16972144318562">If <strong id="as_06_0401__b12649189115414">operation</strong> is set to <strong id="as_06_0401__b976871918548">SET</strong>, the value ranges from 0 to 200.</li><li id="as_06_0401__li12972643195610">If <strong id="as_06_0401__b13160165618541">operation</strong> is set to <strong id="as_06_0401__b2029714596546">ADD</strong>, <strong id="as_06_0401__b798416185520">REMOVE</strong>, or <strong id="as_06_0401__b7950192184120">REDUCE</strong>, the value ranges from 1 to 200.</li></ul>
<div class="note" id="as_06_0401__note99603584562"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="as_06_0401__p696175820561">Either <strong id="as_06_0401__b842352706105430">instance_number</strong> or <strong id="as_06_0401__b842352706105435">instance_percentage</strong> is required.</p>
</div></div>
</td>
</tr>
<tr id="as_06_0401__row4165649917933"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0401__p17249893172946">instance_percentage</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0401__p55064094172946">No</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0401__p31006664172946">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0401__p083717531563">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. If <strong id="as_06_0401__b587711610207">operation</strong> is set to <strong id="as_06_0401__b7766189182012">ADD</strong>, <strong id="as_06_0401__b155020126201">REMOVE</strong> or <strong id="as_06_0401__b1958414415402">REDUCE</strong>, the value is an integer from 1 to 20000. If <strong id="as_06_0401__b15177335112010">operation</strong> is set to <strong id="as_06_0401__b15787182814204">SET</strong>, the value is an integer from 0 to 20000.</p>
<p id="as_06_0401__p55280357172946">If neither <strong id="as_06_0401__b8423527061122">instance_number</strong> nor <strong id="as_06_0401__b8423527061126">instance_percentage</strong> is specified, the number of instances to be operated is 1.</p>
<p id="as_06_0401__p27761166172946">Either <strong id="as_06_0401__b389626453">instance_number</strong> or <strong id="as_06_0401__b125335115">instance_percentage</strong> is required.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="as_06_0401__ul6149759"><li id="as_06_0401__li55347837">Example request<div class="p" id="as_06_0401__p1195125082713"><a name="as_06_0401__li55347837"></a><a name="li55347837"></a>This example shows how to create a periodic AS policy named <strong id="as_06_0401__b84235270611439">as-policy-7a75</strong>. The policy takes effect from 2015-12-14T03:34Z through 2015-12-27T03:34Z. During this period, one instance will be added to AS group with ID <strong id="as_06_0401__b8423527061169">5bc3aa02-b83e-454c-aba1-4d2095c68f8b</strong> at 16:00 every day.<pre class="screen" id="as_06_0401__screen104882474274">POST https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_policy
{
"scaling_policy_name": "as-policy-7a75",
"scaling_policy_action": {
"operation": "ADD",
"instance_number": 1
},
"cool_down_time": 900,
"scheduled_policy": {
"launch_time": "16:00",
"recurrence_type": "Daily",
"start_time": "2015-12-14T03:34Z",
"end_time": "2015-12-27T03:34Z"
},
"scaling_policy_type": "RECURRENCE",
"scaling_group_id": "5bc3aa02-b83e-454c-aba1-4d2095c68f8b"
}</pre>
</div>
</li></ul>
</div>
<div class="section" id="as_06_0401__section35224963"><h4 class="sectiontitle">Response Message</h4><ul id="as_06_0401__ul47625437"><li id="as_06_0401__li25975757">Response parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table32455223" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Response parameters</caption><thead align="left"><tr id="as_06_0401__row51926520"><th align="left" class="cellrowborder" valign="top" width="23%" id="mcps1.3.4.2.1.1.2.4.1.1"><p id="as_06_0401__p45298596"><strong id="as_06_0401__b19479181614539">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.1.1.2.4.1.2"><p id="as_06_0401__p45307656">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.99999999999999%" id="mcps1.3.4.2.1.1.2.4.1.3"><p id="as_06_0401__p46041549"><strong id="as_06_0401__b953018165312">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__row38378011"><td class="cellrowborder" valign="top" width="23%" headers="mcps1.3.4.2.1.1.2.4.1.1 "><p id="as_06_0401__p21611161">scaling_policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.1.2.4.1.2 "><p id="as_06_0401__p5673583">String</p>
</td>
<td class="cellrowborder" valign="top" width="56.99999999999999%" headers="mcps1.3.4.2.1.1.2.4.1.3 "><p id="as_06_0401__p56907078">Specifies the AS policy ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="as_06_0401__ul46070597"><li id="as_06_0401__li11982196">Example response<pre class="screen" id="as_06_0401__screen5566768594941">{
"scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"
}</pre>
</li></ul>
</div>
<div class="section" id="as_06_0401__section48589216"><h4 class="sectiontitle">Returned Values</h4><ul id="as_06_0401__ul59793748"><li id="as_06_0401__li1272826">Normal<p id="as_06_0401__p11455439"><a name="as_06_0401__li1272826"></a><a name="li1272826"></a>200</p>
</li><li id="as_06_0401__li35990092">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0401__table55475379" frame="border" border="1" rules="all"><thead align="left"><tr id="as_06_0401__row47787886"><th align="left" class="cellrowborder" valign="top" width="35%" id="mcps1.3.5.2.2.1.1.3.1.1"><p id="as_06_0401__p45613538">Returned Value</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="65%" id="mcps1.3.5.2.2.1.1.3.1.2"><p id="as_06_0401__p3709091">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0401__row32000920"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p41937705">400 Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p41510976">The server failed to process the request.</p>
</td>
</tr>
<tr id="as_06_0401__row38054464"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p62512728">401 Unauthorized</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p30366184">You must enter the username and password to access the requested page.</p>
</td>
</tr>
<tr id="as_06_0401__row4860205"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p58132325">403 Forbidden</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p11097898">You are forbidden to access the requested page.</p>
</td>
</tr>
<tr id="as_06_0401__row32772220"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p37304191">404 Not Found</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p1740610">The server could not find the requested page.</p>
</td>
</tr>
<tr id="as_06_0401__row15665491"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p60945241">405 Method Not Allowed</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p37617525">You are not allowed to use the method specified in the request.</p>
</td>
</tr>
<tr id="as_06_0401__row3013405"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p42759282">406 Not Acceptable</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p40949840">The response generated by the server could not be accepted by the client.</p>
</td>
</tr>
<tr id="as_06_0401__row33004241"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p56097870">407 Proxy Authentication Required</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p47633640">You must use the proxy server for authentication to process the request.</p>
</td>
</tr>
<tr id="as_06_0401__row26049579"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p29641146">408 Request Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p52122650">The request timed out.</p>
</td>
</tr>
<tr id="as_06_0401__row66450672"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p13795340">409 Conflict</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p43680716">The request could not be processed due to a conflict.</p>
</td>
</tr>
<tr id="as_06_0401__row57582125"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p33640543">500 Internal Server Error</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p40529449">Failed to complete the request because of an internal service error.</p>
</td>
</tr>
<tr id="as_06_0401__row29220727"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p18068697">501 Not Implemented</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p54278376">Failed to complete the request because the server does not support the requested function.</p>
</td>
</tr>
<tr id="as_06_0401__row18743339"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p41815528">502 Bad Gateway</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p31614597">Failed to complete the request because the request is invalid.</p>
</td>
</tr>
<tr id="as_06_0401__row16095919"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p28701056">503 Service Unavailable</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p43084165">Failed to complete the request because the system is unavailable.</p>
</td>
</tr>
<tr id="as_06_0401__row52213166"><td class="cellrowborder" valign="top" width="35%" headers="mcps1.3.5.2.2.1.1.3.1.1 "><p id="as_06_0401__p1408093">504 Gateway Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="65%" headers="mcps1.3.5.2.2.1.1.3.1.2 "><p id="as_06_0401__p46946741">A gateway timeout error occurred.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="as_06_0401__section17669131616110"><h4 class="sectiontitle">Error Codes</h4><p id="as_06_0401__p172692548116">See <a href="as_07_0102.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="as_06_0400.html">AS Policies</a></div>
</div>
</div>