policy.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. // Copyright 2019 Google LLC.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. //
  15. syntax = "proto3";
  16. package google.iam.v1;
  17. import "google/type/expr.proto";
  18. import "google/api/annotations.proto";
  19. option cc_enable_arenas = true;
  20. option csharp_namespace = "Google.Cloud.Iam.V1";
  21. option go_package = "google.golang.org/genproto/googleapis/iam/v1;iam";
  22. option java_multiple_files = true;
  23. option java_outer_classname = "PolicyProto";
  24. option java_package = "com.google.iam.v1";
  25. option php_namespace = "Google\\Cloud\\Iam\\V1";
  26. // Defines an Identity and Access Management (IAM) policy. It is used to
  27. // specify access control policies for Cloud Platform resources.
  28. //
  29. //
  30. // A `Policy` is a collection of `bindings`. A `binding` binds one or more
  31. // `members` to a single `role`. Members can be user accounts, service accounts,
  32. // Google groups, and domains (such as G Suite). A `role` is a named list of
  33. // permissions (defined by IAM or configured by users). A `binding` can
  34. // optionally specify a `condition`, which is a logic expression that further
  35. // constrains the role binding based on attributes about the request and/or
  36. // target resource.
  37. //
  38. // **JSON Example**
  39. //
  40. // {
  41. // "bindings": [
  42. // {
  43. // "role": "roles/resourcemanager.organizationAdmin",
  44. // "members": [
  45. // "user:mike@example.com",
  46. // "group:admins@example.com",
  47. // "domain:google.com",
  48. // "serviceAccount:my-project-id@appspot.gserviceaccount.com"
  49. // ]
  50. // },
  51. // {
  52. // "role": "roles/resourcemanager.organizationViewer",
  53. // "members": ["user:eve@example.com"],
  54. // "condition": {
  55. // "title": "expirable access",
  56. // "description": "Does not grant access after Sep 2020",
  57. // "expression": "request.time <
  58. // timestamp('2020-10-01T00:00:00.000Z')",
  59. // }
  60. // }
  61. // ]
  62. // }
  63. //
  64. // **YAML Example**
  65. //
  66. // bindings:
  67. // - members:
  68. // - user:mike@example.com
  69. // - group:admins@example.com
  70. // - domain:google.com
  71. // - serviceAccount:my-project-id@appspot.gserviceaccount.com
  72. // role: roles/resourcemanager.organizationAdmin
  73. // - members:
  74. // - user:eve@example.com
  75. // role: roles/resourcemanager.organizationViewer
  76. // condition:
  77. // title: expirable access
  78. // description: Does not grant access after Sep 2020
  79. // expression: request.time < timestamp('2020-10-01T00:00:00.000Z')
  80. //
  81. // For a description of IAM and its features, see the
  82. // [IAM developer's guide](https://cloud.google.com/iam/docs).
  83. message Policy {
  84. // Specifies the format of the policy.
  85. //
  86. // Valid values are 0, 1, and 3. Requests specifying an invalid value will be
  87. // rejected.
  88. //
  89. // Operations affecting conditional bindings must specify version 3. This can
  90. // be either setting a conditional policy, modifying a conditional binding,
  91. // or removing a binding (conditional or unconditional) from the stored
  92. // conditional policy.
  93. // Operations on non-conditional policies may specify any valid value or
  94. // leave the field unset.
  95. //
  96. // If no etag is provided in the call to `setIamPolicy`, version compliance
  97. // checks against the stored policy is skipped.
  98. int32 version = 1;
  99. // Associates a list of `members` to a `role`. Optionally may specify a
  100. // `condition` that determines when binding is in effect.
  101. // `bindings` with no members will result in an error.
  102. repeated Binding bindings = 4;
  103. // `etag` is used for optimistic concurrency control as a way to help
  104. // prevent simultaneous updates of a policy from overwriting each other.
  105. // It is strongly suggested that systems make use of the `etag` in the
  106. // read-modify-write cycle to perform policy updates in order to avoid race
  107. // conditions: An `etag` is returned in the response to `getIamPolicy`, and
  108. // systems are expected to put that etag in the request to `setIamPolicy` to
  109. // ensure that their change will be applied to the same version of the policy.
  110. //
  111. // If no `etag` is provided in the call to `setIamPolicy`, then the existing
  112. // policy is overwritten. Due to blind-set semantics of an etag-less policy,
  113. // 'setIamPolicy' will not fail even if the incoming policy version does not
  114. // meet the requirements for modifying the stored policy.
  115. bytes etag = 3;
  116. }
  117. // Associates `members` with a `role`.
  118. message Binding {
  119. // Role that is assigned to `members`.
  120. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  121. string role = 1;
  122. // Specifies the identities requesting access for a Cloud Platform resource.
  123. // `members` can have the following values:
  124. //
  125. // * `allUsers`: A special identifier that represents anyone who is
  126. // on the internet; with or without a Google account.
  127. //
  128. // * `allAuthenticatedUsers`: A special identifier that represents anyone
  129. // who is authenticated with a Google account or a service account.
  130. //
  131. // * `user:{emailid}`: An email address that represents a specific Google
  132. // account. For example, `alice@example.com` .
  133. //
  134. //
  135. // * `serviceAccount:{emailid}`: An email address that represents a service
  136. // account. For example, `my-other-app@appspot.gserviceaccount.com`.
  137. //
  138. // * `group:{emailid}`: An email address that represents a Google group.
  139. // For example, `admins@example.com`.
  140. //
  141. //
  142. // * `domain:{domain}`: The G Suite domain (primary) that represents all the
  143. // users of that domain. For example, `google.com` or `example.com`.
  144. //
  145. //
  146. repeated string members = 2;
  147. // The condition that is associated with this binding.
  148. // NOTE: An unsatisfied condition will not allow user access via current
  149. // binding. Different bindings, including their conditions, are examined
  150. // independently.
  151. google.type.Expr condition = 3;
  152. }
  153. // The difference delta between two policies.
  154. message PolicyDelta {
  155. // The delta for Bindings between two policies.
  156. repeated BindingDelta binding_deltas = 1;
  157. // The delta for AuditConfigs between two policies.
  158. repeated AuditConfigDelta audit_config_deltas = 2;
  159. }
  160. // One delta entry for Binding. Each individual change (only one member in each
  161. // entry) to a binding will be a separate entry.
  162. message BindingDelta {
  163. // The type of action performed on a Binding in a policy.
  164. enum Action {
  165. // Unspecified.
  166. ACTION_UNSPECIFIED = 0;
  167. // Addition of a Binding.
  168. ADD = 1;
  169. // Removal of a Binding.
  170. REMOVE = 2;
  171. }
  172. // The action that was performed on a Binding.
  173. // Required
  174. Action action = 1;
  175. // Role that is assigned to `members`.
  176. // For example, `roles/viewer`, `roles/editor`, or `roles/owner`.
  177. // Required
  178. string role = 2;
  179. // A single identity requesting access for a Cloud Platform resource.
  180. // Follows the same format of Binding.members.
  181. // Required
  182. string member = 3;
  183. // The condition that is associated with this binding.
  184. google.type.Expr condition = 4;
  185. }
  186. // One delta entry for AuditConfig. Each individual change (only one
  187. // exempted_member in each entry) to a AuditConfig will be a separate entry.
  188. message AuditConfigDelta {
  189. // The type of action performed on an audit configuration in a policy.
  190. enum Action {
  191. // Unspecified.
  192. ACTION_UNSPECIFIED = 0;
  193. // Addition of an audit configuration.
  194. ADD = 1;
  195. // Removal of an audit configuration.
  196. REMOVE = 2;
  197. }
  198. // The action that was performed on an audit configuration in a policy.
  199. // Required
  200. Action action = 1;
  201. // Specifies a service that was configured for Cloud Audit Logging.
  202. // For example, `storage.googleapis.com`, `cloudsql.googleapis.com`.
  203. // `allServices` is a special value that covers all services.
  204. // Required
  205. string service = 2;
  206. // A single identity that is exempted from "data access" audit
  207. // logging for the `service` specified above.
  208. // Follows the same format of Binding.members.
  209. string exempted_member = 3;
  210. // Specifies the log_type that was be enabled. ADMIN_ACTIVITY is always
  211. // enabled, and cannot be configured.
  212. // Required
  213. string log_type = 4;
  214. }