Creating Resource Pool Tags in Batches
Function
This API is used to add or update multiple tags for a specified resource pool. It is used when administrators need to manage resource pools by category (such as cost ownership and environment ID), configure metadata (such as project ownership and owner information) in batches, or update existing tag values. Before calling this API, ensure that the target resource pool exists and can be managed, you have the permissions to manage resource pool tags, and the submitted tag data complies with the format requirements (for example, the key is not empty and the value length is limited). After this API is called, the system adds a new tag to the resource pool or overwrites the value of the tag with the same name, and other configuration attributes of the resource pool are not affected. If the resource pool does not exist, you do not have the required permissions, the tag format is incorrect, or the system service is abnormal, an error message (such as "404 Not Found", "403 Forbidden", "400 Bad Request", or "503 Service Unavailable") is returned.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.
- If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
- If you are using identity policy-based authorization, no identity policy-based permission required for calling this API.
URI
POST /v1/{project_id}/pools/{pool_name}/tags/create
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition: Project ID. For details, see Obtaining a Project ID and Name. Constraints: The value can contain 1 to 64 characters. Only letters, digits, and hyphens (-) are allowed. Range: N/A Default Value: N/A |
| pool_name | Yes | String | Definition: Resource pool name. The value is obtained from name in the metadata field of the resource pool details. Constraints: N/A Range: N/A Default Value: N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| tags | Yes | Array of Tag objects | Definition: Tags to be added. |
Response Parameters
Status code: 204
| Parameter | Type | Description |
|---|---|---|
| tags | Array of PoolTag objects | Definition: Resource tag list. |
| Parameter | Type | Description |
|---|---|---|
| key | String | Definition: Tag of the resource type. Range: N/A |
| values | Array of strings | Definition: Tag value of the resource type. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A |
| error_msg | String | Definition: Error message. Range: N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A |
| error_msg | String | Definition: Error message. Range: N/A |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Range: N/A |
| error_msg | String | Definition: Error message. Range: N/A |
Status code: 404
Example Requests
https://{endpoint}/v1/{project_id}/pools/a55eba18-1ebf-4e9a-8229-d2d3b593a3dc/tags/create
{
"tags" : [ {
"key" : "test",
"value" : "service-gpu"
}, {
"key" : "model_version",
"value" : "0.1"
} ]
} Example Responses
Status code: 204
Added.
{
"tags" : [ {
"key" : "test",
"values" : [ "service-gpu", "service-cpu" ]
}, {
"key" : "model_version",
"values" : [ "0.1", "0.2" ]
} ]
} Status Codes
| Status Code | Description |
|---|---|
| 204 | Added. |
| 400 | Invalid parameter. |
| 401 | Authentication failed. |
| 403 | Insufficient permissions. |
| 404 | Resource not found. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot