Huawei Cloud ASM List Skill
Overview
This skill queries the list of ASM (Application Service Mesh) meshes under
the current Huawei Cloud tenant / project and fuzzy-matches them by mesh
name. It returns the matching meshes together with their key attributes: the
mesh name (metadata.name), mesh id (metadata.uid), status (status.phase)
and creation timestamp (metadata.creation_timestamp).
The ASM list API (GET /v1/{project_id}/meshes) returns all meshes of the
project and has no server-side name filter. Therefore the skill performs a
client-side fuzzy match: it lists all meshes and keeps only those whose
name contains the requested keyword (case-insensitive substring match).
Architecture:
Agent → huaweicloudsdkasm.v1 AsmClient.list_meshes() → Huawei Cloud ASM API (GET /v1/{project_id}/meshes)
↘ client-side fuzzy filter on metadata.name → matched meshes
API used (verified from SDK _http_info):
| Operation | SDK Method | API Path |
|---|---|---|
| List meshes | AsmClient.list_meshes() |
GET /v1/{project_id}/meshes |
Region endpoint (from SDK AsmRegion): cn-north-4 →
https://asm.cn-north-4.myhuaweicloud.com. Note: the ASM service currently
supports only the cn-north-4 region — AsmRegion.value_of() rejects any
other region id.
Applicable Scenarios:
- ASM inventory: "list all ASM meshes of this tenant" or "show me the ASM name list"
- Locate a mesh by name: "find the mesh whose name contains 'prod'"
- Daily inspection: snapshot of all meshes and their status phase
- Troubleshooting: check a mesh's status by fuzzy name lookup
能力边界(Capability Boundary): 本 Skill 仅查询 ASM 网格列表并按名称模糊匹配。不创建/删除/修改网格, 也不查询/操作网格内的服务、虚拟服务、目标规则、网关等子资源。若用户询问 "创建/删除/更新ASM网格" 或 "查询网格内资源" 等,请明确告知本 Skill 不提供 该能力。
Prerequisites
-
Python 3.8+ with the Huawei Cloud Python SDK installed:
pip3 install huaweicloudsdkasm -
Authentication credentials —
HUAWEICLOUD_SDK_AKandHUAWEICLOUD_SDK_SKenvironment variables (or the alternateHUAWEI_ACCESS_KEY/HUAWEI_SECRET_KEY, orHWC_AK/HWC_SK). Credentials are read from the environment only — never hardcode them. -
IAM permissions — the account needs the mesh list permission. See
references/iam-policies.md. -
A region where the tenant owns ASM meshes; specify it with
AsmRegion.value_of(...).
Workflow
- Identify the intent — Confirm the user wants to list ASM meshes and, if given, the fuzzy name keyword (the substring to match).
- Confirm region — Default
cn-north-4; let the user override with another region if needed. - Run the query — Call
list_meshes()through the SDK to fetch all meshes. - Apply the fuzzy filter — If a keyword is provided, keep only meshes
whose
metadata.namecontains the keyword (case-insensitive). If no keyword is given, list all meshes. - Present the results — Show name, id, status phase and creation timestamp for each matching mesh.
- Handle errors — If the call fails:
- Region not supported (
region_id ... is not in the following supported regions): the ASM service only supportscn-north-4— use that region. - Credentials/permissions (
APIGW.0802 forbiddenor a 403): the account lacks permission — verify the IAM policy grants the mesh list action. - SDK not installed:
pip3 install huaweicloudsdkasm.
- Region not supported (
Core Commands
This skill runs through the Python SDK because the KooCLI (hcloud) does
not support the ASM service. Use the following pattern:
List all ASM meshes of the project (compact fields)
python3 -c "
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkasm.v1 import AsmClient, ListMeshesRequest
from huaweicloudsdkasm.v1.region.asm_region import AsmRegion
client = AsmClient.new_builder() \\
.with_credentials(BasicCredentials(os.environ['HUAWEICLOUD_SDK_AK'],
os.environ['HUAWEICLOUD_SDK_SK'])) \\
.with_region(AsmRegion.value_of('cn-north-4')) \\
.build()
resp = client.list_meshes(ListMeshesRequest())
for m in resp.items or []:
print(m.metadata.name, m.metadata.uid, m.status.phase)
"
Fuzzy-match meshes by name (case-insensitive substring)
python3 -c "
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkasm.v1 import AsmClient, ListMeshesRequest
from huaweicloudsdkasm.v1.region.asm_region import AsmRegion
keyword = 'prod' # the fuzzy name keyword
client = AsmClient.new_builder() \\
.with_credentials(BasicCredentials(os.environ['HUAWEICLOUD_SDK_AK'],
os.environ['HUAWEICLOUD_SDK_SK'])) \\
.with_region(AsmRegion.value_of('cn-north-4')) \\
.build()
resp = client.list_meshes(ListMeshesRequest())
matched = [m for m in (resp.items or []) if keyword.lower() in (m.metadata.name or '').lower()]
for m in matched:
print(m.metadata.name, m.metadata.uid, m.status.phase, m.metadata.creation_timestamp)
print('matched', len(matched))
"
Note:
ListMeshesRequestaccepts no parameters. Fuzzy matching is done client-side onmetadata.name. An emptyitemsarray (or no matches) means the tenant has no meshes matching in that region.
Parameter Confirmation(参数确认)
| Parameter | Required | Description | Example |
|---|---|---|---|
{region} |
No | Huawei Cloud region. Only cn-north-4 is supported by the ASM service (default cn-north-4) |
cn-north-4 |
{keyword} |
No | Fuzzy name substring to match (case-insensitive). Empty = list all meshes | prod |
Note: The ASM service supports only the
cn-north-4region; passing any other region id toAsmRegion.value_of()raises aKeyError. If the user does not provide a keyword, the skill lists all meshes of the project. If a keyword is provided, only meshes whose name contains it are returned.
Output Format(输出格式)
Each mesh is printed on one line as:
<mesh_name> <mesh_id> <status_phase> <creation_timestamp>
mesh_name—metadata.namemesh_id—metadata.uidstatus_phase—status.phase(e.g.available)creation_timestamp—metadata.creation_timestamp
When a fuzzy keyword is used, the output ends with matched <N> where N is the
number of matching meshes. An empty list (or matched 0) is a valid result and
means no mesh matches in the region.
Notes(注意事项)
- The ASM list API returns all meshes of the project; the name filter is applied client-side and is case-insensitive substring matching.
- The ASM service supports only the
cn-north-4region. - This skill is strictly read-only: it never creates, modifies or deletes any mesh.
Verification Method(验证方法)
- SDK availability:
python3 -c "from huaweicloudsdkasm.v1 import AsmClient, ListMeshesRequest; print('SDK OK')" - Live list: run the Core Commands snippet above and confirm a line per mesh
(or
total meshes: 0when the tenant has no meshes). - Fuzzy match: filter with a keyword and confirm
matched N; a keyword with no matches must returnmatched 0without error. - Read-only assertion: the skill only issues
GET /v1/{project_id}/meshes.
See references/verification-method.md for the full procedure.
Best Practices(最佳实践)
- Always pass the region explicitly; only
cn-north-4is supported by ASM. - Prefer a keyword when the tenant owns many meshes — the filter runs client-side.
- Keep AK/SK in environment variables (
HUAWEICLOUD_SDK_AK/HUAWEICLOUD_SDK_SK); never embed credentials in the conversation or files.
KooCLI Command Format Standard
This skill is SDK-based — the KooCLI (hcloud) has no ASM service (the
service name ASM is rejected by the CLI with [USE_ERROR]Unsupported service: ASM). All operations are performed via the huaweicloudsdkasm
Python SDK. There are therefore no hcloud <Service> <Operation> commands to
document here.
Reference Documents
- IAM Policies — Least-privilege IAM permissions
- CLI Installation Guide — SDK and authentication setup
- Verification Method — How to verify the skill works
- Dataflow Diagram — Request flow diagram
- Acceptance Criteria — Acceptance test checklist
