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 編碼字串。 |