公告:所有在
2025 年 4 月 15 日之前注册使用 Earth Engine 的非商业项目都必须
验证是否符合非商业性质的资格条件,才能继续使用 Earth Engine。
Policy
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
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 (Binding )
}
],
"etag": string
} |
字段 |
version |
integer
指定政策的格式。 有效值为 0 、1 和 3 。指定无效值的请求将被拒绝。 任何影响条件角色绑定的操作都必须指定版本 3 。此要求适用于以下操作:
- 获取包含条件角色绑定的政策
- 向政策添加条件角色绑定
- 更改政策中的条件角色绑定
- 从包含条件的政策中移除任何角色绑定,而无论此绑定是否含有条件
重要提示:如果您使用 IAM 条件,则必须在调用 setIamPolicy 时包含 etag 字段。如果您省略此字段,则 IAM 允许您使用版本 1 政策覆盖版本 3 政策,而且版本 3 政策中的所有条件都会丢失。 如果政策不包含任何条件,则对该政策执行的操作可以指定任何有效版本,也可以不设置该字段。 如需了解哪些资源支持在其 IAM 政策中使用条件,请参阅 IAM 文档。
|
bindings[] |
object (Binding )
将一组 members 或主账号与一个 role 相关联。(可选)可以指定一个 condition 以确定如何及何时应用 bindings 。每个 bindings 必须至少包含一个主账号。 Policy 中的 bindings 最多可以引用 1,500 个主账号;其中,最多有 250 个主账号可以是 Google 群组。主账号的每个实例都会计入相应限制。例如,如果 bindings 向 user:alice@example.com 授予了 50 个不同的角色且没有向任何其他主账号授予角色,那么您最多还可以向 Policy 中的 bindings 添加 1,450 个主账号。
|
etag |
string (bytes format)
etag 用于乐观并发控制,可帮助防止同时对政策进行的更新相互覆盖。强烈建议系统在“读取-修改-写入”周期中使用 etag 来执行政策更新以避免冲突:返回 etag 来响应 getIamPolicy ,系统应将该 etag 放入对 setIamPolicy 的请求中,以确保其更改将应用于同一版本的政策。
重要提示:如果您使用 IAM 条件,则必须在调用 setIamPolicy 时包含 etag 字段。如果您省略此字段,则 IAM 允许您使用版本 1 政策覆盖版本 3 政策,而且版本 3 政策中的所有条件都会丢失。 base64 编码的字符串。
|
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eIAM policies control access to Google Cloud resources by defining who (members) has what permissions (roles).\u003c/p\u003e\n"],["\u003cp\u003eMembers can be users, groups, domains, or service accounts, while roles are collections of permissions.\u003c/p\u003e\n"],["\u003cp\u003ePolicies contain bindings that link members to roles, and these bindings can optionally include conditions for access.\u003c/p\u003e\n"],["\u003cp\u003eConditions allow granting access only when specific criteria are met, such as time-based constraints.\u003c/p\u003e\n"],["\u003cp\u003ePolicies are represented in JSON or YAML format and include versioning and an etag for concurrency control.\u003c/p\u003e\n"]]],["IAM policies manage Google Cloud resource access using `bindings`. Bindings link `members` (users, groups, etc.) to `roles` (permission lists). Some bindings include a `condition`, a logical expression restricting access based on request or resource attributes. Policies have a `version` (0, 1, or 3), with version 3 required for conditional bindings. The `etag` field, a base64-encoded string, ensures concurrent update safety; it is required for version 3.\n"],null,["# Policy\n\nAn Identity and Access Management (IAM) policy, which specifies access controls for Google Cloud resources.\n\nA `Policy` is a collection of `bindings`. A `binding` binds one or more `members`, or principals, to a single `role`. Principals can be user accounts, service accounts, Google groups, and domains (such as G Suite). A `role` is a named list of permissions; each `role` can be an IAM predefined role or a user-created custom role.\n\nFor some types of Google Cloud resources, a `binding` can also specify a `condition`, which is a logical expression that allows access to a resource only if the expression evaluates to `true`. A condition can add constraints based on attributes of the request, the resource, or both. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies).\n\n**JSON example:** \n\n {\n \"bindings\": [\n {\n \"role\": \"roles/resourcemanager.organizationAdmin\",\n \"members\": [\n \"user:mike@example.com\",\n \"group:admins@example.com\",\n \"domain:google.com\",\n \"serviceAccount:my-project-id@appspot.gserviceaccount.com\"\n ]\n },\n {\n \"role\": \"roles/resourcemanager.organizationViewer\",\n \"members\": [\n \"user:eve@example.com\"\n ],\n \"condition\": {\n \"title\": \"expirable access\",\n \"description\": \"Does not grant access after Sep 2020\",\n \"expression\": \"request.time \u003c timestamp('2020-10-01T00:00:00.000Z')\",\n }\n }\n ],\n \"etag\": \"BwWWja0YfJA=\",\n \"version\": 3\n }\n\n**YAML example:** \n\n bindings:\n - members:\n - user:mike@example.com\n - group:admins@example.com\n - domain:google.com\n - serviceAccount:my-project-id@appspot.gserviceaccount.com\n role: roles/resourcemanager.organizationAdmin\n - members:\n - user:eve@example.com\n role: roles/resourcemanager.organizationViewer\n condition:\n title: expirable access\n description: Does not grant access after Sep 2020\n expression: request.time \u003c timestamp('2020-10-01T00:00:00.000Z')\n etag: BwWWja0YfJA=\n version: 3\n\nFor a description of IAM and its features, see the [IAM documentation](https://cloud.google.com/iam/docs/).\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"version\": integer, \"bindings\": [ { object (/earth-engine/reference/rest/Shared.Types/Binding) } ], \"etag\": string } ``` |\n\n| Fields ||\n|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `version` | `integer` Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: - Getting a policy that includes a conditional role binding - Adding a conditional role binding to a policy - Changing a conditional role binding in a policy - Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). |\n| `bindings[]` | `object (`[Binding](/earth-engine/reference/rest/Shared.Types/Binding)`)` Associates a list of `members`, or principals, with a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one principal. The `bindings` in a `Policy` can refer to up to 1,500 principals; up to 250 of these principals can be Google groups. Each occurrence of a principal counts towards these limits. For example, if the `bindings` grant 50 different roles to `user:alice@example.com`, and not to any other principal, then you can add another 1,450 principals to the `bindings` in the `Policy`. |\n| `etag` | `string (`[bytes](https://developers.google.com/discovery/v1/type-format)` format)` `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. A base64-encoded string. |"]]