Querying Resources of a Specified Dimension and a Specified Service Type in a Resource Group
Function
This API is used to query resources of a specified dimension for a specified resource type in a resource group.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v2/{project_id}/resource-groups/{group_id}/services/{service}/resources
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant ID. |
group_id |
Yes |
String |
Resource group ID, which starts with rg and is followed by 22 characters, including letters and digits. |
service |
Yes |
String |
Service type, for example, SYS.ECS. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dim_name |
No |
String |
Resource dimension name. Multiple dimensions are separated with commas (,) in alphabetical order. |
limit |
No |
String |
Number of items on each page during pagination query. The value ranges from 1 to 100 (default). |
offset |
No |
Integer |
Start position for pagination query, indicating the sequence number of the data record where the query starts. The default value is 0. Value range: 0-10000 |
status |
No |
String |
Resource health status. The value can only be health, unhealthy, or no_alarm_rule. health: An alarm rule has been created for the resource and there is no alarm triggered. unhealthy: An alarm rule has been created for the resource and there are alarms triggered. no_alarm_rule: No alarm rule has been created for the resource. Enumeration values:
|
dim_value |
No |
String |
Resource dimension value. Fuzzy match is not supported. If a resource has multiple dimensions, you can specify one of them. |
tag |
No |
String |
Resource tag information. The format is "[key]":"[value]", for example: "ssss":"1111". |
extend_relation_id |
No |
String |
Enterprise project ID. |
product_name |
No |
String |
Cloud product of the resource group. Generally, the value format is Service namespace,First-level dimension name of the service, for example, SYS.ECS,instance_id. |
resource_name |
No |
String |
Resource name. Regex Pattern: ^$|^([\u4E00-\u9FFF]|[a-z]|[A-Z]|[0-9]|_|-|\\.|)+$ |
event_status |
No |
String |
Resource health status. The value can only be health, unhealthy, or no_alarm_rule. health: An event alarm rule has been created for the resource and there is no alarm triggered. unhealthy: An event alarm rule has been created for the resource and there are alarms triggered. no_alarm_rule: No event alarm rule has been created for the resource. Enumeration values:
|
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Tenant token. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
count |
Integer |
Total number of resources. Value range: 0-10000 |
resources |
Array of GetResourceGroupResources objects |
Resources in a resource group. |
Parameter |
Type |
Description |
---|---|---|
status |
String |
Metric alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). Enumeration values:
|
dimensions |
Array of ResourceDimension objects |
Resource dimension information. |
tags |
String |
Resource tag information. The value is a JSON character string in the format of key/value, for example, "{"sss":"aaa"}". |
enterprise_project_id |
String |
Enterprise Project ID. |
event_status |
String |
Event alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). Enumeration values:
|
resource_name |
String |
Resource name |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Service metric dimension. Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-)*$ |
value |
String |
Value of a resource dimension. It is the instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Regex Pattern: ^((([a-z]|[A-Z]|[0-9]|\*|_|/|#|\(|\)){1}([a-z]|[A-Z]|[0-9]|_|-|\.|\*|/|#|\(|\))*))$ |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Status codes customized by each cloud service when a request error occurs. |
error_msg |
String |
Request error message. |
request_id |
String |
Request ID. |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Status codes customized by each cloud service when a request error occurs. |
error_msg |
String |
Request error message. |
request_id |
String |
Request ID. |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Status codes customized by each cloud service when a request error occurs. |
error_msg |
String |
Request error message. |
request_id |
String |
Request ID. |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Status codes customized by each cloud service when a request error occurs. |
error_msg |
String |
Request error message. |
request_id |
String |
Request ID. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Status codes customized by each cloud service when a request error occurs. |
error_msg |
String |
Request error message. |
request_id |
String |
Request ID. |
Example Requests
Query resources of a specified dimension for a specified resource type in a resource group.
'/v2/{project_id}/resource-groups/{group_id}/services/{service}/resources'
Example Responses
Status code: 200
OK
{ "count" : 1000, "resources" : [ { "status" : "health", "dimensions" : [ { "name" : "instance_id", "value" : "4270ff17-aba3-4138-89fa-820594c39755" } ] } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Parameter verification failed. |
401 |
Not authenticated. |
403 |
Authentication failed. |
404 |
Resource not found. |
500 |
Internal system 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