Updated on 2024-07-25 GMT+08:00

Adding or Deleting Tags in Batches

Function

This API is used to batch add tags to or delete tags from a specified resource. TMS needs to use this API to manage tags of resources in batches. A resource can have a maximum of 10 tags.

URI

POST /v3/{project_id}/{resource_type}/{resource_id}/tags/action

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

resource_id

Yes

String

Specifies the resource ID.

resource_type

Yes

String

Specifies the Direct Connect resource type.

  • dc-directconnect: connection
  • dc-vgw: virtual gateway
  • dc-vif: virtual interface

Enumeration values:

  • dc-directconnect
  • dc-vgw
  • dc-vif

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

action

Yes

String

Specifies the operation. The options are as follows:

  • create
  • delete

Enumeration values:

  • create
  • delete

tags

No

Array of Tag objects

Specifies the tags.

sys_tags

No

Array of Tag objects

Specifies the system tags.

Table 3 Tag

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key. The key can contain a maximum of 36 Unicode characters, including letters, digits, hyphens (-), and underscores (_).

Minimum: 0

Maximum: 36

value

No

String

Specifies the tag value. The value can contain a maximum of 43 Unicode characters, including letters, digits, hyphens (-), underscores (_), and periods (.).

Minimum: 0

Maximum: 43

Response Parameters

None

Example Requests

  • Batch adding tags to resources
    POST https://{endpoint}/v3/cfa563efb77d4b6d9960781d82530fd8/dc-vgw/3320166e-b937-40cc-a35c-02cd3f2b3ee2/tags/action
    
    {
      "action" : "create",
      "tags" : [ {
        "key" : "key1",
        "value" : "value1"
      }, {
        "key" : "key2",
        "value" : "value2"
      } ]
    }
  • Batch deleting resource tags
    POST https://{endpoint}/v3/cfa563efb77d4b6d9960781d82530fd8/dc-vgw/3320166e-b937-40cc-a35c-02cd3f2b3ee2/tags/action
    
    {
      "action" : "delete",
      "tags" : [ {
        "key" : "key1"
      }, {
        "key" : "key2",
        "value" : "value3"
      } ]
    }

Example Responses

None

Status Codes

Status Code

Description

204

No Content

Error Codes

See Error Codes.