Updated on 2025-10-24 GMT+08:00

Querying the Total Number of User Resources

Function

This API is used to query the total number of user resources.

Users can query resources. The number of resource data records that meet the filter criteria can be returned.

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

    coc:instance:countResources

    List

    -

    -

    -

    -

URI

GET /v1/resources/count

Table 1 Query Parameters

Parameter

Mandatory

Type

Description

provider

Yes

String

Definition:

Cloud service name.

Constraints:

N/A

Value range:

The value is a string. The value can be ecs, cce, or rds.

Default value:

N/A

type

Yes

String

Definition:

Resource type.

Constraints:

N/A

Value range:

There are many resource types. Select a resource type based on the actual service. The common resource types are as follows:

  • cloudservers: Elastic Cloud Servers (ECSs)

  • servers: bare metal server (BMSs)

  • clusters: Cloud Container Engine (CCE) instances

  • instances: cloud database instances

Default value:

N/A

resource_id_list

No

Array of strings

Definition:

Resource ID list.

Constraints:

N/A

Value range:

A collection of resource IDs selected by users.

Default value:

N/A

name

No

String

Definition:

Cloud resource name.

Constraints:

N/A

Value range:

The value is a string. For details, see BMS.

Default value:

N/A

region_id

No

String

Definition:

Region ID.

Constraints:

N/A

Value range:

ID of the region with which the region is associated.

Default value:

N/A

az_id

No

String

Definition:

AZ ID.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

ip_type

No

String

Definition:

The property is in the IP address format.

Constraints:

N/A

Value range:

  • fixed: internal IP address

floating: elastic public IP address

Default value:

N/A

ip

No

String

Definition:

Cloud resource IP address.

Constraints:

N/A

Value range:

Filtering results for IPv4 addresses, which are fuzzy matched.

Default value:

N/A

status

No

String

Definition:

Cloud resource status.

Constraints:

N/A

Value range:

Select an ECS status that is available inECS.

Default value:

N/A

agent_state

No

String

Definition:

Agent status.

Constraints:

N/A

Value range:

  • ONLINE: The UniAgent is running.

  • OFFLINE: The UniAgent is abnormal.

  • INSTALLING: The UniAgent is being installed.

  • FAILED: The UniAgent fails to be installed.

  • UNINSTALLED: The UniAgent is uninstalled.

  • null: The UniAgent is not installed.

Default value:

N/A

image_name

No

String

Definition:

Image name, which is used for fuzzy match.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

os_type

No

String

Definition:

System type.

Constraints:

N/A

Value range:

  • window: Windows OS.

  • linux: Linux OS.

Default value:

N/A

tag

No

String

Definition:

Cloud resource tag.

Constraints:

A tag is in the format of "key.value". The maximum lengths of the key and value are 36 and 43 characters, respectively.

Value range:

The key of the tag can contain only letters, digits, underscores (_) , and hyphens (-). The value of the tag can contain only letters, digits, underscores (_) , hyphens (-), and periods (.).

Default value:

N/A

tag_key

No

String

Definition:

Tag key of a cloud resource.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

group_id

No

String

Definition:

Group ID of a cloud resource.

Constraints:

If the group ID is used, the number of resources in the group is queried.

Value range:

N/A

Default value:

N/A

component_id

No

String

Definition:

Component ID of a cloud resource.

Constraints:

If the component ID is used, the number of resources in the component is queried.

Value range:

N/A

Default value:

N/A

application_id

No

String

Definition:

Application ID of a cloud resource.

Constraints:

If the application ID is used, the number of resources of the application is queried.

Value range:

N/A

Default value:

N/A

cce_cluster_id

No

String

Definition:

CCE cluster ID.

Constraints:

N/A

Value range:

ID of the CCE cluster to which the resource belongs.

Default value:

N/A

ep_id

No

String

Definition:

Enterprise project ID.

Constraints:

N/A

Value range:

Select a project ID that is available inEnterprise Management.

Default value:

N/A

is_delegated

No

String

Definition:

Hosted

Constraints:

N/A

Value range:

  • true: The enterprise project has been hosted.

  • false: The enterprise project is not hosted.

Default value:

N/A

is_collected

No

Boolean

Definition:

Whether to add it to favorites.

Constraints:

N/A

Value range:

  • true: The enterprise project has been added to favorites.

  • false: The enterprise project is not added to favorites.

Default value:

N/A

flavor_name

No

String

Definition:

Resource flavor name.

Constraints:

N/A

Value range:

N/A

Default value:

N/A

charging_mode

No

String

Definition:

Cloud server billing mode.

Constraints:

N/A

Value range:

Billing mode.

  • 0: pay-per-use

  • 1: yearly/monthly

  • 2: spot price

Default value:

N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response header parameters

Parameter

Type

Description

X-request-id

String

Definition:

Request ID used for task tracing.

Value range:

request_uuid-timestamp-host name

Table 3 Response body parameters

Parameter

Type

Description

data

Long

Definition:

Number of cloud resources.

Value range:

The value ranges from 0 to 65,535.

Status code: 400

Table 4 Response header parameters

Parameter

Type

Description

X-request-id

String

Definition:

Request ID used for task tracing.

Value range:

request_uuid-timestamp-host name

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

The value contains 8 to 36 characters.

error_msg

String

Definition:

Error description.

Value range:

The value contains 2 to 512 characters.

Example Requests

Query the total number of user resources.

GET https://{Endpoint}/v1/resources/count?type=clusters&provider=cce&is_collected=false

Example Responses

Status code: 200

The total number of resources is queried.

{
  "data" : 54
}

Status Codes

Status Code

Description

200

The total number of resources is queried.

400

Failed to query the total number of resources.

Error Codes

See Error Codes.