TagResources

Updated at:

Creates and binds tags to specified app instance groups according to Alibaba Cloud tag specifications. If a tag with the same key already exists on a resource, the tag value is updated to the value specified in the current request. Currently, only the app instance group (`APPINSTANCEGROUP`) resource type is supported.

Operation description

Prerequisites

When you call this operation as a RAM user or by using STS credentials, you must have the appstreaming:TagResources permission.

The resources to which you want to bind tags must belong to the current Alibaba Cloud account. This operation currently supports only app instance group resources. You must set ResourceType to APPINSTANCEGROUP. You can obtain the app instance group ID by calling ListAppInstanceGroup.

Tag rules

  • A single request can bind up to 20 tags to up to 50 resources. Duplicate resource IDs are automatically deduplicated.

  • A tag key must be 1 to 128 characters in length, and a tag value must be 0 to 256 characters in length. Both are case-sensitive.

  • A tag key cannot start with aliyun or acs: (case-insensitive). Neither tag keys nor tag values can contain http:// or https://.

  • Tag keys in the same request cannot be duplicate. Otherwise, the error code InvalidTag.Duplicated is returned.

  • A tag key on a resource can correspond to only one tag value. If the tag key already exists on the resource, the tag value is updated to the new value.

  • A single resource can be bound to up to 20 custom tags. If this limit is exceeded, the error code ResourceTag.CustomTagCountExceed is returned.

Execution results

  • If any specified app instance group does not exist or does not belong to the current account, the entire request fails, and the error code InvalidAppInstanceGroup.NotFound is returned. No tags are bound to any resources.

  • If the binding is successful, the response contains only RequestId and does not return tag details.

  • If multiple resources are specified and the binding fails for only some of the resources, the operation still returns a success response, and the response does not contain failure details. Call ListTagResources to verify the binding results. If only one resource is specified and the binding fails, the operation directly returns the corresponding error code.

Call sequence

  1. Call ListAppInstanceGroup to obtain the IDs of the app instance groups to which you want to bind tags.

  2. Call this operation and specify ResourceType=APPINSTANCEGROUP, ResourceId.N, and Tag.N.Key/Tag.N.Value.

  3. To view the tags bound to a resource, call ListTagResources. To unbind tags, call UntagResources.

The masked identifiers in the examples are used to demonstrate the format. Replace them with your actual identifiers when you call the operation.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

appstreaming:TagResources

update

*All Resource

*

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID. This parameter is required. Specify the ID of the region where the app instance group resides, such as cn-hangzhou.

cn-hangzhou

ResourceType

string

Yes

The resource type. This parameter is required. Currently, only app instance groups are supported. The value is case-insensitive, but we recommend that you use uppercase letters:

  • APPINSTANCEGROUP: app instance group.

If you specify other values, the error code InvalidResourceType.Invalid is returned.

Valid values:

  • APPINSTANCEGROUP :

    App instance group.

APPINSTANCEGROUP

ResourceId

array

Yes

The list of resource IDs to which you want to bind tags. This parameter is required. Specify the app instance group IDs. You can specify up to 50 IDs in a single request. Duplicate IDs are automatically deduplicated.

All IDs must belong to existing app instance groups under the current Alibaba Cloud account. If any ID does not exist or does not belong to the current account, the entire request fails and the error code InvalidAppInstanceGroup.NotFound is returned. No tags are bound to any resources.

string

Yes

The app instance group ID. You can obtain the ID by calling ListAppInstanceGroup.

aig-9ciijz60n4xsv****

Tag

array<object>

Yes

The list of tags to bind. This parameter is required. You can specify up to 20 tags in a single request. You must specify both Key and Value for each tag.

  • Tag keys in the same request cannot be duplicate. Otherwise, the error code InvalidTag.Duplicated is returned.

  • If a tag with the same key already exists on the resource, the tag value is updated to the value specified in the current request.

  • A single resource can be bound to up to 20 custom tags. If this limit is exceeded, the error code ResourceTag.CustomTagCountExceed is returned.

Tag keys starting with System/ are Wuying system tags. Only the following values are supported, and the tag value can only be true or false:

  • System/Scheduler/GRAYSCALE: the canary release tag for the app instance group.

  • System/Scheduler/STOP_NEW_USER_CONNECTION: prevents newly bound users from establishing connections to the app instance group.

If you specify other tag keys starting with System/, the error code InvalidTag.SystemTagKeyInvalid or InvalidTag.SystemKeyNotAllow is returned.

object

Yes

The key-value pair of a tag.

Key

string

Yes

The tag key. This parameter is required. The tag key must be 1 to 128 characters in length and is case-sensitive. It cannot start with aliyun or acs: (case-insensitive) and cannot contain http:// or https://. It supports letters, digits, spaces, and common Chinese and English punctuation marks. If the tag key does not meet the rules, the error code InvalidTagPolicy.KeyInvalid is returned.

Resolution

Value

string

Yes

The tag value. This parameter is required. The tag value must be 0 to 256 characters in length and is case-sensitive. Empty strings are allowed. It cannot contain http:// or https://. If the tag value does not meet the rules, the error code InvalidTagPolicy.ValueInvalid is returned.

If the tag key is a system tag, the tag value can only be true or false.

720p

Response elements

Element

Type

Description

Example

object

The response of the request. If the binding is successful, only the request ID is returned.

RequestId

string

The request ID. You can use the request ID to troubleshoot request issues.

1CBAFFAB-B697-4049-A9B1-67E1FC5F****

Examples

Success response

JSON format

{
  "RequestId": "1CBAFFAB-B697-4049-A9B1-67E1FC5F****"
}

Error codes

HTTP status code

Error code

Error message

Description

500 ServiceUnavailable Service unavailable. Please try again later. Service unavailable. Please try again later.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.