nav-img
Advanced

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.

URI

GET /v2/{project_id}/resource-groups/{group_id}/services/{service}/resources

Table 1 Path Parameters

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

Table 2 Query Parameters

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:

  • health

  • unhealthy

  • no_alarm_rule

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

tag

No

String

Resource tag. The format is [key]:**[value]. Example: ssss:1111.

Minimum: 0

Maximum: 500

extend_relation_id

No

String

Enterprise project ID.

Minimum: 0

Maximum: 128

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies the tenant token.

Minimum: 1

Maximum: 16384

Response Parameters

Status code: 200

Table 4 Response body parameters

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

Table 5 GetResourceGroupResources

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:

  • health

  • unhealthy

  • no_alarm_rule

dimensions

Array of Dimension objects

Specifies the resource dimension information.

Array Length: 1 - 4

Table 6 Dimension

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

Table 7 Response body parameters

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

Table 8 Response body parameters

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

Table 9 Response body parameters

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

Table 10 Response body parameters

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

Table 11 Response body parameters

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