Querying Resource Groups
Function
This API is used to query resource groups.
URI
GET /v2/{project_id}/resource-groups
Parameter | Mandatory | Type | Description |
|---|---|---|---|
project_id | Yes | String | Project ID. |
Parameter | Mandatory | Type | Description |
|---|---|---|---|
enterprise_project_id | No | String | ID of the enterprise project that a resource group belongs to. |
group_name | No | String | Resource group name. Fuzzy search is supported. |
group_id | No | String | Resource group ID, which starts with rg and is followed by 22 characters, including letters and digits. |
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. |
limit | No | Integer | Number of items on each page during pagination query. The value ranges from 1 to 100 (default). |
type | No | String | Method for adding resources to a resource group. The value can only be EPS (synchronizing resources from enterprise projects), TAG (dynamic tag matching), Manual (manually adding resources), COMB (automatically adding resources – matching by multiple criteria), or NAME (fuzzy matching by resource name). If this parameter is not specified, all resource groups are queried. |
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 resource groups. |
resource_groups | Array of OneResourceGroupResp objects | Resource group list. |
Parameter | Type | Description |
|---|---|---|
group_name | String | Resource group name. |
group_id | String | Resource group ID, which starts with rg and is followed by 22 characters, including letters and digits. |
create_time | String | Time when a resource group was created. |
enterprise_project_id | String | ID of the enterprise project that a resource group belongs to. |
type | String | Resource adding/matching mode. The value can only be EPS (matching enterprise projects), TAG (matching tags), NAME (matching instance names), COMB (combination matching), or Manual (manual adding). |
status | String | Metric alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). |
event_status | String | Event alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). |
resource_statistics | resource_statistics object | Resource quantity statistics. |
related_ep_ids | Array of strings | List of specified enterprise projects when the resource matching rule is enterprise project matching. |
association_alarm_templates | Array of AssociationAlarmTemplate objects | List of associated alarm templates. |
Parameter | Type | Description |
|---|---|---|
unhealthy | Integer | Number of resources in the alarm |
total | Integer | Total number of resources. |
event_unhealthy | Integer | Number of triggered resources |
namespaces | Integer | Resource Types |
Parameter | Type | Description |
|---|---|---|
template_id | String | ID of an alarm template. |
template_name | String | Alarm template name |
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: 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 resource groups.
/v2/{project_id}/resource-groups?offset=0&limit=100 Example Responses
Status code: 200
OK
{
"resource_groups" : [ {
"group_name" : "group1",
"create_time" : "2006-01-02T15:04:05.000Z",
"group_id" : "rg0123456789xxxx",
"enterprise_project_id" : "0",
"type" : "Manual"
}, {
"group_name" : "band",
"type" : "EPS",
"create_time" : "2006-01-02T15:04:05.000Z",
"group_id" : "rg0123456789xxxx",
"enterprise_project_id" : "d61d4705-5658-42f5-8e0c-70eb34d17b02"
}, {
"group_name" : "group2",
"type" : "TAG",
"create_time" : "2006-01-02T15:04:05.000Z",
"group_id" : "rg0123456789xxxx",
"enterprise_project_id" : "0"
} ],
"count" : 3
} Status Codes
Status Code | Description |
|---|---|
200 | OK |
400 | Parameter verification failed. |
401 | Not authenticated. |
403 | Authentication failed. |
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.

