Huawei Cloud VPC List Skill
Overview
This skill queries the list of VPCs (Virtual Private Clouds) under the current
Huawei Cloud tenant / project and returns their key attributes (ID, name, CIDR,
status, description, enterprise project). It uses the huaweicloudsdkvpc Python
SDK to call the VPC v3 API (ListVpcs), and automatically aggregates all
paginated results to ensure the returned VPC count matches the actual total.
Architecture
Agent → scripts/list_vpcs.py (Python SDK) → Huawei Cloud VPC v3 API
API version
| Version | SDK Operation | API Path |
|---|---|---|
| v3 | VpcClient.list_vpcs |
GET /v3/{project_id}/vpc/vpcs |
Applicable Scenarios
- Network inventory: "list all VPCs of this tenant" — returns correct total count
- VPC planning: verify existing CIDR ranges before creating new subnets/VPCs
- Troubleshooting: locate a VPC by name/id and inspect its status
- Enterprise-project audit: list VPCs of one enterprise project or all projects
能力边界(Capability Boundary): 本 Skill 仅查询 VPC 列表。不创建/删除/修改 VPC,也不查询子网、安全组、 路由表等其它资源(那些属于 VPC 的其它查询能力或专用 Skill)。 若用户询问"查询子网/安全组/路由表"等,请明确告知本 Skill 不提供该能力。
Prerequisites
-
Python 3.8+ with
huaweicloudsdkvpcpackage installed:pip install huaweicloudsdkvpc -
IAM permissions —
vpc:vpcs:list(read-only) is required to list VPCs. Seereferences/iam-policies.md. -
AK/SK credentials — set via environment variables:
HUAWEI_ACCESS_KEY/HUAWEI_SECRET_KEY, orHW_AK/HW_SK, or- other
HUAWEI*_AK/HUAWEI*_SKpattern variables
-
Region and Project ID — specify via
--regionand--project_id.
Workflow
- Confirm parameters — ask the user for the target region (default
cn-north-4), project ID, and any optional filters - Verify prerequisites — check
list_vpcs.py --helpfor syntax validity, and confirm AK/SK environment variables are set - Run the query — execute
python3 scripts/list_vpcs.py --project_id=...with the desired filters and pagination options - Aggregate all pages — the script automatically loops through all
paginated results using the
next_markerfrom each response, ensuring every VPC is counted - Return results — the script outputs the full VPC list (id, name, cidr, status, description, enterprise project id) along with the correct total count aggregated across all pages
- Handle errors — on auth/region errors, verify credentials and region; on permission errors, report the missing IAM permission
Core Commands
Query All VPCs (with full page aggregation)
python3 scripts/list_vpcs.py --project_id={project_id} --region={region}
Query with a Custom Limit Per Page
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --limit=100
Filter by Enterprise Project
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --enterprise_project_id={id}
Filter by VPC Name
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --name my-vpc
Filter by VPC ID
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --id {vpc_id}
Filter by CIDR
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --cidr 192.168.0.0/16
Local Pagination (after full aggregation)
# Full aggregation returns all VPCs
python3 scripts/list_vpcs.py --project_id={project_id} --region={region}
# Use marker to start from a specific VPC
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --marker={vpc_id}
Output as Text Table
python3 scripts/list_vpcs.py --project_id={project_id} --region={region} --output=text
Parameter Confirmation
| Parameter | Required | Description | Example |
|---|---|---|---|
{project_id} |
Yes | Huawei Cloud project ID (from IAM) | 0a0... |
{region} |
Yes | Huawei Cloud region | cn-north-4 |
{limit} |
No | Max records to show (default: 2000, max: 2000) | 100 |
{marker} |
No | Start marker for continuation | VPC UUID from response |
{name} |
No | VPC name filter (multiple supported) | production-vpc |
{id} |
No | VPC ID filter (multiple supported) | vpc-... |
{cidr} |
No | CIDR filter (multiple supported) | 192.168.0.0/16 |
{description} |
No | Description filter (multiple supported) | production |
{enterprise_project_id} |
No | Enterprise project ID | 0 or all_granted_eps |
