Updated on 2024-04-03 GMT+08:00

Adding Resource Tags in Batches

Function

This API is used to add tags to a specified instance in batches.

Calling Method

For details, see Calling APIs.

URI

POST /v5/{project_id}/{resource_type}/{resource_id}/tags/create

Table 1 Parameter description

Parameter

Type

Mandatory

Description

project_id

String

Yes

Specifies a project ID. You can obtain the project ID by referring to Obtaining the Project ID.

resource_type

String

Yes

  • Specifies the resource type.
  • The value can be vpn-gateway, customer-gateway, or vpn-connection.

resource_id

String

Yes

Indicates a resource ID.

Request

  • Request parameters
    Table 2 Request parameters

    Parameter

    Type

    Mandatory

    Description

    tags

    Array of ResourceTag objects

    Yes

    • Specifies a tag list.
    • A maximum of 20 tags can be specified.
    Table 3 ResourceTag

    Parameter

    Type

    Mandatory

    Description

    key

    String

    Yes

    • Specifies a tag key.
    • The value is a string of 1 to 128 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).

    value

    String

    No

    • Specifies a tag value.
    • The value is a string of 0 to 255 characters that can contain digits, letters, Spanish characters, Portuguese characters, spaces, and special characters (_ . : = + - @).
  • Example request
    POST https://{Endpoint}/v5/{project_id}/{resource_type}/{resource_id}/tags/create
    {
        "tags": [{
            "key": "key1",
            "value": "value1"
        }]
    }

Response

  • Response parameters

    Returned status code 204: Tags are successfully added.

Status Codes

For details, see Status Codes.