编程

huawei-cloud-project-list

试用

Lists Huawei Cloud IAM (Identity and Access Management) projects — enumerates all projects under the authenticated account with project ID, name, domain ID, parent ID, enabled status and description, using the KooCLI `hcloud IAM KeystoneListProjects` command (primary) or the huaweicloudsdkiam Python SDK (fallback). Provides read-only project inventory for account management, resource discovery, permission review and multi-region operations planning. Use this skill whenever the user mentions project list query. Triggers include: list projects, project list, query projects, enumerate projects, show projects, project inventory, 查询项目, 项目列表, 查看项目, 列出项目, 获取项目列表, 华为云项目, 查询华为云项目列表.

它能做什么

Lists Huawei Cloud IAM (Identity and Access Management) projects — enumerates all projects under the authenticated account with project ID, name, domain ID, parent ID, enabled status and description, using the KooCLI `hcloud IAM KeystoneListProjects` command (primary) or the huaweicloudsdkiam Python SDK (fallback). Provides read-only project inventory for account management, resource discovery, permission review and multi-region operations planning. Use this skill whenever the user mentions project list query. Triggers include: list projects, project list, query projects, enumerate projects, show projects, project inventory, 查询项目, 项目列表, 查看项目, 列出项目, 获取项目列表, 华为云项目, 查询华为云项目列表.

技能文档

Huawei Cloud Project List Skill

Overview

This skill lists all Huawei Cloud IAM (Identity and Access Management) projects owned by the authenticated account. It is a read-only inventory skill: it never creates, modifies, deletes projects, or changes any IAM configuration.

Architecture:

Agent → hcloud CLI (KooCLI IAM, primary) → Huawei Cloud IAM API
       ↘ huaweicloudsdkiam Python SDK (fallback)  ↗

Applicable Scenarios:

  • Project inventory and resource discovery (locate project IDs for other services)
  • Multi-region operations planning (each region has its own system project)
  • Permission review (checking which projects exist under the account)
  • Troubleshooting account-level IAM configuration

Prerequisites

  1. hcloud CLI (KooCLI) installed and authenticated — See references/cli-installation-guide.md
  2. IAM permissionsiam:projects:listProjects — See references/iam-policies.md
  3. Python 3.6+ with huaweicloudsdkiam package (SDK fallback) — pip install huaweicloudsdkiam

Credentials. 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.

Workflow

  1. Verify prerequisiteshcloud version, then run the list command (below)
  2. Run the queryhcloud IAM KeystoneListProjects (CLI primary) with desired options
  3. Handle results — Parse project IDs, names, domain IDs, parent IDs, enabled status, and descriptions; report the total project count
  4. Fallback — If the CLI is unavailable, use the Python SDK example below

Core Commands

List All Projects

hcloud IAM KeystoneListProjects --cli-region=cn-north-4

List Projects (JSON Output)

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --cli-output=json

Filter by Project Name

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --name=

Filter by Domain ID (Account ID)

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --domain_id=

Filter by Enabled Status

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --enabled=true

Filter by Parent Project ID

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --parent_id=

Pagination

hcloud IAM KeystoneListProjects --cli-region=cn-north-4 --page=1 --per_page=50

SDK Fallback Example

import os
from huaweicloudsdkcore.auth.credentials import GlobalCredentials
from huaweicloudsdkiam.v3 import IamClient
from huaweicloudsdkiam.v3.model import KeystoneListProjectsRequest
from huaweicloudsdkiam.v3.region.iam_region import IamRegion

# Project 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_projects(KeystoneListProjectsRequest())
projects = response.projects or []
for project in projects:
    print(project.id, project.name, project.domain_id, project.parent_id, project.enabled, project.description)
print("Project number:", len(projects))

Parameter Confirmation

ParameterRequiredDescriptionExample
--cli-regionYesHuawei Cloud region for the CLI endpointcn-north-4
--nameNoFilter by project name--name=cn-north-4
--domain_idNoFilter by domain ID (account ID)--domain_id=xxx
--enabledNoFilter by enabled status (true/false)--enabled=true
--parent_idNoFilter by parent project ID (subprojects)--parent_id=xxx
--page / --per_pageNoPagination (page ≥ 1, per_page 1–5000, used together)--page=1 --per_page=50
--cli-outputNoOutput format (json/table)--cli-output=json

Reference Documents

  • CLI Installation Guide
  • IAM Policies
  • Verification Method
  • Data Flow Diagram
  • Acceptance Criteria

KooCLI Command Format Standard

The hcloud IAM module maps directly to the Huawei Cloud IAM API operations.

FeatureDescriptionExample
Service nameIAMhcloud IAM KeystoneListProjects
Operation nameIAM API operation nameKeystoneListProjects
Simple parameter--key=valuehcloud IAM KeystoneListProjects --name=cn-north-4
Output format--cli-output=json/table--cli-output=json
CredentialsKooCLI configured account (AK/SK or env vars)hcloud configure

相关技能

Query the total number of Huawei Cloud services available through KooCLI offline metadata. Returns the count of all supported cloud services from the cached service catalog. Triggers include: "how many Huawei Cloud services", "count Huawei Cloud services", "华为云服务总数", "华为云有多少个服务", "查询华为云服务数量".

1 次安装

通过本地 Python SDK 只读查询华为云 IAM 资源(用户、用户组、策略、委托、AK/SK、MFA、安全设置)。

作者 huaweicloud-skills-team6 次安装

通过本地 Python 脚本只读查询华为云 ECS、BMS、IMS、AS 资源。

作者 huaweicloud-skills-team2 次安装

Provides guidance for Huawei Cloud KooCLI command-line tool operations. Covers KooCLI installation, IAM authentication configuration, access credential confi...

作者 huaweicloud-skills-team1 次安装

Queries Huawei Cloud monitoring and enterprise project resources (CES/EPS). Covers alarm rules, alarm histories, alarm templates, dashboards, notification ma...

作者 huaweicloud-skills-team1 次安装

面向华为云资源的只读查询能力,用于资源清点、核对与参数发现。

作者 huaweicloud-skills-team6 次安装