Install
openclaw skills install @erickeyhu-hug/huawei-cloud-iam-role-listLists Huawei Cloud IAM (Identity and Access Management) roles — enumerates all IAM roles (permissions) under the authenticated account with role ID, display name, internal name, catalog and type, using the KooCLI hcloud IAM KeystoneListPermissions command (primary) or the ListPoliciesV5 command / huaweicloudsdkiam Python SDK (fallback). Provides read-only IAM role inventory for account management, security auditing, permission review and resource discovery. Use this skill whenever the user mentions IAM role list query. Triggers include: list IAM roles, IAM role list, query IAM roles, enumerate IAM roles, show IAM roles, IAM role inventory, permission list, 查询IAM角色, IAM角色列表, 查看IAM角色, 角色列表, 权限列表, 列出IAM角色, 查询角色, 获取角色列表.
openclaw skills install @erickeyhu-hug/huawei-cloud-iam-role-listThis skill lists all Huawei Cloud IAM (Identity and Access Management) roles owned by the authenticated account. It is a read-only inventory skill: it never creates, modifies, deletes roles, or changes any IAM configuration.
Architecture:
Agent → hcloud CLI (KooCLI IAM, primary) → Huawei Cloud IAM API
↘ ListPoliciesV5 / huaweicloudsdkiam Python SDK (fallback) ↗
Applicable Scenarios:
references/cli-installation-guide.mdiam:roles:listRoles — See references/iam-policies.mdhuaweicloudsdkiam package (SDK fallback) — pip install huaweicloudsdkiamCredentials. KooCLI reads credentials from
hcloud configure(AK/SK) or environment variables. The IAM API is global (no region endpoint), so the same account credentials used for other Huawei Cloud services work here. Never ask the user to paste AK/SK into the conversation.
hcloud version, then run the list command (below)hcloud IAM KeystoneListPermissions (CLI primary) with desired optionshcloud IAM ListPoliciesV5 or the Python SDK example belowhcloud IAM KeystoneListPermissions --cli-region=cn-north-4
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --cli-output=json
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --permission_type=role
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --permission_type=policy
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --domain_id=<domain-id>
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --permission_type=role --catalog=CCE
hcloud IAM KeystoneListPermissions --cli-region=cn-north-4 --display_name=<display-name>
hcloud IAM ListPoliciesV5 --cli-region=cn-north-4 --policy_type=system
import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkiam.v3 import IamClient
from huaweicloudsdkiam.v3.model import KeystoneListPermissionsRequest
from huaweicloudsdkiam.v3.region.iam_region import IamRegion
# IAM role listing is a domain-level (global) operation, so use GlobalCredentials
# with the domain ID (account ID). Obtain the domain ID from the console or via
# `hcloud IAM KeystoneListAuthDomains`.
credentials = GlobalCredentials(
os.environ["HUAWEI_CLOUD_ACCESS_KEY"],
os.environ["HUAWEI_CLOUD_SECRET_KEY"],
).with_domain_id(os.environ["HUAWEI_CLOUD_DOMAIN_ID"])
client = IamClient.new_builder() \
.with_credentials(credentials) \
.with_region(IamRegion.value_of("cn-north-4")) \
.build()
response = client.keystone_list_permissions(KeystoneListPermissionsRequest())
roles = response.roles or []
for role in roles:
print(role.id, role.display_name, role.name, role.catalog, role.type)
print("Role number:", len(roles))
| Parameter | Required | Description | Example |
|---|---|---|---|
--cli-region | Yes | Huawei Cloud region for the CLI endpoint | cn-north-4 |
--permission_type | No | System permission type (role or policy, valid when domain_id is blank) | --permission_type=role |
--domain_id | No | Account ID; if specified, only custom policies of the account are returned | --domain_id=xxx |
--catalog | No | Service catalog of the permission (e.g. CCE, ECS) | --catalog=CCE |
--display_name | No | Permission display name (e.g. Administrator) | --display_name=ECS Administrator |
--name | No | Internal permission name | --name=cce_adm |
--type | No | Display mode: domain, project, or all | --type=domain |
--page / --per_page | No | Pagination for custom policies (1–300 per page) | --page=1 --per_page=50 |
--cli-output | No | Output format (json/table) | --cli-output=json |
The hcloud IAM module maps directly to the Huawei Cloud IAM API operations.
| Feature | Description | Example |
|---|---|---|
| Service name | IAM | hcloud IAM KeystoneListPermissions |
| Operation name | IAM API operation name | KeystoneListPermissions |
| Simple parameter | --key=value | hcloud IAM KeystoneListPermissions --permission_type=role |
| Output format | --cli-output=json/table | --cli-output=json |
| Credentials | KooCLI configured account (AK/SK or env vars) | hcloud configure |