Querying Resources of a Specified Dimension and a Specified Service Type in a Resource Group
Function
This API is used to query resources of a specified dimension and a specified service type in a resource group.
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/{group_id}/services/{service}/resources
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Specifies the tenant ID. Minimum: 1 Maximum: 64 |
group_id |
Yes |
String |
Specifies the resource group ID, which starts with rg and is followed by 22 characters, including letters and digits. Minimum: 2 Maximum: 24 |
service |
Yes |
String |
Specifies the service type, for example, SYS.ECS. Minimum: 3 Maximum: 32 |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
dim_name |
No |
String |
Specifies the resource dimension name. Separate multiple dimensions with commas (,) in alphabetical order. Minimum: 1 Maximum: 131 |
limit |
No |
String |
Specifies the number of items on each page during pagination query. The value ranges from 1 to 100 (default). Minimum: 1 Maximum: 100 |
offset |
No |
Integer |
Specifies the start position for pagination query, indicating the sequence number of the data record where the query starts. The default value is 0. Minimum: 0 Maximum: 10000 |
status |
No |
String |
Specifies the resource health status. The value can only be health, unhealthy, or no_alarm_rule. health: An alarm rule has been created for the resource and there is no alarm triggered. unhealthy: An alarm rule has been created for the resource and there are alarms triggered. no_alarm_rule: No alarm rule has been created for the resource. Enumeration values:
|
dim_value |
No |
String |
Specifies the resource dimension value. Fuzzy match is not supported. If a resource has multiple dimensions, you can specify one of them. Minimum: 1 Maximum: 1027 |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Specifies the tenant token. Minimum: 1 Maximum: 16384 |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
count |
Integer |
Specifies the total number of resources. Minimum: 0 Maximum: 10000 |
resources |
Array of GetResourceGroupResources objects |
Specifies the resource list in a resource group. Array Length: 0 - 100 |
Parameter |
Type |
Description |
---|---|---|
status |
String |
Specifies the resource health status. health: An alarm rule has been created for the resource and there is no alarm triggered. unhealthy: An alarm rule has been created for the resource and there are alarms triggered. no_alarm_rule: The resource is not associated with any alarm rule. Enumeration values:
|
dimensions |
Array of Dimension objects |
Specifies the resource dimension information. Array Length: 1 - 4 |
Parameter |
Type |
Description |
---|---|---|
name |
String |
Specifies the dimension of a resource. For example, the dimension of an ECS can be instance_id. A maximum of four dimensions are supported. For the metric dimension of each resource, see Services Interconnected with Cloud Eye. Regex Pattern: ^([a-z]|[A-Z]){1}([a-z]|[A-Z]|[0-9]|_|-){1,32}$ |
value |
String |
Specifies the value of a resource dimension, which is the resource ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Regex Pattern: ^((([a-z]|[A-Z]|[0-9]){1}([a-z]|[A-Z]|[0-9]|_|-|\.)*)|\*){1,256}$ |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 403
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 404
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Specifies the status codes customized by each cloud service when a request error occurs. Minimum: 0 Maximum: 256 |
error_msg |
String |
Specifies the request error message. Minimum: 0 Maximum: 256 |
request_id |
String |
Specifies the request ID. Minimum: 0 Maximum: 256 |
Example Requests
Querying resources of a specified dimension and a specified service type in a resource group
'/v2/{project_id}/resource-groups/{group_id}/services/{service}/resources'
Example Responses
Status code: 200
OK
{ "count" : 1000, "resources" : [ { "status" : "health", "dimensions" : [ { "name" : "instance_id", "value" : "4270ff17-aba3-4138-89fa-820594c39755" } ] } ] }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
400 |
Failed to verify parameters. |
401 |
Not authenticated. |
403 |
Authentication failed. |
404 |
Resource not found. |
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