forked from docs/doc-exports
Reviewed-by: Bobkova, Natalia <natalia.bobkova@t-systems.com> Co-authored-by: Zaoxu, Li <lizaoxu@huawei.com> Co-committed-by: Zaoxu, Li <lizaoxu@huawei.com>
138 lines
12 KiB
HTML
138 lines
12 KiB
HTML
<a name="smn_api_56003"></a><a name="smn_api_56003"></a>
|
|
|
|
<h1 class="topictitle1">Adding a Tag</h1>
|
|
<div id="body1523350913840"><div class="section" id="smn_api_56003__section6275354111818"><h4 class="sectiontitle">Description</h4><ul id="smn_api_56003__ul33304380203733"><li id="smn_api_56003__li51147505203733">API name<p id="smn_api_56003__p38624841203741"><a name="smn_api_56003__li51147505203733"></a><a name="li51147505203733"></a>CreateResourceTag</p>
|
|
</li></ul>
|
|
<ul id="smn_api_56003__ul20998054203745"><li id="smn_api_56003__li46884910203750">Function<p id="smn_api_56003__p1663642517323"><a name="smn_api_56003__li46884910203750"></a><a name="li46884910203750"></a>You can add a maximum of 20 tags to a resource.</p>
|
|
<p id="smn_api_56003__p6634154131819">The API is idempotent. If a to-be-created tag has the same key as an existing tag, the tag will be created and overwrite the existing one.</p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56003__section12757544187"><h4 class="sectiontitle">URI</h4><ul id="smn_api_56003__ul9634254141820"><li id="smn_api_56003__li96341154191814">URI format<p id="smn_api_56003__p1863405461812"><a name="smn_api_56003__li96341154191814"></a><a name="li96341154191814"></a>POST /v2/{project_id}/{resource_type}/{resource_id}/tags</p>
|
|
</li><li id="smn_api_56003__li4634125417181">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56003__table1029119541182" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56003__row6634135420184"><th align="left" class="cellrowborder" valign="top" width="17.738226177382263%" id="mcps1.3.2.2.2.1.1.5.1.1"><p id="smn_api_56003__p0650125431810"><strong id="smn_api_56003__b842352706191030">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="23.357664233576642%" id="mcps1.3.2.2.2.1.1.5.1.2"><p id="smn_api_56003__p1465005418189"><strong id="smn_api_56003__b593421527191713">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="26.027397260273972%" id="mcps1.3.2.2.2.1.1.5.1.3"><p id="smn_api_56003__p0650175419188"><strong id="smn_api_56003__b84235270619112">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="32.87671232876712%" id="mcps1.3.2.2.2.1.1.5.1.4"><p id="smn_api_56003__p156507545182"><strong id="smn_api_56003__b84235270619115">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56003__row4650165421816"><td class="cellrowborder" valign="top" width="17.738226177382263%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56003__p3650854151810">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.357664233576642%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56003__p1365025412188">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.027397260273972%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56003__p186502054111811">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="32.87671232876712%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56003__p1665018541188">Project ID</p>
|
|
<p id="smn_api_56003__p118812918506">See <a href="smn_api_66000.html">Obtaining a Project ID</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56003__row19650165415182"><td class="cellrowborder" valign="top" width="17.738226177382263%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56003__p99531421797">resource_type</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.357664233576642%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56003__p1495310421799">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.027397260273972%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56003__p149531342296">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="32.87671232876712%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56003__p52661238184213">Resource type</p>
|
|
<p id="smn_api_56003__p2132642131918">Only <strong id="smn_api_56003__b419116426340">smn_topic</strong> (topic) is supported.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56003__row0650054191817"><td class="cellrowborder" valign="top" width="17.738226177382263%" headers="mcps1.3.2.2.2.1.1.5.1.1 "><p id="smn_api_56003__p1363485413187">resource_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="23.357664233576642%" headers="mcps1.3.2.2.2.1.1.5.1.2 "><p id="smn_api_56003__p463417547182">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="26.027397260273972%" headers="mcps1.3.2.2.2.1.1.5.1.3 "><p id="smn_api_56003__p7634195417180">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="32.87671232876712%" headers="mcps1.3.2.2.2.1.1.5.1.4 "><p id="smn_api_56003__p176341254201810">Resource ID</p>
|
|
<p id="smn_api_56003__p57491711103514">Obtain a resource ID:</p>
|
|
<ul id="smn_api_56003__ul111761720155610"><li id="smn_api_56003__smn_api_56002_li969342316131">Add <strong id="smn_api_56003__smn_api_56002_b1745003620">X-SMN-RESOURCEID-TYPE=name</strong> in the request header and set the resource ID to the topic name.</li><li id="smn_api_56003__smn_api_56002_li1669312233134">Call the <strong id="smn_api_56003__smn_api_56002_b84235270694340">GetResourceInstances</strong> API to obtain the resource ID.</li></ul>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56003__section15306154161813"><h4 class="sectiontitle">Request</h4><ul id="smn_api_56003__ul365015417185"><li id="smn_api_56003__li116501654111816">Parameter description
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56003__table2306754131811" frame="border" border="1" rules="all"><thead align="left"><tr id="smn_api_56003__row10650115416183"><th align="left" class="cellrowborder" valign="top" width="16.13838616138386%" id="mcps1.3.3.2.1.1.1.5.1.1"><p id="smn_api_56003__p2650155410184"><strong id="smn_api_56003__b925226853">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="21.837816218378165%" id="mcps1.3.3.2.1.1.1.5.1.2"><p id="smn_api_56003__p3650185481810"><strong id="smn_api_56003__b843143595">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.45835416458354%" id="mcps1.3.3.2.1.1.1.5.1.3"><p id="smn_api_56003__p16501254141811"><strong id="smn_api_56003__b448338107">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="45.56544345565444%" id="mcps1.3.3.2.1.1.1.5.1.4"><p id="smn_api_56003__p1765017544189"><strong id="smn_api_56003__b1589956463">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56003__row465019548182"><td class="cellrowborder" valign="top" width="16.13838616138386%" headers="mcps1.3.3.2.1.1.1.5.1.1 "><p id="smn_api_56003__p26501954141814">tag</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="21.837816218378165%" headers="mcps1.3.3.2.1.1.1.5.1.2 "><p id="smn_api_56003__p13650175411819">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.45835416458354%" headers="mcps1.3.3.2.1.1.1.5.1.3 "><p id="smn_api_56003__p12650654151819">Resource_tag structure</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="45.56544345565444%" headers="mcps1.3.3.2.1.1.1.5.1.4 "><p id="smn_api_56003__p8650554201817">Tag to be added. For details, see <a href="#smn_api_56003__table1127111434346">Table 1</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<div class="tablenoborder"><a name="smn_api_56003__table1127111434346"></a><a name="table1127111434346"></a><table cellpadding="4" cellspacing="0" summary="" id="smn_api_56003__table1127111434346" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Resource_tag structure</caption><thead align="left"><tr id="smn_api_56003__smn_api_56001_row139311651171713"><th align="left" class="cellrowborder" valign="top" width="24.672467246724672%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="smn_api_56003__smn_api_56001_p993135161718"><strong id="smn_api_56003__smn_api_56001_b6377153915111">Parameter</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="16.5016501650165%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="smn_api_56003__smn_api_56001_p13931451141710"><strong id="smn_api_56003__smn_api_56001_b496436261">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.291529152915292%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="smn_api_56003__smn_api_56001_p393125141712"><strong id="smn_api_56003__smn_api_56001_b36311841175120">Description</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="43.53435343534354%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="smn_api_56003__smn_api_56001_p1715443212610"><strong id="smn_api_56003__smn_api_56001_b134437429517">Constraint</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="smn_api_56003__smn_api_56001_row3931105113173"><td class="cellrowborder" valign="top" width="24.672467246724672%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="smn_api_56003__smn_api_56001_p17931145131711">key</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.5016501650165%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="smn_api_56003__smn_api_56001_p16931751111714">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.291529152915292%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="smn_api_56003__smn_api_56001_p393175116171">Tag key</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.53435343534354%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="smn_api_56003__smn_api_56001_p171314419267">A key can contain up to 36 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A key cannot be left blank, be an empty string, or start or end with a space.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="smn_api_56003__smn_api_56001_row39312515173"><td class="cellrowborder" valign="top" width="24.672467246724672%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="smn_api_56003__smn_api_56001_p09311651171711">value</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="16.5016501650165%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="smn_api_56003__smn_api_56001_p14931751141720">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.291529152915292%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="smn_api_56003__smn_api_56001_p159313515179">Tag value</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="43.53435343534354%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="smn_api_56003__smn_api_56001_p344164632615">A value can contain up to 43 Unicode characters, including only digits, letters, hyphens (-), and underscores (_). A value can be an empty string, but it cannot start or end with a space.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="smn_api_56003__ul156505545181"><li id="smn_api_56003__li1765015471818">Example request<pre class="screen" id="smn_api_56003__screen2650135413180">POST https://{SMN_Endpoint}/v2/{project_id}/{resource_type}/{resource_id}/tags</pre>
|
|
</li></ul>
|
|
<ul id="smn_api_56003__ul465065410183"><li id="smn_api_56003__li1265095491813">Example request<pre class="screen" id="smn_api_56003__screen86502543186">{
|
|
"tag":
|
|
{
|
|
"key": "DEV",
|
|
"value": "DEV1"
|
|
}
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="smn_api_56003__section12429402325"><h4 class="sectiontitle">Response</h4><p id="smn_api_56003__p454911110507">None</p>
|
|
</div>
|
|
<div class="section" id="smn_api_56003__section11338754191819"><h4 class="sectiontitle">Returned Value</h4><p id="smn_api_56003__p144041524121813">See <a href="smn_api_63002.html">Returned Value</a>.</p>
|
|
</div>
|
|
<div class="section" id="smn_api_56003__section73211020122511"><h4 class="sectiontitle">Error Codes</h4><p id="smn_api_56003__p9759142919265">See <a href="smn_api_64000.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="smn_api_56000.html">Resource Tag Operations</a></div>
|
|
</div>
|
|
</div>
|
|
|