Help Center/ Cloud Eye/ API Reference/ API V2/ Resource Groups/ Querying Resource Groups
Updated on 2025-10-30 GMT+08:00

Querying Resource Groups

Function

This API is used to query resource groups.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    ces:resourceGroups:list

    List

    -

    g:EnterpriseProjectId

    • ces:resourceGroups:get

    -

URI

GET /v2/{project_id}/resource-groups

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Table 2 Query Parameters

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

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Tenant token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

count

Integer

Total number of resource groups.

resource_groups

Array of OneResourceGroupResp objects

Resource group list.

Table 5 OneResourceGroupResp

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.

Table 6 resource_statistics

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

Table 7 AssociationAlarmTemplate

Parameter

Type

Description

template_id

String

ID of an alarm template.

template_name

String

Alarm template name

Status code: 400

Table 8 Response body parameters

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

Table 9 Response body parameters

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

Table 10 Response body parameters

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

Table 11 Response body parameters

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.