You need to enable JavaScript to run this app.
导航

TagResources

最近更新时间2024.03.22 08:27:45

首次发布时间2022.09.02 08:49:19

调用TagResources接口,为资源添加用户标签。

使用说明

  • 为同一个资源重复添加相同标签键的标签,则后添加的标签值会自动覆盖之前的标签值。
  • 每个资源最多可添加50个用户标签,每次调用该接口最多可添加20个用户标签。
  • Tags.N.a类型的参数中,“N”表示标签信息的序号,需按照数字顺序从1开始填写,取值范围为1~20。多个标签之间使用&分隔。

调试

请求参数

名称
类型是否必选示例值
描述
ActionStringTagResources要执行的操作,取值为TagResources。
VersionString2020-04-01API版本信息,当前版本为2020-04-01。

ResourceType

String

clb

资源的类型,取值如下:

  • clb:负载均衡实例。
  • listener:监听器。
  • servergroup:后端服务器组。
  • acl:访问控制。
  • certificate:证书。

ResourceIds.N

String

ResourceIds.1=clb-273sdsdsxxxxxp8u2j****&ResourceIds.2=clb-2fe6fszjgeznk5oxruv0u****

资源的ID。

说明

  • 参数 - N:表示资源 ID的序号,单次调用数量上限50个。
  • 多个资源 ID之间使用&分隔。

Tags.N.Key

String

Tags.1.Key=k1&Tags.2.Key=k2

用户标签的标签键。

  • 长度限制为1~128个字符。
  • 大小写敏感,不能以volc:sys:的任意大小写组合开头。
  • 不能以空格开头或结尾。
  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

同一资源的标签键不允许重复。如果传入的Tags.N.Key与已有标签的标签键重复,则后添加的标签会覆盖原有标签。

Tags.N.Value

String

Tags.1.Value=v1&Tags.2.Value=v2

用户标签的标签值。

  • 长度限制为1~256个字符。
  • 大小写敏感,不能以空格开头或结尾。
  • 允许包含各国语言文字、数字、空格()、下划线(_)、点号(.)、半角冒号(:)、斜杠(/)、等号(=)、加号(+)、减号(-)和@。

如果传入该参数,则必须先传入Tags.N.Key

返回参数

名称类型示例值描述
RequestIdString2021062415303301022514515207C4****请求ID。

请求示例

GET /?Action=TagResources&Version=2020-04-01&ResourceType=clb&ResourceIds.1=clb-273sdsdsxxxxxp8u2j****&ResourceIds.2=clb-2fe6fszjgeznk5oxruv0u****&Tags.1.Key=k1&Tags.2.Key=k2&Tags.1.Value=v1&Tags.2.Value=v2 HTTP/1.1
Host: open.volcengineapi.com
ServiceName: clb
Region: cn-beijing

返回示例

{
    "ResponseMetadata": {
        "RequestId": "2021062415303301022514515207C4****",
        "Action": "TagResources",
        "Version": "2020-04-01",
        "Service": "clb",
        "Region": "cn-beijing"
    },
    "Result": {
        "RequestId": "2021062415303301022514515207C4****"
    }
}

错误码

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

HttpCode错误码错误信息描述

400

MissingParameter

The request is missing a required parameter. Ensure that you have supplied all the required parameters for the request; for example, the 'XXX'.

该请求缺少必要参数。请确保发起请求已提供全部必要参数,比如XXX

说明

其中,XXX表示缺少的参数名称。

400InvalidTagKey.MalformedThe specified TagKey is invalid.指定的 TagKey 参数格式不合法。
400InvalidTagValue.MalformedThe specified TagValue is invalid.指定的 TagValue 参数格式不合法。
400LimitExceeded.TagOperationYou've reached the limit on the number of tags that you can operate at one time.已达到单次可操作标签数量的上限。
400LimitExceeded.ResourceYou've reached the limit on the number of resources that you can operate at one time.已达到单次可操作资源数量的上限。
400LimitExceeded.ServiceManagedTagYou've reached the limit on the number of service managed tags that you can create.已达到单次可创建受管资源标签键值数量的上限。
400InvalidResourceType.MalformedThe specified parameter resource type is invalid.资源类型不合法。
400QuotaExceeded.ResourceCustomTagsYou've reached the limit on the number of resource tags that you can create.已达到单个资源可创建用户标签的数量的配额上限。
400QuotaExceeded.ResourceSystemTagsYou've reached the limit on the number of system tags that you can create.已达到单个资源可创建系统标签的数量的配额上限。
400InvalidIncorrectOrder.MalformedThe specified index order is malformed.指定标签的索引顺序参数格式不合法。
403ForbiddenYou are not authorized to perform operations on the service managed tag.无权限对指定资源打上受管标签。
403InvalidResourceType.ServcieManagedThe specified ResourceType is managed by a service.指定的资源是服务托管资源。
404InvalidResource.NotFoundThe specified resource does not exist.指定的资源不存在。