Querying Resources by Tag
Function
This API is used to query resources by tag.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v1/{resource_type}/resource-instances/filter
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
resource_type |
Yes |
Object |
Specifies the resource type. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
limit |
No |
Integer |
Specifies the number of results on each page. |
|
offset |
No |
Integer |
Specifies the number of bytes to skip before starting to read data. |
Request Parameters
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
X-Auth-Token |
Yes |
String |
Specifies the user token. The token can be obtained by calling the IAM API. The value of X-Subject-Token in the response header is the user token. |
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
tags |
No |
Array of Tag objects |
Specifies the tag list. |
|
matches |
No |
Array of Match objects |
Specifies the matched results. |
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
resources |
Array of ResourceTags objects |
Specifies the resource list. |
|
total_count |
Integer |
Specifies the total number of resources. |
|
Parameter |
Type |
Description |
|---|---|---|
|
resource_id |
String |
Specifies the resource ID. |
|
resource_name |
String |
Specifies resource name. |
|
tags |
Array of ResourceTag objects |
Specifies the tag. |
|
Parameter |
Type |
Description |
|---|---|---|
|
key |
String |
Specifies the tag key. The key must meet the following requirements:
|
|
value |
String |
Specifies the tag value. The value must meet the following requirements:
|
Example Requests
Querying Resources by Tag
POST https://{ga_endpoint}/v1/{resource_type}/resource-instances/filter
{
"tags" : [ {
"key" : "tagKey",
"values" : [ "tagValue" ]
} ],
"matches" : [ {
"key" : "resourceName",
"value" : "name"
} ]
}
Example Responses
Status code: 200
Operation successful.
{
"resources" : [ {
"resource_id" : "c2b210b2-60c4-449d-91e2-9e9ea1dd7443",
"resource_name" : "resourceName",
"tags" : [ {
"key" : "tagKey",
"value" : "tagValue"
} ]
} ],
"total_count" : 1
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Operation successful. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot