Policy

IAM(Identity and Access Management)ポリシーを定義します。アクセス制御ポリシーを Cloud Platform リソースに指定するのに用いられます。

Policybindings のリストで構成されています。bindingmembers のリストを 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(Binding)
    }
  ],
  "etag": string
}
フィールド
version
(deprecated)

number

サポート終了。

bindings[]

object(Binding)

members のリストを role に関連付けます。bindings にメンバーが存在しないとエラーになります。

etag

string (bytes format)

etag は、オプティミスティック同時実行制御でポリシーの同時更新による相互上書きを防ぐために使用されます。競合状態の発生を回避する目的で、システムのポリシー更新の読み込み・変更・書き込みサイクルでは etag を活用することを強くおすすめします。getIamPolicy へのレスポンスでは etag が返されます。その etag を setIamPolicy に対するリクエストに配置すれば、対応する変更が同じバージョンのポリシーに確実に適用されるようになります。

setIamPolicy の呼び出しに etag が含まれていない場合、既存のポリシーは盲目的に上書きされます。

Base64 でエンコードされた文字列。

バインディング

membersrole に関連付けます。

JSON 表現
{
  "role": string,
  "members": [
    string
  ],
  "condition": {
    object(Expr)
  }
}
フィールド
role

string

members に割り当てる役割。例: roles/viewerroles/editor、または roles/owner

members[]

string

Cloud Platform リソースのアクセスのリクエスト元を識別する情報を指定します。members には次の値を指定できます。

  • allUsers: Google アカウントの有無を問わず、インターネット上のすべてのユーザーを表す特別な識別子。

  • allAuthenticatedUsers: Google アカウントまたはサービス アカウントで認証される任意のユーザーを表す特別な識別子。

  • user:{emailid}: 特定の Google アカウントを表すメールアドレス。例: alice@gmail.com

  • serviceAccount:{emailid}: サービス アカウントを表すメールアドレス。例: my-other-app@appspot.gserviceaccount.com

  • group:{emailid}: Google グループを表すメールアドレス。例: admins@example.com

  • domain:{domain}: そのドメインのすべてのユーザーを表す Google Apps ドメイン名。たとえば、google.comexample.com です。

condition

object(Expr)

未実装。このバインディングに関連付けられている条件。注: 条件を満たさないと、ユーザーは現在のバインディングからアクセスできません。別々のバインディングは、その条件を含めて個別に検査されます。

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

string

Common Expression Language 構文による式のテキスト表現。

それを含んでいるメッセージのアプリケーション コンテキストにより、サポートされる CEL の既知の機能セットが決まります。

title

string

式のタイトル(省略可)。その目的を表す短い文字列です。たとえば、その式を入力できる UI でこれを使用します。

description

string

式の説明(省略可)。これは、式を説明する長いテキストです。たとえば、UI で式にカーソルを合わせたときに表示されます。

location

string

エラー報告用に式の場所を示す文字列(省略可)。たとえば、ファイル名とファイル内の位置。