Query Resource Groups
Function
This API is used to query all resource groups you created.
URI
GET /V1.0/{project_id}/resource-groups
- Parameter description
Table 1 Parameter description 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.
group_name
string
No
Specifies the resource group, for example, Resource-Group-ECS-01.
group_id
string
No
Specifies the resource group ID, for example, rg1603786526428bWbVmk4rP.
status
string
No
Specifies the resource group health status. Possible values are health, unhealth, and no_alarm_rule. health indicates that no alarms have been generated for the resource group.
start
integer
No
Specifies the start value of pagination. The value is an integer. The default value is 0.
limit
integer
No
Specifies the maximum number of records that can be queried at a time. The value range is (0,100] and the default value is 100.
- Example
GET https://{Cloud Eye endpoint}/V1.0/{project_id}/resource-groups
Request
None
Response
- Response parameters
Table 2 Parameter description Parameter
Type
Mandatory
Description
Array of objects
No
Specifies information about one or more resource groups.
MetaData object
No
Specifies the number of metadata records in the query result.
Table 3 resource_groups field data structure description Parameter
Type
Mandatory
Description
group_name
string
No
Specifies the resource group name, for example, ResourceGroup-Test01.
group_id
string
No
Specifies the resource group ID, for example, rg1603786526428bWbVmk4rP.
create_time
long
No
Specifies the time when the resource group is created. The value is a UNIX timestamp and the unit is ms. Example: 1603819753000
InstanceStatistics object
No
Specifies the resource statistics in the resource group.
status
string
No
Specifies the current status of the resource group.
Possible values are:
- health: No alarms have been generated for the resource group.
- unhealth: An alarm or alarms have been generated for a resource or resources in the resource group.
- no_alarm_rule: No alarm rules have been set for the resource group.
enterprise_project_id
string
No
Specifies the enterprise project associated with the resource group. The default value 0 indicates enterprise project default.
Table 4 instance_statistics field data structure description Parameter
Type
Mandatory
Description
unhealth
integer
No
Specifies the number of resources in the Alarm state in the resource group.
total
integer
No
Specifies the total number of resources in the resource group.
type_statistics
string
No
Specifies the total number of resource types in the resource group. For example, if ECS, EIP and bandwidth are added to the resource group, the type_statistics value is 2.
Table 5 meta_data field data structure description Parameter
Type
Mandatory
Description
total
Integer
No
Specifies the total number of query results.
- Response example
{ "resource_groups": [ { "group_name": "ResourceGroup-Test01", "resources": [], "create_time": 1606374365000, "group_id": "rg16063743652226ew93e64p", "instance_statistics": { "unhealth": 2, "total": 10, "type_statistics": 1 }, "status": "unhealth", "enterprise_project_id": "0" }, { "group_name": "RS", "resources": [], "create_time": 1606327955000, "group_id": "rg1606327955657LRj1lrE4y", "instance_statistics": { "unhealth": 0, "total": 2, "type_statistics": 1 }, "status": "no_alarm_rule", "enterprise_project_id": "0" }, { "group_name": "RS", "resources": [], "create_time": 1606327947000, "group_id": "rg1606327947514v9OWqAD3N", "instance_statistics": { "unhealth": 0, "total": 2, "type_statistics": 1 }, "status": "no_alarm_rule", "enterprise_project_id": "0" }, { "group_name": "RS", "resources": [], "create_time": 1606327946000, "group_id": "rg1606327946625PYogr059N", "instance_statistics": { "unhealth": 0, "total": 2, "type_statistics": 1 }, "status": "no_alarm_rule", "enterprise_project_id": "0" }, { "group_name": "ResourceGroupCorrect_2", "resources": [], "create_time": 1606325669000, "group_id": "rg1606325669900Rk4eKkLMZ", "instance_statistics": { "unhealth": 0, "total": 1, "type_statistics": 1 }, "status": "no_alarm_rule", "enterprise_project_id": "0" } ], "meta_data": { "total": 5 } }
Returned Value
- Normal
- Abnormal
Returned Value
Description
400 Bad Request
Request error.
401 Unauthorized
The authentication information is not provided or is incorrect.
403 Forbidden
You are forbidden to access the page requested.
408 Request Timeout
The request timed out.
429 Too Many Requests
Concurrent requests are excessive.
500 Internal Server Error
Failed to complete the request because of an internal service error.
503 Service Unavailable
The service is currently unavailable.
Error Code
For details, see Error Codes.
Last Article: Deleting a Resource Group
Next Article: Event Monitoring
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.