TagResources

更新时间: 2026-05-15 19:28:36

Call TagResources to add tags to resources.

Debugging

You can call this operation in OpenAPI Explorer without having to manually calculate signatures. After a successful call, OpenAPI Explorer automatically generates SDK code examples.

Authorization

The following table describes the authorization information required for this operation. To grant a RAM user or RAM role permission to call this operation, add the operation to the Action element of a RAM policy statement. For more information, see the following descriptions:

  • Operation: The API operation to authorize.

  • Access level: The access level of each operation. Valid values: Write, Read, and List.

  • Resource type: The resource type that can be authorized for the operation. The following rules apply:

    • Required resource types are highlighted in the table.

    • For an operation that does not support resource-level authorization, All Resources is displayed.

  • Condition key: The condition key that is defined by the cloud service.

  • Associated operation: Other operations that must be granted to the RAM user or RAM role to ensure that this operation can be successfully called.

Actions

Access level

Resource type

Condition key

Associated operation

alikafka:TagResources

Write

instance

acs:alikafka:{#regionId}:{#accountId}:{#InstanceId}

None

None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The region ID of the resource.

cn-hangzhou

ResourceType

string

Yes

The resource type. This is an enumerated parameter. Valid values:

  • instance

  • topic

  • consumer group

Note

This parameter is not case-sensitive.

instance

ResourceId

array

Yes

A list of resource IDs.

string

Yes

The ID of the resource to be tagged. The format of the resource ID varies based on the resource type:

  • instance: instanceId

  • topic: Kafka_alikafka_instanceId_topic

  • consumer group: Kafka_alikafka_instanceId_consumerGroup

For example, if the instance ID is alikafka_post-cn-v0h1fgs2xxxx, the topic name is test-topic, and the consumer group name is test-consumer-group, the corresponding resource IDs are alikafka_post-cn-v0h1fgs2xxxx, Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-topic, and Kafka_alikafka_post-cn-v0h1fgs2xxxx_test-consumer-group, respectively.

alikafka_post-cn-v0h1fgs2****

Tag

array<object>

Yes

A list of tags.

object

Yes

Key

string

Yes

The tag key.

  • The tag key cannot be an empty string.

  • The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

FinanceDept

Value

string

No

The tag value.

  • The tag value can be an empty string.

  • The tag value can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

FinanceJoshua

InstanceId

string

No

The ID of the instance that hosts the resource to be tagged.

alikafka_post-cn-v0h1fgs2****

Response parameters

Parameter

Type

Description

Example

object

RequestId

string

The request ID.

C46FF5A8-C5F0-4024-8262-B16B6392****

Examples

Sample success response

JSON format

{
  "RequestId": "C46FF5A8-C5F0-4024-8262-B16B6392****"
}

Error codes

For a list of common error codes, see Common error codes.

Change history

Date

Description

Actions

2023-11-09

Internal API configurations were updated. This change does not affect API calls.

View change details

上一篇: UntagResources - Remove tags from resources 下一篇: SASL users
阿里云首页 云消息队列 Kafka 版 相关技术圈