更新时间:2024-04-08 GMT+08:00

应用管理与运维平台 ServiceStage

Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)可以使用以下授权项元素设置访问控制策略。

SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。

本章节介绍组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。

如何使用这些元素编辑SCP自定义策略,请参考创建SCP

操作(Action)

操作(Action)即为SCP中支持的授权项。

  • “访问级别”列描述如何对操作进行分类(list、read和write等)。此分类可帮助您了解在SCP中相应操作对应的访问级别。
  • “资源类型”列指每个操作是否支持资源级权限。
    • 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在SCP语句的Resource元素中指定所有资源类型(“*”)。
    • 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
    • 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。

    关于ServiceStage定义的资源类型的详细信息请参见资源类型(Resource)

  • “条件键”列包括了可以在SCP语句的Condition元素中支持指定的键值。
    • 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
    • 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
    • 如果此列条件键没有值(-),表示此操作不支持指定条件键。

    关于ServiceStage定义的条件键的详细信息请参见条件(Condition)

您可以在SCP语句的Action元素中指定以下ServiceStage的相关操作。

表1 ServiceStage支持的授权项

授权项

描述

访问级别

资源类型

条件键

servicestage:app:getApplication

授予用户查看指定应用权限

read

app

  • g:EnterpriseProjectId
  • g:ResourceTag

servicestage:app:createApplication

授予用户创建应用权限

write

app

  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:app:modifyApplication

授予用户更新应用权限

write

app

  • g:EnterpriseProjectId
  • g:ResourceTag
  • g:RequestTag
  • g:TagKeys

servicestage:app:deleteApplication

授予用户删除应用权限

write

app

  • g:EnterpriseProjectId
  • g:ResourceTag

servicestage:app:listApplication

授予用户查看应用列表权限

list

-

-

servicestage:app:getConfiguration

授予用户查看应用配置权限

read

app

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:app:deleteConfiguration

授予用户删除应用配置权限

write

app

  • g:EnterpriseProjectId
  • g:ResourceTag

servicestage:app:modifyConfiguration

授予用户更新应用配置权限

write

app

  • g:EnterpriseProjectId
  • g:ResourceTag

servicestage:app:getComponent

授予用户查看指定应用组件权限

read

app

  • g:EnterpriseProjectId
  • g:ResourceTag

servicestage:app:createComponent

授予用户创建应用组件权限

write

app

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:app:modifyComponent

授予用户更新应用组件权限

write

app

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:app:deleteComponent

授予用户删除应用组件权限

write

app

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:app:listComponent

授予用户查看应用组件列表权限

list

-

-

servicestage:environment:create

授予用户创建环境权限

write

environment

  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:environment:get

授予用户查看环境信息权限

read

environment

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:environment:list

授予用户查看环境列表权限

list

-

-

servicestage:environment:modify

授予用户更新环境权限

write

environment

  • g:ResourceTag
  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:environment:delete

授予用户删除环境权限

write

environment

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:environment:tag

授予TMS用户创建环境标签权限

tagging

environment

  • g:ResourceTag
  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:app:tag

授予TMS用户创建应用标签权限

tagging

app

  • g:ResourceTag
  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:environment:listResourcesByTag

授予TMS用户通过标签查询环境资源权限

read

environment

  • g:RequestTag
  • g:TagKeys

servicestage:app:listResourcesByTag

授予TMS用户通过标签查询应用资源权限

read

app

  • g:RequestTag
  • g:TagKeys

servicestage:environment:unTagResource

授予TMS用户删除环境资源标签权限

tagging

environment

  • g:ResourceTag
  • g:RequestTag
  • g:EnterpriseProjectId
  • g:TagKeys

servicestage:app:unTagResource

授予TMS用户删除应用资源标签权限

tagging

app

  • g:ResourceTag
  • g:EnterpriseProjectId
  • g:RequestTag
  • g:TagKeys

servicestage:environment:listTags

授予TMS用户查询环境资源标签列表权限

read

-

-

servicestage:app:listTags

授予TMS用户查询应用资源标签列表权限

read

-

-

