Querying All Resource Groups
Function
This API is used to query all created 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 /V1.0/{project_id}/resource-groups
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition Project ID. It is used to specify the project that an asset belongs to. You can query the assets of a project by project ID. You can obtain the project ID from the API or console. For details, see Obtaining a Project ID. Constraints N/A Range 1 to 64 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| group_name | No | String | Definition Resource group name. Constraints N/A Range It allows 1 to 128 characters and can contain letters, digits, underscores (_), and hyphens (-). Default Value N/A |
| group_id | No | String | Definition Resource group ID. Constraints N/A Range The value starts with rg and is followed by 22 characters of letters, digits, or a combination of both. Default Value N/A |
| status | No | String | Definition Health status of a resource group. Constraints N/A Range Default Value N/A |
| start | No | Integer | Definition Pagination start value. Constraints N/A Range [0,9999999] Default Value 0 |
| limit | No | Integer | Definition Maximum number of records that can be queried at a time. Constraints N/A Range [1,100] Default Value 100 |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| Content-Type | No | String | Definition MIME type of the request body. Constraints N/A Range 1 to 64 characters Default Value Default value application/json; charset=UTF-8 is recommended. For APIs used to upload objects or images, the MIME type varies with the flow type. |
| X-Auth-Token | No | String | Definition User token. Constraints N/A Range 1 to 16,384 characters Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| resource_groups | Array of ResourceGroupInfo objects | Definition Information about one or more resource groups. |
| meta_data | TotalMetaData object | Definition Number of metadata records in the query results. |
| Parameter | Type | Description |
|---|---|---|
| group_name | String | Definition Resource group name. Range It allows 1 to 128 characters and can contain letters, digits, underscores (_), and hyphens (-). |
| type | String | Definition Method of adding or matching resources. Range EPS (by enterprise project), TAG (by tag), NAME (by instance name), COMB (by multiple criteria), or Manual/an empty value (manual addition). |
| relation_ids | Array of strings | Definition Enterprise project IDs. |
| group_id | String | Definition Resource group ID. Range The value starts with rg and is followed by 22 characters that can include letters and digits. 2 to 24 characters. |
| create_time | Long | Definition Time when the resource group was created. The value is a UNIX timestamp in milliseconds. Example: 1603819753000 Range [0,9223372036854775807] |
| instance_statistics | InstanceStatistics object | Definition Resource statistics in the resource group. |
| status | String | Definition Health status of a resource group. Range |
| enterprise_project_id | String | Definition ID of the enterprise project that a resource group belongs to. Range The value can contain letters, digits, and hyphens (-). It can be 0 (ID of the default enterprise project). |
| resources | Array of Resource objects | Definition Information about one or more resources. This parameter is left blank by default. |
| Parameter | Type | Description |
|---|---|---|
| unhealth | Integer | Definition Number of resources in the Alarm state in the resource group. Range [0,2147483647] |
| total | Integer | Definition Total number of resources in the resource group. Range [0,2147483647] |
| type_statistics | Integer | Definition Number of resource types in the resource group. For example, if ECS, EIP, and bandwidth are added to the resource group, the value is 2. Range [0,2147483647] |
| Parameter | Type | Description |
|---|---|---|
| relation_id | String | Definition Alarm rule ID or resource group ID. Range N/A |
| namespace | String | Definition Metric namespace. Range N/A |
| dimensions | Array of DimensionResp objects | Definition Metric dimension. |
| status | String | Definition Resource health status. Range |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition Monitoring dimension name. For example, the dimension of an ECS is instance_id . For details about the dimension names of each resource, see their service documentation. You can navigate there from Services Interconnected with Cloud Eye. Range The value must start with a letter and can only contain letters, digits, underscores (_), and hyphens (-). 1 to 32 characters. |
| value | String | Definition Monitoring dimension value, for example, the ECS ID. Range [0,256] |
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Definition Total number of records. Range [0,2147483647] |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| - | String | Request error. |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| - | String | The authentication information is not provided or is incorrect. |
Status code: 403
| Parameter | Type | Description |
|---|---|---|
| - | String | Access to the requested page is forbidden. |
Status code: 408
| Parameter | Type | Description |
|---|---|---|
| - | String | The request timed out. |
Status code: 429
| Parameter | Type | Description |
|---|---|---|
| - | String | Too many requests. |
Status code: 500
| Parameter | Type | Description |
|---|---|---|
| - | String | Failed to complete the request because of an internal service error. |
Status code: 503
| Parameter | Type | Description |
|---|---|---|
| - | String | The system is currently unavailable. |
Example Requests
/V1.0/{project_id}/resource-groups?start=0&limit=10 Example Responses
Status code: 200
OK
{
"resource_groups" : [ {
"group_name" : "ResourceGroup-Test01",
"type" : "TAG",
"relation_ids" : [ "0" ],
"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",
"type" : "TAG",
"relation_ids" : [ "0" ],
"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",
"type" : "TAG",
"relation_ids" : [ "0" ],
"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",
"type" : "TAG",
"relation_ids" : [ "0" ],
"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",
"type" : "TAG",
"relation_ids" : [ "0" ],
"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
}
} Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 408 | Request Timeout |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
| 503 | Service Unavailable |
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