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.
URI
GET /v2/{project_id}/resource-groups/{group_id}/services/{service}/resources
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Project 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. 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. |
|
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. |
|
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. |
|
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. |
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. |
|
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). |
|
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). |
|
resource_name |
String |
Resource name |
|
Parameter |
Type |
Description |
|---|---|---|
|
name |
String |
Definition 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 Dimensions. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain letters, digits, underscores (_), and hyphens (-). Default Value N/A |
|
value |
String |
Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A |
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.