You need to enable JavaScript to run this app.
导航
TagResources - 创建标签 (新版)
最近更新时间:2024.12.13 14:10:07首次发布时间:2024.12.13 14:10:07
我的收藏
有用
有用
无用
无用

调用 TagResources 接口为一个或多个资源添加用户标签。

使用说明

注意

注意事项

  • 标签的更多信息请参见标签概述
  • 单个资源最多可以添加50个标签,单次调用该接口最多支持添加20个标签。
  • 为同一个资源重复添加相同标签键的标签,则新标签值会自动覆盖原标签值。
  • “删除中”的资源不允许添加标签。

调试

请求参数

下表仅列出该接口特有的请求参数和部分公共参数。更多信息请见公共参数

参数
类型
是否必填
示例值
描述
Action
String

TagResources

要执行的操作,取值:TagResources。

Version
String

2020-04-01

API的版本,取值:2020-04-01。

ResourceIds.N
Array of String

ResourceIds.1=i-l8u0p77yseabkpak****&ResourceIds.2=i-l8u0p7xyseabkbak****

资源ID。

  • 参数 - N:表示资源的序号,取值范围:1~50。
  • 多个资源之间用&分隔。
ResourceType
String

instance

资源类型,取值:

  • instance:实例
  • image:镜像
  • reservedinstance:预留实例券
  • scheduledinstance:弹性预约实例
  • keypair:密钥对
Tags.N.Key
Array of String

Tags.1.Key=k1

为资源添加的用户标签的标签键。

  • 参数 - N:表示标签键的序号,取值范围:1~20。
  • 多个标签键之间用&分隔。

命名规则如下:

  • 不能以任何大小写形式的volc:sys:开头。

volc:sys:开头为系统预留标签键禁止创建。

  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。
  • 长度限制在1~128个字符之间。
Tags.N.Value
Array of String

Tags.1.Value=v1

为资源添加的用户标签的标签值。

  • 参数 - N:表示标签值的序号,取值范围:1~20。
  • 多个标签值之间用&分隔。

命名规则如下:

  • 只能包含语言字符、数字、空格和英文符号“_”、“.”、“:”、“/”、“=”、“+”、“-”、“@”。
  • 允许为空,长度限制在0~256个字符之间。

返回参数

下表仅列出本接口特有的返回参数。更多信息请参见返回结构

参数
类型
示例值
描述
RequestId
String

20230810120154605002C8D8D494A3****

请求ID。

请求示例

GET /?Action=TagResources&Version=2020-04-01&ResourceType=instance&ResourceIds.1=i-l8u0p77yseabkpak****&ResourceIds.2=i-l8u0p7xyseabkbak****&Tags.1.Key=k1&Tags.1.Value=v1 HTTP/1.1
Host: open.volcengineapi.com
Region: cn-beijing
ServiceName: ecs

返回示例

{
    "ResponseMetadata": {
        "RequestId": "20230810120154605002C8D8D494A3****",
        "Action": "TagResources",
        "Version": "2020-04-01",
        "Service": "ecs",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "20230810120154605002C8D8D494A3****"
    }

错误码

下表为您列举了该接口与业务逻辑相关的错误码。公共错误码请参见公共错误码文档。

状态码
错误码
错误信息
说明
400
IdempotentParameterMismatch
The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical.

幂等参数不一致。

400
InvalidClientToken.Malformed
The specified ClientToken is malformed.

指定的ClientToken不合法。

400
InvalidResourceStatus
The status of the specified resource does not support this request.

当前资源的状态不支持此操作。

400
InvalidTagKey.Malformed
The specified TagKey is malformed.

指定的标签的键不合法。

400
InvalidTagValue.Malformed
The specified TagValue is malformed.

指定的标签的值不合法。

400
LimitExceeded.MaximumResourceIds
You've reached the limit on the number of ResourceIds that you can set.

指定的资源ID数量超过限制。

400
LimitExceeded.MaximumTags
You've reached the limit on the number of tags that you can create.

指定的标签数量超过最大限制。

400
QuotaExceeded.MaximumSystemTags
You've reached the limit on the number of System Tags that you can create.

已达到单个资源可创建系统标签上限。

400
QuotaExceeded.MaximumTags
You've reached the limit on the number of Tags that you can create.

已达到单个资源可创建标签上限。

404
InvalidResourceId.NotFound
The specified ResourceId does not exist.

指定资源不存在。

404
InvalidResourceType.NotFound
The specified ResourceType does not exist.

指定的资源类型不存在。

404
InvalidTag.NotFound
The specified tag does not exist.

指定的键值不存在。

409
InvalidTagKey.Conflict
The specified TagKey already exists.

指定的标签键已存在。

412
IdempotentProcessing
The request uses the same client token as a previous one that is still in process.

先前的幂等请求仍在处理中,请稍后重试。

412
OperationDenied.ResourceLocked
The specified operation is denied as your resource is locked for another operation.

指定的操作被拒绝,因为您的资源已被其他操作锁定。

500
InternalError
An internal error has occurred.

内部错误,请重试。如果多次尝试失败,请提交工单。