doc-exports/docs/dws/api-ref/dws_02_0046.html
Lu, Huayi 3d88b677fd DWS API 830.201 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-05-10 13:18:08 +00:00

169 lines
14 KiB
HTML

<a name="EN-US_TOPIC_0000001185833146"></a><a name="EN-US_TOPIC_0000001185833146"></a>
<h1 class="topictitle1">Adding a Resource Tag</h1>
<div id="body1524298666228"><div class="section" id="EN-US_TOPIC_0000001185833146__section1575619425339"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0000001185833146__p5893242193310">This API is used to add a resource tag for a resource. A maximum of 10 tags can be added for one resource.</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section875774253320"><h4 class="sectiontitle">URI</h4><ul id="EN-US_TOPIC_0000001185833146__ul389384214334"><li id="EN-US_TOPIC_0000001185833146__li1893742133316">URI format<pre class="screen" id="EN-US_TOPIC_0000001185833146__screen73881204118">POST /v1.0/{project_id}/clusters/{resource_id}/tags</pre>
</li><li id="EN-US_TOPIC_0000001185833146__li3894174263314">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table157630425330" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row19894154214335"><th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p12894154253318"><strong id="EN-US_TOPIC_0000001185833146__b44439534309">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p158941442123317"><strong id="EN-US_TOPIC_0000001185833146__b84235270684256">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p1389411427332"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="59%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p1089414220333"><strong id="EN-US_TOPIC_0000001185833146__b117745133113">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row15894184214336"><td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p1889410428338">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p1689474219337">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p11894154210333">String</p>
</td>
<td class="cellrowborder" valign="top" width="59%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p14202648155510">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_0000001185833146__row13895154219336"><td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p13895154223310">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p08955423332">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p188955425332">String</p>
</td>
<td class="cellrowborder" valign="top" width="59%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p158951842193319">Resource ID. Currently, you can only add tags to a cluster, so specify this parameter to the cluster ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section177454283320"><h4 class="sectiontitle">Request Message</h4><ul id="EN-US_TOPIC_0000001185833146__ul28961442143317"><li id="EN-US_TOPIC_0000001185833146__li19642544114018">Request example<pre class="screen" id="EN-US_TOPIC_0000001185833146__screen23631847184015">POST /v1.0/89cd04f168b84af6be287f71730fdb4b/clusters/7d85f602-a948-4a30-afd4-e84f47471c15/tags
{
"tag":
{
"key":"Flower",
"value":"rose"
}
}</pre>
</li><li id="EN-US_TOPIC_0000001185833146__li12896174215338">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table8775154243312" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row689694212335"><th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.2.1.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p1289694223319"><strong id="EN-US_TOPIC_0000001185833146__b1374761253115">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.2.1.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p589644283312"><strong id="EN-US_TOPIC_0000001185833146__b1009693427">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.3.2.2.1.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p489684217332"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.99999999999999%" id="mcps1.3.3.2.2.1.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p889664283319"><strong id="EN-US_TOPIC_0000001185833146__b189448147316">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row589624293319"><td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p1389616422333">tag</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p1089614263318">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p789844219336"><a href="#EN-US_TOPIC_0000001185833146__table354113151341">tag</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="57.99999999999999%" headers="mcps1.3.3.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p8898124293318">Tags.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001185833146__table354113151341"></a><a name="table354113151341"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table354113151341" frame="border" border="1" rules="all"><caption><b>Table 3 </b><strong id="EN-US_TOPIC_0000001185833146__b84235270695528">tag</strong> field description</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row75500152343"><th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.3.2.2.2.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p1055331553419"><strong id="EN-US_TOPIC_0000001185833146__b760716189315">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.3.2.2.2.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p1955513152341"><strong id="EN-US_TOPIC_0000001185833146__b1691242476">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.3.2.2.2.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p14556111515343"><strong>Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.99999999999999%" id="mcps1.3.3.2.2.2.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p25591515193418"><strong id="EN-US_TOPIC_0000001185833146__b6423202103115">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row456181593412"><td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p7564151563419">key</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p0567115143415">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p2569191518343">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.99999999999999%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p75721115103417">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_0000001185833146__p922511632019">It can contain uppercase letters (A to Z), lowercase letters (a to z), digits (0-9), hyphens (-), and underscores (_).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row457371583412"><td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p4575515143418">value</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p17578015193411">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p18579815123412">String</p>
</td>
<td class="cellrowborder" valign="top" width="57.99999999999999%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p9582161516342">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. It can contain uppercase letters (A to Z), lowercase letters (a to z), digits (0-9), hyphens (-), and underscores (_).</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section1267862233212"><h4 class="sectiontitle">Response Message</h4><p id="EN-US_TOPIC_0000001185833146__en-us_topic_0067625516_p070316818262">Example response</p>
<pre class="screen" id="EN-US_TOPIC_0000001185833146__sabffaf8806d04531be3a32b013bf56e3">status CODE 204</pre>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section12791174212331"><h4 class="sectiontitle">Status Code</h4><ul id="EN-US_TOPIC_0000001185833146__ul589917423335"><li id="EN-US_TOPIC_0000001185833146__li1689913427332">Normal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table14791154243313" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Returned value for successful requests</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row189919424333"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.5.2.1.1.2.3.1.1"><p id="EN-US_TOPIC_0000001185833146__p19899154215335"><strong id="EN-US_TOPIC_0000001185833146__b842352706111354">Returned Value</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.5.2.1.1.2.3.1.2"><p id="EN-US_TOPIC_0000001185833146__p13899134214337"><strong id="EN-US_TOPIC_0000001185833146__b8180123133112">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row0899134215334"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.1.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p1889934213310">204</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.1.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p159001442163319">No Content</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0000001185833146__li19900542133320">Exception
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table079410423337" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Returned value for failed requests</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row1890018421333"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.5.2.2.1.2.3.1.1"><p id="EN-US_TOPIC_0000001185833146__p590014263316"><strong id="EN-US_TOPIC_0000001185833146__b2138132172">Returned Value</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.5.2.2.1.2.3.1.2"><p id="EN-US_TOPIC_0000001185833146__p1790014263315"><strong id="EN-US_TOPIC_0000001185833146__b18999233133114">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row15900134293311"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p390016425330">400</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p16900194213316">Invalid tag.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row1890044213335"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p59001542133319">401</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p69001642163314">Authentication failed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row1890014253315"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p109004427335">403</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p6900154293315">You do not have the permission to perform the operation.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row149007426339"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p209006420331">404</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p18900642183316">The requested resource was not found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row129001842173315"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.2.1.2.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p11900342133310">500</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.2.1.2.3.1.2 "><p id="EN-US_TOPIC_0000001185833146__p169001642103316">Internal service error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</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>