This skill provides governance capabilities for Huawei Cloud SWR (Software Repository for Container) using the hcloud CLI, covering permissions, retention policies, sharing, and agency delegation.
Architecture: hcloud CLI → SWR Service API → Permission/Retention/Domain/Share/Agency resources
Related Skills:
huawei-cloud-swr-image-management - Image lifecycle management (namespace, repo, tag, auth, quota)huawei-cloud-swr-image-automation - Image automation ops (sync, triggers, domains)huawei-cloud-swr-enterprise-instance - Enterprise instance managementCapabilities:
Typical Use Cases:
hcloud version to verify installationprintf "y\n" | hcloud version to accept privacy statementValid Huawei Cloud credentials (AK/SK mode)
Security Rules:
echo $HUAWEI_CLOUD_AK or echo $HUAWEI_CLOUD_SK to check credentialsHUAWEI_CLOUD_AK, HUAWEI_CLOUD_SK, HUAWEI_CLOUD_REGIONConfiguration Method (Environment Variables Only):
bash
export HUAWEI_CLOUD_AK=<your-ak>
export HUAWEI_CLOUD_SK=<your-sk>
export HUAWEI_CLOUD_REGION=cn-north-4
⚠️ Important Security Notes:
API ActionPermissionPurposeswr:namespace:auth:createCreate NS authGrant namespace permissionsswr:namespace:auth:getGet NS authQuery namespace permissionsswr:namespace:auth:updateUpdate NS authModify namespace permissionsswr:namespace:auth:deleteDelete NS authRevoke namespace permissionsswr:repository:auth:createCreate repo authGrant repository permissionsswr:repository:auth:getGet repo authQuery repository permissionsswr:repository:auth:updateUpdate repo authModify repository permissionsswr:repository:auth:deleteDelete repo authRevoke repository permissionsswr:retention:createCreate retentionCreate retention rulesswr:retention:listList retentionList retention rulesswr:retention:getGet retentionView retention rule detailsswr:retention:updateUpdate retentionModify retention rulesswr:retention:deleteDelete retentionRemove retention rulesswr:domain:createCreate domainCreate shared download domainsswr:domain:listList domainsList shared download domainsswr:domain:getGet domainView domain detailsswr:domain:updateUpdate domainModify domain settingsswr:domain:deleteDelete domainRemove shared download domainsswr:share:listList shared reposList shared repositoriesswr:share:getGet shared repoView shared repository detailsswr:share:feature:getGet share featureCheck sharing feature gatesswr:global:feature:getGet global featureCheck global feature gatesswr:agency:checkCheck agencyCheck agency delegation statusswr:agency:createCreate agencyCreate agency delegationswr:accessory:listList accessoriesList repository accessoriesswr:reference:listList referencesList repository references
See IAM Permission Policies for complete policy JSON.
Permission Failure Handling:
references/iam-policies.mdSee Task: Namespace Permissions for detailed workflows.
bash
# Show namespace permissions (who has access and their auth levels)
hcloud SWR ShowNamespaceAuth --namespace=pancake --cli-region=cn-north-4
# Grant namespace permission to a user
hcloud SWR CreateNamespaceAuth --namespace=pancake --1.auth=7 --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
# Update namespace permission for a user
hcloud SWR UpdateNamespaceAuth --namespace=pancake --1.auth=3 --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
# Revoke namespace permission for a user
hcloud SWR DeleteNamespaceAuth --namespace=pancake --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
Auth Values: 7 = manage (full control), 3 = edit (push/pull), 1 = read (pull only)
⚠️ Array-Style Parameters: Permission operations use --[N].auth, --[N].user_id, --[N].user_name format where [N] is the array index (starting from 1). For a single user, use --1.auth=7 --1.user_id=xxx --1.user_name=xxx. See Common Pitfalls for details.
See Task: Repository Permissions for detailed workflows.
bash
# Show repository permissions
hcloud SWR ShowUserRepositoryAuth --namespace=pancake --repository=openclaw-sandbox --cli-region=cn-north-4
# Grant repository permission to a user
hcloud SWR CreateUserRepositoryAuth --namespace=pancake --repository=openclaw-sandbox --1.auth=7 --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
# Update repository permission for a user
hcloud SWR UpdateUserRepositoryAuth --namespace=pancake --repository=openclaw-sandbox --1.auth=3 --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
# Revoke repository permission for a user
hcloud SWR DeleteUserRepositoryAuth --namespace=pancake --repository=openclaw-sandbox --1.user_id=05949eb5350010e21f85c017722182de --1.user_name=hwstaff_p00506267 --cli-region=cn-north-4
Auth Values: Same as namespace permissions: 7 = manage, 3 = edit, 1 = read
bash
# Check if agency delegation is enabled
hcloud SWR CheckAgency --cli-region=cn-north-4
# Create agency delegation for SWR
hcloud SWR CreateAgency --cli-region=cn-north-4
Use Cases:
CheckAgency returns whether agency is already configured; CreateAgency sets up the delegationSee Task: Retention Management for detailed workflows.
bash
# List retention rules for a repository
hcloud SWR ListRetentions --namespace=pancake --repository=openclaw-sandbox --cli-region=cn-north-4
# Create a retention rule (keep last 10 tags)
hcloud SWR CreateRetention --namespace=pancake --repository=openclaw-sandbox --algorithm=or --rules.1.template=tag_rule --rules.1.params.num=10 --rules.1.tag_selectors.1.kind=label --rules.1.tag_selectors.1.pattern=latest --cli-region=cn-north-4
# Create a retention rule (keep tags from last 30 days)
hcloud SWR CreateRetention --namespace=pancake --repository=openclaw-sandbox --algorithm=or --rules.1.template=date_rule --rules.1.params.days=30 --rules.1.tag_selectors.1.kind=label --rules.1.tag_selectors.1.pattern=latest --cli-region=cn-north-4
# Show retention rule details
hcloud SWR ShowRetention --namespace=pancake --repository=openclaw-sandbox --retention_id=<id> --cli-region=cn-north-4
# Update a retention rule
hcloud SWR UpdateRetention --namespace=pancake --repository=openclaw-sandbox --retention_id=<id> --algorithm=or --rules.1.template=tag_rule --rules.1.params.num=5 --rules.1.tag_selectors.1.kind=label --rules.1.tag_selectors.1.pattern=latest --cli-region=cn-north-4
# Delete a retention rule
hcloud SWR DeleteRetention --namespace=pancake --repository=openclaw-sandbox --retention_id=<id> --cli-region=cn-north-4
# List retention execution histories
hcloud SWR ListRetentionHistories --namespace=pancake --repository=openclaw-sandbox --retention_id=<id> --cli-region=cn-north-4
Retention Rule Templates:
tag_rule: Keep a specified number of the most recent tags ( params.num)date_rule: Keep tags created within a specified number of days ( params.days)Tag Selector Kinds:
label: Exact tag name match (e.g., latest, v1.0)regexp: Regex pattern match (e.g., v\d+\.\d+\.\d+)Algorithm: or means rules are combined with OR logic (a tag is retained if it matches ANY rule)
See Task: Shared Domains for detailed workflows.
bash
# List shared download domains for a repository
hcloud SWR ListRepoDomains --namespace=pancake --repository=openclaw-sandbox --cli-region=cn-north-4
# Create a shared download domain
hcloud SWR CreateRepoDomains --namespace=pancake --repository=openclaw-sandbox --domain=shared-domain-name --cli-region=cn-north-4
# Show shared domain details
hcloud SWR ShowAccessDomain --namespace=pancake --repository=openclaw-sandbox --access_domain=shared-domain-name --cli-region=cn-north-4
# Update a shared download domain
hcloud SWR UpdateRepoDomains --namespace=pancake --repository=openclaw-sandbox --domain=shared-domain-name --permit=read --cli-region=cn-north-4
# Delete a shared download domain
hcloud SWR DeleteRepoDomains --namespace=pancake --repository=openclaw-sandbox --access_domain=shared-domain-name --cli-region=cn-north-4
See Task: Image Sharing for detailed workflows.
bash
# List all shared repositories
hcloud SWR ListSharedReposDetails --cli-region=cn-north-4
# List shared repository details
hcloud SWR ListSharedRepoDetails --cli-region=cn-north-4
# Check sharing feature gates
hcloud SWR ShowShareFeatureGates --cli-region=cn-north-4
# Check global feature gates
hcloud SWR ListGlobalFeatureGates --cli-region=cn-north-4
bash
# List repository accessories
hcloud SWR ListRepoAccessories --namespace=pancake --repository=openclaw-sandbox --cli-region=cn-north-4
# List repository references
hcloud SWR ListReferences --namespace=pancake --repository=openclaw-sandbox --cli-region=cn-north-4
ParameterRequired/OptionalDescriptionDefault--cli-regionRequiredHuawei Cloud region IDConfig value or HUAWEI_CLOUD_REGION``--namespaceContext-dependentSWR namespace (organization)N/A--repositoryContext-dependentImage repository nameN/A
ParameterRequiredDescriptionConstraints--namespaceYesNamespace nameMust exist--repositoryYesRepository name (repo-level only)Must exist--[N].authYesPermission level7=manage, 3=edit, 1=read--[N].user_idYesIAM user IDHex string (e.g., 05949eb5350010e21f85c017722182de)--[N].user_nameYesIAM user nameIAM user display name
⚠️ Array Index Format: [N] starts from 1 (not 0). For granting permission to a single user, use --1.auth=7 --1.user_id=xxx --1.user_name=xxx. For multiple users, use --1.auth=7 --1.user_id=xxx --1.user_name=xxx --2.auth=3 --2.user_id=yyy --2.user_name=yyy.
ParameterRequiredDescriptionConstraints--namespaceYesNamespace nameMust exist--repositoryYesRepository nameMust exist--retention_idYesRetention rule ID (for show/update/delete)Numeric ID--algorithmYesRule combination logicFixed value or``--rules.[N].templateYesRule template typedate_rule or tag_rule``--rules.[N].paramsYesRule parametersdays for date_rule, num for tag_rule--rules.[N].tag_selectors.[N].kindYesSelector kindlabel or regexp``--rules.[N].tag_selectors.[N].patternYesSelector patternTag name or regex
ParameterRequiredDescriptionConstraints--namespaceYesNamespace nameMust exist--repositoryYesRepository nameMust exist--domainYes (create)Shared domain nameDomain identifier--access_domainYes (show/delete)Domain nameSame as domain--permitYes (update)Permission typeread
See Output Format for detailed response format examples (NamespaceAuth, RepositoryAuth, RepoDomains, CheckAgency, ShareFeatureGates, GlobalFeatureGates, Retentions, RepoAccessories, ListSharedReposDetails).
Key Format Notes:
auth: Permission value (7=manage, 3=edit, 1=read)self_auth vs others_auths: Check both when auditing permissionsListRepoDomains: Uses created/updated (NOT created_at/updated_at)ListRetentions: Returns flat array (empty [] when no rules)ListRepoAccessories: Uses total + accessories (null when empty)See Verification Method for step-by-step verification.
1 (read) for pull-only, 3 (edit) for push/pull, 7 (manage) for full controltag_rule (keep N most recent) for most cases; date_rule (keep tags within N days) for time-based cleanuplabel kind with latest pattern to protect important tags from retention cleanupdeadline=forever for stable internal sharing; set specific deadlines for temporary cross-team accessShowNamespaceAuth and ShowUserRepositoryAuth to periodically review who has accessDocumentDescriptionSWR Governance API Guidehcloud SWR governance API referenceOutput FormatResponse format examples (verified)IAM Permission PoliciesRequired permissions and policy JSONVerification MethodStep-by-step verificationCommon PitfallsTroubleshooting guidesTask: Namespace PermissionsNamespace permission workflowsTask: Repository PermissionsRepository permission workflowsTask: Retention ManagementRetention rule workflowsTask: Shared DomainsShared domain workflowsTask: Image SharingImage sharing workflows
hcloud SWR <Operation> formatcreated/updated — NOT created_at/updated_atSee Common Pitfalls & Solutions for detailed troubleshooting guides.
Quick Reference:
PitfallSymptomQuick FixArray-style paramsPermission grant failsUse --1.auth=7 --1.user_id=xxx (index from 1, not 0)Auth value wrongUser has unexpected access7=manage, 3=edit, 1=read (not 1/2/3)self_auth vs others_authsMissing user in auditCheck both self_auth and others_authsDomain timestamp fieldsParsing created_at failsUse created/ updated (not created_at)Retention rule formatCreateRetention failsNested array params: --rules.1.tag_selectors.1.kindAgency not configuredImage sync/CCE trigger failsRun CheckAgency then CreateAgency