Querying DeHs by Tag
Function
- This API is used to filter DeHs by tag and return the list of all tags of a DeH.
- Tag Management Service (TMS) uses this API to filter the DeHs.
URI
POST /v1.0/{project_id}/dedicated-host-tags/resource_instances/action
Table 1 describes the parameters.
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
project_id |
String |
Yes |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
tags |
Array of objects |
No |
Displays all DeHs with specified tags. For more information, see Table 3.
|
not_tags |
Array of objects |
No |
Displays the DeHs with none of specified tags. For more information, see Table 3.
|
limit |
Integer |
No |
Limits the maximum number of queried DeHs. The value cannot be a negative number. The maximum value is 1000.
|
offset |
Integer |
No |
Specifies the index position. The query starts from the next piece of data indexed by this parameter. The value must be a non-negative number. You do not need to specify this parameter when querying resources on the first page. When you query resources on subsequent pages, set the value of offset to the location returned in the response body for the previous query.
|
action |
String |
Yes |
Specifies the operation, which can be filter or count.
|
tags_any |
Array of objects |
No |
Includes any of the specified tags. For more information, see Table 3.
|
not_tags_any |
Array of objects |
No |
Excludes any of the specified tags. For more information, see Table 3.
|
matches |
Array of objects |
No |
Specifies the search field, which is used to search for DeHs by condition. Currently, only resource_name can be used for search. For more information, see Table 4. |
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
key |
String |
Yes |
Specifies the tag key.
|
values |
Array of strings |
No |
Specifies the tag values.
|
Parameter |
Type |
Mandatory |
Description |
---|---|---|---|
key |
String |
Yes |
Specifies the key parameter to be matched.
NOTE:
The parameter value can only be resource_name, which is the DeH name. |
value |
String |
Yes |
Specifies the tag value.
|
Response
Parameter |
Type |
Description |
---|---|---|
resources |
Array of objects |
Specifies the returned DeH list. For details, see Table 6. |
total_count |
Integer |
Specifies the total number of resources. |
Parameter |
Type |
Description |
---|---|---|
resource_id |
String |
Specifies the DeH ID. |
resouce_detail |
String |
Specifies the DeH details. This field is used for future extension and is left empty by default. |
tags |
Array of objects |
Specifies the tag list. For details, see Table 7. |
resource_name |
String |
Specifies the resource name. |
Parameter |
Type |
Description |
---|---|---|
key |
String |
Specifies the tag key.
|
value |
String |
Specifies the tag value.
|
Example Request
POST https://{Endpoint}/v1.0/9c53a566cb3443ab910cf0daebca90c4/dedicated-host-tags/resource_instances/action { "offset": "0", "limit": "100", "action": "filter", "matches": [ { "key": "resource_name", "value": "resource1" } ], "tags": [ { "key": "key1", "values": ["value1"] } ] }
Example Response
Response body when action is set to filter
{ "resources": [ { "resource_detail": null, "resource_id": "cdfs_cefs_wesas_12_dsad", "resource_name": "resource1", "tags": [ { "key": "key1", "value": "value1" } ] } ], "total_count": 1 }
Response body when action is set to count
{ "total_count": 100 }
Status Code
See Status 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