Queries tags that are added to Virtual Private Cloud (VPC) peering connections.

Usage notes

  • 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 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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTagResources

The operation that you want to perform. Set the value to ListTagResources.

ResourceType String Yes PeerConnection

The type of the resource. Set the value to PeerConnection, which specifies a VPC peering connection.

ResourceId.N String No pcc-bp16qjewdsunr41m1****

The ID of the resource. You can specify up to 20 resource IDs.

Note Specify at least one of the ResourceId.N and Tag.N parameters (Tag.N.Key and Tag.N.Value).
Tag.N.Key String No FinanceDept

The key of the tag that is added to the resource. You can specify up to 20 tag keys. The tag key cannot be an empty string.

The key can be up to 64 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The key must start with a letter but cannot start with aliyun or acs:. The key cannot contain http:// or https://.

Note Specify at least one of the ResourceId.N and Tag.N parameters (Tag.N.Key and Tag.N.Value).
Tag.N.Value String No FinanceJoshua

The value of the tag that is added to the resource. You can specify up to 20 tag values. It can be an empty string.

The value can be up to 128 characters in length and can contain letters, digits, periods (.), underscores (_), and hyphens (-). The value must start with a letter but cannot start with aliyun or acs:. The value cannot contain http:// or https://.

Note Specify at least one of the ResourceId.N and Tag.N parameters (Tag.N.Key and Tag.N.Value).
MaxResults Integer No 50

The number of entries to return on each page. Valid values: 1 to 50. Default value: 50.

NextToken String No FFmyTO70tTpLG6I3FmYAXGKPd****

The token that is used for the next query. Valid values:

  • If this is your first query or no subsequent query is to be sent, ignore this parameter.
  • If a next query is to be sent, set the value to the value of NextToken that is returned in the last call.
RegionId String Yes cn-hangzhou

The region ID of the resource.

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

Response parameters

Parameter Type Example Description
RequestId String DE65F6B7-7566-4802-9007-96F2494AC512

The ID of the request.

TagResources Array of TagResultModelList

The resources to which the tags are added.

ResourceId String pcc-bp16qjewdsunr41m1****

The ID of the resource.

ResourceType String PeerConnection

The type of the resource. The value is set to PeerConnection, which indicates a VPC peering connection.

RegionNo String cn-hangzhou

The region of the requester VPC.

TagKey String FinanceDept

The tag key.

TagValue String FinanceJoshua

The tag value.

NextToken String FFmyTO70tTpLG6I3FmYAXGKPd****

The token that is used for the next query. Valid values:

  • If NextToken is empty, it indicates that no next query is to be sent.
  • If NextToken is returned, the value indicates the token that is used for the next query.
MaxResults Integer 50

The number of entries returned per page.

Examples

Sample requests

http(s)://[Endpoint]/?Action=ListTagResources
&ResourceType=PeerConnection
&ResourceId=["pcc-bp16qjewdsunr41m1****"]
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&MaxResults=50
&NextToken=FFmyTO70tTpLG6I3FmYAXGKPd****
&RegionId=cn-hangzhou
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTagResourcesResponse>
    <RequestId>DE65F6B7-7566-4802-9007-96F2494AC512</RequestId>
    <TagResources>
        <ResourceId>pcc-bp16qjewdsunr41m1****</ResourceId>
        <ResourceType>PeerConnection</ResourceType>
        <RegionNo>cn-hangzhou</RegionNo>
        <TagKey>FinanceDept</TagKey>
        <TagValue>FinanceJoshua</TagValue>
    </TagResources>
    <NextToken>FFmyTO70tTpLG6I3FmYAXGKPd****</NextToken>
    <MaxResults>50</MaxResults>
</ListTagResourcesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "DE65F6B7-7566-4802-9007-96F2494AC512",
  "TagResources" : [ {
    "ResourceId" : "pcc-bp16qjewdsunr41m1****",
    "ResourceType" : "PeerConnection",
    "RegionNo" : "cn-hangzhou",
    "TagKey" : "FinanceDept",
    "TagValue" : "FinanceJoshua"
  } ],
  "NextToken" : "FFmyTO70tTpLG6I3FmYAXGKPd****",
  "MaxResults" : 50
}

Error codes

HttpCode Error code Error message Description
400 InvalidTagKey The tag keys are not valid. The error message returned because the tag key is invalid.
400 NumberExceed.Tags The maximum number of tags is exceeded. The error message returned because the number of tags exceeds the upper limit.
400 NumberExceed.ResourceIds The maximum number of resource IDs is exceeded. The error message returned because the specified number of resource group IDs exceeds the upper limit.
400 Forbidden.TagKeys The tag key cannot be operated by the request. The error message returned because you cannot manage the tag key by calling the operation.
400 Forbidden.TagKey.Duplicated The specified tag key already exists. The error message returned because the tag key already exists.
400 InvalidInstanceIds.NotFound The instance IDs are not found. The error message returned because the instance ID is not found.
400 InvalidInstanceType.NotFound The instance type is not found. The error message returned because the instance type is not found.

For a list of error codes, see Service error codes.