servicestage:pipeline:get

授予用户查看流水线权限

read

pipeline

-

servicestage:pipeline:create

授予用户创建流水线权限

write

pipeline

-

servicestage:pipeline:modify

授予用户更新流水线权限

write

pipeline

-

servicestage:pipeline:delete

授予用户删除流水线权限

write

pipeline

-

servicestage:pipeline:list

授予用户查看流水线列表权限

list

-

-

servicestage:assembling:runtimeList

授予用户查看技术栈列表权限

read

-

-

servicestage:assembling:getInfo

授予用户查看构建信息权限

list

-

-

servicestage:assembling:create

授予用户创建构建任务权限

write

assembling

-

servicestage:assembling:modify

授予用户更新构建任务权限

write

assembling

-

servicestage:assembling:delete

授予用户删除构建任务权限

write

assembling

-

servicestage:assembling:list

授予用户查看构建任务列表权限

list

-

-

servicestage:repositoryAuth:list

授予用户获取仓库授权列表权限

list

-

-

servicestage:repositoryAuth:get

授予用户获取仓库授权权限

read

repositoryAuth

-

servicestage:repositoryAuth:create

授予用户创建仓库授权权限

write

repositoryAuth

-

servicestage:repositoryAuth:delete

授予用户删除仓库授权权限

write

repositoryAuth

-

servicestage:environment:listTagsForResource

授予eps用户查询环境资源标签列表权限

read

environment

  • g:ResourceTag
  • g:EnterpriseProjectId

servicestage:app:listTagsForResource

授予eps用户查询应用资源标签列表权限

read

app

  • g:ResourceTag
  • g:EnterpriseProjectId

ServiceStage的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。

表2 API与授权项的关系

API

对应的授权项

依赖的授权项

GET /v2/{project_id}/cas/metadata/runtimes

servicestage:app:listApplication

-

GET /v2/{project_id}/cas/metadata/flavors

servicestage:app:listApplication

-

POST /v2/{project_id}/cas/environments

servicestage:environment:create

-

GET /v2/{project_id}/cas/environments

servicestage:environment:list

-

PUT /v2/{project_id}/cas/environments/{environment_id}

servicestage:environment:modify

-

DELETE /v2/{project_id}/cas/environments/{environment_id}

servicestage:environment:delete

-

GET /v2/{project_id}/cas/environments/{environment_id}

servicestage:environment:get

-

PATCH /v2/{project_id}/cas/environments/{environment_id}/resources

servicestage:environment:modify

-

POST /v2/{project_id}/cas/applications

servicestage:app:createApplication

-

GET /v2/{project_id}/cas/applications

servicestage:app:listApplication

-

PUT /v2/{project_id}/cas/applications/{application_id}

servicestage:app:modifyApplication

-

DELETE /v2/{project_id}/cas/applications/{application_id}

servicestage:app:deleteApplication

-

GET /v2/{project_id}/cas/applications/{application_id}

servicestage:app:getApplication

-

PUT /v2/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:modifyConfiguration

-

DELETE /v2/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:deleteConfiguration

-

GET /v2/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:getConfiguration

-

POST /v2/{project_id}/cas/applications/{application_id}/components

servicestage:app:createComponent

servicestage:assembling:getInfo

servicestage:assembling:create

GET /v2/{project_id}/cas/applications/{application_id}/components

servicestage:app:listComponent

-

PUT /v2/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:modifyComponent

-

DELETE /v2/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:deleteComponent

-

GET /v2/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:getComponent

-

POST /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances

servicestage:app:createComponent

servicestage:assembling:getInfo

servicestage:assembling:create

GET /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances

servicestage:app:listComponent

-

POST /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}/action

servicestage:app:modifyComponent

-

PUT /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}

servicestage:app:modifyComponent

-

DELETE /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}

servicestage:app:deleteComponent

-

GET /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}

servicestage:app:getComponent

-

GET /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}/snapshots

servicestage:app:getComponent

-

GET /v2/{project_id}/cas/jobs/{job_id}

servicestage:app:listApplication

-

