huawei-cloud-obs-total-size
БесплатноЗапускает вложенные скриптыНе проверенQueries the total storage size of Huawei Cloud OBS (Object Storage Service) buckets. Prints a single size value, a number in bytes by default; the optional…
от huaweicloudskill227 установок в других каталогахОб этом скилле
Huawei Cloud OBS Total Size Skill
Overview
This skill queries the total size of Huawei Cloud OBS buckets and prints the size value. The default output is a single number in bytes; with --unit kb|mb|gb or --human it prints a scaled or human-readable value instead. It is a read-only statistics skill: it never creates, modifies, or deletes buckets, directories, or objects.
Output behavior: the final size is printed as one value on stdout. Warnings for skipped inaccessible buckets and error messages are written to stderr only, never mixed into the size value.
Architecture:
Agent → hcloud CLI (KooCLI OBS / obsutil, primary) → Huawei Cloud OBS API
↘ huaweicloudsdkobs Python SDK (fallback) ↗
Two query scopes:
| Scope | Description | Example |
|---|---|---|
| Single bucket | Total size of one bucket only | --bucket my-bucket → 5002295 |
| All buckets (default) | Combined total size across all buckets under the account | --all → 9533151096 |
Applicable Scenarios:
- Capacity review: "how much storage does this bucket / my OBS account use?"
- Cost estimation: estimate OBS storage billing based on total bytes
- Storage planning: compare usage before migration or quota changes
- Compliance auditing: track total storage growth
Prerequisites
- hcloud CLI (KooCLI) installed and authenticated — See
references/cli-installation-guide.md - obsutil installed — required by the
hcloud OBS lscommand (bundled with KooCLI or standalone) - OBS credentials configured for obsutil —
hcloud OBS lsreads AK/SK/endpoint from the obsutil config file (.obsutilconfigin the user home directory), which is separate from the KooCLI account credentials - Python 3.8+ with
huaweicloudsdkobspackage (SDK fallback) —pip install huaweicloudsdkobs - IAM permissions —
obs:bucket:ListBucket,obs:object:List,obs:bucket:ListAllMyBuckets— Seereferences/iam-policies.md
Multi-region buckets
--all parses the region of each bucket from the hcloud OBS ls output and dynamically binds the bucket's own
regional endpoint (CLI uses -e=obs.<region>.myhuaweicloud.com, the SDK builds a client bound to the bucket's
location), so buckets spread across multiple regions are still summed correctly. A single bucket that cannot be
queried (bucket does not exist / no permission) is skipped with a warning on stderr instead of aborting the whole
summation. / --all 会从 hcloud OBS ls 的输出解析每个桶所属区域,并按桶所属区域动态绑定 endpoint,因此账号下存在
多区域桶时仍可正确汇总。单个桶查询失败(桶不存在 / 无权限)会跳过并在 stderr 给出告警,不会中断整次求和。
OBS credentials are separate
Before running, check whether obsutil credentials are configured:
hcloud OBS ls -s -limit=1
If the output is Please set ak, sk and endpoint in the configuration file! or an InvalidAccessKeyId error,
obsutil credentials are not configured. The agent never collects or stores the user's AK/SK — the user must
configure them in their own terminal (never ask the user to paste AK/SK into the conversation). Provide the
following example command for the user to run:
hcloud obs config -i=<YourAK> -k=<YourSK> -e=obs.<Region>.myhuaweicloud.com
Example (cn-north-4): hcloud obs config -i=<YourAK> -k=<YourSK> -e=obs.cn-north-4.myhuaweicloud.com
Workflow
- Confirm the scope with the user first — before running any query, explicitly ask the user which OBS bucket to measure, or whether they want the total across all buckets. Never run an aggregate (all-buckets) query against a broad scope without explicit user confirmation.
- Verify prerequisites —
hcloud version,hcloud OBS ls -s -limit=1to confirm obsutil credentials - Run the query after confirmation — use the script
scripts/query_obs_total_size.py(primary) with the scope the user confirmed - Return the size — the script prints a single value on stdout; relay that value to the user
Core Commands
Total Size of a Single Bucket (Primary)
Returns the total size of one bucket, in bytes:
python3 scripts/query_obs_total_size.py --bucket <bucket_name>
Total Size Across All Buckets
Returns the combined total size of all buckets under the account, in bytes. Buckets in regions other than the configured endpoint are queried with their own regional endpoint automatically; a single inaccessible bucket is skipped with a warning instead of aborting the whole sum:
python3 scripts/query_obs_total_size.py --all
--all is the default when --bucket is not given:
python3 scripts/query_obs_total_size.py
Different Output Units
# MB
python3 scripts/query_obs_total_size.py --all --unit mb
# Human readable (e.g. 8.88GB)
python3 scripts/query_obs_total_size.py --all --human
Force SDK Executor
If the CLI/obsutil path is unavailable, force the Python SDK:
python3 scripts/query_obs_total_size.py --all --executor sdk
Direct C
Установить huawei-cloud-obs-total-size в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл huawei-cloud-obs-total-size?
Queries the total storage size of Huawei Cloud OBS (Object Storage Service) buckets. Prints a single size value, a number in bytes by default; the optional `--unit`/`--human` flags return a scaled (kb/mb/gb) or human-readable value (e.g. `4.77MB`) instead. Supports querying the total size of one bucket or the combined total across all buckets under the account. Uses the KooCLI obsutil-backed `hcloud OBS ls ... -du -bf=raw` command (primary) or the huaweicloudsdkobs Python SDK (fallback). Read-only — never creates, modifies or deletes any resource. On skipped or failed buckets it prints a warning to stderr and continues with the remaining buckets instead of aborting the whole sum. Use this skill whenever the user wants to know the total size of a Huawei Cloud OBS bucket or the overall Huawei Cloud OBS storage usage, e.g. for capacity review, cost estimation or storage planning. Triggers include: OBS total size, OBS bucket size, query OBS storage usage, OBS storage occupied, OBS大小, OBS总大小, OBS桶大小, OBS存储用量, OBS容量, 查询OBS大小.
Как установить скилл huawei-cloud-obs-total-size?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл huawei-cloud-obs-total-size запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic