Queries the tags that are attached to one or more Server Migration Center (SMC) resources. SMC resources consist of migration sources and migration tasks.

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 sourceserver

The type of the SMC resource. Valid values:

  • sourceserver: migration source
  • replicationjob: migration task
NextToken String No caeba0bbb2be03f84eb48b699f0a4883

The token that is required for the next query.

ResourceId.N String No s-bp1e2fsl57knvuug****

The ID of the SMC resource. SMC resources consist of migration sources and migration tasks.

Tag.N.Key String No TestKey

The key of tag N. The key must be 1 to 64 characters in length. Valid values of N: 1 to 20.

Tag.N is used for exact match of SMC resources to which the tag is attached. Tag N consists of a key-value pair.

  • Tag keys and values are case-sensitive.
  • If you set only the Tag.N.Key parameter, all resources to which the specified tags are attached are returned.
  • If you set only the Tag.N.Value parameter, the error message InvalidParameter.TagValue is returned.
  • If you specify multiple tag key-value pairs at a time, only SMC resources that match all tag key-value pairs are returned.
Tag.N.Value String No TestValue

The value of tag N. The value must be 1 to 64 characters in length. Valid values of N: 1 to 20.

Response parameters

Parameter Type Example Description
NextToken String caeba0bbb2be03f84eb48b699f0a4883

The token that is required for the next query.

If a null value is returned for this parameter, no more tags can be queried.

RequestId String 17743161-66F3-4E7F-B8AE-845FB28B928F

The ID of the request.

TagResources Array of TagResource

The returned information about the SMC resources and tags. The information includes the ID, type, and tag key-value pairs of the resources.

TagResource
ResourceType String ALIYUN::SMC::SOURCESERVER

The type of the resource.

TagValue String TestValue

The tag value of the resource.

ResourceId String s-bp1e2fsl57knvuug****

The ID of the resource.

TagKey String TestKey

The tag key of the resource.

Examples

Sample requests

http(s)://smc.aliyuncs.com/?Action=ListTagResources
&ResourceType=sourceserver
&NextToken=caeba0bbb2be03f84eb48b699f0a4883
&ResourceId=["s-bp1e2fsl57knvuug****"]
&Tag=[{"Key":"TestKey","Value":"TestValue"}]
&<Common request parameters>

Sample success responses

XML format

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

<ListTagResourcesResponse>
    <NextToken>caeba0bbb2be03f84eb48b699f0a4883</NextToken>
    <RequestId>17743161-66F3-4E7F-B8AE-845FB28B928F</RequestId>
    <TagResources>
        <ResourceType>ALIYUN::SMC::SOURCESERVER</ResourceType>
        <TagValue>TestValue</TagValue>
        <ResourceId>s-bp1e2fsl57knvuug****</ResourceId>
        <TagKey>TestKey</TagKey>
    </TagResources>
</ListTagResourcesResponse>

JSON format

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

{
  "NextToken" : "caeba0bbb2be03f84eb48b699f0a4883",
  "RequestId" : "17743161-66F3-4E7F-B8AE-845FB28B928F",
  "TagResources" : [ {
    "ResourceType" : "ALIYUN::SMC::SOURCESERVER",
    "TagValue" : "TestValue",
    "ResourceId" : "s-bp1e2fsl57knvuug****",
    "TagKey" : "TestKey"
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 NumberExceed.Tags The maximum number of the Tag parameters cannot exceed 20. The error message returned because the number of specified tags exceeds the upper limit of 20.
400 MissingParameter.ResourceType You must specify ResourceType. The error message returned because the resource type is not specified.
400 InvalidResourceType.NotFound The specified ResourceType does not exist. The error message returned because the resource type does not exist.
400 NumberExceed.ResourceIds The maximum number of ResourceId parameters cannot exceed 50. The error message returned because the number of specified resource IDs exceeds the upper limit of 50.
400 Duplicate.ResourceId The ResourceId contains duplicate values. The error message returned because duplicate resource IDs are specified.
400 InvalidResourceId.NotFound The specified ResourceIds do not exist. The error message returned because the specified resource does not exist.

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