doc-exports/docs/dws/api-ref/dws_02_0047.html
Lu, Huayi 24f47208ec DWS API 831.100 version
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com>
Co-authored-by: Lu, Huayi <luhuayi@huawei.com>
Co-committed-by: Lu, Huayi <luhuayi@huawei.com>
2024-10-07 10:18:56 +00:00

190 lines
15 KiB
HTML

<a name="EN-US_TOPIC_0000001185673164"></a><a name="EN-US_TOPIC_0000001185673164"></a>
<h1 class="topictitle1">Adding or Deleting Resource Tags in Batches</h1>
<div id="body1524298666228"><div class="section" id="EN-US_TOPIC_0000001185673164__section961342216326"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001185673164__p10850132213218">This API is used to add or delete tags in batches for a specified resource. A maximum of 10 tags can be added for one resource.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section3616162211329"><h4 class="sectiontitle">URI</h4><pre class="screen" id="EN-US_TOPIC_0000001185673164__screen57624166115">POST /v1.0/{project_id}/clusters/{resource_id}/tags/action</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673164__table8814122482018" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673164__row38121024112015"><th align="left" class="cellrowborder" valign="top" width="16.97%" id="mcps1.3.2.3.2.5.1.1"><p id="EN-US_TOPIC_0000001185673164__p481222402020"><strong id="EN-US_TOPIC_0000001185673164__b1014278746113643">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.67%" id="mcps1.3.2.3.2.5.1.2"><p id="EN-US_TOPIC_0000001185673164__p10812924122010"><strong id="EN-US_TOPIC_0000001185673164__b84235270684256">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="11.39%" id="mcps1.3.2.3.2.5.1.3"><p id="EN-US_TOPIC_0000001185673164__p19812024132011"><strong id="EN-US_TOPIC_0000001185673164__b2092674802113643">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="60.97%" id="mcps1.3.2.3.2.5.1.4"><p id="EN-US_TOPIC_0000001185673164__p1812192412202"><strong id="EN-US_TOPIC_0000001185673164__b183815522312">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185673164__row481311241202"><td class="cellrowborder" valign="top" width="16.97%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p781252411202">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="10.67%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p18131024112020">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="11.39%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p9813192412202">String</p>
</td>
<td class="cellrowborder" valign="top" width="60.97%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p108136241206">Project ID. For details about how to obtain the project ID, see <a href="dws_02_0011.html">Obtaining a Project ID</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row881312244201"><td class="cellrowborder" valign="top" width="16.97%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p20813924152011">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="10.67%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p11813324182016">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="11.39%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p7813142418204">String</p>
</td>
<td class="cellrowborder" valign="top" width="60.97%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p681362416208">Resource ID, for example, <strong id="EN-US_TOPIC_0000001185673164__b1118031274113643">7d85f602-a948-4a30-afd4-e84f47471c15</strong>.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section138362454207"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673164__table2817135718208" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request body parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673164__row118171578206"><th align="left" class="cellrowborder" valign="top" width="17.818218178182182%" id="mcps1.3.3.2.2.5.1.1"><p id="EN-US_TOPIC_0000001185673164__p4817457102018"><strong id="EN-US_TOPIC_0000001185673164__b555759865113643">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.05899410058994%" id="mcps1.3.3.2.2.5.1.2"><p id="EN-US_TOPIC_0000001185673164__p1581765782012"><strong id="EN-US_TOPIC_0000001185673164__b1382860531">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.938606139386062%" id="mcps1.3.3.2.2.5.1.3"><p id="EN-US_TOPIC_0000001185673164__p1381816579207"><strong id="EN-US_TOPIC_0000001185673164__b1226411756113643">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.18418158184181%" id="mcps1.3.3.2.2.5.1.4"><p id="EN-US_TOPIC_0000001185673164__p10818857192013"><strong id="EN-US_TOPIC_0000001185673164__b5591924329">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185673164__row08181657112015"><td class="cellrowborder" valign="top" width="17.818218178182182%" headers="mcps1.3.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p208181157102016">tags</p>
</td>
<td class="cellrowborder" valign="top" width="10.05899410058994%" headers="mcps1.3.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p18818657162014">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.938606139386062%" headers="mcps1.3.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p98181257172018">List&lt;<a href="#EN-US_TOPIC_0000001185673164__table98198573205">ResourceTag</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="58.18418158184181%" headers="mcps1.3.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p4818057122014">Tag list.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row0818115711208"><td class="cellrowborder" valign="top" width="17.818218178182182%" headers="mcps1.3.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p188185572203">action</p>
</td>
<td class="cellrowborder" valign="top" width="10.05899410058994%" headers="mcps1.3.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p28188571202">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.938606139386062%" headers="mcps1.3.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p178191557122018">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.18418158184181%" headers="mcps1.3.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p1581925720203">Identifies the operation. The value can be <strong id="EN-US_TOPIC_0000001185673164__b842352706112823">create</strong> or <strong id="EN-US_TOPIC_0000001185673164__b842352706112836">delete</strong>.</p>
<ul id="EN-US_TOPIC_0000001185673164__ul2081910577204"><li id="EN-US_TOPIC_0000001185673164__li11819195710208"><strong id="EN-US_TOPIC_0000001185673164__b84235270611286">create</strong>: adds tags in batches.</li><li id="EN-US_TOPIC_0000001185673164__li38191957122016"><strong id="EN-US_TOPIC_0000001185673164__b84235270611295">delete</strong>: deletes tags in batches.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001185673164__table98198573205"></a><a name="table98198573205"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673164__table98198573205" frame="border" border="1" rules="all"><caption><b>Table 3 </b>resource_tag</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185673164__row4819057172017"><th align="left" class="cellrowborder" valign="top" width="17.580000000000002%" id="mcps1.3.3.3.2.5.1.1"><p id="EN-US_TOPIC_0000001185673164__p8819175782013"><strong id="EN-US_TOPIC_0000001185673164__b107161953321">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="10.18%" id="mcps1.3.3.3.2.5.1.2"><p id="EN-US_TOPIC_0000001185673164__p1381935713205"><strong id="EN-US_TOPIC_0000001185673164__b790861639">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.06%" id="mcps1.3.3.3.2.5.1.3"><p id="EN-US_TOPIC_0000001185673164__p1582011572204"><strong id="EN-US_TOPIC_0000001185673164__b872596091113643">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.18%" id="mcps1.3.3.3.2.5.1.4"><p id="EN-US_TOPIC_0000001185673164__p1182065717203"><strong id="EN-US_TOPIC_0000001185673164__b1953698183217">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185673164__row16820135720206"><td class="cellrowborder" valign="top" width="17.580000000000002%" headers="mcps1.3.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p1482055772012">key</p>
</td>
<td class="cellrowborder" valign="top" width="10.18%" headers="mcps1.3.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p17820125714203">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.06%" headers="mcps1.3.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p12820165742010">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.18%" headers="mcps1.3.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p13820105716206">Tag key. A tag key can contain a maximum of 36 Unicode characters, which cannot be null. The first and last characters cannot be spaces.</p>
<p id="EN-US_TOPIC_0000001185673164__p982095772010">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row282011571208"><td class="cellrowborder" valign="top" width="17.580000000000002%" headers="mcps1.3.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185673164__p20820105752011">value</p>
</td>
<td class="cellrowborder" valign="top" width="10.18%" headers="mcps1.3.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185673164__p782035762014">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.06%" headers="mcps1.3.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185673164__p1382115578200">String</p>
</td>
<td class="cellrowborder" valign="top" width="58.18%" headers="mcps1.3.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185673164__p882115742015">Key value. A tag value can contain a maximum of 43 Unicode characters, which can be null. The first and last characters cannot be spaces.</p>
<p id="EN-US_TOPIC_0000001185673164__p782135715201">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section1841717108213"><h4 class="sectiontitle">Response Parameters</h4><p id="EN-US_TOPIC_0000001185673164__p8343121562120">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section96421022183220"><h4 class="sectiontitle">Example Request</h4><ul id="EN-US_TOPIC_0000001185673164__ul6852182212326"><li id="EN-US_TOPIC_0000001185673164__li13891162211426">Sample request for adding tags in batches<pre class="screen" id="EN-US_TOPIC_0000001185673164__screen1347173614419">POST /v1.0/89cd04f168b84af6be287f71730fdb4b/clusters/7d85f602-a948-4a30-afd4-e84f47471c15/tags/action
{
"action": "create",
"tags": [
{
"key": "Flower",
"value": "rose"
},
{
"key": "Food",
"value": "pie"
}
]
}</pre>
</li><li id="EN-US_TOPIC_0000001185673164__li14434316423">Sample request for deleting tags in batches<pre class="screen" id="EN-US_TOPIC_0000001185673164__screen12938182294217">POST /v1.0/89cd04f168b84af6be287f71730fdb4b/clusters/7d85f602-a948-4a30-afd4-e84f47471c15/tags/action
{
"action": "delete",
"tags": [
{
"key": "Flower",
"value": "rose"
},
{
"key": "Food",
"value": "pie"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section1267862233212"><h4 class="sectiontitle">Response Message</h4><p id="EN-US_TOPIC_0000001185673164__p19894163419213">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185673164__section367910228327"><h4 class="sectiontitle">Status Code</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185673164__table5682122263215" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001185673164__row13855122218322"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.7.2.1.3.1.1"><p id="EN-US_TOPIC_0000001185673164__p188551522163210"><strong id="EN-US_TOPIC_0000001185673164__b84235270611397">Returned Value</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.7.2.1.3.1.2"><p id="EN-US_TOPIC_0000001185673164__p8855102283212"><strong id="EN-US_TOPIC_0000001185673164__b14713916163213">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185673164__row16139184272118"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p16139114282119">204</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p11139942192118">Tags are added or deleted in batches.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row17855722163216"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p785572213216">400</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p88559223327">Invalid tag.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row1085562212325"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p15855102243213">401</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p885518226328">Authentication failed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row12855622183220"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p385532293210">403</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p38551822153220">Insufficient permission.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row198552222326"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p13855022103219">404</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p19855222183220">No resources found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185673164__row1885502219326"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185673164__p78551522163211">500</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.7.2.1.3.1.2 "><p id="EN-US_TOPIC_0000001185673164__p12855182213325">Internal service error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="dws_02_0045.html">Tag Management APIs</a></div>
</div>
</div>