Huawei Cloud DWS Cluster List Skill
Overview
This skill queries the DWS (Data Warehouse Service) cluster list under a Huawei Cloud tenant and returns only the cluster names. It is designed for daily inspection, resource inventory, and quick cluster overview scenarios.
Architecture: KooCLI (hcloud) → DWS ListClusters API → jq extraction of clusters[].name
Applicable Scenarios:
- Daily inspection of DWS clusters
- Resource inventory / asset overview
- Quick listing of all DWS cluster names under the tenant
Typical Use Cases:
- "查询一下我账号下有哪些DWS集群"
- "列出所有DWS集群的名称"
- "帮我看看租户下DWS列表"
- "List all my DWS clusters"
- "Show me the DWS cluster names under this tenant"
Prerequisites
1. CLI Requirements
- KooCLI (hcloud) >= 3.2.0
- Verify installation: hcloud version
- If not installed or version too low, see CLI Installation Guide
2. Authentication Configuration
- Valid Huawei Cloud credentials (AK/SK mode), configured via the hcloud configure command
- Security Rules:
- Never expose AK/SK values in conversations or commands
- Never ask users to input AK/SK directly in conversation
- Only use the hcloud configure list command to check credential status
3. IAM Permission Requirements
dws:cluster:list(DWS cluster list permission)- See IAM Policies
Workflow
- Confirm the target region (default
cn-north-4if not specified). - Run the
hcloud DWS ListClusterscommand with--cli-region=<region>. - Optionally filter by enterprise project with
--enterprise_project_id=<ep_id>. - Extract cluster names from the JSON response with
jq -r '.clusters[]?.name'. - Output the cluster name list; if none exist, report "No DWS clusters found in region ".
Core Commands
# List all DWS clusters and extract cluster names
hcloud DWS ListClusters --cli-region=<region> | jq -r '.clusters[]?.name'
# List DWS clusters under a specific enterprise project
hcloud DWS ListClusters --cli-region=<region> --enterprise_project_id=<ep_id> | jq -r '.clusters[]?.name'
# List clusters across all granted enterprise projects
hcloud DWS ListClusters --cli-region=<region> --enterprise_project_id=all_granted_eps | jq -r '.clusters[]?.name'
# Full JSON output (when cluster details are also needed)
hcloud DWS ListClusters --cli-region=<region>
Script Mode (quality-reporting integrated)
# Query DWS cluster names with execution-quality reporting (skill_quality_sdk)
python3 scripts/list_dws_clusters.py --region <region> [--enterprise_project_id <ep_id>]
The wrapper script scripts/list_dws_clusters.py runs the same hcloud command, extracts cluster names,
and reports execution quality (success/biz_fail/sys_fail + error codes) to the skillsopr operations console
via the vendored scripts/skill_quality_sdk.py. Reporting is silent on failure and never blocks the query.
Error Handling
Important: hcloud outputs non-JSON error text to stdout with exit code 0 for parameter/credential errors (invalid region, bad AK/SK, etc.). Do NOT rely on the shell exit code alone.
| Error scenario | hcloud behavior | Recommended handling |
|---|---|---|
Invalid --cli-region |
stdout contains [USE_ERROR]The value of cli-region is not supported... + supported region list, exit 0 |
Use the wrapper script (scripts/list_dws_clusters.py) which detects [USE_ERROR] / Failed to obtain project ID / Unauthorized markers regardless of exit code and reports the real cause; or run the bare hcloud command first to confirm the output is valid JSON before piping to jq |
| Invalid / expired AK/SK | stdout contains Failed to obtain project ID... Unauthorized, exit 0 |
Wrapper reports "凭证认证失败" with guidance to check credential status via the hcloud configure list command and IAM dws:cluster:list permission |
| Network timeout | non-zero exit code | Wrapper reports network/timeout error (N01) |
The wrapper (_run_hcloud) checks hcloud output for [USE_ERROR], [OPENAPI_ERROR], Failed to obtain project ID,
error_code and Unauthorized markers before checking the exit code, then raises an exception that carries
both a translated fix hint and the raw hcloud output — so the real reason is never masked by a JSON parse fallback.
Response format (JSON):
{
"clusters": [
{"id": "xxx", "name": "cluster-1", "status": "AVAILABLE"},
{"id": "yyy", "name": "cluster-2", "status": "ACTIVE"}
],
"count": 2
}
Cluster names are extracted via jq -r '.clusters[]?.name'. When no clusters exist, the API returns {"clusters": [], "count": 0} and the skill reports "No DWS clusters found".
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
region |
Yes | Huawei Cloud region for --cli-region |
cn-north-4 |
enterprise_project_id |
No | Enterprise project ID filter; all_granted_eps queries all authorized enterprise projects |
all_granted_eps |
KooCLI Command Format Standard
hcloud <Service> <Operation> --cli-region=<region> [--key=value ...]
| Feature | Description | Example |
|---|---|---|
| Service name | Exact KooCLI Service name beginning with uppercase | DWS |
| Operation name | PascalCase | ListClusters |
| Region parameter | --cli-region=<value> |
--cli-region=cn-north-4 |
| Simple parameter | --key=value |
--enterprise_project_id=all_granted_eps |
Reference Documents
- IAM Policies — Least-privilege IAM policy for DWS cluster listing
- CLI Installation Guide — KooCLI installation and configuration
- Verification Method — How to verify the skill works
- Data Flow Diagram — Mermaid diagram of the query flow
- Acceptance Criteria — Definition of done for this skill
