通过 hcloud CLI 管理华为云 SWR 命名空间、镜像仓库、版本标签、登录凭证与配额。
编程
Huawei Cloud Swr Enterprise Instance
试用Huawei Cloud SWR enterprise instance lifecycle management via hcloud CLI. Trigger: "SWR enterprise instance", "SWR 企业实例", "SWR 企业版", "企业仓库实例", "swr.ee", "实例管理
它能做什么
Huawei Cloud SWR enterprise instance lifecycle management via hcloud CLI. Trigger: "SWR enterprise instance", "SWR 企业实例", "SWR 企业版", "企业仓库实例", "swr.ee", "实例管理"
技能文档
Huawei Cloud SWR Enterprise Instance Management
Overview
This skill provides lifecycle management for Huawei Cloud SWR (Software Repository for Container)
enterprise instances using hcloud CLI. Enterprise instances provide dedicated, isolated container
registry environments with security scanning, replication, and custom domain support.
Architecture: hcloud CLI → SWR API → Instance/Namespace/Registry/Repository/Artifact/Credential/Endpoint/Domain
Related Skills:
huawei-cloud-swr-image-management- Image lifecycle (basic SWR namespaces, repos, tags, auth, quotas)huawei-cloud-swr-image-governance- Image governance (permissions, retention, sharing, immutable rules)huawei-cloud-swr-image-automation- Image automation ops (sync, triggers, domains)
Capabilities:
- Instance lifecycle: create/list/show/delete/update configuration
- Namespace management with security scanning and vulnerability blocking
- Registry management for cross-instance image sync
- Repository and artifact management with vulnerability scanning
- Credential management (long-term and temporary)
- Network access (VPC internal endpoints, public access with whitelist)
- Custom domain management
- Statistics and job monitoring
Prerequisites
0. Enterprise Repository Service Authorization (MANDATORY)
You must authorize the SWR Enterprise Repository feature before using this skill. Visit https://console.huaweicloud.com/swr-instance to complete authorization. If any API returns an authorization error, direct the user to this link and wait for confirmation.
1. hcloud CLI Requirements (MANDATORY)
- hcloud CLI installed (version >= 7.2.2)
- Run
hcloud versionto verify; first-time:printf "y\n" | hcloud version
2. Credential Configuration
- Valid Huawei Cloud credentials (AK/SK mode via environment variables)
- Never expose AK/SK in code, conversation, or commands
- Use env vars:
HUAWEI_CLOUD_AK,HUAWEI_CLOUD_SK,HUAWEI_CLOUD_REGION - Prefer IAM users over root account; enable MFA for sensitive operations
export HUAWEI_CLOUD_AK=
export HUAWEI_CLOUD_SK=
export HUAWEI_CLOUD_REGION=cn-north-4
3. IAM Permission Requirements
See IAM Permission Policies for complete permission list and policy JSON.
Permission Failure Handling:
- When any command fails due to permission errors, read
references/iam-policies.md - Display the required permission list and policy JSON to the user
- Guide the user to create a custom policy in IAM console
- Wait for user confirmation that permissions have been granted
Core Commands
See Command Reference for full command examples and naming rules.
⚠️ hcloud CLI CreateInstance Bug: hcloud SWR CreateInstance has a duplicate --project_id
parameter bug (重复的参数:project_id). Use the Python SDK script instead:
python scripts/swr_instance_helper.py create --name=my-instance --spec=swr.ee.basic \
--vpc_id= --subnet_id= \
--enterprise_project_id=0 --description="My enterprise registry"
All other lifecycle commands (List/Show/Update/Delete) work fine with hcloud CLI.
Resource Types and Commands:
| Resource | Key Commands | Reference |
|---|---|---|
| Instance | Create (SDK), List, Show, UpdateConfig, Delete | Task: Lifecycle |
| Namespace | Create, List, Show, Update, Delete | Task: Namespaces |
| Registry | Create, List, Show, Update, Delete | Task: Registries |
| Repository | List, Show, Update, Delete | Task: Registries |
| Artifact | List, Show, Scan, Delete | Task: Artifacts |
| Credential | CreateLt, CreateTemp, List, Update, Delete | Task: Credentials |
| Endpoint | CreateInternal, List, Show, Delete, Policy CRUD | Task: Endpoints |
| Domain | Add, List, Show, Delete, Update | Task: Domains |
| Statistics/Jobs | ListStatistics, ListJobs, ShowJob, DeleteJob | Command Reference |
Parameter Reference
See Parameter Reference for detailed parameter tables (Common, Instance Creation, Namespace, Registry, Endpoint Whitelist).
Output Format
See Output Format for response format examples.
Verification
See Verification Method for step-by-step verification.
Best Practices
- Instance naming: Use descriptive names reflecting environment (
prod-instance,dev-instance) - VPC selection: Choose VPC/subnet matching your workload deployment
- Namespace security: Enable
auto_scan=trueandprevent_vul=truefor production - Severity blocking:
high/criticalfor production;none/lowfor development - Registry credentials: Store securely; rotate access keys periodically
- Public access: Always configure IP whitelist when enabling public access
- Custom domains: Use SCM certificates for HTTPS
- Delete with caution: Instance/namespace/artifact deletion is irreversible
- Credentials: LtCredential for CI/CD; TempCredential for temporary access
- Spec selection:
swr.ee.basicfor small teams;swr.ee.professionalfor enterprise
Reference Documents
| Document | Description |
|---|---|
| Command Reference | Full CLI examples and naming rules |
| Parameter Reference | Parameter tables (Instance, Namespace, Registry, Endpoint) |
| SWR Instance API Guide | hcloud SWR instance API reference |
| SDK Helper Script | Python SDK for CreateInstance (bypasses hcloud bug) |
| Output Format | Response format examples |
| IAM Permission Policies | Required permissions and policy JSON |
| Verification Method | Step-by-step verification |
| Common Pitfalls | Troubleshooting guides |
| Task: Instance Lifecycle | Instance create, list, show, update config |
| Task: Instance Namespaces | Namespace CRUD workflows |
| Task: Instance Registries | Registry CRUD and repositories |
| Task: Instance Artifacts | Artifact management and scanning |
| Task: Instance Credentials | Credential management workflows |
| Task: Instance Endpoints | Internal and public access configuration |
| Task: Instance Domains | Custom domain management |
Notes
- Instance deletion is irreversible — removes ALL data permanently
- Namespace deletion is irreversible — removes all repositories and artifacts
- Artifact deletion is irreversible — the image version cannot be recovered
- Default domain cannot be deleted — only custom domains can be removed
- AK/SK must never be hardcoded — use environment variables only
- hcloud CLI CreateInstance bug — use Python SDK script as alternative
- Pagination:
offsetmust be 0 or a multiple oflimit - Registry access_secret is sensitive — never expose or log
Common Pitfalls
See Common Pitfalls for detailed troubleshooting guides.
Key pitfalls: invalid instance name format, VPC/subnet not found, instance still creating, offset not multiple of limit, registry credential wrong, domain cert not found, cannot delete default domain, public whitelist format, hcloud CreateInstance bug, SWR service quota exceeded.
相关技能
通过 hcloud CLI 管理华为云 SWR 镜像权限、保留规则、共享下载域名与委托关系。
Query the list of Huawei Cloud SWR (Software Repository for Container) image repositories under the current project/region. Lists all image repositories with their name, namespace, category, visibility (public/private), image/tag count, size, download count, full image path, tags and timestamps. Supports optional filtering by namespace, repository name (fuzzy match), category, and pagination (limit/offset) with sorting for account-wide repository inventory. Use when the user wants to: (1) list all Huawei Cloud SWR image repositories / 查询华为云SWR镜像仓库列表, (2) check how many image repositories exist in the account or region, (3) inspect repository visibility, size, tag count, or path for daily inspection or troubleshooting, (4) filter repositories by namespace, name, or category, (5) page through or sort repository results. Triggers include: "SWR列表", "华为云SWR列表", "查询SWR列表", "SWR镜像仓库列表", "容器镜像仓库列表", "SWR repository list", "list SWR repos", "ListReposDetails", "SWR仓库查询", "查看SWR仓库", "镜像仓库列表"
在华为云 SWR 上配置跨区域镜像同步和触发器,让镜像推送自动变成 CCE/CCI 部署更新。
Query the list of Huawei Cloud SWR (Software Repository for Container) namespaces (organizations) under the current project/region. Lists all namespaces with their ID, name, creator, auth level, access user count and repository count. Supports optional filtering by namespace name. This is the top-level resource listing for SWR — namespaces organize image repositories into groups. Use when the user wants to: (1) list all Huawei Cloud SWR namespaces / 查询华为云SWR组织列表, (2) check how many SWR organizations exist in the account or region, (3) inspect namespace auth level, repository count, or creator for daily inspection or troubleshooting, (4) filter namespaces by name. Triggers include: "SWR组织列表", "华为云SWR组织列表", "查询SWR组织", "SWR namespace list", "list SWR namespaces", "ListNamespaces", "SWR命名空间列表", "查看SWR组织", "SWR名称列表"
通过 hcloud CLI 全生命周期管理华为云 CCI 容器实例:命名空间、网络、工作负载、日志查询,并内置安全确认机制。
shijingcheng 的更多技能
浏览全部技能通过 Python SDK 管理华为云 CCE 集群、节点池、节点和插件的全生命周期,危险操作需 confirm=true。
查询华为云 CCE 集群 Pod/Node 指标及 ECS、ELB、EIP、NAT 资源指标,支持基于阈值的异常检测。
在华为云 SWR 上配置跨区域镜像同步和触发器,让镜像推送自动变成 CCE/CCI 部署更新。
通过 hcloud CLI 管理华为云 SWR 命名空间、镜像仓库、版本标签、登录凭证与配额。
通过 hcloud CLI 管理华为云 SWR 镜像权限、保留规则、共享下载域名与委托关系。
通过 hcloud CLI 全生命周期管理华为云 CCI 容器实例:命名空间、网络、工作负载、日志查询,并内置安全确认机制。