Identity and Access Management (IAM) 政策,用于指定 Google Cloud 资源的访问权限控制。
Policy 是 bindings 的集合。binding 会将一个或多个 members 或主账号绑定到单个 role。主账号可以是用户账号、服务账号、Google 群组以及网域(例如 G Suite)。role 是命名的权限列表;每个 role 可以是 IAM 预定义角色或用户创建的自定义角色。
对于某些类型的 Google Cloud 资源,binding 还可以指定 condition,这是一个逻辑表达式。只有在此表达式的计算结果为 true 时才允许访问资源。条件可以根据请求和/或资源的特性添加限制条件。如需了解哪些资源支持在其 IAM 政策中使用条件,请参阅 IAM 文档。
JSON 示例:
    {
      "bindings": [
        {
          "role": "roles/resourcemanager.organizationAdmin",
          "members": [
            "user:mike@example.com",
            "group:admins@example.com",
            "domain:google.com",
            "serviceAccount:my-project-id@appspot.gserviceaccount.com"
          ]
        },
        {
          "role": "roles/resourcemanager.organizationViewer",
          "members": [
            "user:eve@example.com"
          ],
          "condition": {
            "title": "expirable access",
            "description": "Does not grant access after Sep 2020",
            "expression": "request.time < timestamp('2020-10-01T00:00:00.000Z')",
          }
        }
      ],
      "etag": "BwWWja0YfJA=",
      "version": 3
    }
YAML 示例:
    bindings:
    - members:
      - user:mike@example.com
      - group:admins@example.com
      - domain:google.com
      - serviceAccount:my-project-id@appspot.gserviceaccount.com
      role: roles/resourcemanager.organizationAdmin
    - members:
      - user:eve@example.com
      role: roles/resourcemanager.organizationViewer
      condition:
        title: expirable access
        description: Does not grant access after Sep 2020
        expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
    etag: BwWWja0YfJA=
    version: 3
如需了解 IAM 及其功能,请参阅 IAM 文档。
| JSON 表示法 | 
|---|
| {
  "version": integer,
  "bindings": [
    {
      object ( | 
| 字段 | |
|---|---|
| version | 
 指定政策的格式。 有效值为  任何影响条件角色绑定的操作都必须指定版本  
 重要提示:如果您使用 IAM 条件,则必须在调用  如果政策不包含任何条件,则对该政策执行的操作可以指定任何有效版本,也可以不设置该字段。 如需了解哪些资源支持在其 IAM 政策中使用条件,请参阅 IAM 文档。 | 
| bindings[] | 
 将一组  
 | 
| etag | 
 
 重要提示:如果您使用 IAM 条件,则必须在调用  base64 编码的字符串。 |