POST /v3/{project_id}/cas/environments

servicestage:environment:create

-

GET /v3/{project_id}/cas/environments

servicestage:environment:list

-

PUT /v3/{project_id}/cas/environments/{environment_id}

servicestage:environment:modify

-

DELETE /v3/{project_id}/cas/environments/{environment_id}

servicestage:environment:delete

-

GET /v3/{project_id}/cas/environments/{environment_id}

servicestage:environment:get

-

PUT /v3/{project_id}/cas/environments/{environment_id}/resources

servicestage:environment:modify

-

GET /v3/{project_id}/cas/environments/{environment_id}/resources

servicestage:environment:list

-

POST /v3/{project_id}/cas/applications

servicestage:app:createApplication

-

GET /v3/{project_id}/cas/applications

servicestage:app:listApplication

-

PUT /v3/{project_id}/cas/applications/{application_id}

servicestage:app:modifyApplication

-

GET /v3/{project_id}/cas/applications/{application_id}

servicestage:app:getApplication

-

GET /v3/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:getConfiguration

-

PUT /v3/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:modifyConfiguration

-

DELETE /v3/{project_id}/cas/applications/{application_id}/configuration

servicestage:app:deleteConfiguration

-

POST /v3/{project_id}/cas/applications/{application_id}/components

servicestage:app:createComponent

servicestage:assembling:getInfo

servicestage:assembling:create

GET /v3/{project_id}/cas/applications/{application_id}/components

servicestage:app:listComponent

-

GET /v3/{project_id}/cas/components

servicestage:app:listComponent

-

PUT /v3/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:modifyComponent

-

DELETE /v3/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:deleteComponent

-

GET /v3/{project_id}/cas/applications/{application_id}/components/{component_id}

servicestage:app:getComponent

-

POST /v3/{project_id}/cas/applications/{application_id}/components/{component_id}/action

servicestage:app:modifyComponent

-

GET /v3/{project_id}/cas/applications/{application_id}/components/{component_id}/records

servicestage:app:listComponent

-

GET /v3/{project_id}/cas/runtimestacks

servicestage:app:listApplication

-

GET /v1/{project_id}/git/auths

servicestage:repositoryAuth:list

-

GET /v1/{project_id}/git/auths/{repo_type}/redirect

servicestage:repositoryAuth:get

-

POST /v1/{project_id}/git/auths/{repo_type}/oauth

servicestage:repositoryAuth:create

-

POST /v1/{project_id}/git/auths/{repo_type}/personal

servicestage:repositoryAuth:create

-

POST /v1/{project_id}/git/auths/{repo_type}/password

servicestage:repositoryAuth:create

-

DELETE /v1/{project_id}/git/auths/{name}

servicestage:repositoryAuth:delete

-

GET /v2/{project_id}/servicestage-environment/{environment_id}/tags

servicestage:environment:listTagsForResource

-

GET /v2/{project_id}/servicestage-application/{app_id}/tags

servicestage:app:listTagsForResource

-

资源类型(Resource)

资源类型(Resource)表示SCP所作用的资源。如表3中的某些操作指定了可以在该操作指定的资源类型,则必须在具有该操作的SCP语句中指定该资源的URN,SCP仅作用于此资源;如未指定,Resource默认为“*”,则SCP将应用到所有资源。您也可以在SCP中设置条件,从而指定资源类型。

ServiceStage定义了以下可以在SCP的Resource元素中使用的资源类型。

表3 ServiceStage支持的资源类型

资源类型

URN

app

servicestage:<region>:<account-id>:app:<app-id>

environment

servicestage:<region>:<account-id>:environment:<environment-id>

pipeline

servicestage:<region>:<account-id>:pipeline:<pipeline-id>

assembling

servicestage:<region>:<account-id>:assembling:<assembling-id>

repositoryAuth

servicestage:<region>:<account-id>:repositoryAuth:<repositoryAuth-id>

条件(Condition)

ServiceStage服务不支持在SCP中的条件键中配置服务级的条件键。

ServiceStage可以使用适用于所有服务的全局条件键,请参考全局条件键