分布式缓存服务 DCS
Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)可以使用以下授权项元素设置访问控制策略。
SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。
本章节介绍组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。
如何使用这些元素编辑SCP自定义策略,请参考创建SCP。
操作(Action)
操作(Action)即为SCP中支持的授权项。
- “访问级别”列描述如何对操作进行分类(list、read和write等)。此分类可帮助您了解在SCP中相应操作对应的访问级别。
- “资源类型”列指每个操作是否支持资源级权限。
- 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在SCP语句的Resource元素中指定所有资源类型(“*”)。
- 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
- 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。
关于DCS定义的资源类型的详细信息请参见资源类型(Resource)。
- “条件键”列包括了可以在SCP语句的Condition元素中支持指定的键值。
- 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
- 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
- 如果此列条件键没有值(-),表示此操作不支持指定条件键。
关于DCS定义的条件键的详细信息请参见条件(Condition)。
您可以在SCP语句的Action元素中指定以下DCS的相关操作。
授权项 |
描述 |
访问级别 |
资源类型(*为必须) |
条件键 |
---|---|---|---|---|
dcs:instance:create |
授予权限以创建缓存实例。 |
write |
- |
|
dcs:instance:list |
授予权限以查询缓存列表。 |
list |
- |
g:EnterpriseProjectId |
dcs:instance:exportListFile |
授予权限以下载导出的缓存实例列表文件。 |
list |
- |
- |
dcs:instance:delete |
授予权限以删除缓存实例。 |
write |
instance |
g:EnterpriseProjectId |
dcs:instance:get |
授予权限以查询缓存实例。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:modify |
授予权限以修改缓存实例。 |
write |
instance * |
|
dcs:instance:scale |
授予权限以扩容缓存实例。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:swap |
授予权限以执行缓存实例主备倒换。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:modifyAuthInfo |
授予权限以修改缓存实例密码。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:modifyStatus |
授予权限以重启缓存实例或清空缓存实例数据。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getConfiguration |
授予权限以查询实例配置参数。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:modifyConfiguration |
授予权限以修改缓存实例配置参数。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:deleteDataBackupFile |
授予权限以删除缓存实例备份数据。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:restoreData |
授予权限以恢复缓存实例数据。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getDataRestoreLog |
授予权限以查询实例恢复记录。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:downloadBackupData |
授予权限以获取实例备份文件下载链接。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:backupData |
授予权限以备份缓存实例数据。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getDataBackupLog |
授予权限以查询实例备份记录。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:migrationTask:create |
授予权限以创建数据迁移任务。 |
write |
- |
- |
dcs:migrationTask:list |
授予权限以查询数据迁移任务列表。 |
list |
- |
- |
dcs:migrationTask:delete |
授予权限以删除数据迁移任务。 |
write |
migrationTask |
- |
dcs:migrationTask:get |
授予权限以查询数据迁移任务。 |
read |
migrationTask * |
- |
dcs:migrationTask:modify |
授予权限以配置、停止数据迁移任务。 |
write |
migrationTask * |
- |
dcs:instance:listBigKey |
授予权限以查询实例大key列表。 |
list |
instance * |
g:EnterpriseProjectId |
dcs:instance:getBigKey |
授予权限以查询实例大key详情。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:deleteBigKeyScanTask |
授予权限以删除实例大key扫描任务。 |
write |
instance |
g:EnterpriseProjectId |
dcs:instance:updateBigKeyAutoScanConfig |
授予权限以修改实例大key扫描任务配置。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getBigKeyAutoScanConfig |
授予权限以查询实例大key扫描任务配置。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:analyzeHotKey |
授予权限以执行实例热key分析。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:listHotKey |
授予权限以查询实例热key列表。 |
list |
instance * |
g:EnterpriseProjectId |
dcs:instance:getHotKey |
授予权限以查询实例热key详情。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:deleteHotKeyScanTask |
授予权限以删除实例热key扫描任务。 |
write |
instance |
g:EnterpriseProjectId |
dcs:instance:updateHotKeyAutoScanConfig |
授予权限以修改实例热key扫描任务配置。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getHotKeyAutoScanConfig |
授予权限以查询实例热key扫描任务配置。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:analyzeExpiredKey |
授予权限以执行实例过期key分析。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getAutoExpiredKeyScanTask |
授予权限以查询过期key扫描任务。 |
read |
instance * |
- |
dcs:instance:updateExpiredKeyScanConfig |
授予权限以修改实例过期key扫描任务配置。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:getExpiredKeyScanConfig |
授予权限以查询实例过期key扫描任务配置。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:slowlog:list |
授予权限以查询慢日志列表。 |
list |
instance * |
g:EnterpriseProjectId |
dcs:aclaccount:create |
授予权限以创建ACL账号。 |
write |
instance * |
- |
dcs:aclaccount:list |
授予权限以查询ACL账户列表。 |
list |
instance * |
- |
dcs:aclaccount:modify |
授予权限以修改ACL账号密码。 |
write |
instance * |
- |
dcs:aclaccount:delete |
授予权限以删除ACL账号。 |
write |
instance * |
- |
dcs:whitelist:modify |
授予权限以设置IP白名单分组。 |
write |
instance * |
- |
dcs:whitelist:list |
授予权限以查询指定实例的IP白名单。 |
list |
instance * |
- |
dcs:instance:getBackgroundTask |
授予权限以查询后台任务列表。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:deleteBackgroundTask |
授予权限以删除后台任务。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:createDiagnosisTask |
授予权限以诊断实例。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:instance:listDiagnosisTask |
授予权限以查询实例诊断任务列表。 |
list |
instance * |
g:EnterpriseProjectId |
dcs:instance:getDiagnosisTask |
授予权限以查询实例诊断详情。 |
read |
instance * |
g:EnterpriseProjectId |
dcs:instance:deleteDiagnosisTask |
授予权限以删除诊断记录。 |
write |
instance * |
g:EnterpriseProjectId |
dcs:template:list |
授予权限以查询参数模板列表。 |
list |
- |
- |
dcs:template:create |
授予权限以创建自定义模板。 |
write |
- |
- |
dcs:template:get |
授予权限以查询参数模板。 |
read |
- |
- |
dcs:template:modify |
授予权限以修改自定义参数模板。 |
write |
- |
- |
dcs:template:delete |
授予权限以删除自定义参数模板。 |
write |
- |
- |
dcs:tag:list |
授予权限以查询租户所有标签。 |
list |
- |
- |
dcs:tag:modify |
授予权限以批量添加或删除标签。 |
write |
instance * |
- |
- |
|
|||
dcs:tag:get |
授予权限以查询单个实例标签。 |
read |
instance * |
- |
- |
|
|||
dcs:redisLog:get |
授予权限以获取日志下载链接。 |
read |
instance * |
- |
dcs:quota:get |
授予权限以查询租户配额。 |
read |
- |
- |
dcs:instance:webcli |
授予权限以使用WebCli连接Redis实例。 |
write |
instance * |
- |
dcs:clientIpTrans:modify |
授予权限以开启或关闭客户端ip透传。 |
write |
instance * |
- |
dcs:clients:list |
授予权限以查询Redis会话列表。 |
read |
instance * |
- |
dcs:clients:kill |
授予权限以Kill Redis会话。 |
write |
instance * |
- |
dcs:ssl:get |
授予权限以获取SSL证书信息。 |
read |
instance * |
- |
dcs:ssl:modify |
授予权限以修改SSL开关配置。 |
write |
instance * |
- |
dcs:job:get |
授予权限以获取前置任务检查结果。 |
read |
- |
- |
dcs:task:list |
授予权限以获取后台任务列表。 |
list |
- |
- |
dcs:task:delete |
授予权限以删除后台任务记录。 |
write |
- |
- |
DCS的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。
API |
对应的授权项 |
依赖的授权项 |
---|---|---|
GET /v2/{project_id}/instances |
dcs:instance:list |
- |
DELETE /v2/{project_id}/instances |
dcs:instance:delete |
|
GET /v2/{project_id}/instances/{instance_id} |
dcs:instance:get |
- |
DELETE /v2/{project_id}/instances/{instance_id} |
dcs:instance:delete |
|
PUT /v2/{project_id}/instances/{instance_id} |
dcs:instance:modify |
|
POST /v2/{project_id}/instances/{instance_id}/resize |
dcs:instance:scale |
|
POST /v2/{project_id}/instances/{instance_id}/resize/check-job |
dcs:instance:scale |
- |
POST /v2/{project_id}/instances/{instance_id}/swap |
dcs:instance:swap |
- |
PUT /v2/{project_id}/instances/{instance_id}/password |
dcs:instance:modifyAuthInfo |
- |
POST /v2/{project_id}/instances/{instance_id}/password/reset |
dcs:instance:modifyAuthInfo |
- |
GET /v2/{project_id}/instances/status |
dcs:instance:list |
- |
PUT /v2/{project_id}/instances/status |
dcs:instance:modifyStatus |
- |
GET /v2/{project_id}/instances/statistic |
dcs:instance:list |
- |
POST /v2/{project_id}/instances/{instance_id}/groups/{group_id}/replications/{node_id}/slave-priority |
dcs:instance:modify |
- |
DELETE /v2/{project_id}/instances/{instance_id}/groups/{group_id}/replications/{node_id}/remove-ip |
dcs:instance:delete |
- |
GET /v2/{project_id}/instance/{instance_id}/groups |
dcs:instance:get |
- |
GET /v2/{project_id}/instances/{instance_id}/configs |
dcs:instance:getConfiguration |
- |
PUT /v2/{project_id}/instances/{instance_id}/configs |
dcs:instance:modifyConfiguration |
- |
PUT /v2/{project_id}/instances/{instance_id}/async-configs |
dcs:instance:modifyConfiguration |
- |
DELETE /v2/{project_id}/instances/{instance_id}/backups/{backup_id} |
dcs:instance:deleteDataBackupFile |
- |
POST /v2/{project_id}/instances/{instance_id}/restores |
dcs:instance:restoreData |
- |
GET /v2/{project_id}/instances/{instance_id}/restores |
dcs:instance:getDataRestoreLog |
- |
POST /v2/{project_id}/instances/{instance_id}/backups/{backup_id}/links |
dcs:instance:downloadBackupData |
- |
POST /v2/{project_id}/instances/{instance_id}/backups |
dcs:instance:backupData |
- |
GET /v2/{project_id}/instances/{instance_id}/backups |
dcs:instance:getDataBackupLog |
- |
POST /v2/{project_id}/migration-task |
dcs:migrationTask:create |
- |
GET /v2/{project_id}/migration-tasks |
dcs:migrationTask:list |
- |
DELETE /v2/{project_id}/migration-tasks/delete |
dcs:migrationTask:delete |
- |
GET /v2/{project_id}/migration-task/{task_id} |
dcs:migrationTask:get |
- |
POST /v2/{project_id}/migration-task/{task_id}/stop |
dcs:migrationTask:modify |
- |
GET /v2/{project_id}/migration-task/{task_id}/stats |
dcs:migrationTask:get |
- |
POST /v2/{project_id}/migration/instance |
dcs:migrationTask:create |
- |
POST /v2/{project_id}/migration/{task_id}/task |
dcs:migrationTask:modify |
- |
POST /v2/{project_id}/migration-task/batch-stop |
dcs:migrationTask:modify |
- |
POST /v2/{project_id}/migration-task/{task_id}/sync-stop |
dcs:migrationTask:modify |
- |
GET /v2/{project_id}/dcs/tags |
dcs:tag:list |
- |
POST /v2/{project_id}/dcs/{instance_id}/tags/action |
dcs:tag:modify |
- |
GET /v2/{project_id}/instances/{instance_id}/tags |
dcs:tag:get |
- |
GET /v2/{project_id}/instances/{instance_id}/bigkey-tasks |
dcs:instance:listBigKey |
- |
PUT /v2/{project_id}/instances/{instance_id}/bigkey/autoscan |
dcs:instance:updateBigKeyAutoScanConfig |
- |
GET /v2/{project_id}/instances/{instance_id}/bigkey/autoscan |
dcs:instance:getBigKeyAutoScanConfig |
- |
POST /v2/{project_id}/instances/{instance_id}/hotkey-task |
dcs:instance:analyzeHotKey |
- |
GET /v2/{project_id}/instances/{instance_id}/hotkey-tasks |
dcs:instance:listHotKey |
- |
GET /v2/{project_id}/instances/{instance_id}/hotkey-task/{hotkey_id} |
dcs:instance:getHotKey |
- |
DELETE /v2/{project_id}/instances/{instance_id}/hotkey-task/{hotkey_id} |
dcs:instance:deleteHotKeyScanTask |
- |
PUT /v2/{project_id}/instances/{instance_id}/hotkey/autoscan |
dcs:instance:updateHotKeyAutoScanConfig |
- |
GET /v2/{project_id}/instances/{instance_id}/hotkey/autoscan |
dcs:instance:getHotKeyAutoScanConfig |
- |
POST /v2/{project_id}/instances/{instance_id}/scan-expire-keys-task |
dcs:instance:analyzeExpiredKey |
- |
GET /v2/{project_id}/instances/{instance_id}/auto-expire/histories |
dcs:instance:getAutoExpiredKeyScanTask |
- |
POST /v2/{project_id}/instances/{instance_id}/auto-expire/scan |
dcs:instance:analyzeExpiredKey |
- |
GET /v2/{project_id}/instances/{instance_id}/scan-expire-keys/autoscan-config |
dcs:instance:getExpiredKeyScanConfig |
- |
PUT /v2/{project_id}/instances/{instance_id}/scan-expire-keys/autoscan-config |
dcs:instance:updateExpiredKeyScanConfig |
- |
GET /v2/{project_id}/instances/{instance_id}/slowlog |
dcs:slowlog:list |
- |
GET /v2/{project_id}/instances/{instance_id}/redislog |
dcs:redisLog:get |
- |
POST /v2/{project_id}/instances/{instance_id}/redislog |
dcs:redisLog:get |
- |
POST /v2/{project_id}/instances/{instance_id}/redislog/{id}/links |
dcs:redisLog:get |
- |
POST /v2/{project_id}/instances/{instance_id}/accounts |
dcs:aclaccount:create |
- |
GET /v2/{project_id}/instances/{instance_id}/accounts |
dcs:aclaccount:list |
- |
PUT /v2/{project_id}/instances/{instance_id}/accounts/{account_id}/password/modify |
dcs:aclaccount:modify |
- |
PUT /v2/{project_id}/instances/{instance_id}/accounts/{account_id}/password/reset |
dcs:aclaccount:modify |
- |
PUT /v2/{project_id}/instances/{instance_id}/accounts/{account_id} |
dcs:aclaccount:modify |
- |
PUT /v2/{project_id}/instances/{instance_id}/accounts/{account_id}/role |
dcs:aclaccount:modify |
- |
DELETE /v2/{project_id}/instances/{instance_id}/accounts/{account_id} |
dcs:aclaccount:delete |
- |
PUT /v2/{project_id}/instance/{instance_id}/whitelist |
dcs:whitelist:modify |
- |
GET /v2/{project_id}/instance/{instance_id}/whitelist |
dcs:whitelist:list |
- |
GET /v2/{project_id}/instances/{instance_id}/tasks |
dcs:instance:getBackgroundTask |
- |
DELETE /v2/{project_id}/instances/{instance_id}/tasks/{task_id} |
dcs:instance:deleteBackgroundTask |
- |
GET /v2/{project_id}/quota |
dcs:quota:get |
- |
GET /v2/{project_id}/dims/monitored-objects/{instance_id} |
dcs:instance:get |
- |
GET /v2/{project_id}/dims/monitored-objects |
dcs:instance:list |
- |
POST /v2/{project_id}/instances/{instance_id}/diagnosis |
dcs:instance:createDiagnosisTask |
- |
GET /v2/{project_id}/instances/{instance_id}/diagnosis |
dcs:instance:listDiagnosisTask |
- |
GET /v2/{project_id}/diagnosis/{report_id} |
dcs:instance:getDiagnosisTask |
- |
DELETE /v2/{project_id}/instances/{instance_id}/diagnosis |
dcs:instance:deleteDiagnosisTask |
- |
GET /v2/{project_id}/config-templates |
dcs:template:list |
- |
POST /v2/{project_id}/config-templates |
dcs:template:create |
- |
GET /v2/{project_id}/config-templates/{template_id} |
dcs:template:get |
- |
DELETE /v2/{project_id}/config-templates/{template_id} |
dcs:template:delete |
- |
PUT /v2/{project_id}/config-templates/{template_id} |
dcs:template:modify |
- |
GET /v2/{project_id}/instances-logical-nodes |
dcs:instance:list |
- |
GET /v2/{project_id}/instances/{instance_id}/config-histories |
dcs:instance:get |
- |
PUT /v2/{project_id}/instances/{instance_id}/bandwidth |
dcs:instance:modify |
- |
PUT /v2/{project_id}/instances/{instance_id}/async-swap |
dcs:instance:swap |
- |
GET /v2/{project_id}/instances/{instance_id}/operations |
dcs:instance:get |
- |
POST /v2/{project_id}/instances/{instance_id}/webcli/auth |
dcs:instance:webcli |
- |
POST /v2/{project_id}/instances/{instance_id}/webcli/command |
dcs:instance:webcli |
- |
POST /v2/{project_id}/instances/{instance_id}/webcli/logout |
dcs:instance:webcli |
- |
PUT /v2/{project_id}/{instance_id}/client-ip-transparent-transmission |
dcs:clientIpTrans:modify |
- |
GET /v2/{project_id}/instances/{instance_id}/bigkey-task/{bigkey_id} |
dcs:instance:getBigKey |
- |
DELETE /v2/{project_id}/instances/{instance_id}/bigkey-task/{bigkey_id} |
dcs:instance:deleteBigKeyScanTask |
- |
POST /v2/{project_id}/instances/{instance_id}/clients |
dcs:clients:list |
- |
GET /v2/{project_id}/instances/{instance_id}/clients |
dcs:clients:list |
- |
POST /v2/{project_id}/instances/{instance_id}/clients/kill |
dcs:clients:kill |
- |
POST /v2/{project_id}/instances/{instance_id}/clients/kill-all |
dcs:clients:kill |
- |
GET /v2/{project_id}/instances/{instance_id}/config-histories/{history_id} |
dcs:instance:get |
- |
GET /v2/{project_id}/instances/{instance_id}/deletable-replication |
dcs:instance:scale |
- |
POST /v2/{project_id}/instances/export |
dcs:instance:list |
- |
GET /v2/{project_id}/instance/{instance_id}/groups/{group_id}/group-nodes-state |
dcs:instance:get |
- |
POST /v2/{project_id}/instance/{instance_id}/groups/{group_id}/replications/{node_id}/async-switchover |
dcs:instance:swap |
- |
GET /v2/{project_id}/instances/{instance_id}/ssl |
dcs:ssl:get |
- |
PUT /v2/{project_id}/instances/{instance_id}/ssl |
dcs:ssl:modify |
- |
POST /v2/{project_id}/instances/{instance_id}/ssl-certs/download |
dcs:ssl:modify |
- |
GET /v2/{project_id}/instances/{instance_id}/tasks/{task_id}/progress |
dcs:instance:getBackgroundTask |
- |
GET /v2/{project_id}/instances/export-job |
dcs:instance:exportListFile |
- |
GET /v2/{project_id}/jobs/{job_id} |
dcs:job:get |
- |
PUT /v2/{project_id}/migration-task/{task_id} |
dcs:migrationTask:modify |
- |
POST /v2/{project_id}/migration-task/{task_id}/exchange-ip |
dcs:migrationTask:modify |
- |
GET /v2/{project_id}/tasks |
dcs:task:list |
- |
DELETE /v2/{project_id}/tasks/{task_id} |
dcs:task:delete |
- |
GET /v2/{project_id}/migration-task/{task_id}/logs |
dcs:migrationTask:get |
- |
资源类型(Resource)
资源类型(Resource)表示SCP所作用的资源。如表3中的某些操作指定了可以在该操作指定的资源类型,则必须在具有该操作的SCP语句中指定该资源的URN,SCP仅作用于此资源;如未指定,Resource默认为“*”,则SCP将应用到所有资源。您也可以在SCP中设置条件,从而指定资源类型。
DCS定义了以下可以在自定义SCP的Resource元素中使用的资源类型。
条件(Condition)
条件(Condition)是SCP生效的特定条件,包括条件键和运算符。
- 条件键表示SCP语句的Condition元素中的键值。根据适用范围,分为全局级条件键和服务级条件键。
- 全局级条件键(前缀为g:)适用于所有操作,在鉴权过程中,云服务不需要提供用户身份信息,系统将自动获取并鉴权。 详情请参见:全局条件键。
- 服务级条件键(前缀通常为服务缩写,如dcs:)仅适用于对应服务的操作,详情请参见表4。
- 单值/多值表示API调用时请求中与条件关联的值数。单值条件键在API调用时的请求中最多包含一个值,多值条件键在API调用时请求可以包含多个值。例如:g:SourceVpce是单值条件键,表示仅允许通过某个VPC终端节点发起请求访问某资源,一个请求最多包含一个VPC终端节点ID值。g:TagKeys是多值条件键,表示请求中携带的所有标签的key组成的列表,当用户在调用API请求时传入标签可以传入多个值。
- 运算符与条件键、条件值一起构成完整的条件判断语句,当请求信息满足该条件时,SCP才能生效。支持的运算符请参见:运算符。
DCS定义了以下可以在自定义SCP的Condition元素中使用的条件键,您可以使用这些条件键进一步细化SCP语句应用的条件。