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.
URI
GET /v2/{project_id}/resource-groups
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant ID. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
enterprise_project_id |
No |
String |
ID of the enterprise project that a resource group belongs to. Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$ |
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. Value range: 0-10000 |
limit |
No |
Integer |
Number of items on each page during pagination query. The value ranges from 1 to 100 (default). Value range: 1-100 |
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. Enumeration values:
|
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. Value range: 0-1000 |
resource_groups |
Array of OneResourceGroupResp objects |
Resource group list. |
Parameter |
Type |
Description |
---|---|---|
group_name |
String |
Resource group name. Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$ |
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. Regex Pattern: ^((([a-z]|[0-9]){8}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){4}-([a-z]|[0-9]){12})|0)$ |
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). Enumeration values:
|
status |
String |
Metric alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). Enumeration values:
|
event_status |
String |
Event alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set). Enumeration values:
|
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 Value range: 0-9999999 |
total |
Integer |
Total number of resources. Value range: 0-9999999 |
event_unhealthy |
Integer |
Number of triggered resources Value range: 0-9999999 |
namespaces |
Integer |
Resource Types Value range: 0-9999999 |
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.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot