You can call ListTagResources to query the tags that are bound to one or more EMR clusters.
Note the following information when you call the operation:
- Specify at least one of the ResourceId.N and Tag.N(Tag.N.Key and Tag.N.Value) in the request to specify the query object.
- When you specify Tag.N and ResourceId.N at the same time, only EMR clusters that meet both conditions are included in the returned result.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | No | ListTagResources |
The operation that you want to perform. This parameter is required for API requests that you create by piecing together HTTP or HTTPS URLs. Set the value to ListTagResources. |
RegionId | String | Yes | cn-hangzhou |
The region ID of the instance. You can call DescribeRegions Interface to view the latest list of Alibaba Cloud regions. |
ResourceType | String | Yes | cluster |
The type of the resource. The EMR cluster is cluster. |
ResourceId.N | RepeatList | No | C-3652B95F65967*** |
The ID of the EMR cluster. You can call the ListClusters You can call this operation to view the ID of a cluster. Valid values of N: 1 to 50. |
Tag.N.Key | String | No | DevDept |
The tag key used for exact search of EMR clusters. Valid values of a tag key: 1 to 128. Valid values of N: 1 to 20. Tag.N is used for exact match of EMR clusters that are bound with specified tags. It consists of one key-value pair.
|
Tag.N.Value | String | No | DevNianmin |
The tag value used for exact searches of EMR clusters. You can call ListTagResources View data on the Member Management page. Valid values of the tag value: 1 to 128. Valid values of N: 1 to 20. |
NextToken | String | No | caeba0bbb2be03f84eb48b699f0a**** |
The token used to perform the next query. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | caeba0bbb2be03f84eb48b699f0a**** |
The token that was returned for the next query. |
RequestId | String | DE65F6B7-7566-4802-9007-96F2494AC5XX |
The ID of the request. |
TagResources | Array of TagResource |
A collection of clusters and tags, including the cluster ID, resource type, and tag key-value pair. |
|
TagResource | |||
ResourceId | String | C-3652B95F6596**** |
The ID of the cluster. |
ResourceType | String | cluster |
The type of the resource. The EMR cluster is cluster. |
TagKey | String | DevDept |
The key of each tag. |
TagValue | String | DevNianmin |
The tag value of the instance. |
Examples
Sample requests
http(s)://[Endpoint]/?Action=ListTagResources
&RegionId=cn-hangzhou
&ResourceType=cluster
&<common request parameters>
Sample success responses
XML
format
<RequestId>DE65F6B7-7566-4802-9007-96F2494AC5XX</RequestId>
<NextToken>caeba0bbb2be03f84eb48b699f0a****</NextToken>
<TagResources>
<TagResource>
<ResourceId>C-3652B95F6596****</ResourceId>
<TagKey>DevDept</TagKey>
<ResourceType>cluster</ResourceType>
<TagValue>DevNianmin</TagValue>
</TagResource>
</TagResources>
JSON
Syntax
{
"RequestId":"DE65F6B7-7566-4802-9007-96F2494AC5XX",
"NextToken":"caeba0bbb2be03f84eb48b699f0a****",
"TagResources":{
"TagResource":[
{
"ResourceId":"C-3652B95F6596****",
"TagKey":"DevDept",
"ResourceType":"cluster",
"TagValue":"DevNianmin"
}
]
}
}