|
| 1 | +:original_name: sfs_03_0002.html |
| 2 | + |
| 3 | +.. _sfs_03_0002: |
| 4 | + |
| 5 | +Batch Adding Tags to a Resource |
| 6 | +=============================== |
| 7 | + |
| 8 | +Function |
| 9 | +-------- |
| 10 | + |
| 11 | +This API is used to batch add tags for a general purpose file system. You can add up to 20 tags to a resource. |
| 12 | + |
| 13 | +URI |
| 14 | +--- |
| 15 | + |
| 16 | +- POST /v3/sfs/tms/{project_id}/file-systems/{resource_id}/tags/create |
| 17 | +- Parameter description |
| 18 | + |
| 19 | + +-------------+-----------+--------+----------------------------------------------------------------------+ |
| 20 | + | Parameter | Mandatory | Type | Description | |
| 21 | + +=============+===========+========+======================================================================+ |
| 22 | + | project_id | Yes | String | The project ID. | |
| 23 | + +-------------+-----------+--------+----------------------------------------------------------------------+ |
| 24 | + | resource_id | Yes | String | The resource ID, which is the name of a general purpose file system. | |
| 25 | + +-------------+-----------+--------+----------------------------------------------------------------------+ |
| 26 | + |
| 27 | +Request Parameters |
| 28 | +------------------ |
| 29 | + |
| 30 | +.. table:: **Table 1** Request header parameters |
| 31 | + |
| 32 | + +-----------------+-----------------+-----------------+------------------------------------+ |
| 33 | + | Parameter | Mandatory | Type | Description | |
| 34 | + +=================+=================+=================+====================================+ |
| 35 | + | Content-type | Yes | String | The MIME type of the request body. | |
| 36 | + | | | | | |
| 37 | + | | | | Example: application/json | |
| 38 | + +-----------------+-----------------+-----------------+------------------------------------+ |
| 39 | + | X-Auth-Token | No | String | The user token. | |
| 40 | + +-----------------+-----------------+-----------------+------------------------------------+ |
| 41 | + |
| 42 | +.. table:: **Table 2** Request body parameters |
| 43 | + |
| 44 | + +-----------------+-----------------+-----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ |
| 45 | + | Parameter | Mandatory | Type | Description | |
| 46 | + +=================+=================+=========================================================================================+==============================================================================================================+ |
| 47 | + | tags | No | List<:ref:`resource_tag <sfs_03_0002__en-us_topic_0000001886392461_table667613216170>`> | The tag list. For details, see :ref:`Table 3 <sfs_03_0002__en-us_topic_0000001886392461_table667613216170>`. | |
| 48 | + | | | | | |
| 49 | + | | | | This parameter is mandatory for common tenants. | |
| 50 | + | | | | | |
| 51 | + | | | | Use either **tags** or **sys_tags** if you have the op_service permissions. | |
| 52 | + +-----------------+-----------------+-----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ |
| 53 | + | sys_tags | No | List<:ref:`resource_tag <sfs_03_0002__en-us_topic_0000001886392461_table667613216170>`> | The system tag list. This parameter is available only to the op_service permissions. | |
| 54 | + | | | | | |
| 55 | + | | | | Use either **tags** or **sys_tags** if you have the op_service permissions. | |
| 56 | + | | | | | |
| 57 | + | | | | Only one **resource_tag** structure is used in TMS calls currently. | |
| 58 | + | | | | | |
| 59 | + | | | | The key is fixed at **\_sys_enterprise_project_id**. | |
| 60 | + | | | | | |
| 61 | + | | | | The value can be **UUID** or **0**. **0** indicates the default enterprise project. | |
| 62 | + | | | | | |
| 63 | + | | | | System tags can only be added. | |
| 64 | + | | | | | |
| 65 | + | | | | For details, see :ref:`Table 3 <sfs_03_0002__en-us_topic_0000001886392461_table667613216170>`. | |
| 66 | + +-----------------+-----------------+-----------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------+ |
| 67 | + |
| 68 | +.. _sfs_03_0002__en-us_topic_0000001886392461_table667613216170: |
| 69 | + |
| 70 | +.. table:: **Table 3** resource_tag |
| 71 | + |
| 72 | + +-----------+-----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 73 | + | Parameter | Mandatory | Type | Description | |
| 74 | + +===========+===========+========+============================================================================================================================================================================================================================================================================================================================================+ |
| 75 | + | key | Yes | String | The tag key. A tag key can contain a maximum of 128 characters. It can contain letters, digits, and spaces representable in UTF-8 and special characters ``(_.:=+-@).`` It cannot start or end with a space and cannot be left empty. Tag keys starting with **\_sys\_** are system tags, and you cannot start a tag key with **\_sys\_**. | |
| 76 | + +-----------+-----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 77 | + | value | No | String | The tag value. A tag value can contain a maximum of 255 characters. It can contain letters, digits, and spaces representable in UTF-8 and special characters ``(_.:=+-@)`` and can be left empty. It cannot start or end with a space. | |
| 78 | + +-----------+-----------+--------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ |
| 79 | + |
| 80 | +Response Parameters |
| 81 | +------------------- |
| 82 | + |
| 83 | +None |
| 84 | + |
| 85 | +Example Request |
| 86 | +--------------- |
| 87 | + |
| 88 | +Batch adding tags to a general purpose file system whose name is **bucketName** with the project ID **c80a2157ba1d46c0825265947342077c**: |
| 89 | + |
| 90 | +.. code-block:: text |
| 91 | +
|
| 92 | + POST https://{endpoint}/v3/sfs/tms/c80a2157ba1d46c0825265947342077c/file-systems/bucketName/tags/create |
| 93 | +
|
| 94 | +Request body example: |
| 95 | + |
| 96 | +.. code-block:: |
| 97 | +
|
| 98 | + { |
| 99 | + "tags":[ |
| 100 | + { |
| 101 | + "key":"key1", |
| 102 | + "value":"value1" |
| 103 | + }, |
| 104 | + { |
| 105 | + "key":"key2", |
| 106 | + "value":"value2" |
| 107 | + } |
| 108 | + ] |
| 109 | + } |
| 110 | +
|
| 111 | +Example Response |
| 112 | +---------------- |
| 113 | + |
| 114 | +None |
| 115 | + |
| 116 | +Status Codes |
| 117 | +------------ |
| 118 | + |
| 119 | +- Normal |
| 120 | + |
| 121 | +=========== ======================== |
| 122 | +Status Code Description |
| 123 | +=========== ======================== |
| 124 | +204 Resource tags are added. |
| 125 | +=========== ======================== |
| 126 | + |
| 127 | +- Abnormal |
| 128 | + |
| 129 | +=========== ====================== |
| 130 | +Status Code Description |
| 131 | +=========== ====================== |
| 132 | +400 Invalid tag parameter. |
| 133 | +401 Certification failed. |
| 134 | +403 Authentication failed. |
| 135 | +404 Resource not found. |
| 136 | +500 System error. |
| 137 | +=========== ====================== |
0 commit comments