doc-exports/docs/as/api-ref/as_06_0402.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

390 lines
38 KiB
HTML

<a name="as_06_0402"></a><a name="as_06_0402"></a>
<h1 class="topictitle1">Creating an AS Policy (V2)</h1>
<div id="body1521704457471"><div class="section" id="as_06_0402__section384010584211"><h4 class="sectiontitle">Function</h4><p id="as_06_0402__p14923172444213">This API is used to create an AS policy for an AS group or bandwidth.</p>
<p id="as_06_0402__p18867438413">The difference between the V2 and V1 APIs for creating an AS policy is that V2 supports creating an AS policy for adjusting bandwidth and differentiating scaling resources by their types.</p>
</div>
<div class="section" id="as_06_0402__section10265184815423"><h4 class="sectiontitle">URI</h4><p id="as_06_0402__p07392310431">POST /autoscaling-api/v2/{project_id}/scaling_policy</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table169543711435" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="as_06_0402__row13696163774311"><th align="left" class="cellrowborder" valign="top" width="18.81188118811881%" id="mcps1.3.2.3.2.5.1.1"><p id="as_06_0402__p1279614712431"><strong id="as_06_0402__b11494155113536">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20.792079207920793%" id="mcps1.3.2.3.2.5.1.2"><p id="as_06_0402__p279694716432">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.2.3.2.5.1.3"><p id="as_06_0402__p207961347134317">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="44.554455445544555%" id="mcps1.3.2.3.2.5.1.4"><p id="as_06_0402__p9796647104314"><strong id="as_06_0402__b1527116529538">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row14696183764311"><td class="cellrowborder" valign="top" width="18.81188118811881%" headers="mcps1.3.2.3.2.5.1.1 "><p id="as_06_0402__p879674711433">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="20.792079207920793%" headers="mcps1.3.2.3.2.5.1.2 "><p id="as_06_0402__p157961847154317">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.2.3.2.5.1.3 "><p id="as_06_0402__p1679634714436">String</p>
</td>
<td class="cellrowborder" valign="top" width="44.554455445544555%" headers="mcps1.3.2.3.2.5.1.4 "><p id="as_06_0402__p36520930">Specifies the project ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="as_06_0402__section2677384410"><h4 class="sectiontitle">Request Message</h4><ul id="as_06_0402__ul8805618154413"><li id="as_06_0402__li128058185448">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table2201101210456" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="as_06_0402__row12020125459"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="as_06_0402__p17592192817454"><strong id="as_06_0402__b124308538536">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="as_06_0402__p45921928114511">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="as_06_0402__p2592132816453">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="as_06_0402__p559214289456"><strong id="as_06_0402__b15272105416537">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row52021512204518"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p1659213281452">scaling_policy_name</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p259292814514">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p9592202874514">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p559262834520">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_0402__row820251216459"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p6592122819459">scaling_resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p125925282456">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p17592328124517">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p1259311288457">Specifies the scaling resource ID, which is the unique ID of an AS group or bandwidth.</p>
<ul id="as_06_0402__ul712911394401"><li id="as_06_0402__li1175864484016">If <strong id="as_06_0402__b14391174651513">scaling_resource_type</strong> is set to <strong id="as_06_0402__b156051651101519">SCALING_GROUP</strong>, this parameter indicates the unique AS group ID.</li><li id="as_06_0402__li8131143910405">If <strong id="as_06_0402__b7180161951611">scaling_resource_type</strong> is set to <strong id="as_06_0402__b682413238165">BANDWIDTH</strong>, this parameter indicates the unique bandwidth ID.</li></ul>
</td>
</tr>
<tr id="as_06_0402__row17203171294512"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p1959342811457">scaling_resource_type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p1459313284450">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p135931928174517">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p759312894514">Specifies the scaling resource type.</p>
<ul id="as_06_0402__ul959382812457"><li id="as_06_0402__li05931228104520">AS group: <strong id="as_06_0402__b84235270691950">SCALING_GROUP</strong></li><li id="as_06_0402__li1659316283454">Bandwidth: <strong id="as_06_0402__b8423527069204">BANDWIDTH</strong></li></ul>
</td>
</tr>
<tr id="as_06_0402__row1720351244514"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p19593228114519">scaling_policy_type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p205937286458">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p185931028174514">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p3593142819452">Specifies the AS policy type.</p>
<ul id="as_06_0402__ul14593528184513"><li id="as_06_0402__li1259310285454"><strong id="as_06_0402__b8908878154133">ALARM</strong> (corresponding to <strong id="as_06_0402__b13071039154133">alarm_id</strong>): indicates that the scaling action is triggered by an alarm. </li><li id="as_06_0402__li185931528164514"><strong id="as_06_0402__b47749798154133">SCHEDULED</strong> (corresponding to <strong id="as_06_0402__b27095003154133">scheduled_policy</strong>): indicates that the scaling action is triggered as scheduled.</li><li id="as_06_0402__li7594102814450"><strong id="as_06_0402__b48283661154133">RECURRENCE</strong> (corresponding to <strong id="as_06_0402__b31899767154133">scheduled_policy</strong>): indicates that the scaling action is triggered periodically.</li></ul>
</td>
</tr>
<tr id="as_06_0402__row52037123452"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p15594112854517">alarm_id</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p259442834514">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p125941128194517">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p65945288457">Specifies the alarm rule ID. This parameter is mandatory when <strong id="as_06_0402__b842352706153331">scaling_policy_type</strong> is set to <strong id="as_06_0402__b842352706153340">ALARM</strong>. After this parameter is specified, the value of <strong id="as_06_0402__b842352706153543">scheduled_policy</strong> does not take effect.</p>
<p id="as_06_0402__p65947283452">After you create an alarm policy, the system automatically adds an alarm triggering activity of the autoscaling type to the <strong id="as_06_0402__b84235270619718">alarm_actions</strong> field in the alarm rule specified by the parameter value.</p>
<p id="as_06_0402__p18594112815454">You can obtain the parameter value by querying Cloud Eye alarm rules. </p>
</td>
</tr>
<tr id="as_06_0402__row5203121244518"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p159411286451">scheduled_policy</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p45941328174510">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__a4c03d226ca78442f99e13b8d363cd51d"><a href="#as_06_0402__table10424101264616">scheduled_policy</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p1859414287454">Specifies the periodic or scheduled AS policy. This parameter is mandatory when <strong id="as_06_0402__b842352706171742">scaling_policy_type</strong> is set to <strong id="as_06_0402__b842352706171747">SCHEDULED</strong> or <strong id="as_06_0402__b842352706171752">RECURRENCE</strong>. After this parameter is specified, the value of <strong id="as_06_0402__b84235270614268">alarm_id</strong> does not take effect. For details, see <a href="#as_06_0402__table10424101264616">Table 3</a>.</p>
</td>
</tr>
<tr id="as_06_0402__row7203121211450"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p1059420285454">scaling_policy_action</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p1259402884516">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p1574044754119"><a href="#as_06_0402__table14148153113492">scaling_policy_action</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p12594528104514">Specifies the scaling action of the AS policy. For details, see <a href="#as_06_0402__table14148153113492">Table 4</a>.</p>
</td>
</tr>
<tr id="as_06_0402__row420381284513"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p759572814455">cool_down_time</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p11595172824510">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p1459512824515">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p45958289453">Specifies the cooldown period (in seconds). The value ranges from 0 to 86400 and is 300 by default.</p>
</td>
</tr>
<tr id="as_06_0402__row2952620415"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="as_06_0402__p7501355122517">description</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="as_06_0402__p1504555257">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="as_06_0402__p6506558259">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="as_06_0402__p3501755202518">Specifies the description of the AS policy. The value can contain 1 to 256 characters.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="as_06_0402__table10424101264616"></a><a name="table10424101264616"></a><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table10424101264616" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="as_06_0402__b4822102864416">scheduled_policy</strong> field description</caption><thead align="left"><tr id="as_06_0402__row04247128463"><th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="as_06_0402__p1436872914616">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="as_06_0402__p536822910460">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="as_06_0402__p12368142912468">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="as_06_0402__p10368229174610">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row144243125465"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0402__p5368629204611">launch_time</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0402__p163681629114614">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0402__p33681296461">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0402__p20368142914465">Specifies the time when the scaling action is triggered. The time format complies with UTC.</p>
<ul id="as_06_0402__ul103681229164620"><li id="as_06_0402__li6368112954614">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_0402__li143681029134616">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_0402__row0424412154617"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0402__p1736819298466">recurrence_type</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0402__p2368112913463">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0402__p13368229194611">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0402__p8368429184610">Specifies the periodic triggering type. This parameter is mandatory when <strong id="as_06_0402__b842352706172110">scaling_policy_type</strong> is set to <strong id="as_06_0402__b842352706172115">RECURRENCE</strong>.</p>
<ul id="as_06_0402__ul863212301573"><li id="as_06_0402__li14632230473"><strong>Daily</strong>: indicates that the scaling action is triggered once a day.</li><li id="as_06_0402__li66327301711"><strong>Weekly</strong>: indicates that the scaling action is triggered once a week.</li><li id="as_06_0402__li1163283011718"><strong id="as_06_0402__b387417421849">Monthly</strong>: indicates that the scaling action is triggered once a month.</li></ul>
</td>
</tr>
<tr id="as_06_0402__row114247121463"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0402__p13697293462">recurrence_value</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0402__p9369152912468">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0402__p1369172910462">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0402__a07f48cfcdafa4ffd87bba3b4e90c0111">Specifies the day when a periodic scaling action is triggered. This parameter is mandatory when <strong id="as_06_0402__b14071725125218">scaling_policy_type</strong> is set to <strong id="as_06_0402__b1840852525212">RECURRENCE</strong>.</p>
<ul id="as_06_0402__ul436942914464"><li id="as_06_0402__li33698299469">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_0402__li1536919293461">If <strong id="as_06_0402__b1485018471022">recurrence_type</strong> is set to <strong id="as_06_0402__b985014479210">Weekly</strong>, the value ranges from <strong id="as_06_0402__b485014712219">1</strong> (Sunday) to <strong id="as_06_0402__b198517471721">7</strong> (Saturday). The digits refer to dates in each week and separated by a comma, such as <strong id="as_06_0402__b138512047722">1,3,5</strong>.</li><li id="as_06_0402__li9369152974615">If <strong id="as_06_0402__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>.<div class="note" id="as_06_0402__note1181534852717"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="as_06_0402__p281624817271">When <strong id="as_06_0402__b2323101020414">recurrence_type</strong> is set to <strong id="as_06_0402__b932318101418">Daily</strong>, this parameter does not take effect.</p>
</div></div>
</li></ul>
</td>
</tr>
<tr id="as_06_0402__row18424141294615"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0402__p163691829174618">start_time</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0402__p7369182914614">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0402__p10369729194615">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0402__p183691295469">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_0402__p037052919466">The time format is <strong>YYYY-MM-DDThh:mmZ</strong>.</p>
</td>
</tr>
<tr id="as_06_0402__row19425912204620"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="as_06_0402__p137012924616">end_time</p>
</td>
<td class="cellrowborder" valign="top" width="19%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="as_06_0402__p237015297461">No</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="as_06_0402__p03701429134615">String</p>
</td>
<td class="cellrowborder" valign="top" width="45%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="as_06_0402__p13370192974611">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_0402__b842352706173440">scaling_policy_type</strong> is set to <strong id="as_06_0402__b842352706173444">RECURRENCE</strong>. When the scaling action is triggered periodically, the end time cannot be earlier than the current and start time.</p>
<p id="as_06_0402__p203703299462">The time format is <strong>YYYY-MM-DDThh:mmZ</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="as_06_0402__table14148153113492"></a><a name="table14148153113492"></a><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table14148153113492" frame="border" border="1" rules="all"><caption><b>Table 4 </b><strong id="as_06_0402__b93951447104417">scaling_policy_action</strong> field description</caption><thead align="left"><tr id="as_06_0402__row914933174911"><th align="left" class="cellrowborder" valign="top" width="20.202020202020204%" id="mcps1.3.3.2.1.3.2.5.1.1"><p id="as_06_0402__p1984914718496">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.191919191919194%" id="mcps1.3.3.2.1.3.2.5.1.2"><p id="as_06_0402__p68491047104920">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.151515151515152%" id="mcps1.3.3.2.1.3.2.5.1.3"><p id="as_06_0402__p12849747144916">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.45454545454546%" id="mcps1.3.3.2.1.3.2.5.1.4"><p id="as_06_0402__p98494475496">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row19149123164911"><td class="cellrowborder" valign="top" width="20.202020202020204%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0402__p118491447144918">operation</p>
</td>
<td class="cellrowborder" valign="top" width="19.191919191919194%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0402__p12849647124917">No</p>
</td>
<td class="cellrowborder" valign="top" width="15.151515151515152%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0402__p19849164719493">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><div class="p" id="as_06_0402__p12849194711498">Specifies the operation to be performed. The default operation is <strong id="as_06_0402__b1898710304536">ADD</strong>.<ul id="as_06_0402__ul627111141476"><li id="as_06_0402__li79048588174">If <strong id="as_06_0402__b13175144944616">scaling_resource_type</strong> is set to <strong id="as_06_0402__b1906755154616">SCALING_GROUP</strong>, the following operations are supported:<ul id="as_06_0402__ul4517141421818"><li id="as_06_0402__li1027113147720"><strong id="as_06_0402__b8423527069234">ADD</strong>: indicates adding instances.</li><li id="as_06_0402__li127210148716"><strong id="as_06_0402__b84235270692351">REMOVE/REDUCE</strong>: indicates removing or reducing instances.</li><li id="as_06_0402__li72721414572"><strong id="as_06_0402__b84235270692418">SET</strong>: indicates setting the number of instances to a specified value.</li></ul>
</li><li id="as_06_0402__li657252681717">If <strong id="as_06_0402__b142804917503">scaling_resource_type</strong> is set to <strong id="as_06_0402__b1741712985119">BANDWIDTH</strong>, the following operations are supported:<ul id="as_06_0402__ul10599126171711"><li id="as_06_0402__li175991826141717"><strong id="as_06_0402__b643951612511">ADD</strong>: indicates adding instances.</li><li id="as_06_0402__li65991526111711"><strong id="as_06_0402__b2271915151019">REDUCE</strong>: indicates reducing instances.</li><li id="as_06_0402__li1259916262179"><strong id="as_06_0402__b5271191519102">SET</strong>: indicates setting the number of instances to a specified value.</li></ul>
</li></ul>
</div>
</td>
</tr>
<tr id="as_06_0402__row8149143119496"><td class="cellrowborder" valign="top" width="20.202020202020204%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0402__p484914764910">size</p>
</td>
<td class="cellrowborder" valign="top" width="19.191919191919194%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0402__p208491947124912">No</p>
</td>
<td class="cellrowborder" valign="top" width="15.151515151515152%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0402__p5849247124914">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0402__p18849194784912">Specifies the operation size. The value is an integer from 0 to 300. The default value is <strong id="as_06_0402__b11732181112413">1</strong>. This parameter can be set to <strong id="as_06_0402__b5635125912547">0</strong> only when <strong id="as_06_0402__b9320322105511">operation</strong> is set to <strong id="as_06_0402__b196421525125513">SET</strong>.</p>
<ul id="as_06_0402__ul1883910551366"><li id="as_06_0402__li178399551463">If <strong>scaling_resource_type</strong> is set to <strong>SCALING_GROUP</strong>, this parameter indicates the number of instances. The value is an integer from 0 to 300 and the default value is <strong>1</strong>.</li><li id="as_06_0402__li118396551860">If <strong>scaling_resource_type</strong> is set to <strong>BANDWIDTH</strong>, this parameter indicates the bandwidth (Mbit/s). The value is an integer from 1 to 300 and the default value is <strong>1</strong>.</li><li id="as_06_0402__li188391555769">If <strong id="as_06_0402__b8423527061619">scaling_resource_type</strong> is set to <strong id="as_06_0402__b84235270616122">SCALING_GROUP</strong>, either <strong id="as_06_0402__b842352706105430">size</strong> or <strong id="as_06_0402__b842352706105435">percentage</strong> can be set.</li></ul>
</td>
</tr>
<tr id="as_06_0402__row16150133114912"><td class="cellrowborder" valign="top" width="20.202020202020204%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0402__p184984724914">percentage</p>
</td>
<td class="cellrowborder" valign="top" width="19.191919191919194%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0402__p785044715492">No</p>
</td>
<td class="cellrowborder" valign="top" width="15.151515151515152%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0402__p178501847124913">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0402__p38501247184913">Specifies the percentage of instances to be operated. If <strong id="as_06_0402__b16372183920211">operation</strong> is set to <strong id="as_06_0402__b1037363917217">ADD</strong>, <strong id="as_06_0402__b11642163516565">REMOVE</strong>, or <strong id="as_06_0402__b1237543912118">REDUCE</strong>, the value of this parameter is an integer from 1 to 20000. If <strong id="as_06_0402__b13375939102115">operation</strong> is set to <strong id="as_06_0402__b23771239132117">SET</strong>, the value is an integer from 0 to 20000.</p>
<ul id="as_06_0402__ul1740120777"><li id="as_06_0402__li974019014710">If <strong id="as_06_0402__b84235270616313">scaling_resource_type</strong> is set to <strong id="as_06_0402__b84235270616320">SCALING_GROUP</strong>, either <strong id="as_06_0402__b190074049516530">size</strong> or <strong id="as_06_0402__b35265935816530">percentage</strong> can be set. If neither <strong id="as_06_0402__b84235270616550">size</strong> nor <strong id="as_06_0402__b84235270616556">percentage</strong> is set, the default value of <strong id="as_06_0402__b8423527061667">size</strong> is <strong id="as_06_0402__b84235270616612">1</strong>.</li><li id="as_06_0402__li15740608717">If <strong id="as_06_0402__b7913672816">scaling_resource_type</strong> is set to <strong id="as_06_0402__b0590640112810">BANDWIDTH</strong>, <strong id="as_06_0402__b51941644192810">percentage</strong> is unavailable.</li></ul>
</td>
</tr>
<tr id="as_06_0402__row2150173194911"><td class="cellrowborder" valign="top" width="20.202020202020204%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="as_06_0402__p4850347164914">limits</p>
</td>
<td class="cellrowborder" valign="top" width="19.191919191919194%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="as_06_0402__p4850547184915">No</p>
</td>
<td class="cellrowborder" valign="top" width="15.151515151515152%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="as_06_0402__p385004711497">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="45.45454545454546%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="as_06_0402__p11850647164919">Specifies the operation restrictions.</p>
<p id="as_06_0402__p1785064744911">If <strong id="as_06_0402__b172916117291">scaling_resource_type</strong> is set to <strong id="as_06_0402__b172949118294">BANDWIDTH</strong> and <strong id="as_06_0402__b129451172919">operation</strong> is not <strong id="as_06_0402__b2029515172914">SET</strong>, this parameter takes effect and the unit is Mbit/s.</p>
<ul id="as_06_0402__ul19875103016377"><li id="as_06_0402__li17875830203719">If <strong id="as_06_0402__b11433157115">operation</strong> is set to <strong id="as_06_0402__b1414531516119">ADD</strong>, this parameter indicates the maximum bandwidth allowed.</li><li id="as_06_0402__li4875113014375">If <strong>operation</strong> is set to <strong>REDUCE</strong>, this parameter indicates the minimum bandwidth allowed.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<ul id="as_06_0402__ul11842151935110"><li id="as_06_0402__li484241916513">Example request<div class="p" id="as_06_0402__p9341838112810"><a name="as_06_0402__li484241916513"></a><a name="li484241916513"></a>This example shows how to create an alarm policy named <strong id="as_06_0402__b77271235103911">hth_aspolicy_1</strong> with the following configurations: The alarm rule ID is <strong id="as_06_0402__b44385543912">al1513822380493GvlJKZwA8</strong>; when the alarm threshold is reached according to the alarm rule, the bandwidth with ID <strong id="as_06_0402__b17243145014419">8ade64b5-d685-40b8-8582-4ce306ea37a6</strong> will be increased by 1 Mbit/s until the bandwidth reaches 10 Mbit/s.<pre class="screen" id="as_06_0402__screen15555334182811">POST https://{Endpoint}/autoscaling-api/v2/{project_id}/scaling_policy
{
"alarm_id": "al1513822380493GvlJKZwA8",
"cool_down_time": 900,
"scaling_resource_id": "8ade64b5-d685-40b8-8582-4ce306ea37a6",
"scaling_resource_type": "BANDWIDTH",
"scaling_policy_action": {
"size": 1,
"operation": "ADD",
"limits": 10
},
"scaling_policy_name": "hth_aspolicy_1",
"scaling_policy_type": "ALARM"
}</pre>
</div>
</li></ul>
<div class="section" id="as_06_0402__section1133152055814"><h4 class="sectiontitle">Response Message</h4><ul id="as_06_0402__ul12577203919582"><li id="as_06_0402__li5577193914582">Response parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table2454125213587" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Response parameters</caption><thead align="left"><tr id="as_06_0402__row134541952105817"><th align="left" class="cellrowborder" valign="top" width="28.000000000000004%" id="mcps1.3.5.2.1.1.2.4.1.1"><p id="as_06_0402__p14813106591"><strong id="as_06_0402__b1420924125415">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="26%" id="mcps1.3.5.2.1.1.2.4.1.2"><p id="as_06_0402__p1181314014595"><strong id="as_06_0402__b84235270693914">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.5.2.1.1.2.4.1.3"><p id="as_06_0402__p1681360205913"><strong id="as_06_0402__b1434595105411">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row645511524585"><td class="cellrowborder" valign="top" width="28.000000000000004%" headers="mcps1.3.5.2.1.1.2.4.1.1 "><p id="as_06_0402__p198134045919">scaling_policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="26%" headers="mcps1.3.5.2.1.1.2.4.1.2 "><p id="as_06_0402__p12814130195914">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.5.2.1.1.2.4.1.3 "><p id="as_06_0402__p168144045917">Specifies the AS policy ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="as_06_0402__li1486182175912">Example response<pre class="screen" id="as_06_0402__screen1792292618014">{
"scaling_policy_id": "0h327883-324n-4dzd-9c61-68d03ee191dd"
}</pre>
</li></ul>
</div>
<div class="section" id="as_06_0402__section12531175212811"><h4 class="sectiontitle">Returned Values</h4><ul id="as_06_0402__ul678116717911"><li id="as_06_0402__li67811720914">Normal<p id="as_06_0402__p078116716919"><a name="as_06_0402__li67811720914"></a><a name="li67811720914"></a>200</p>
</li><li id="as_06_0402__li87811572913">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_0402__table98255396918" frame="border" border="1" rules="all"><thead align="left"><tr id="as_06_0402__row16826103916915"><th align="left" class="cellrowborder" valign="top" width="37%" id="mcps1.3.6.2.2.1.1.3.1.1"><p id="as_06_0402__p7898152092">Returned Value</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="63%" id="mcps1.3.6.2.2.1.1.3.1.2"><p id="as_06_0402__p489816521797">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_0402__row1382614391590"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p11898552298">400 Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p108981852296">The server failed to process the request.</p>
</td>
</tr>
<tr id="as_06_0402__row11826143918912"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p1289811521910">401 Unauthorized</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p14898105216917">You must enter the username and password to access the requested page.</p>
</td>
</tr>
<tr id="as_06_0402__row082613391793"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p178981652891">403 Forbidden</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p1389818529914">You are forbidden to access the requested page.</p>
</td>
</tr>
<tr id="as_06_0402__row1982663913918"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p15899105212914">404 Not Found</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p1589915521498">The server could not find the requested page.</p>
</td>
</tr>
<tr id="as_06_0402__row882683911914"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p168991652792">405 Method Not Allowed</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p489910525915">You are not allowed to use the method specified in the request.</p>
</td>
</tr>
<tr id="as_06_0402__row118266391992"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p789914525916">406 Not Acceptable</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p38991952398">The response generated by the server could not be accepted by the client.</p>
</td>
</tr>
<tr id="as_06_0402__row1982653916915"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p5899205214917">407 Proxy Authentication Required</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p8899155218920">You must use the proxy server for authentication to process the request.</p>
</td>
</tr>
<tr id="as_06_0402__row68261139391"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p489919521493">408 Request Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p148997521199">The request timed out.</p>
</td>
</tr>
<tr id="as_06_0402__row118263391996"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p1989910521296">409 Conflict</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p2899125213915">The request could not be processed due to a conflict.</p>
</td>
</tr>
<tr id="as_06_0402__row1882643913911"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p138998521697">500 Internal Server Error</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p1089975215917">Failed to complete the request because of an internal service error.</p>
</td>
</tr>
<tr id="as_06_0402__row178261339094"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p1989915521793">501 Not Implemented</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p6899105217917">Failed to complete the request because the server does not support the requested function.</p>
</td>
</tr>
<tr id="as_06_0402__row382612399913"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p889915525910">502 Bad Gateway</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p1990095214918">Failed to complete the request because the request is invalid.</p>
</td>
</tr>
<tr id="as_06_0402__row78261039593"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p169001052195">503 Service Unavailable</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p14900155215918">Failed to complete the request because the system is unavailable.</p>
</td>
</tr>
<tr id="as_06_0402__row682615391991"><td class="cellrowborder" valign="top" width="37%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_0402__p99001552295">504 Gateway Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="63%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_0402__p159009521193">A gateway timeout error occurred.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="as_06_0402__section17669131616110"><h4 class="sectiontitle">Error Codes</h4><p id="as_06_0402__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>