Creates tags and adds them to a list of Server Migration Center (SMC) resources. The SMC resources include migration sources and tasks.

Description

A maximum of 20 tags can be added to each SMC resource.

Before you add tags to an SMC resource, Alibaba Cloud checks the number of existing tags of the resource. If the maximum number is reached, an error message is returned.

Request parameter

Parameter Type Required Example Description
Action String Yes TagResources

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

ResourceType String Yes sourceserver

The type of the SMC resource. Valid values:

  • sourceserver: migration source
  • replicationjob: migration task
ResourceId.N String No s-bw526m1vi6x20c6g****

The ID of the SMC resource.

Tag.N.Key String No TestKey

The key of tag N that is added to the SMC resource. Valid values of N: 1 to 20.

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

Tag.N.Value String No TestValue

The value of tag N that is added to the SMC resource. Valid values of N: 1 to 20.

The tag value can be an empty string. It can be up to 64 characters in length and cannot contain http:// or https://.

Response parameters

Parameter Type Example Description
RequestId String 3E8B9ABB-289A-44E6-942D-8AA9E493****

The ID of the request.

Examples

Sample requests

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

Sample success responses

XML format

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

<TagResourcesResponse>
    <RequestId>3E8B9ABB-289A-44E6-942D-8AA9E493****</RequestId>
</TagResourcesResponse>

JSON format

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

{
  "RequestId" : "3E8B9ABB-289A-44E6-942D-8AA9E493****"
}

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.