定义身份和访问权限管理 (IAM) 政策,用于指定 Cloud Platform 资源的访问权限控制政策。
Policy
由一系列 bindings
组成。binding
会将一系列 members
绑定到 role
,其中成员可以是用户账号、Google 群组、Google 网域和服务账号。role
是 IAM 定义的指定权限的列表。
JSON 示例
{
"bindings": [
{
"role": "roles/owner",
"members": [
"user:mike@example.com",
"group:admins@example.com",
"domain:google.com",
"serviceAccount:my-other-app@appspot.gserviceaccount.com"
]
},
{
"role": "roles/viewer",
"members": ["user:sean@example.com"]
}
]
}
YAML 示例
bindings:
- members:
- user:mike@example.com
- group:admins@example.com
- domain:google.com
- serviceAccount:my-other-app@appspot.gserviceaccount.com
role: roles/owner
- members:
- user:sean@example.com
role: roles/viewer
如需了解 IAM 及其功能,请参阅 IAM 开发者指南。
JSON 表示法 | |
---|---|
{
"version": number,
"bindings": [
{
object( |
字段 | |
---|---|
version |
已弃用。 |
bindings[] |
将一系列 |
etag |
如果在调用 使用 base64 编码的字符串。 |
Binding
将 members
与 role
关联。
JSON 表示法 | |
---|---|
{
"role": string,
"members": [
string
],
"condition": {
object( |
字段 | |
---|---|
role |
分配给 |
members[] |
指定请求访问 Cloud Platform 资源的身份。
|
condition |
未实现。与此绑定关联的条件。注意:若不满足条件,则不允许用户通过当前绑定进行访问。系统会单独对不同的绑定(包括其条件)进行检查。 |
Expr
表示表达式文本。示例:
title: "User account presence"
description: "Determines whether the request has a user account"
expression: "size(request.user) > 0"
JSON 表示法 | |
---|---|
{ "expression": string, "title": string, "description": string, "location": string } |
字段 | |
---|---|
expression |
采用通用表达式语言语法的表达式的文本表示法。 包含消息的应用上下文决定支持 CEL 的哪个常用特征集。 |
title |
表达式的可选标题,即说明其用途的短字符串。该标题可用于允许输入表达式的内容(例如界面)。 |
description |
表达式的可选说明。该说明是描述表达式的较长文本,例如在界面中将鼠标悬停在表达式上时显示的文本。 |
location |
可选字符串,可指示用于错误报告的表达式的位置,例如文件名和文件中的位置。 |