Creating or Deleting a Tag

Function

This API is used to create or delete a tag.

Each AS group can have a maximum of 10 tags added to it.

URI

POST /autoscaling-api/v1/{project_id}/{resource_type}/{resource_id}/tags/action

Table 1 Parameter description

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

resource_type

Yes

String

Specifies the resource type. The option is as follows:

scaling_group_tag: indicates that the resource type is AS groups.

resource_id

Yes

String

Resource ID

Request

Table 2 Request parameters

Parameter

Mandatory

Type

Description

tags

Yes

Array of ResourceTag objects

Specifies the tag list. For details, see Table 3.

If action is set to delete, the tag structure cannot be missing, and the key cannot be left blank or an empty string.

action

Yes

String

Specifies the operation ID. The value is case-sensitive and can be any of the following:

  • delete: indicates deleting a tag.
  • create: indicates creating a tag. If the same key value already exists, it will be overwritten.
Table 3 ResourceTag field description

Parameter

Mandatory

Type

Description

key

Yes

String

Specifies the tag key. Tag keys of a resource must be unique.

It contains a maximum of 36 Unicode characters. It cannot be left blank. It can contain only digits, letters, hyphens (-), underscores (_), and at signs (@).

value

No

String

Specifies the tag value.

A tag value contains a maximum of 43 Unicode characters and can be left blank. It can contain only digits, letters, hyphens (-), underscores (_), and at signs (@).

Example Request

This example adds two tags (key = ENV15 and value = ENV15) and (key = ENV151 and value = ENV151) to the AS group with ID e5d27f5c-dd76-4a61-b4bc-a67c5686719a.

POST https://{Endpoint}/autoscaling-api/v1/{project_id}/scaling_group_tag/e5d27f5c-dd76-4a61-b4bc-a67c5686719a/tags/action

{ 
  "tags": [
    { 
        "key": "ENV15", 
        "value": "ENV15" 
    }, 
    { 
        "key": "ENV151", 
        "value": "ENV151" 
    }
    ], 
  "action": "create" 
}

Response

None

Example Response

None

Returned Values

Error Codes

See Error Codes.