All Products
Search
Document Center

Server Load Balancer:ListTagResources

Last Updated:Oct 10, 2024

Queries the tags that are added to resources.

Operation description

  • Set ResourceId.N or Tag.N that consists of Tag.N.Key and Tag.N.Value in the request to specify the object to be queried.
  • Tag.N is a resource tag that consists of a key-value pair. If you set only Tag.N.Key, all tag values that are associated with the specified tag key are returned. If you set only Tag.N.Value, an error message is returned.
  • If you set Tag.N and ResourceId.N to filter tags, ResourceId.N must match all specified key-value pairs.
  • If you specify multiple key-value pairs, resources that contain these key-value pairs are returned.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
slb:ListTagResourcesget
  • acl
    acs:slb:{#regionId}:{#accountId}:acl/{#aclId}
  • loadbalancer
    acs:slb:{#regionId}:{#accountId}:loadbalancer/{#loadbalancerId}
  • ServerCertificate
    acs:slb:{#regionId}:{#AccountId}:certificate/{#ServerCertificateId}
  • CaCertificate
    acs:slb:{#regionId}:{#AccountId}:certificate/{#CaCertificateId}
  • slb:tag
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID of the CLB instance.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
ResourceTypestringYes

The type of the resource. Valid values:

  • instance: a CLB instance
  • certificate: a certificate
  • acl: an access control list (ACL)
  • listener: a listener
  • vservergroup: a vServer group
  • masterslaveservergroup: a primary/secondary server group
instance
NextTokenstringNo

The token that determines the start point of the query. Valid values:

  • If this is your first query or no subsequent query is to be sent, ignore this parameter.
  • If a subsequent query is to be sent, set the parameter to the value of NextToken that is returned from the last call.
caeba0bbb2be03f84eb48b699f0a****
ResourceIdarrayNo

The resource ID. You can specify up to 20 resources.

Note The value of ResourceId of a listener is LoadBalancerId_Listener protocol_Port, where LoadBalancerId is the ID of the CLB instance and port is the listener port. Example: lb-bp1qnnvj18yy6h****_http_80.
stringNo

The resource ID. You can specify up to 20 resources.

Note The value of ResourceId of a listener is LoadBalancerId_Listener protocol_Port, where LoadBalancerId is the ID of the CLB instance and port is the listener port. Example: lb-bp1qnnvj18yy6h****_http_80.
lb-bp1qnnvj18yy6h****
Tagarray<object>No

The tags.

objectNo
KeystringNo

The tag key of the resource. You can specify up to 20 tag keys.

The tag key cannot be an empty string. The tag key must be 1 to 64 characters in length and cannot start with aliyun or acs:. The tag key cannot contain http:// or https://.

FinanceDept
ValuestringNo

The tag value of the resource. You can specify up to 20 tag values. The tag value cannot be an empty string.

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

FinanceJoshua

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The token that determines the start point of the query. Valid values:

  • If NextToken is empty, it indicates that no subsequent query is to be sent.
  • If a value of NextToken is returned, the value is the token that is used for the subsequent query.
caeba0bbb2be03f84eb48b699f0a****
RequestIdstring

The ID of the request.

DE65F6B7-7566-4802-9007-96F2494AC512
TagResourcesarray<object>

The resources to which the tags are added.

TagResourceobject
TagValuestring

The tag value.

FinanceJoshua
ResourceTypestring

The resource type.

instance
ResourceIdstring

The resource ID.

lb-bp16qjewdsunr4****
TagKeystring

The tag key.

FinanceDept

Examples

Sample success responses

JSONformat

{
  "NextToken": "caeba0bbb2be03f84eb48b699f0a****",
  "RequestId": "DE65F6B7-7566-4802-9007-96F2494AC512",
  "TagResources": {
    "TagResource": [
      {
        "TagValue": "FinanceJoshua",
        "ResourceType": "instance",
        "ResourceId": "lb-bp16qjewdsunr4****",
        "TagKey": "FinanceDept"
      }
    ]
  }
}

Error codes

HTTP status codeError codeError message
400TagTypeNotSameThe category of tags in the same request must be the same.
400ResourceNotExist%s.
400QueryTokenNotExistThe specified NextToken does not exist.
400InvalidParam.NextTokenThe specified NextToken is invalid.
400InvalidParam.ScopeThe specified Scope is invalid.
400InvalidParam.ResourceTypeThe specified ResourceType is invalid.
400InvalidParam.TagKeyThe specified TagKey is invalid.
400InvalidParam.TagValueThe specified TagValue is invalid.
400InvalidParam.TagKeyOrValueThe specified TagKey or TagValue is invalid.
400InvalidParam.TagOwnerUidThe specified TagOwnerUid is invalid.
400InvalidParam.TagOwnerBidThe specified TagOwnerBid is invalid.
400MissingParam.ScopeThe parameter Scope is required.
400MissingParam.TagOwnerUidThe parameter TagOwnerUid is required.
400MissingParam.TagOwnerBidThe parameter TagOwnerBid is required.
400InvalidParameter.RegionIdThe specified RegionId does not exist.
400MissingParam.TagOrResourceIdThe parameter Tag or ResourceId is required at least one.
400SizeLimitExceeded.ResourceIdThe maximum size of ResourceId is exceeded.
400SizeLimitExceeded.TagThe maximum size of Tag is exceeded.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history