身份策略授权参考
云服务在IAM预置了常用的权限,称为系统身份策略。如果IAM系统身份策略无法满足授权要求,管理员可以根据各服务支持的授权项,创建IAM自定义身份策略来进行精细的访问控制,IAM自定义身份策略是对系统身份策略的扩展和补充。
除IAM服务外,Organizations服务中的服务控制策略(Service Control Policy,以下简称SCP)也可以使用这些授权项元素设置访问控制策略。
SCP不直接进行授权,只划定权限边界。将SCP绑定到组织单元或者成员账号时,并没有直接对组织单元或成员账号授予操作权限,而是规定了成员账号或组织单元包含的成员账号的授权范围。IAM身份策略授予权限的有效性受SCP限制,只有在SCP允许范围内的权限才能生效。
IAM服务与Organizations服务在使用这些元素进行访问控制时,存在着一些区别,详情请参见:IAM服务与Organizations服务权限访问控制的区别。
本章节介绍IAM服务身份策略授权场景中自定义身份策略和组织服务中SCP使用的元素,这些元素包含了操作(Action)、资源(Resource)和条件(Condition)。
操作(Action)
操作(Action)即为身份策略中支持的授权项。
- “访问级别”列描述如何对操作进行分类(List、Read和Write等)。此分类可帮助您了解在身份策略中相应操作对应的访问级别。
- “资源类型”列指每个操作是否支持资源级权限。
- 资源类型支持通配符号*表示所有。如果此列没有值(-),则必须在身份策略语句的Resource元素中指定所有资源类型(“*”)。
- 如果该列包含资源类型,则必须在具有该操作的语句中指定该资源的URN。
- 资源类型列中必需资源在表中用星号(*)标识,表示使用此操作必须指定该资源类型。
关于AgentArts定义的资源类型的详细信息请参见资源类型(Resource)。
- “条件键”列包括了可以在身份策略语句的Condition元素中支持指定的键值。
- 如果该授权项资源类型列存在值,则表示条件键仅对列举的资源类型生效。
- 如果该授权项资源类型列没有值(-),则表示条件键对整个授权项生效。
- 如果此列条件键没有值(-),表示此操作不支持指定条件键。
关于AgentArts定义的条件键的详细信息请参见条件(Condition)。
- “别名”列包括了可以在身份策略中配置的策略授权项。通过这些授权项,可以控制支持策略授权的API访问。详细信息请参见身份策略兼容性说明。
您可以在身份策略语句的Action元素中指定以下AgentArts的相关操作。
| 授权项 | 描述 | 访问级别 | 资源类型(*为必须) | 条件键 | 别名 |
|---|---|---|---|---|---|
| agentarts:runtime:createCoreRuntime | 授予权限以用户创建运行时。 | Write | CoreRuntime * | - | - |
| - | |||||
| agentarts:runtime:listCoreRuntimes | 授予权限以用户查看运行时列表。 | List | CoreRuntime * | - | - |
| agentarts:runtime:showCoreRuntime | 授予权限以用户查看运行时详情。 | Read | CoreRuntime * | - | |
| agentarts:runtime:updateCoreRuntime | 授予权限以用户更新运行时。 | Write | CoreRuntime * | - | |
| - | |||||
| agentarts:runtime:deleteCoreRuntime | 授予权限以用户删除运行时。 | Write | CoreRuntime * | - | |
| agentarts:runtimeEndpoint:createCoreRuntimeEndpoint | 授予权限以用户创建运行时访问方式。 | Write | CoreRuntimeEndpoint * | - | - |
| - | |||||
| agentarts:runtimeEndpoint:listCoreRuntimeEndpoints | 授予权限以用户查看运行时访问方式列表。 | List | CoreRuntime * | - | - |
| CoreRuntimeEndpoint * | - | ||||
| agentarts:runtimeEndpoint:showCoreRuntimeEndpoint | 授予权限以用户查看运行时访问方式详情。 | Read | CoreRuntimeEndpoint * | - | |
| agentarts:runtimeEndpoint:updateCoreRuntimeEndpoint | 授予权限以用户更新运行时访问方式。 | Write | CoreRuntimeEndpoint * | - | |
| - | |||||
| agentarts:runtimeEndpoint:deleteCoreRuntimeEndpoint | 授予权限以用户删除运行时访问方式。 | Write | CoreRuntimeEndpoint * | - | |
| agentarts:runtime:listCoreRuntimeVersions | 授予权限以用户查看运行时版本列表。 | List | CoreRuntime * | - | |
| agentarts::createCoreSubscription | 授予权限以用户开通AgentRun服务。 | Write | - | - | - |
| agentarts::showCoreSubscription | 授予用户查看AgentRun开通状态的权限。 | Read | - | - | - |
AgentArts的API通常对应着一个或多个授权项。表2展示了API与授权项的关系,以及该API需要依赖的授权项。
| API | 对应的授权项 | 依赖的授权项 |
|---|---|---|
| POST /v1/core/runtimes | agentarts:runtime:createCoreRuntime |
|
| GET /v1/core/runtimes | agentarts:runtime:listCoreRuntimes | - |
| GET /v1/core/runtimes/{runtime_id} | agentarts:runtime:showCoreRuntime | - |
| PUT /v1/core/runtimes/{runtime_id} | agentarts:runtime:updateCoreRuntime |
|
| DELETE /v1/core/runtimes/{runtime_id} | agentarts:runtime:deleteCoreRuntime |
|
| POST /v1/core/runtimes/{runtime_id}/endpoints | agentarts:runtimeEndpoint:createCoreRuntimeEndpoint | - |
| GET /v1/core/runtimes/{runtime_id}/endpoints | agentarts:runtimeEndpoint:listCoreRuntimeEndpoints | - |
| GET /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id} | agentarts:runtimeEndpoint:showCoreRuntimeEndpoint | - |
| PUT /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id} | agentarts:runtimeEndpoint:updateCoreRuntimeEndpoint | - |
| DELETE /v1/core/runtimes/{runtime_id}/endpoints/{endpoint_id} | agentarts:runtimeEndpoint:deleteCoreRuntimeEndpoint | - |
| GET /v1/core/runtimes/{runtime_id}/versions | agentarts:runtime:listCoreRuntimeVersions | - |
| - | agentarts::createCoreSubscription | - |
| - | agentarts::showCoreSubscription | - |
资源类型(Resource)
资源类型(Resource)用于定义身份策略生效的资源范围。如表3中某项操作已指定了对应的资源类型,则在包含该操作的身份策略语句中选择填写对应资源的URN时,身份策略仅对该指定资源生效;未填写对应资源的URN时,身份策略将对指定资源类型下所有资源生效;如未指定资源类型,Resource默认取值为“*”,身份策略将作用于所有资源。此外,您也可在身份策略中设置条件,进一步精细化限定资源类型。
AgentArts定义了以下可以在自定义身份策略的Resource元素中使用的资源类型。