Huawei Cloud WAF Protected Website List
Overview
Query the WAF-protected website / domain-name list of a tenant region through
KooCLI hcloud waf ListHost (cloud mode) or hcloud waf ListCompositeHosts
(all modes: cloud + dedicated/premium), returning key fields such as the
protected domain name, protection status, access mode (云模式/独享模式), keep-alive
mode (proxy or direct), and exclusive-IP flag. The skill is aimed at WAF
inventory inspection, daily operations patrol, protection-status verification,
and as a pre-query step for other WAF tasks that need a domain or hostid.
| Command | REST path | Scope |
|---|---|---|
WAF ListHost |
GET /v1/{project_id}/waf/instance |
cloud-mode protected domains |
WAF ListCompositeHosts |
GET /v1/{project_id}/composite-waf/host |
domains across all WAF instances (cloud + premium) |
Architecture:
agent → python3 scripts/list_waf_sites.py [--region=<region>] [--all-modes|--mode=<m>]
→ hcloud waf ListHost | ListCompositeHosts --cli-region=<region>
→ Huawei Cloud WAF OpenAPI → parsed JSON → table / --json / --names-only
Key properties:
- Read-only by design — only the two
List*(GET) operations are ever constructed. A write-intent guard scans user arguments and validates the operation name; mutating intents (create / delete / update / migrate / rename / batch ...) are rejected with an explicit message before any command runs. - KooCLI only — WAF is driven through the hcloud CLI. Credentials are always resolved by the KooCLI profile / environment, never handled by the script.
- Two scopes — by default the skill queries cloud-mode domains
(
ListHost, matching what the WAF console "存量防护网站" tab shows). Add--all-modes(or--mode premium) to query the composite list covering dedicated/premium-mode domains too;waf_typein the JSON response marks each domain ascloudorpremium. - Key-field table default — the default table renders 防护域名 | 防护状态 |
接入方式 | 保活方式 | 独享IP | Domain ID;
--jsongives the raw host array for downstream tooling. - Offline-testable — every code path (routing, output modes, filters, error classification, guard) is covered by unit tests that mock the hcloud subprocess.
Out of scope: every mutating WAF action (create / delete / update a domain, migrate the access mode, batch operations, policy / rule management), and detailed per-domain configuration export. Those require a dedicated write-capable skill and explicit user confirmation.
Dependency: Quality telemetry is collected automatically via skill-quality-cli (installed by scripts/ensure_cli.sh if absent).
Prerequisites
- KooCLI (
hcloud) installed — see references/cli-installation-guide.md. - Active credential profile — configure credentials out-of-band (run the KooCLI configure command in your terminal, or set credential environment variables). Never paste AK/SK into chat; the script never reads, echoes, or stores secrets itself — authentication is delegated entirely to the hcloud profile.
- IAM permission — read-only
waf:host:list; the least-privilege policy is in references/iam-policies.md. - Python 3.8+ (standard library only — argparse / json / subprocess).
- Outbound HTTPS access to
*.myhuaweicloud.com.
skill-quality-cli— ensured bybash scripts/ensure_cli.sh(idempotent, skips if present)- Upgrade: run
skill-quality-cli upgrademanually (no auto-upgrade) - Disable telemetry report: set
SKILL_QUALITY_REPORT=0
- Upgrade: run
Workflow
- Confirm the target region (default
cn-north-4); every WAF call is region-scoped. - Pick the scope — cloud mode only (default), all modes (
--all-modes), or dedicated/premium mode (--mode premium). - Run the list script with the desired output mode and filters.
- Read the result — table for humans,
--jsonfor downstream tooling,--names-onlyfor a compact domain inventory. - Handle the empty / error cases per the Edge Cases table below (the script prints an explicit hint for empty region, missing permission, and missing hcloud).
Core Commands
List cloud-mode protected domains (default)
> **⚠️ Mandatory: every `hcloud` command in this skill MUST be wrapped with `skill-quality-cli run --skill-name huawei-cloud-waf-list -- ` — bare `hcloud` calls are strictly forbidden.**
skill-quality-cli run --skill-name huawei-cloud-waf-list -- python3 scripts/list_waf_sites.py --region={region}
| Parameter | Required | Description |
|---|---|---|
--region |
No (auto) | Region, default cn-north-4 |
Under the hood the skill runs:
skill-quality-cli run --skill-name huawei-cloud-waf-list -- hcloud waf ListHost --cli-region={region} --pagesize=-1
| Parameter | Required | Description |
|---|---|---|
--cli-region |
Yes (auto) | Region, agent fills automatically |
--pagesize |
No | Results per page 1-100; -1 queries all at once |
--hostname |
No | Domain name filter |
--enterprise_project_id |
No | Enterprise project ID (default 0; use all_granted_eps for all) |
--policyname |
No | Protection policy name |
--page |
No | Page number, default 1 |
List protected domains across all WAF instances
skill-quality-cli run --skill-name huawei-cloud-waf-list -- python3 scripts/list_waf_sites.py --all-modes --region={region}
Under the hood the skill runs:
skill-quality-cli run --skill-name huawei-cloud-waf-list -- hcloud waf ListCompositeHosts --cli-region={region} --pagesize=-1
| Parameter | Required | Description |
|---|---|---|
--cli-region |
Yes (auto) | Region, agent fills automatically |
--pagesize |
No | Results per page 1-100; -1 queries all at once |
--hostname |
No | Domain name filter |
--enterprise_project_id |
No | Enterprise project ID (default 0; use all_granted_eps for all) |
--is_https |
No | Whether HTTPS is used for the domain (true/false) |
--protect_status |
No | Protection status: -1 bypass, 0 suspended, 1 enabled |
--policyname |
No | Protection policy name |
--page |
No | Page number, default 1 |
JSON output
skill-quality-cli run --skill-name huawei-cloud-waf-list -- python3 scripts/list_waf_sites.py --all-modes --json --region={region}
The JSON body keeps the raw host array: hostname, hostid, protect_status,
access_status, proxy, exclusive_ip, waf_type (cloud / premium),
policyid, server and more.
Name-only output
skill-quality-cli run --skill-name huawei-cloud-waf-list -- python3 scripts/list_waf_sites.py --names-only --region={region}
Filter by protection status
skill-quality-cli run --skill-name huawei-cloud-waf-list -- python3 scripts/list_waf_sites.py --all-modes --protect-status 1 --region={region}
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
--region |
No | Huawei Cloud region (CLI --cli-region) |
cn-north-4 |
--all-modes |
No | Query all WAF modes (cloud + premium) | flag |
--mode |
No | cloud (default behavior) / premium |
premium |
--json |
No | Raw JSON response body | flag |
--names-only |
No | Unique sorted domain list | flag |
--hostname |
No | Domain name filter | www.example.com |
--protect-status |
No | -1 bypass / 0 suspended / 1 enabled |
1 |
--enterprise-project-id |
No | Enterprise project ID | 0 / all_granted_eps |
--policyname |
No | Protection policy name | default |
--pagesize |
No | Page size, default -1 (all) |
-1 |
Edge Cases
| Scenario | Behavior |
|---|---|
| No protected sites in region | 当前区域无 WAF 防护网站。 |
| Filter matches nothing | 未找到匹配的防护网站。 |
IAM permission missing (WAF.00012006) |
无权限访问 WAF 防护网站列表,请检查 IAM 权限(waf:host:list)。 |
Region disabled (APIGW.0802) |
当前账号在该区域不可用(APIGW.0802),请更换 --region。 |
| hcloud not installed | Explicit install hint pointing to KooCLI quickstart |
| Write intent detected | Read-only guard error before any command runs |
References
- references/cli-installation-guide.md
- references/iam-policies.md
- references/verification-method.md
- references/dataflow-diagram.md
- references/acceptance-criteria.md
KooCLI Command Format Standard
skill-quality-cli run --skill-name huawei-cloud-waf-list -- hcloud <service> <Operation> --cli-region=<region> [--key=value ...]
| Feature | Description | Example |
|---|---|---|
| Service name | waf (verified from hcloud waf --help; service code lowercase) |
waf |
| Operation name | PascalCase | ListHost, ListCompositeHosts |
| Region parameter | --cli-region=<value> |
--cli-region=cn-north-4 |
| Simple parameter | --key=value |
--pagesize=-1 |
Service and parameter names are taken verbatim from hcloud WAF --help /
hcloud waf ListHost --help — never invented.
