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

234 lines
19 KiB
HTML

<a name="as_06_1003"></a><a name="as_06_1003"></a>
<h1 class="topictitle1">Creating or Deleting a Tag</h1>
<div id="body1500262816659"><div class="section" id="as_06_1003__section54294980114716"><h4 class="sectiontitle">Function</h4><p id="as_06_1003__p35817234114716">This API is used to create or delete a tag.</p>
</div>
<p id="as_06_1003__p203576351510">Each AS group can have a maximum of 10 tags added to it.</p>
<div class="section" id="as_06_1003__section53919650114716"><h4 class="sectiontitle">URI</h4><p id="as_06_1003__p36006234114716">POST /autoscaling-api/v1/{project_id}/{resource_type}/{resource_id}/tags/action</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_1003__table30823845114716" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="as_06_1003__row45946273114716"><th align="left" class="cellrowborder" valign="top" width="22%" id="mcps1.3.3.3.2.5.1.1"><p id="as_06_1003__p30660627114716"><strong id="as_06_1003__b174891716459">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.3.3.2.5.1.2"><p id="as_06_1003__p482845114716">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.3.2.5.1.3"><p id="as_06_1003__p39110504114716">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="48%" id="mcps1.3.3.3.2.5.1.4"><p id="as_06_1003__p13834268114716"><strong id="as_06_1003__b157324455">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_1003__row46833887114716"><td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.3.3.2.5.1.1 "><p id="as_06_1003__p35448540114716">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.3.2.5.1.2 "><p id="as_06_1003__p52759481114716">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.3.2.5.1.3 "><p id="as_06_1003__p45659550114716">String</p>
</td>
<td class="cellrowborder" valign="top" width="48%" headers="mcps1.3.3.3.2.5.1.4 "><p id="as_06_1003__p36520930">Specifies the project ID.</p>
</td>
</tr>
<tr id="as_06_1003__row66924761114716"><td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.3.3.2.5.1.1 "><p id="as_06_1003__p52196538114716">resource_type</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.3.2.5.1.2 "><p id="as_06_1003__p61217114716">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.3.2.5.1.3 "><p id="as_06_1003__p4958579114716">String</p>
</td>
<td class="cellrowborder" valign="top" width="48%" headers="mcps1.3.3.3.2.5.1.4 "><p id="as_06_1003__p75841038195410">Specifies the resource type. The option is as follows:</p>
<p id="as_06_1003__p1338315305567"><strong id="as_06_1003__b5223413648">scaling_group_tag</strong>: indicates that the resource type is AS groups.</p>
</td>
</tr>
<tr id="as_06_1003__row58034801114716"><td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.3.3.2.5.1.1 "><p id="as_06_1003__p3198450114716">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.3.2.5.1.2 "><p id="as_06_1003__p57747899114716">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.3.2.5.1.3 "><p id="as_06_1003__p47068277114716">String</p>
</td>
<td class="cellrowborder" valign="top" width="48%" headers="mcps1.3.3.3.2.5.1.4 "><p id="as_06_1003__p54434120114716">Resource ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="as_06_1003__section47087579114716"><h4 class="sectiontitle">Request Message</h4><ul id="as_06_1003__ul55997526114716"><li id="as_06_1003__li34215690114716">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_1003__table39505762114716" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="as_06_1003__row32657858114716"><th align="left" class="cellrowborder" valign="top" width="21%" id="mcps1.3.4.2.1.1.2.5.1.1"><p id="as_06_1003__p28040847114716"><strong id="as_06_1003__b12141532455">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.4.2.1.1.2.5.1.2"><p id="as_06_1003__p56716153114716">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18%" id="mcps1.3.4.2.1.1.2.5.1.3"><p id="as_06_1003__p30605671114716">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="41%" id="mcps1.3.4.2.1.1.2.5.1.4"><p id="as_06_1003__p63140290114716"><strong id="as_06_1003__b1478843164517">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_1003__row14089841114716"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.2.1.1.2.5.1.1 "><p id="as_06_1003__p4522712205810">tags</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.1.2.5.1.2 "><p id="as_06_1003__p45225124580">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.4.2.1.1.2.5.1.3 "><p id="as_06_1003__p6339193387">Array of <a href="#as_06_1003__table64069331114716">ResourceTag</a> objects</p>
</td>
<td class="cellrowborder" valign="top" width="41%" headers="mcps1.3.4.2.1.1.2.5.1.4 "><p id="as_06_1003__p1952218123585">Specifies the tag list. For details, see <a href="#as_06_1003__table64069331114716">Table 3</a>.</p>
<p id="as_06_1003__p552221225811">If <strong id="as_06_1003__b842352706104838">action</strong> is set to <strong id="as_06_1003__b842352706104848">delete</strong>, the tag structure cannot be missing, and the key cannot be left blank or an empty string.</p>
</td>
</tr>
<tr id="as_06_1003__row42939634114716"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.3.4.2.1.1.2.5.1.1 "><p id="as_06_1003__p452218127585">action</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.4.2.1.1.2.5.1.2 "><p id="as_06_1003__p16522012145815">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18%" headers="mcps1.3.4.2.1.1.2.5.1.3 "><p id="as_06_1003__p152241235813">String</p>
</td>
<td class="cellrowborder" valign="top" width="41%" headers="mcps1.3.4.2.1.1.2.5.1.4 "><p id="as_06_1003__p1152219121582">Specifies the operation ID. The value is case-sensitive and can be any of the following:</p>
<ul id="as_06_1003__ul181663201195"><li id="as_06_1003__li1016613201193"><strong id="as_06_1003__b842352706135945">delete</strong>: indicates deleting a tag.</li><li id="as_06_1003__li6166102001917"><strong id="as_06_1003__b842352706104918">create</strong>: indicates creating a tag. If the same key value already exists, it will be overwritten.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="as_06_1003__table64069331114716"></a><a name="table64069331114716"></a><table cellpadding="4" cellspacing="0" summary="" id="as_06_1003__table64069331114716" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="as_06_1003__b6699296094725">ResourceTag</strong> field description</caption><thead align="left"><tr id="as_06_1003__row5644334114716"><th align="left" class="cellrowborder" valign="top" width="20.588235294117645%" id="mcps1.3.4.2.1.2.2.5.1.1"><p id="as_06_1003__p54537872114716">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.607843137254903%" id="mcps1.3.4.2.1.2.2.5.1.2"><p id="as_06_1003__p55491527114716">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.607843137254903%" id="mcps1.3.4.2.1.2.2.5.1.3"><p id="as_06_1003__p65628731114716">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40.19607843137255%" id="mcps1.3.4.2.1.2.2.5.1.4"><p id="as_06_1003__p14326995114716">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_1003__row19635960114716"><td class="cellrowborder" valign="top" width="20.588235294117645%" headers="mcps1.3.4.2.1.2.2.5.1.1 "><p id="as_06_1003__p1224383015599">key</p>
</td>
<td class="cellrowborder" valign="top" width="19.607843137254903%" headers="mcps1.3.4.2.1.2.2.5.1.2 "><p id="as_06_1003__p62441630155916">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="19.607843137254903%" headers="mcps1.3.4.2.1.2.2.5.1.3 "><p id="as_06_1003__p02441330195919">String</p>
</td>
<td class="cellrowborder" valign="top" width="40.19607843137255%" headers="mcps1.3.4.2.1.2.2.5.1.4 "><p id="as_06_1003__p4781631122336">Specifies the tag key. Tag keys of a resource must be unique.</p>
<ul id="as_06_1003__ul16323643185717"><li id="as_06_1003__li18747152018277">A tag key contains a maximum of 36 Unicode characters and cannot be left blank. It can contain only digits, letters, hyphens (-), underscores (_), and at signs (@).</li><li id="as_06_1003__li114611655819">When <strong id="as_06_1003__b842352706105024">action</strong> is set to <strong id="as_06_1003__b842352706105027">delete</strong>, the tag character set is not verified, and a key contains a maximum of 127 Unicode characters.</li></ul>
</td>
</tr>
<tr id="as_06_1003__row33928679114716"><td class="cellrowborder" valign="top" width="20.588235294117645%" headers="mcps1.3.4.2.1.2.2.5.1.1 "><p id="as_06_1003__p4244143010594">value</p>
</td>
<td class="cellrowborder" valign="top" width="19.607843137254903%" headers="mcps1.3.4.2.1.2.2.5.1.2 "><p id="as_06_1003__p1624483018599">No</p>
</td>
<td class="cellrowborder" valign="top" width="19.607843137254903%" headers="mcps1.3.4.2.1.2.2.5.1.3 "><p id="as_06_1003__p4245530165910">String</p>
</td>
<td class="cellrowborder" valign="top" width="40.19607843137255%" headers="mcps1.3.4.2.1.2.2.5.1.4 "><p id="as_06_1003__p45707304223349">Specifies the tag value.</p>
<ul id="as_06_1003__ul944659195818"><li id="as_06_1003__li15215494284">A tag value contains a maximum of 43 Unicode characters and can be left blank. It can contain only digits, letters, hyphens (-), underscores (_), and at signs (@).</li><li id="as_06_1003__li134031211582">When <strong id="as_06_1003__b219764743">action</strong> is set to <strong id="as_06_1003__b1804310095">delete</strong>, the tag character set is not verified, and a value contains a maximum of 255 Unicode characters. If <strong id="as_06_1003__b84235270611421">value</strong> is specified, tags are deleted by key and value. If <strong id="as_06_1003__b842352706114252">value</strong> is not specified, tags are deleted by key.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="as_06_1003__ul19018078114716"><li id="as_06_1003__li49016700114716">Example request<p id="as_06_1003__p11449155453811"><a name="as_06_1003__li49016700114716"></a><a name="li49016700114716"></a>This example shows how to add two tags (key = <strong id="as_06_1003__b84235270620268">ENV15</strong> and value = <strong id="as_06_1003__b842352706202555">ENV15</strong>) and (key = <strong id="as_06_1003__b842352706202558">ENV151</strong> and value = <strong id="as_06_1003__b84235270620263">ENV151</strong>) to the AS group with ID <strong id="as_06_1003__b842352706202549">e5d27f5c-dd76-4a61-b4bc-a67c5686719a</strong>.</p>
<pre class="screen" id="as_06_1003__screen149226455382">POST https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_group_tag/e5d27f5c-dd76-4a61-b4bc-a67c5686719a/tags/action
{
"tags": [
{
"key": "ENV15",
"value": "ENV15"
},
{
"key": "ENV151",
"value": "ENV151"
}
],
"action": "create"
}</pre>
</li></ul>
</div>
<div class="section" id="as_06_1003__section11862673114716"><h4 class="sectiontitle">Response Message</h4><ul id="as_06_1003__ul49926818"><li id="as_06_1003__li23646388">Response parameters<p id="as_06_1003__p4284774320370"><a name="as_06_1003__li23646388"></a><a name="li23646388"></a>None</p>
</li><li id="as_06_1003__li299069979413">Example response<p id="as_06_1003__p6165130820374"><a name="as_06_1003__li299069979413"></a><a name="li299069979413"></a>None</p>
</li></ul>
</div>
<div class="section" id="as_06_1003__section57954106114716"><h4 class="sectiontitle">Returned Values</h4><ul id="as_06_1003__ul63770982114716"><li id="as_06_1003__li37067933114716">Normal<p id="as_06_1003__p65175943114716"><a name="as_06_1003__li37067933114716"></a><a name="li37067933114716"></a>204</p>
</li><li id="as_06_1003__li49712583114716">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="as_06_1003__table44760069114716" frame="border" border="1" rules="all"><thead align="left"><tr id="as_06_1003__row21851625114716"><th align="left" class="cellrowborder" valign="top" width="43.5%" id="mcps1.3.6.2.2.1.1.3.1.1"><p id="as_06_1003__p25151238114716">Returned Value</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.49999999999999%" id="mcps1.3.6.2.2.1.1.3.1.2"><p id="as_06_1003__p23984387114716">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="as_06_1003__row63687176114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p58387646114716">400 Bad Request</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p31778892114716">The server failed to process the request.</p>
</td>
</tr>
<tr id="as_06_1003__row17574580114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p14254907114716">401 Unauthorized</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p13796781114716">You must enter the username and password to access the requested page.</p>
</td>
</tr>
<tr id="as_06_1003__row57062171114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p58633115114716">403 Forbidden</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p51661884114716">You are forbidden to access the requested page.</p>
</td>
</tr>
<tr id="as_06_1003__row62303776114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p13441109114716">404 Not Found</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p14988030114716">The server could not find the requested page.</p>
</td>
</tr>
<tr id="as_06_1003__row674546114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p54638245114716">405 Method Not Allowed</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p63621696114716">You are not allowed to use the method specified in the request.</p>
</td>
</tr>
<tr id="as_06_1003__row35724356114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p7991760114716">406 Not Acceptable</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p43352791114716">The response generated by the server could not be accepted by the client.</p>
</td>
</tr>
<tr id="as_06_1003__row54630805114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p63019107114716">407 Proxy Authentication Required</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p4274017114716">You must use the proxy server for authentication to process the request.</p>
</td>
</tr>
<tr id="as_06_1003__row38466153114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p28750707114716">408 Request Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p47105921114716">The request timed out.</p>
</td>
</tr>
<tr id="as_06_1003__row21300109114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p47587293114716">409 Conflict</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p29365542114716">The request could not be processed due to a conflict.</p>
</td>
</tr>
<tr id="as_06_1003__row62963287114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p66861447114716">500 Internal Server Error</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p47068099114716">Failed to complete the request because an internal service error occurred.</p>
</td>
</tr>
<tr id="as_06_1003__row20959714114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p20015260114716">501 Not Implemented</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p10623383114716">Failed to complete the request because the server does not support the requested function.</p>
</td>
</tr>
<tr id="as_06_1003__row28501588114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p26927315114716">502 Bad Gateway</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p33628902114716">Failed to complete the request because the server has received an invalid response.</p>
</td>
</tr>
<tr id="as_06_1003__row34224667114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p20734632114716">503 Service Unavailable</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p1783613114716">Failed to complete the request because the system is currently unavailable.</p>
</td>
</tr>
<tr id="as_06_1003__row16052523114716"><td class="cellrowborder" valign="top" width="43.5%" headers="mcps1.3.6.2.2.1.1.3.1.1 "><p id="as_06_1003__p25185952114716">504 Gateway Timeout</p>
</td>
<td class="cellrowborder" valign="top" width="56.49999999999999%" headers="mcps1.3.6.2.2.1.1.3.1.2 "><p id="as_06_1003__p26796209114716">A gateway timeout error occurred.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="as_06_1003__section17669131616110"><h4 class="sectiontitle">Error Codes</h4><p id="as_06_1003__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_1000.html">Tags</a></div>
</div>
</div>