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 for a specified resource 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.
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:getServiceResources
Read
-
g:EnterpriseProjectId
- ces:resourceGroups:get
 
-
 
URI
GET /v2/{project_id}/resource-groups/{group_id}/services/{service}/resources
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        project_id  | 
      
        Yes  | 
      
        String  | 
      
        Project ID.  | 
     
| 
        group_id  | 
      
        Yes  | 
      
        String  | 
      
        Resource group ID, which starts with rg and is followed by 22 characters, including letters and digits.  | 
     
| 
        service  | 
      
        Yes  | 
      
        String  | 
      
        Service type, for example, SYS.ECS.  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        dim_name  | 
      
        No  | 
      
        String  | 
      
        Resource dimension. Multiple dimensions are separated with commas (,) in alphabetical order.  | 
     
| 
        limit  | 
      
        No  | 
      
        String  | 
      
        Number of items on each page during pagination query. The value ranges from 1 to 100 (default).  | 
     
| 
        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.  | 
     
| 
        status  | 
      
        No  | 
      
        String  | 
      
        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.  | 
     
| 
        dim_value  | 
      
        No  | 
      
        String  | 
      
        Resource dimension value. Fuzzy match is not supported. If a resource has multiple dimensions, you can specify one of them.  | 
     
| 
        tag  | 
      
        No  | 
      
        String  | 
      
        Resource tag information. The format is "[key]":"[value]", for example: "ssss":"1111".  | 
     
| 
        extend_relation_id  | 
      
        No  | 
      
        String  | 
      
        Enterprise project ID.  | 
     
| 
        product_name  | 
      
        No  | 
      
        String  | 
      
        Cloud product of the resource group. Generally, the value format is Service namespace,First-level dimension name of the service, for example, SYS.ECS,instance_id.  | 
     
| 
        resource_name  | 
      
        No  | 
      
        String  | 
      
        Resource name.  | 
     
| 
        event_status  | 
      
        No  | 
      
        String  | 
      
        Resource health status. The value can only be health, unhealthy, or no_alarm_rule. health: An event alarm rule has been created for the resource and there is no alarm triggered. unhealthy: An event alarm rule has been created for the resource and there are alarms triggered. no_alarm_rule: No event alarm rule has been created for the resource.  | 
     
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 resources.  | 
     
| 
        resources  | 
      
        Array of GetResourceGroupResources objects  | 
      
        Resources in a resource group.  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        status  | 
      
        String  | 
      
        Metric alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set).  | 
     
| 
        dimensions  | 
      
        Array of ResourceDimension objects  | 
      
        Resource dimension information.  | 
     
| 
        tags  | 
      
        String  | 
      
        Resource tag information. The value is a JSON character string in the format of key/value, for example, "{"sss":"aaa"}".  | 
     
| 
        enterprise_project_id  | 
      
        String  | 
      
        Enterprise Project ID.  | 
     
| 
        event_status  | 
      
        String  | 
      
        Event alarm status. The value can be health (alarming), unhealthy (triggered), or no_alarm_rule (no alarm rule is set).  | 
     
| 
        resource_name  | 
      
        String  | 
      
        Resource name  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        name  | 
      
        String  | 
      
        Definition 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 Service Metric Dimensions. Constraints N/A Range The value starts with a letter and allows 1 to 32 characters. It can contain letters, digits, underscores (_), and hyphens (-). Default Value N/A  | 
     
| 
        value  | 
      
        String  | 
      
        Definition Resource dimension value, which is an instance ID, for example, 4270ff17-aba3-4138-89fa-820594c39755. Constraints N/A Range 1 to 256 characters Default Value N/A  | 
     
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: 404
| 
        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 resources of a specified dimension for a specified resource 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  | 
      
        Parameter verification failed.  | 
     
| 
        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