huawei-cloud-storage-query
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHuawei 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
(e.g.,scripts/<service_category>/)scripts/as/list_scaling_groups.py- All scripts and environment check scripts are inside the skill package, must be executed using
, do not run them directly in the shellskill action=exec- For specific script paths and parameters, refer to
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 where this SKILL.md resides
⚠️ 执行方式(必读):此技能通过本地Python脚本执行查询。禁止使用hcloud、openstack或其他CLI工具或直接API调用。
- 查询脚本位于技能目录下的
(例如:scripts/<service_category>/)scripts/as/list_scaling_groups.py- 所有脚本和环境检查脚本均包含在技能包内,必须使用
执行,请勿在shell中直接运行skill action=exec- 具体脚本路径和参数请参考
references/<service>/guide.md- 请勿尝试使用hcloud、openstack、curl IAM或其他CLI/API方法;此技能不依赖这些工具
- 所有路径均相对于技能目录,即本SKILL.md所在的目录
Overview
概述
This skill is a standalone read-only query skill that uses local Python scripts to call the Huawei Cloud Python SDK to query Huawei Cloud resources, available specifications, and existing resource information.
This skill is applicable to the following scenarios:
- Query available cloud resource specifications in a given region
- Query available images for a given OS type
- Query disk types and existing disk information
- Query existing resources and their key attributes
- Query resources not created via Terraform or other IaC tools
- Prepare real parameters for automated configuration, resource verification, or environment inventory
- Obtain reusable information such as resource ID, name, specification, image, network, disk, etc.
This skill does NOT handle the following:
- Creating resources
- Modifying resources
- Deleting resources
- Guessing or fabricating information that has not been queried
此技能是一个独立的只读查询技能,使用本地Python脚本调用华为云Python SDK来查询华为云资源、可用规格以及现有资源信息。
此技能适用于以下场景:
- 查询指定区域内可用的云资源规格
- 查询指定操作系统类型的可用镜像
- 查询磁盘类型和现有磁盘信息
- 查询现有资源及其关键属性
- 查询未通过Terraform或其他IaC工具创建的资源
- 为自动化配置、资源验证或环境清单准备真实参数
- 获取可复用信息,如资源ID、名称、规格、镜像、网络、磁盘等
此技能不处理以下操作:
- 创建资源
- 修改资源
- 删除资源
- 猜测或编造未查询到的信息
Capabilities
功能
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:
- Query resource lists
- Query individual resource details
- Query available specifications, images, disk types, and other selection information
- Query key identifiers and dependency relationships of existing resources
此技能通过scripts目录中的分类脚本提供查询能力,并通过references目录中的分类指南提供使用说明。
此技能提供的功能包括:
- 查询资源列表
- 查询单个资源详情
- 查询可用规格、镜像、磁盘类型等可选信息
- 查询现有资源的关键标识和依赖关系
Usage Principles
使用原则
Important: Script paths executed within this skill are all relative to the skill directory, which is the directory where this SKILL.md resides
- This skill only performs queries, no write operations
- Prefer explicitly specified region, project, AZ, resource name, resource ID, etc. from the user
- Query results must be based on actual API responses, not inferred from experience
- Returned results should prioritize key fields for subsequent reuse
- When the result set is large, narrow the scope first using conditions like region, name, id, status, tag, etc.
- If no corresponding script or guide exists for the current resource type, clearly state that it is unsupported; do not return unreliable results
- If the user has not provided necessary scope information and no default values exist in the environment, confirm before executing the query
- Execute directly according to guide.md; do not read the script contents in the scripts directory
- Cache output when it is large
- Before executing each script, always run -h first to view usage
- Do not fabricate script names; execute according to the script names in guide.md. If a script name is not found in guide.md, it means it is not supported
重要提示:此技能内执行的脚本路径均相对于技能目录,即本SKILL.md所在的目录
- 此技能仅执行查询操作,无写入操作
- 优先使用用户明确指定的区域、项目、可用区、资源名称、资源ID等信息
- 查询结果必须基于实际API响应,不得凭经验推断
- 返回结果应优先提供后续可复用的关键字段
- 当结果集较大时,先通过区域、名称、ID、状态、标签等条件缩小范围
- 如果当前资源类型没有对应的脚本或指南,需明确说明不支持;请勿返回不可靠结果
- 如果用户未提供必要的范围信息且环境中无默认值,执行查询前需先确认
- 严格按照guide.md执行;请勿读取scripts目录中的脚本内容
- 当输出内容较大时进行缓存
- 执行每个脚本前,务必先运行查看使用方法
-h - 请勿编造脚本名称;严格按照guide.md中的脚本名称执行。如果在guide.md中未找到脚本名称,则表示不支持该脚本
Prerequisites
前提条件
Before use, you must run the environment check script to complete environment validation 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 useto chain commands (PowerShell 5.x does not support it); use semicolons if you need to change directories first&&
The script will check in sequence: Python >= 3.6 → install dependencies → validate SDK →
validate credentials → validate service availability. If the environment check fails,
fix the issues before proceeding with other scripts.
Environment Variables:
| Variable | Required | Description |
|---|---|---|
| HW_ACCESS_KEY | Yes | Huawei Cloud AK |
| HW_SECRET_KEY | Yes | Huawei Cloud SK |
| HW_REGION_NAME | No | Default cn-north-4 |
| HW_PROJECT_ID | No | Project ID (automatically obtained via IAM API when not set) |
| HW_SECURITY_TOKEN | No | Required for temporary AK/SK |
Do not output the values of the above environment variables. For additional parameters
required by other resource scripts (availability zone, enterprise project, etc.),
refer to 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, the following steps must be executed without waiting for the user to prompt again:
调用此技能时,必须执行以下步骤,无需等待用户再次提示:
Step 1: Environment Preparation
步骤1:环境准备
Run 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 as prompted and re-run 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 Script
步骤2:识别并执行查询脚本
- Based on the user's query intent, read to determine the script path and parameters to execute
references/<service>/guide.md - First run to view script usage:
-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
- Linux / macOS:
- 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>
- Linux / macOS:
- Format the results and return to the user
Important:
- All scripts and environment check scripts are inside the skill package, must be executed using , do not run them directly in the shell
skill action=exec - The venv is automatically created by the check_env script; on Linux/macOS Python is located at , on Windows at
.venv/bin/python3.venv/Scripts/python3.exe - Do not execute scripts directly with
python3 - Do not read the script source code in the scripts directory; just follow the instructions in guide.md
- Cache results when output is large
- The parameter is optional; when not provided, it is automatically obtained via IAM API based on region
--project_id
- 根据用户的查询意图,阅读确定要执行的脚本路径和参数
references/<service>/guide.md - 先运行查看脚本使用方法:
-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
- Linux / macOS:
- 根据用户需求组装参数并执行脚本:
- 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>
- Linux / macOS:
- 格式化结果并返回给用户
重要提示:
- 所有脚本和环境检查脚本均包含在技能包内,必须使用执行,请勿在shell中直接运行
skill action=exec - venv由check_env脚本自动创建;在Linux/macOS上Python路径为,在Windows上为
.venv/bin/python3.venv/Scripts/python3.exe - 请勿直接使用执行脚本
python3 - 请勿读取scripts目录中的脚本源代码;只需按照guide.md中的说明操作
- 当输出内容较大时进行缓存
- 参数为可选;未提供时将基于区域通过IAM API自动获取
--project_id
Directory Structure
目录结构
The directory conventions are as follows (all paths are relative to the skill directory):
- scripts/<resource_category>/ contains the corresponding Python query scripts. No need to read script contents; execute scripts according to the usage instructions in guide.md
- references/<resource_category>/guide.md contains the corresponding resource usage guide
- Each script is responsible for a single, clear query action
- Each resource category maintains at least one guide.md to describe script capabilities, parameters, and usage
目录约定如下(所有路径均相对于技能目录):
- scripts/<resource_category>/ 包含对应的Python查询脚本。无需读取脚本内容;按照guide.md中的使用说明执行脚本即可
- references/<resource_category>/guide.md 包含对应的资源使用指南
- 每个脚本负责单一、明确的查询操作
- 每个资源类别至少维护一个guide.md,用于描述脚本功能、参数和使用方法
Parameter Confirmation
参数确认
Before executing a query script, confirm the following parameters:
| Parameter | Required | Description |
|---|---|---|
| region | Yes | Huawei Cloud region, e.g., cn-north-4 |
| --project_id | No | Project ID, automatically obtained when not provided |
| --availability_zone | No | Availability zone, required for some resource queries |
For other script-specific parameters, refer to .
references/<service>/guide.md执行查询脚本前,请确认以下参数:
| 参数 | 是否必填 | 描述 |
|---|---|---|
| region | 是 | 华为云区域,例如cn-north-4 |
| --project_id | 否 | 项目ID,未提供时自动获取 |
| --availability_zone | 否 | 可用区,部分资源查询需要此参数 |
其他脚本特定参数请参考。
references/<service>/guide.mdOutput Format
输出格式
Query results are output in JSON format, containing the following common fields:
- : Total number of matched resources
total - : Resource list, each resource contains key fields such as id, name, status, etc.
items - Specific fields vary by resource type; see individual guide.md for details
查询结果以JSON格式输出,包含以下通用字段:
- :匹配资源的总数
total - :资源列表,每个资源包含id、name、status等关键字段
items - 具体字段因资源类型而异;详情请查看各guide.md
Verification Method
验证方法
- Run the environment check script to confirm dependencies and credentials are available
- Use the parameter to view script usage and confirm parameters are correct
-h - Execute queries against known resources and compare with console data to verify result accuracy
- Check that the returned count is reasonable
total
- 运行环境检查脚本,确认依赖和凭证可用
- 使用参数查看脚本使用方法,确认参数正确
-h - 针对已知资源执行查询,并与控制台数据对比验证结果准确性
- 检查返回的计数是否合理
total
Best Practices
最佳实践
- Narrow the query scope first (specify region, availability zone, etc.) to avoid returning too much data
- Use to view the complete list of parameters supported by the script
--help - Cache large query results locally to avoid repeated requests
- When multiple resource information is needed, query in dependency order (e.g., query VPC first, then subnets)
- When script execution fails, check environment variables and network connectivity first
- 先缩小查询范围(指定区域、可用区等),避免返回过多数据
- 使用查看脚本支持的完整参数列表
--help - 将大型查询结果本地缓存,避免重复请求
- 当需要多个资源信息时,按依赖顺序查询(例如先查询VPC,再查询子网)
- 脚本执行失败时,首先检查环境变量和网络连通性
Reference Documentation
参考文档
- Huawei Cloud Python SDK Official Documentation
- Huawei Cloud API Explorer
- Service query script usage guides:
references/<service>/guide.md
- 华为云Python SDK官方文档
- 华为云API Explorer
- 服务查询脚本使用指南:
references/<service>/guide.md
Notes
注意事项
- This skill only provides read-only query capabilities; no write operations are performed
- Do not output the values of HW_ACCESS_KEY, HW_SECRET_KEY, and other environment variables
- All scripts must be executed via ; do not run them directly in the shell
skill action=exec - Do not guess script names; strictly execute according to the names in guide.md
- The environment check script must be run before querying
- When using temporary AK/SK, HW_SECURITY_TOKEN must be set
- 此技能仅提供只读查询能力;不执行任何写入操作
- 请勿输出HW_ACCESS_KEY、HW_SECRET_KEY等环境变量的值
- 所有脚本必须通过执行;请勿在shell中直接运行
skill action=exec - 请勿猜测脚本名称;严格按照guide.md中的名称执行
- 查询前必须运行环境检查脚本
- 使用临时AK/SK时,必须设置HW_SECURITY_TOKEN