Install
openclaw skills install @erickeyhu-hug/huawei-cloud-gaussdb-countCount the number of Huawei Cloud GaussDB instances in a region and output the count. Covers both GaussDB for openGauss and GaussDB (MySQL-compatible) instances. Returns the authoritative total_count from the list API, so the reported number is always correct. Read-only — never creates, modifies or deletes any resource. Use for GaussDB database inventory, daily inspection, or cost review. Triggers include: count GaussDB, GaussDB count, GaussDB instance count, how many GaussDB instances, GaussDB数量, GaussDB实例数量, 查询GaussDB数量, GaussDB总数, 统计GaussDB实例数.
openclaw skills install @erickeyhu-hug/huawei-cloud-gaussdb-countThis skill queries the total number of Huawei Cloud GaussDB instances in a region and outputs the count. It supports both GaussDB product families:
GaussDBforopenGauss service.GaussDB service.The count is taken from the authoritative total_count field returned by the
list API, so the result is exact regardless of page size — no pagination sum is
needed for the count itself.
Architecture:
Agent → hcloud CLI (primary) → Huawei Cloud GaussDB API
↘ Python SDK (fallback) ↗
Applicable Scenarios:
references/cli-installation-guide.mdhuaweicloudsdkgaussdbforopengauss and huaweicloudsdkgaussdb
packages (SDK fallback)references/iam-policies.mdtotal_count from each response| Purpose | Command |
|---|---|
| Count all GaussDB for openGauss instances | hcloud GaussDBforopenGauss ListInstances --cli-region={region} --limit=100 |
| Purpose | Command |
|---|---|
| Count all GaussDB (MySQL) instances | hcloud GaussDB ListGaussMySqlInstances --cli-region={region} --limit=100 |
To return just the numeric count:
hcloud GaussDBforopenGauss ListInstances --cli-region={region} --limit=100 | jq -r '.total_count'
hcloud GaussDB ListGaussMySqlInstances --cli-region={region} --limit=100 | jq -r '.total_count'
When the CLI is unavailable, use the Python SDK:
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkgaussdbforopengauss.v3.region.gaussdbforopengauss_region import GaussDBforopenGaussRegion
from huaweicloudsdkgaussdbforopengauss.v3 import GaussDBforopenGaussClient, ListInstancesRequest
credentials = BasicCredentials().with_ak(os.getenv("HUAWEI_ACCESS_KEY")) \
.with_sk(os.getenv("HUAWEI_SECRET_KEY"))
client = GaussDBforopenGaussClient.new_builder() \
.with_credentials(credentials) \
.with_region(GaussDBforopenGaussRegion.value_of("{region}")) \
.build()
response = client.list_instances(ListInstancesRequest(limit=100))
print(response.total_count)
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkgaussdb.v3.region.gaussdb_region import GaussDBRegion
from huaweicloudsdkgaussdb.v3 import GaussDBClient, ListGaussMySqlInstancesRequest
credentials = BasicCredentials().with_ak(os.getenv("HUAWEI_ACCESS_KEY")) \
.with_sk(os.getenv("HUAWEI_SECRET_KEY"))
client = GaussDBClient.new_builder() \
.with_credentials(credentials) \
.with_region(GaussDBRegion.value_of("{region}")) \
.build()
response = client.list_gauss_my_sql_instances(ListGaussMySqlInstancesRequest(limit=100))
print(response.total_count)
A ready-to-run helper script is provided in scripts/count_gaussdb_instances.py covering both product families. The script catches
ClientRequestException/SdkException and prints a concise, actionable error message (credential / region / IAM-permission hint) then exits
non-zero — it never dumps a raw traceback.
| Parameter | Required | Description | Example |
|---|---|---|---|
{region} | Yes | Huawei Cloud region | cn-north-4 |
{limit} | No | Max records per page (1-100, default 100); does not affect total_count | 100 |
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]
| Feature | Description | Example |
|---|---|---|
| Service name | GaussDBforopenGauss, GaussDB | hcloud GaussDBforopenGauss ListInstances --cli-region={region} |
| Operation name | PascalCase | ListInstances, ListGaussMySqlInstances |
| Region parameter | --cli-region=<value> | --cli-region=cn-north-4 |
| Simple parameter | --key=value | --limit=100 |