更新时间:2025-09-19 GMT+08:00

企业仓库资源

资源是服务中存在的对象。在企业仓库中,资源包括:repository、instance、chart,您可以在创建策略时,通过指定资源路径来选择特定资源。

表1 SWR的指定资源与对应路径

指定资源

资源名称

资源路径

repository

镜像仓库

【格式】

SWR:*:*:repository:镜像仓库名称。

其中第一个*是regionid,第二个*是domainid。

【说明】

对于镜像仓库资源,IAM自动生成资源路径前缀SWR:*:*:repository:

通过镜像仓库名称指定具体的资源路径,支持通配符*。例如:

SWR:*:*:repository/*表示任意镜像仓库。

swr:*:*:repository:test/nginx* :test命名空间下,仓库名称以nginx开头的镜像仓库。

swr:*:*:repository:test/nginx :test命名空间下,仓库名称为nginx的镜像仓库。

instance

镜像仓库实例

【格式】

SWR:*:*:instance:镜像仓库实例。

其中第一个*是regionid,第二个*是domainid。

【说明】

对于镜像仓库实例资源,IAM自动生成资源路径前缀SWR:*:*:instance:

通过仓库名称指定具体的资源路径,支持通配符*。例如:

SWR:*:*:instance:example-instance表示名称为example-instance仓库实例。

chart

chart仓库

【格式】

SWR:*:*:chart:Chart仓库名称。

其中第一个*是regionid,第二个*是domainid。

【说明】

对于Chart仓库资源,IAM自动生成资源路径前缀SWR:*:*:chart:

通过Chart仓库名称指定具体的资源路径,支持通配符*。例如:

SWR:*:*:chart:*表示任意Chart仓库。

例如只允许用户操作名为“example-instance”的仓库,则可以通过如下方式配置。

{
    "Version": "1.1",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "swr:instance:*"
            ],
            "Resource": [
                "SWR:*:*:instance:example-instance"
            ]
        }
    ]
}