policy.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. // Copyright (c) 2015, Google Inc.
  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. syntax = "proto3";
  15. package google.iam.v1;
  16. option java_multiple_files = true;
  17. option java_outer_classname = "PolicyProto";
  18. option java_package = "com.google.iam.v1";
  19. // # Overview
  20. //
  21. // The `Policy` defines an access control policy language. It is used to
  22. // define policies that are attached to resources like files, folders, VMs,
  23. // etc.
  24. //
  25. //
  26. // # Policy structure
  27. //
  28. // A `Policy` consists of a list of bindings. A `Binding` binds a set of members
  29. // to a role, where the members include user accounts, user groups, user
  30. // domains, and service accounts. A 'role' is a named set of permissions,
  31. // defined by IAM. The definition of a role is outside the policy.
  32. //
  33. // A permission check first determines the roles that include the specified
  34. // permission, and then determines if the principal specified is a
  35. // member of a binding to at least one of these roles. The membership check is
  36. // recursive when a group is bound to a role.
  37. //
  38. // Policy examples:
  39. //
  40. // ```
  41. // {
  42. // "bindings": [
  43. // {
  44. // "role": "roles/owner",
  45. // "members": [
  46. // "user:mike@example.com",
  47. // "group:admins@example.com",
  48. // "domain:google.com",
  49. // "serviceAccount:frontend@example.iam.gserviceaccounts.com"]
  50. // },
  51. // {
  52. // "role": "roles/viewer",
  53. // "members": ["user:sean@example.com"]
  54. // }
  55. // ]
  56. // }
  57. // ```
  58. message Policy {
  59. // The policy language version. The version of the policy is
  60. // represented by the etag. The default version is 0.
  61. int32 version = 1;
  62. // It is an error to specify multiple bindings for the same role.
  63. // It is an error to specify a binding with no members.
  64. repeated Binding bindings = 4;
  65. // Can be used to perform a read-modify-write.
  66. bytes etag = 3;
  67. }
  68. // Associates members with roles. See below for allowed
  69. // formats of members.
  70. message Binding {
  71. // The name of the role to which the members should be bound.
  72. // Examples: "roles/viewer", "roles/editor", "roles/owner".
  73. // Required
  74. string role = 1;
  75. // Format of member entries:
  76. // 1. allUsers
  77. // Matches any requesting principal (users, service accounts or anonymous).
  78. //
  79. // 2. allAuthenticatedUsers
  80. // Matches any requesting authenticated principal (users or service
  81. // accounts).
  82. //
  83. // 3. user:{emailid}
  84. // A google user account using an email address.
  85. // For example alice@gmail.com, joe@example.com
  86. //
  87. // 4. serviceAccount:{emailid}
  88. // An service account email.
  89. //
  90. // 5. group:{emailid}
  91. // A google group with an email address. For example
  92. // auth-ti-cloud@google.com
  93. //
  94. // 6. domain:{domain}
  95. // A Google Apps domain name.
  96. // For example google.com, example.com
  97. repeated string members = 2;
  98. }