Querying Resources in a Resource Group
Function
This API is used to query resources in a resource group based on the resource group ID.
URI
GET /V1.0/{project_id}/resource-groups/{group_id}
- Parameter description
Table 1 Parameter description Parameter
Mandatory
Description
project_id
Yes
Specifies the project ID.
For details about how to obtain the project ID, see Obtaining a Project ID.
group_id
Yes
Specifies the resource group ID.
status
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.
namespace
No
Specifies the resource namespace. For example, the resource namespace of an ECS is SYS.ECS. To view the namespace of each service, see Services Interconnected with Cloud Eye.
dname
No
Specifies the resource dimension. For example, the ECS dimension is instance_id. To view the dimension of each resource, see Services Interconnected with Cloud Eye.
start
No
Specifies the start value of pagination. The value is an integer. The default value is 0.
limit
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: Query resources in a resource group.
GET https://{Cloud Eye endpoint}/V1.0/{project_id}/resource-groups/{group_id}
Request
None
Response
- Response parameters
Table 2 Response parameters Parameter
Type
Description
group_name
String
Specifies the resource group, for example, Resource-Group-ECS-01.
group_id
String
Specifies the resource group ID, for example, rg1603786526428bWbVmk4rP.
Arrays of objects
Specifies information about one or more resource groups.
status
String
Specifies the status of the resource group. Possible values are health, unhealth, and no_alarm_rule. 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.
create_time
Long
Specifies the time when the resource group is created. The value is a UNIX timestamp and the unit is ms. Example: 1603819753000
MetaData object
Specifies the metadata of query results, including the pagination information.
enterprise_project_id
String
Specifies the enterprise project associated with the resource group. The default value 0 indicates enterprise project default.
Table 3 resources parameter description Parameter
Type
Description
namespace
String
Specifies the resource namespace. For example, the resource namespace of an ECS is SYS.ECS. To view the namespace of each service, see Services Interconnected with Cloud Eye.
Arrays of objects
Specifies one or more resource dimensions.
status
String
Specifies the status of the resource group.
Possible values are health, unhealth, and no_alarm_rule.
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.
Table 4 dimensions field data structure description Parameter
Type
Description
name
string
Specifies the resource dimension. For example, the ECS dimension is instance_id. To view the dimension of each resource, see Services Interconnected with Cloud Eye.
value
string
Specifies the resource dimension value, which is the instance ID. Example: 4270ff17-aba3-4138-89fa-820594c39755
Table 5 meta_data field data structure description Parameter
Type
Description
count
Integer
Specifies the number of returned results.
total
Integer
Specifies the total number of query results.
marker
String
Specifies the pagination marker.
- Response example
{ "group_name": "ResourceGroup-Test-01", "resources": [ { "namespace": "SYS.ECS", "dimensions": [ { "name": "instance_id", "value": "6cffb0bd-fd37-400f-ae6f-8f4be021ff7e" } ], "status": "health", "event_type": 0 }, { "namespace": "SYS.ECS", "dimensions": [ { "name": "instance_id", "value": "e37d6238-9dd3-4720-abcc-eb9f8fb08ca0" } ], "status": "health", "event_type": 0 } ], "create_time": 1604476378000, "group_id": "rg16044763786104XvXvl00a", "status": "health", "meta_data": { "count": 0, "marker": "", "total": 2 }, "enterprise_project_id": "0" }
- Response example
Returned Values
- Normal
- Abnormal
Returned Values
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: Resource Group Management
Next Article: Creating a Resource Group
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.