Listing Resource Instances
Function
This API is used to list resource instances.
URI
POST /v3/{project_id}/{resource_type}/resource-instances/filter
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID. |
resource_type |
Yes |
String |
Resource type. The options are:
|
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
limit |
No |
Integer |
Number of records displayed on each page. The default value is 1000. |
offset |
No |
Integer |
Query result offset. The default value is 0. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
without_any_tag |
No |
Boolean |
Whether no tags are included. The default value is false.
|
tags |
No |
Array of objects |
Tags. For details, see tags.
|
matches |
No |
Array of objects |
Search field. For details, see matches. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key. A tag key can contain a maximum of 128 characters. Only letters, digits, spaces, and special characters (_.:+-@) are allowed, but the value cannot start or end with a space or start with _sys_. |
values |
Yes |
Array of strings |
List of tag values. A tag value can contain a maximum of 255 characters. Only letters, numbers, spaces, and special characters (_.:+-@) are allowed. The value cannot start or end with a space. The value can be an empty array but cannot be left blank. If the values are null, it indicates any_value (querying any value). All values of a tag key are in the OR relationship. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Tag key. Currently, only the option resource_name is available. resource_name: resource name. By default, a fuzzy search is performed based on the prefix of the resource name entered. |
value |
Yes |
String |
Tag value. Enter a maximum of 255 characters. |
Response Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resources |
Yes |
List<resource> |
List of resource instances. For details, see Table 7. |
total_count |
Yes |
Integer |
Total number of records. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
resource_id |
Yes |
String |
Resource ID. |
resource_detail |
Yes |
Object |
Resource details. This field is an extension field and is left blank by default. |
tags |
Yes |
List<resource_tag> |
Tag list, which is an empty array if there are no tags. For details, see Table 8. |
resource_name |
Yes |
String |
Resource name, which is an empty string by default if the resource does not have a name. If the resource is an EIP, the IP address is returned. |
Example Request
{ "tags":[ { "key":"key1", "values":[ "value1", "value2" ] }, { "key":"key2", "values":[ "value1", "value2" ] } ], "matches":[ { "key":"resource_name", "value":"resource1" } ], "without_any_tag":"false" }
Example Response
{ "resources": [ { "resource_detail": null, "resource_id": "test1", "resource_name": "resource1", "tags": [ { "key": "key1", "value": "value1" }, { "key": "key2", "value": "value1" } ] } ], "total_count": 1000 }
Status Codes
Status Code |
Description |
---|---|
200 |
The modification is successful. |
400 |
Request error. |
500 |
Internal server error. |
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