TagResources - 创建并绑定标签

为指定的网关创建并绑定标签。

接口说明

在实例数量较多的情况下,您可以创建多个标签,为实例绑定不同的标签对其进行分类,之后通过标签进行实例筛选。

  • 标签由一对键(key)值(value)组成,键在同账号同地域下唯一,值无此限制。
  • 若设置的标签不存在,则自动创建该标签并绑定到目标实例。
  • 若实例已经绑定了有相同键的标签,则进行覆盖绑定。
  • 每个实例最多可以绑定 20 个标签。
  • 每次调用最多设置 50 个实例进行批量标签绑定。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

下表是API对应的授权信息,可以在RAM权限策略语句的Action元素中使用,用来给RAM用户或RAM角色授予调用此API的权限。具体说明如下:

  • 操作:是指具体的权限点。
  • 访问级别:是指每个操作的访问级别,取值为写入(Write)、读取(Read)或列出(List)。
  • 资源类型:是指操作中支持授权的资源类型。具体说明如下:
    • 对于必选的资源类型,用前面加 * 表示。
    • 对于不支持资源级授权的操作,用全部资源表示。
  • 条件关键字:是指云产品自身定义的条件关键字。
  • 关联操作:是指成功执行操作所需要的其他权限。操作者必须同时具备关联操作的权限,操作才能成功。
操作访问级别资源类型条件关键字关联操作
hcs-sgw:TagResourcesupdate
*全部资源
*

请求参数

名称类型必填描述示例值
RegionIdstring

地域 ID,可以通过接口 DescribeRegions 查看可用的地域 ID。

cn-hangzhou
ResourceRegionIdstring

资源地域 ID。

cn-hangzhou
ResourceTypestring

资源类型定义。唯一取值:GATEWAY。

GATEWAY
Tagarray<object>

标签信息。

object

标签。

Keystring

标签键。可以同时创建 N 个标签键,N 的取值范围为 1~20。不允许传入空字符串。

testkey1
Valuestring

标签键对应的标签值。可以同时创建 N 个标签值,N 的取值范围为 1~20。允许传入空字符串。

testvalue1
ResourceIdarray

网关 ID 列表。可以同时对 N 个实例绑定标签,N 的取值范围为 1~50。

string

网关 ID。

gw-uf6wjk5xxxxxxx

返回参数

名称类型描述示例值
object
RequestIdstring

请求 ID。

224DB9F7-3100-4899-AB9C-C938BCCB43E7

示例

正常返回示例

JSON格式

{
  "RequestId": "224DB9F7-3100-4899-AB9C-C938BCCB43E7"
}

错误码

HTTP status code错误码错误信息
400MissingParameter.ResourceIdsThe parameter - ResourceIds.N should not be null.
400MissingParameter.TagsThe parameter - Tags should not be null.
400Missing.TagKeyThe Tag.N.Key parameter is blank.
400InvalidParameter.TagKeyThe Tag.N.Key parameter is invalid.
400InvalidParameter.TagValueThe Tag.N.Value parameter is invalid.
400InvalidParameter.ResourceTypeThe ResourceType parameter is invalid.
400Duplicate.TagKeyThe Tag.N.Key contain duplicate key.
400MissingParameter.TagOrResourceIdThe specified Tags and ResourcesIds are not allow to both empty.
400NumberExceed.ResourceIdsThe ResourceIds parameter's number is exceed , Valid : 50
400NumberExceed.TagsThe Tags parameter's number is exceed , Valid : 20
400QuotaExceed.TagsPerResourceThe tags per resource number is exceed, Valid: 20
403PermissionDenied.ScopeThe specified operator not have permission to set Scope value.
403PermissionDenied.TagOwnerUidThe specified operator not have permission to set TagOwnerUid value.
403PermissionDenied.TagOwnerBidThe specified operator not have permission to set TagOwnerBid value.
403NoPermissionKey.OperatorThese keys are not permission for this operator.
403NoPermissionKey.ScopeThese keys are not permission for this scope.
403NoPermissionKey.CategoryThese keys are not permission for this category.
403NoPermission.SystemTagThe operator is not permission for the system tag.
403NoPermission.OperatorThe operator is not permission for this operate.
404InvalidResourceType.NotFoundThe ResourceType provided does not exist in our records.
404InvalidResourceId.NotFoundThe specified ResourceId is not found in our records.

访问错误中心查看更多错误码。

变更历史

变更时间变更内容概要操作
暂无变更历史