huawei-cloud-computing-query

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Huawei Cloud Resource Query

华为云资源查询

⚠️ Execution Method (Must Read): This skill executes queries via local Python scripts. Using hcloud, openstack, or other CLI tools or direct API calls is prohibited.
  • Query scripts are located under the skill directory
    scripts/<service_category>/
    (e.g.,
    scripts/as/list_scaling_groups.py
    )
  • All scripts and environment check scripts are inside the skill package. You must use
    skill action=exec
    to execute them; do not run them directly in the shell
  • For specific script paths and parameters, see
    references/<service>/guide.md
  • Do not attempt hcloud, openstack, curl IAM, or other CLI/API methods; this skill does not depend on those tools
  • All paths are relative to the skill directory, which is the directory containing this SKILL.md
⚠️ 执行方式(必读):本技能通过本地Python脚本执行查询。禁止使用hcloud、openstack或其他CLI工具或直接调用API。
  • 查询脚本位于技能目录下的
    scripts/<service_category>/
    (例如
    scripts/as/list_scaling_groups.py
  • 所有脚本和环境检查脚本均包含在技能包内。必须使用
    skill action=exec
    执行它们;请勿在shell中直接运行
  • 具体脚本路径和参数请查看
    references/<service>/guide.md
  • 请勿尝试使用hcloud、openstack、curl IAM或其他CLI/API方法;本技能不依赖这些工具
  • 所有路径均相对于技能目录,即包含此SKILL.md的目录

Overview

概述

This skill is a standalone read-only query skill that queries Huawei Cloud resources, available specifications, and existing resource information by calling the Huawei Cloud Python SDK via local Python scripts.
This skill is applicable to the following scenarios:
  1. Query available cloud resource specifications in a given region
  2. Query available images for a specific operating system
  3. Query cloud disk types and existing cloud disk information
  4. Query existing resources and their key attributes
  5. Query resources not created through Terraform or other IaC tools
  6. Prepare real parameters for automation configuration, resource verification, or environment inventory
  7. Obtain reusable information such as resource IDs, names, specifications, images, networks, and disks
This skill does NOT handle the following:
  1. Creating resources
  2. Modifying resources
  3. Deleting resources
  4. Guessing or fabricating information that was not queried

本技能是一个独立的只读查询技能,通过本地Python脚本调用华为云Python SDK,查询华为云资源、可用规格以及现有资源信息。
本技能适用于以下场景:
  1. 查询指定区域内可用的云资源规格
  2. 查询特定操作系统的可用镜像
  3. 查询云磁盘类型及现有云磁盘信息
  4. 查询现有资源及其关键属性
  5. 查询未通过Terraform或其他IaC工具创建的资源
  6. 为自动化配置、资源验证或环境清单准备真实参数
  7. 获取可复用的信息,如资源ID、名称、规格、镜像、网络和磁盘
本技能不处理以下操作:
  1. 创建资源
  2. 修改资源
  3. 删除资源
  4. 猜测或编造未查询到的信息

Capability Scope

能力范围

This skill provides query capabilities through categorized scripts in the scripts directory, and usage instructions through categorized guides in the references directory. The capabilities provided by this skill include:
  1. Query resource lists
  2. Query individual resource details
  3. Query selection information such as available specifications, images, and disk types
  4. Query key identifiers and dependency relationships of existing resources

本技能通过scripts目录下的分类脚本提供查询能力,通过references目录下的分类指南提供使用说明。 本技能提供的能力包括:
  1. 查询资源列表
  2. 查询单个资源详情
  3. 查询可用规格、镜像、磁盘类型等可选信息
  4. 查询现有资源的关键标识及依赖关系

Usage Principles

使用原则

Important: Script paths executed within this skill are all relative to the skill directory, which is the directory containing this SKILL.md
  1. This skill only performs queries; it does not perform any write operations
  2. Prioritize using information explicitly specified by the user, such as region, project, AZ, resource name, and resource ID
  3. Query results must be based on actual API responses; do not speculate based on experience
  4. Returned results should preserve key fields for subsequent reuse
  5. When the result set is large, prioritize narrowing the scope by conditions such as region, name, id, status, and tag
  6. If the current resource type does not have a corresponding script or guide, clearly state that it is not supported; do not return unreliable results
  7. If the user does not provide necessary scope information and there are no default values in the environment, confirm the information before executing the query
  8. Execute directly according to guide.md; do not read the script contents in the scripts directory
  9. Cache output when it is large
  10. You must execute
    -h
    to view usage before executing each script
  11. Do not fabricate script names; execute according to the script names in guide.md. If a script name is not in guide.md, it means it is not supported

重要提示:本技能内执行的脚本路径均相对于技能目录,即包含此SKILL.md的目录
  1. 本技能仅执行查询操作,不进行任何写入操作
  2. 优先使用用户明确指定的信息,如区域、项目、可用区、资源名称、资源ID
  3. 查询结果必须基于实际API响应,请勿凭经验推测
  4. 返回结果需保留关键字段以便后续复用
  5. 当结果集较大时,优先通过区域、名称、ID、状态、标签等条件缩小范围
  6. 如果当前资源类型没有对应的脚本或指南,需明确说明不支持;请勿返回不可靠结果
  7. 如果用户未提供必要的范围信息且环境中无默认值,需先确认信息再执行查询
  8. 严格按照guide.md执行;请勿读取scripts目录下的脚本内容
  9. 当输出内容较大时进行缓存
  10. 执行每个脚本前必须先执行
    -h
    查看使用方法
  11. 请勿编造脚本名称;严格按照guide.md中的脚本名称执行。如果guide.md中没有对应脚本名称,则表示不支持该操作

Prerequisites

前置条件

Before use, you must run the environment check script to complete environment verification and dependency installation in one step:
  • Linux / macOS:
    skill action=exec: bash skill://scripts/check_env.sh
  • Windows:
    skill action=exec: powershell -ExecutionPolicy Bypass -File skill://scripts/check_env.ps1
Windows Note: Do not use
&&
to concatenate commands (PowerShell 5.x does not support this); use semicolons if you need to change directories first
The script will check in order: Python >= 3.6 → install dependencies → verify SDK → verify credentials → verify service availability. If the environment check fails, fix the issue before continuing with other scripts.
Environment Variables:
VariableRequiredDescription
HW_ACCESS_KEYYesHuawei Cloud AK
HW_SECRET_KEYYesHuawei Cloud SK
HW_REGION_NAMENoDefault cn-north-4
HW_PROJECT_IDNoProject ID (automatically obtained via IAM API if not set)
HW_SECURITY_TOKENNoRequired for temporary AK/SK
Do not output the values of the above environment variables. For other resource scripts that require additional parameters (availability zone, enterprise project, etc.), see the corresponding guide.md.

使用前必须运行环境检查脚本,一键完成环境验证和依赖安装:
  • Linux / macOS:
    skill action=exec: bash skill://scripts/check_env.sh
  • Windows:
    skill action=exec: powershell -ExecutionPolicy Bypass -File skill://scripts/check_env.ps1
Windows注意事项:请勿使用
&&
拼接命令(PowerShell 5.x不支持此语法);如果需要先切换目录,请使用分号分隔
脚本将按以下顺序检查:Python >= 3.6 → 安装依赖 → 验证SDK → 验证凭证 → 验证服务可用性。如果环境检查失败,请根据提示修复问题后再继续执行其他脚本。
环境变量:
变量名是否必填描述
HW_ACCESS_KEY华为云AK
HW_SECRET_KEY华为云SK
HW_REGION_NAME默认值为cn-north-4
HW_PROJECT_ID项目ID(若未设置,将通过IAM API自动获取)
HW_SECURITY_TOKEN使用临时AK/SK时必填
请勿输出上述环境变量的值。 其他需要额外参数(可用区、企业项目等)的资源脚本,请查看对应的guide.md。

Execution Flow

执行流程

When this skill is invoked, you must follow these steps; do not wait for the user to prompt again:
调用本技能时必须遵循以下步骤;无需等待用户再次提示:

Step 1: Environment Preparation

步骤1:环境准备

Execute the environment check script to ensure dependencies are installed and credentials are configured:
  • Linux / macOS:
    skill action=exec: bash skill://scripts/check_env.sh
  • Windows:
    skill action=exec: powershell -ExecutionPolicy Bypass -File skill://scripts/check_env.ps1
If the environment check fails, fix the issue as prompted and re-execute until it passes.
执行环境检查脚本,确保依赖已安装且凭证配置正确:
  • Linux / macOS:
    skill action=exec: bash skill://scripts/check_env.sh
  • Windows:
    skill action=exec: powershell -ExecutionPolicy Bypass -File skill://scripts/check_env.ps1
如果环境检查失败,请根据提示修复问题并重新执行,直到检查通过。

Step 2: Identify and Execute Query Scripts

步骤2:识别并执行查询脚本

  1. Based on the user's query intent, read
    references/<service>/guide.md
    to determine the script path and parameters to execute
  2. First execute
    -h
    to view script usage:
    • Linux / macOS:
      skill action=exec: skill://.venv/bin/python3 skill://scripts/<service>/<script>.py -h
    • Windows:
      skill action=exec: skill://.venv/Scripts/python3.exe skill://scripts/<service>/<script>.py -h
  3. Assemble parameters based on user requirements and execute the script:
    • Linux / macOS:
      skill action=exec: skill://.venv/bin/python3 skill://scripts/<service>/<script>.py <parameters>
    • Windows:
      skill action=exec: skill://.venv/Scripts/python3.exe skill://scripts/<service>/<script>.py <parameters>
  4. Format the results and return them to the user
Important:
  • All scripts and environment check scripts are inside the skill package. You must use
    skill action=exec
    to execute them; do not run them directly in the shell
  • The venv is automatically created by the check_env script. On Linux/macOS, Python is located at
    .venv/bin/python3
    ; on Windows, at
    .venv/Scripts/python3.exe
  • Do not use
    python3
    directly to execute scripts
  • Do not read script source code in the scripts directory; execute according to the instructions in guide.md
  • Cache results when the output is large
  • The
    --project_id
    parameter is optional; if not provided, it is automatically obtained via the IAM API based on the region

  1. 根据用户的查询意图,阅读
    references/<service>/guide.md
    确定要执行的脚本路径和参数
  2. 先执行
    -h
    查看脚本使用方法:
    • Linux / macOS:
      skill action=exec: skill://.venv/bin/python3 skill://scripts/<service>/<script>.py -h
    • Windows:
      skill action=exec: skill://.venv/Scripts/python3.exe skill://scripts/<service>/<script>.py -h
  3. 根据用户需求组装参数并执行脚本:
    • Linux / macOS:
      skill action=exec: skill://.venv/bin/python3 skill://scripts/<service>/<script>.py <parameters>
    • Windows:
      skill action=exec: skill://.venv/Scripts/python3.exe skill://scripts/<service>/<script>.py <parameters>
  4. 格式化结果并返回给用户
重要提示:
  • 所有脚本和环境检查脚本均包含在技能包内。必须使用
    skill action=exec
    执行它们;请勿在shell中直接运行
  • venv由check_env脚本自动创建。在Linux/macOS系统中,Python路径为
    .venv/bin/python3
    ;在Windows系统中为
    .venv/Scripts/python3.exe
  • 请勿直接使用
    python3
    执行脚本
  • 请勿读取scripts目录下的脚本源代码;严格按照guide.md中的说明执行
  • 当输出内容较大时进行缓存
  • --project_id
    参数为可选;若未提供,将基于区域通过IAM API自动获取

Directory Structure

目录结构

The directory conventions are as follows (all paths are relative to the skill directory):
  1. scripts/<resource_category>/ contains the Python query scripts for the corresponding resources. You do not need to read the script contents; execute the scripts according to the usage instructions in guide.md
  2. references/<resource_category>/guide.md contains the usage guide for the corresponding resources
  3. Each script is responsible for a single, clear query action
  4. Each resource category maintains at least one guide.md to describe script capabilities, parameters, and usage

目录约定如下(所有路径均相对于技能目录):
  1. scripts/<resource_category>/ 包含对应资源的Python查询脚本。无需读取脚本内容;严格按照guide.md中的使用说明执行脚本
  2. references/<resource_category>/guide.md 包含对应资源的使用指南
  3. 每个脚本负责单一、明确的查询操作
  4. 每个资源类别至少维护一个guide.md,用于描述脚本能力、参数及使用方法

Parameter Confirmation

参数确认

Before executing query scripts, confirm the following parameters:
ParameterRequiredDescription
regionYesHuawei Cloud region, e.g., cn-north-4
--project_idNoProject ID; automatically obtained if not provided
--availability_zoneNoAvailability zone; required for some resource queries
For script-specific parameters, see
references/<service>/guide.md
.

执行查询脚本前,请确认以下参数:
参数是否必填描述
region华为云区域,例如cn-north-4
--project_id项目ID;若未提供将自动获取
--availability_zone可用区;部分资源查询需要此参数
脚本特定参数请查看
references/<service>/guide.md

Output Format

输出格式

Query results are output in JSON format, containing the following common fields:
  • total
    : Total number of matching resources
  • items
    : Resource list, each resource containing key fields such as id, name, and status
  • Specific fields vary by resource type; see individual guide.md files for details

查询结果以JSON格式输出,包含以下通用字段:
  • total
    :匹配资源的总数
  • items
    :资源列表,每个资源包含id、name、status等关键字段
  • 特定字段因资源类型而异;详情请查看各guide.md文件

Verification Method

验证方法

  1. Execute the environment check script to confirm dependencies and credentials are available
  2. Use the
    -h
    parameter to view script usage and confirm parameters are correct
  3. Execute a query on a known resource and compare with console data to verify result accuracy
  4. Check whether the returned
    total
    count is reasonable

  1. 执行环境检查脚本,确认依赖和凭证可用
  2. 使用
    -h
    参数查看脚本使用方法,确认参数正确
  3. 对已知资源执行查询,并与控制台数据对比验证结果准确性
  4. 检查返回的
    total
    计数是否合理

Best Practices

最佳实践

  1. Narrow the query scope first (specify region, availability zone, etc.) to avoid returning too much data
  2. Use
    --help
    to view the complete list of parameters supported by a script
  3. Cache query results locally when they are large to avoid repeated requests
  4. When multiple resource information is needed, query in dependency order (e.g., query VPC first, then subnet)
  5. When script execution fails, check environment variables and network connectivity first

  1. 先缩小查询范围(指定区域、可用区等),避免返回过多数据
  2. 使用
    --help
    查看脚本支持的完整参数列表
  3. 当查询结果较大时,在本地缓存结果以避免重复请求
  4. 当需要多种资源信息时,按依赖顺序查询(例如先查询VPC,再查询子网)
  5. 脚本执行失败时,先检查环境变量和网络连通性

Reference Documentation

参考文档



Notes

注意事项

  1. This skill only provides read-only query capabilities; it does not perform any write operations
  2. Do not output values of environment variables such as HW_ACCESS_KEY and HW_SECRET_KEY
  3. All scripts must be executed via
    skill action=exec
    ; do not run them directly in the shell
  4. Do not fabricate script names; strictly execute according to the names in guide.md
  5. You must run the environment check script before querying
  6. When using temporary AK/SK, you need to set HW_SECURITY_TOKEN
  1. 本技能仅提供只读查询能力;不进行任何写入操作
  2. 请勿输出HW_ACCESS_KEY、HW_SECRET_KEY等环境变量的值
  3. 所有脚本必须通过
    skill action=exec
    执行;请勿在shell中直接运行
  4. 请勿编造脚本名称;严格按照guide.md中的名称执行
  5. 查询前必须运行环境检查脚本
  6. 使用临时AK/SK时,需要设置HW_SECURITY_TOKEN