doc-exports/docs/csbs/api-ref/en-us_topic_0098635094.html
Wei, Hongmin 8ce662c4dc CSBS API initial version
Reviewed-by: gtema <artem.goncharov@gmail.com>
Co-authored-by: Wei, Hongmin <weihongmin1@huawei.com>
Co-committed-by: Wei, Hongmin <weihongmin1@huawei.com>
2022-10-24 21:06:50 +00:00

212 lines
16 KiB
HTML

<a name="EN-US_TOPIC_0098635094"></a><a name="EN-US_TOPIC_0098635094"></a>
<h1 class="topictitle1">Adding a Tag to a Backup Policy</h1>
<div id="body1519724141407"><div class="section" id="EN-US_TOPIC_0098635094__section663215"><h4 class="sectiontitle">Function</h4><p class="msonormal" id="EN-US_TOPIC_0098635094__p66842817">A resource can have up to 10 tags.</p>
<p class="msonormal" id="EN-US_TOPIC_0098635094__p64714441">The API is idempotent.</p>
<p class="msonormal" id="EN-US_TOPIC_0098635094__p45559064">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>
</div>
<div class="section" id="EN-US_TOPIC_0098635094__section5968939"><h4 class="sectiontitle">URI</h4><ul id="EN-US_TOPIC_0098635094__ul66405588"><li id="EN-US_TOPIC_0098635094__li60779388">URI format<p id="EN-US_TOPIC_0098635094__p10143581"><a name="EN-US_TOPIC_0098635094__li60779388"></a><a name="li60779388"></a>POST https://{endpoint}/v1/{project_id}/csbs_backup_policy/{resource_id}/tags</p>
<p id="EN-US_TOPIC_0098635094__p24183370"></p>
</li><li id="EN-US_TOPIC_0098635094__li16323738">Request header
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table12695920" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Request header</caption><thead align="left"><tr id="EN-US_TOPIC_0098635094__row324668"><th align="left" class="cellrowborder" valign="top" width="24.752475247524753%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="EN-US_TOPIC_0098635094__p209623317216">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.841584158415841%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="EN-US_TOPIC_0098635094__p15962193221">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.861386138613863%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="EN-US_TOPIC_0098635094__p99783315213">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.54455445544555%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="EN-US_TOPIC_0098635094__p6978835213">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row35224963"><td class="cellrowborder" valign="top" width="24.752475247524753%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p34649765">Content-type</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p10902133220614">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p55167604">MIME type of the body in the request</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p36549175">application/json</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row60507121"><td class="cellrowborder" valign="top" width="24.752475247524753%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p2129750">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="15.841584158415841%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p119005323616">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p38292076">User token</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p45836489">-</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
<ul id="EN-US_TOPIC_0098635094__ul21768161"><li id="EN-US_TOPIC_0098635094__li61695723">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table18390601" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0098635094__row7035667"><th align="left" class="cellrowborder" valign="top" width="25%" id="mcps1.3.2.3.1.1.2.5.1.1"><p id="EN-US_TOPIC_0098635094__p1245682610254">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15%" id="mcps1.3.2.3.1.1.2.5.1.2"><p id="EN-US_TOPIC_0098635094__p12456152615256">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.000000000000002%" id="mcps1.3.2.3.1.1.2.5.1.3"><p id="EN-US_TOPIC_0098635094__p20456152682512">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46%" id="mcps1.3.2.3.1.1.2.5.1.4"><p id="EN-US_TOPIC_0098635094__p2456122642515">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row60784581"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p24604028">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p46769243">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p30212363">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p65779720">Project ID</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row41882373"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.3.2.3.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p37029065">resource_id</p>
</td>
<td class="cellrowborder" valign="top" width="15%" headers="mcps1.3.2.3.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p46564252">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.000000000000002%" headers="mcps1.3.2.3.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p13608105">String</p>
</td>
<td class="cellrowborder" valign="top" width="46%" headers="mcps1.3.2.3.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p28514710">Resource ID</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635094__section53720453"><h4 class="sectiontitle">Request</h4><ul id="EN-US_TOPIC_0098635094__ul62725128"><li id="EN-US_TOPIC_0098635094__li27655246">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table47570623" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0098635094__row40977906"><th align="left" class="cellrowborder" valign="top" width="25.252525252525253%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="EN-US_TOPIC_0098635094__p15769330112512">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.141414141414144%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="EN-US_TOPIC_0098635094__p117692030142515">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.141414141414144%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="EN-US_TOPIC_0098635094__p27697305250">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.46464646464647%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="EN-US_TOPIC_0098635094__p4769153092519">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row57980147"><td class="cellrowborder" valign="top" width="25.252525252525253%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p65880360">tag</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p34708966">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.141414141414144%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p59962836">tag</p>
</td>
<td class="cellrowborder" valign="top" width="46.46464646464647%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p25151514">List of tags</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635094__li25037038">Parameter description of field <strong id="EN-US_TOPIC_0098635094__b84235270695528">tag</strong>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table24006753" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Parameter description of field <strong id="EN-US_TOPIC_0098635094__b1173041919212">tag</strong></caption><thead align="left"><tr id="EN-US_TOPIC_0098635094__row22527890"><th align="left" class="cellrowborder" valign="top" width="25.742574257425744%" id="mcps1.3.3.2.2.2.2.5.1.1"><p id="EN-US_TOPIC_0098635094__p4957332182518">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13.861386138613863%" id="mcps1.3.3.2.2.2.2.5.1.2"><p id="EN-US_TOPIC_0098635094__p9957632162511">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.85148514851485%" id="mcps1.3.3.2.2.2.2.5.1.3"><p id="EN-US_TOPIC_0098635094__p209575323251">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="45.54455445544555%" id="mcps1.3.3.2.2.2.2.5.1.4"><p id="EN-US_TOPIC_0098635094__p495723218252">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row53989823"><td class="cellrowborder" valign="top" width="25.742574257425744%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p11099566">key</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p26649649">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p11137969">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p798643483310">Tag key</p>
<p id="EN-US_TOPIC_0098635094__p036816391334">It consists of up to 36 characters.</p>
<p id="EN-US_TOPIC_0098635094__p1815945343312">It cannot be an empty string.</p>
<p id="EN-US_TOPIC_0098635094__p139819543334">Spaces before and after a key will be deprecated.</p>
<p id="EN-US_TOPIC_0098635094__p14766132412516">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row66515904"><td class="cellrowborder" valign="top" width="25.742574257425744%" headers="mcps1.3.3.2.2.2.2.5.1.1 "><p id="EN-US_TOPIC_0098635094__p19079158">value</p>
</td>
<td class="cellrowborder" valign="top" width="13.861386138613863%" headers="mcps1.3.3.2.2.2.2.5.1.2 "><p id="EN-US_TOPIC_0098635094__p1907972">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="14.85148514851485%" headers="mcps1.3.3.2.2.2.2.5.1.3 "><p id="EN-US_TOPIC_0098635094__p20328083">String</p>
</td>
<td class="cellrowborder" valign="top" width="45.54455445544555%" headers="mcps1.3.3.2.2.2.2.5.1.4 "><p id="EN-US_TOPIC_0098635094__p11608421163420">Tag value</p>
<p id="EN-US_TOPIC_0098635094__p489413816351">It consists of up to 43 characters.</p>
<p id="EN-US_TOPIC_0098635094__p14194717123517">It can be an empty string.</p>
<p id="EN-US_TOPIC_0098635094__p1146913338362">Spaces before and after a tag value will be deprecated.</p>
<p id="EN-US_TOPIC_0098635094__p13867418343">It can contain only letters, digits, hyphens (-), and underscores (_).</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635094__li55223077">Example request<pre class="screen" id="EN-US_TOPIC_0098635094__screen19424249103211">POST https://{endpoint}/v1/{project_id}/csbs_backup_policy/{resource_id}/tags</pre>
</li></ul>
<ul id="EN-US_TOPIC_0098635094__ul59414099"><li id="EN-US_TOPIC_0098635094__li64964848">Request body<pre class="screen" id="EN-US_TOPIC_0098635094__screen9654055143217">{
"tag":
{
"key":"DEV",
"value":"DEV1"
}
}</pre>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635094__section13722030"><h4 class="sectiontitle">Status Codes</h4><ul id="EN-US_TOPIC_0098635094__ul2298077"><li id="EN-US_TOPIC_0098635094__li20682694">Normal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table51926520" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0098635094__row5115727"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.4.2.1.1.1.3.1.1"><p id="EN-US_TOPIC_0098635094__p11720763">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.4.2.1.1.1.3.1.2"><p id="EN-US_TOPIC_0098635094__p9857780">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row60282721"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.1.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p51062251">204</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.1.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p42401657">No Content</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0098635094__li46070597">Abnormal
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0098635094__table11982196" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0098635094__row7949639"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.4.2.2.1.1.3.1.1"><p id="EN-US_TOPIC_0098635094__p39940984">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.4.2.2.1.1.3.1.2"><p id="EN-US_TOPIC_0098635094__p13994266">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0098635094__row59793748"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p11455439">400</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p55475379">Invalid action.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row29516363"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p42015198">401</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p47787886">Authentication failed.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row27437792"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p7868661">403</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p33381819">You do not have permission to perform this operation.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row32000920"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p41937705">404</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p41510976">The requested resource was not found.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0098635094__row38054464"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.4.2.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0098635094__p62512728">500</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.4.2.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0098635094__p30366184">A system exception occurs.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0098635094__section61541938486"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0098635094__p999593594811">For details, see <a href="en-us_topic_0071888297.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0098466174.html">Tag Management</a></div>
</div>
</div>