doc-exports/docs/dws/api-ref/dws_02_0046.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

158 lines
13 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><pre class="screen" id="EN-US_TOPIC_0000001185833146__screen73881204118">POST /v1.0/{project_id}/clusters/{resource_id}/tags</pre>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table2972632131717" frame="border" border="1" rules="all"><caption><b>Table 1 </b>URI parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row9971123214171"><th align="left" class="cellrowborder" valign="top" width="14.42%" id="mcps1.3.2.3.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p159717324173"><strong id="EN-US_TOPIC_0000001185833146__b1074156709113648">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.58%" id="mcps1.3.2.3.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p097116329177"><strong id="EN-US_TOPIC_0000001185833146__b84235270684256">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.61%" id="mcps1.3.2.3.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p1897163271717"><strong id="EN-US_TOPIC_0000001185833146__b1999851010113648">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="63.39%" id="mcps1.3.2.3.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p5971532151715"><strong id="EN-US_TOPIC_0000001185833146__b117745133113">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row197213251720"><td class="cellrowborder" valign="top" width="14.42%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p109711232191713">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="9.58%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p7971143291712">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.61%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p297119329178">String</p>
</td>
<td class="cellrowborder" valign="top" width="63.39%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p1597243215171">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__row11972632201712"><td class="cellrowborder" valign="top" width="14.42%" headers="mcps1.3.2.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p4972163291711">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="9.58%" headers="mcps1.3.2.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p199721732181711">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.61%" headers="mcps1.3.2.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p597233216176">String</p>
</td>
<td class="cellrowborder" valign="top" width="63.39%" headers="mcps1.3.2.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p20972133212172">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>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section20626170161811"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table1207591180" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request body parameters</caption><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row02077919185"><th align="left" class="cellrowborder" valign="top" width="14.2985701429857%" id="mcps1.3.3.2.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p820718917186"><strong id="EN-US_TOPIC_0000001185833146__b884370022113648">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.819018098190181%" id="mcps1.3.3.2.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p820859111813"><strong id="EN-US_TOPIC_0000001185833146__b705784931">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.60873912608739%" id="mcps1.3.3.2.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p52081596184"><strong id="EN-US_TOPIC_0000001185833146__b1229675677113648">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="63.273672632736734%" id="mcps1.3.3.2.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p1020815971820"><strong id="EN-US_TOPIC_0000001185833146__b189448147316">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row1208495184"><td class="cellrowborder" valign="top" width="14.2985701429857%" headers="mcps1.3.3.2.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p520829101814">tag</p>
</td>
<td class="cellrowborder" valign="top" width="9.819018098190181%" headers="mcps1.3.3.2.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p2208991184">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.60873912608739%" headers="mcps1.3.3.2.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p112081951815"><a href="#EN-US_TOPIC_0000001185833146__table12208596184">tag</a> object</p>
</td>
<td class="cellrowborder" valign="top" width="63.273672632736734%" headers="mcps1.3.3.2.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p7208791186">Tags.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0000001185833146__table12208596184"></a><a name="table12208596184"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table12208596184" 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__row182092913182"><th align="left" class="cellrowborder" valign="top" width="14.2985701429857%" id="mcps1.3.3.3.2.5.1.1"><p id="EN-US_TOPIC_0000001185833146__p12091294184"><strong id="EN-US_TOPIC_0000001185833146__b760716189315">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="9.819018098190181%" id="mcps1.3.3.3.2.5.1.2"><p id="EN-US_TOPIC_0000001185833146__p22091793189"><strong id="EN-US_TOPIC_0000001185833146__b933738938">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="12.60873912608739%" id="mcps1.3.3.3.2.5.1.3"><p id="EN-US_TOPIC_0000001185833146__p1220913912188"><strong id="EN-US_TOPIC_0000001185833146__b1622727115113648">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="63.273672632736734%" id="mcps1.3.3.3.2.5.1.4"><p id="EN-US_TOPIC_0000001185833146__p192091593182"><strong id="EN-US_TOPIC_0000001185833146__b6423202103115">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0000001185833146__row02091799186"><td class="cellrowborder" valign="top" width="14.2985701429857%" headers="mcps1.3.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p132091297188">key</p>
</td>
<td class="cellrowborder" valign="top" width="9.819018098190181%" headers="mcps1.3.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p8209129121818">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.60873912608739%" headers="mcps1.3.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p2210993186">String</p>
</td>
<td class="cellrowborder" valign="top" width="63.273672632736734%" headers="mcps1.3.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p52101996183">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__p72102911188">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__row1321019911811"><td class="cellrowborder" valign="top" width="14.2985701429857%" headers="mcps1.3.3.3.2.5.1.1 "><p id="EN-US_TOPIC_0000001185833146__p132101916180">value</p>
</td>
<td class="cellrowborder" valign="top" width="9.819018098190181%" headers="mcps1.3.3.3.2.5.1.2 "><p id="EN-US_TOPIC_0000001185833146__p12210179131812">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="12.60873912608739%" headers="mcps1.3.3.3.2.5.1.3 "><p id="EN-US_TOPIC_0000001185833146__p192101998185">String</p>
</td>
<td class="cellrowborder" valign="top" width="63.273672632736734%" headers="mcps1.3.3.3.2.5.1.4 "><p id="EN-US_TOPIC_0000001185833146__p192101392189">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>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section31618188182"><h4 class="sectiontitle">Response Parameters</h4><p id="EN-US_TOPIC_0000001185833146__p6427152501816">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section177454283320"><h4 class="sectiontitle">Example Request</h4><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>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section1267862233212"><h4 class="sectiontitle">Example Responses</h4><p id="EN-US_TOPIC_0000001185833146__p106661350181818">None</p>
</div>
<div class="section" id="EN-US_TOPIC_0000001185833146__section12791174212331"><h4 class="sectiontitle">Status Code</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001185833146__table079410423337" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0000001185833146__row1890018421333"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.7.2.1.3.1.1"><p id="EN-US_TOPIC_0000001185833146__p590014263316"><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.7.2.1.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__row1150113120193"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p919113551918">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_0000001185833146__p1319113521916">Tags added.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row15900134293311"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p390016425330">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_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.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p59001542133319">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_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.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p109004427335">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_0000001185833146__p6900154293315">Insufficient permission.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row149007426339"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p209006420331">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_0000001185833146__p18900642183316">No resources found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0000001185833146__row129001842173315"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.7.2.1.3.1.1 "><p id="EN-US_TOPIC_0000001185833146__p11900342133310">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_0000001185833146__p169001642103316">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>