容器镜像服务 SWR-基于角色与策略授权:SWR资源
SWR资源
资源是服务中存在的对象。在SWR中,资源包括:组织、镜像,您可以在创建策略时,通过指定资源路径来选择特定资源。
指定资源 |
资源路径 |
---|---|
namespace |
【格式】 swr:*:*:namespace:组织名称 【说明】 对于组织资源,IAM自动生成资源路径前缀SWR:*:*:namespace: 通过组织名称指定具体的资源路径,支持通配符*。例如: swr:*:*:namespace:*表示任意组织。 |
repo |
【格式】 swr:*:*:repo:镜像仓库名称 【说明】 对于镜像仓库资源,IAM自动生成资源路径前缀SWR:*:*:repo: 通过镜像仓库名称指定具体的资源路径,支持通配符*。例如: SWR:*:*:repo:*表示任意镜像仓库。 |
例1:只允许用户查询镜像仓库概要信息,则可以通过如下方式配置。
{
"Version": "5.0"
"Statement": [
{
"Effect": "Allow",
"Action": [
"swr:repo:getRepo"
],
"Resource": [
"swr:*:*:repo:*"
]
}
]
}
例2:比如说要把cn-north-4下组织source下的镜像test,同步到cn-north-7的组织target下,那么用户需要有cn-north-4创建自动镜像同步任务的权限、要同步的镜像的下载权限,cn-north-4和cn-north-7的获取临时登录指令的权限,以及cn-north-7目前组织的镜像推送权限:
{
"Version": "5.0",
"Statement": [
{
"Effect": "Allow",
"Action": [
"swr:repo:createAutoSyncRepoJob",
"swr:repo:download"
],
"Resource": [
"swr:cn-north-4:*:repo:source/test"
]
},
{
"Effect": "Allow",
"Action": [
"swr:repo:upload"
],
"Resource": [
"swr:cn-north-7:*:repo:target"
]
},
{
"Effect": "Allow",
"Action": [
"swr::createLoginSecret"
]
}
]
}