explanations.proto 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  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.cloud.policytroubleshooter.v1;
  17. import "google/api/field_behavior.proto";
  18. import "google/iam/v1/policy.proto";
  19. import "google/type/expr.proto";
  20. option csharp_namespace = "Google.Cloud.PolicyTroubleshooter.V1";
  21. option go_package = "google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1;policytroubleshooter";
  22. option php_namespace = "Google\\Cloud\\PolicyTroubleshooter\\V1";
  23. option ruby_package = "Google::Cloud::PolicyTroubleshooter::V1";
  24. // Information about the member, resource, and permission to check.
  25. message AccessTuple {
  26. // Required. The member, or principal, whose access you want to check, in the form of
  27. // the email address that represents that member. For example,
  28. // `alice@example.com` or
  29. // `my-service-account@my-project.iam.gserviceaccount.com`.
  30. //
  31. // The member must be a Google Account or a service account. Other types of
  32. // members are not supported.
  33. string principal = 1 [(google.api.field_behavior) = REQUIRED];
  34. // Required. The full resource name that identifies the resource. For example,
  35. // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
  36. //
  37. // For examples of full resource names for Google Cloud services, see
  38. // https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
  39. string full_resource_name = 2 [(google.api.field_behavior) = REQUIRED];
  40. // Required. The IAM permission to check for the specified member and resource.
  41. //
  42. // For a complete list of IAM permissions, see
  43. // https://cloud.google.com/iam/help/permissions/reference.
  44. //
  45. // For a complete list of predefined IAM roles and the permissions in each
  46. // role, see https://cloud.google.com/iam/help/roles/reference.
  47. string permission = 3 [(google.api.field_behavior) = REQUIRED];
  48. }
  49. // Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed
  50. // to the access check.
  51. message ExplainedPolicy {
  52. // Indicates whether _this policy_ provides the specified permission to the
  53. // specified member for the specified resource.
  54. //
  55. // This field does _not_ indicate whether the member actually has the
  56. // permission for the resource. There might be another policy that overrides
  57. // this policy. To determine whether the member actually has the permission,
  58. // use the `access` field in the
  59. // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
  60. AccessState access = 1;
  61. // The full resource name that identifies the resource. For example,
  62. // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
  63. //
  64. // If the sender of the request does not have access to the policy, this field
  65. // is omitted.
  66. //
  67. // For examples of full resource names for Google Cloud services, see
  68. // https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
  69. string full_resource_name = 2;
  70. // The IAM policy attached to the resource.
  71. //
  72. // If the sender of the request does not have access to the policy, this field
  73. // is empty.
  74. google.iam.v1.Policy policy = 3;
  75. // Details about how each binding in the policy affects the member's ability,
  76. // or inability, to use the permission for the resource.
  77. //
  78. // If the sender of the request does not have access to the policy, this field
  79. // is omitted.
  80. repeated BindingExplanation binding_explanations = 4;
  81. // The relevance of this policy to the overall determination in the
  82. // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
  83. //
  84. // If the sender of the request does not have access to the policy, this field
  85. // is omitted.
  86. HeuristicRelevance relevance = 5;
  87. }
  88. // Details about how a binding in a policy affects a member's ability to use a
  89. // permission.
  90. message BindingExplanation {
  91. // Details about whether the binding includes the member.
  92. message AnnotatedMembership {
  93. // Indicates whether the binding includes the member.
  94. Membership membership = 1;
  95. // The relevance of the member's status to the overall determination for the
  96. // binding.
  97. HeuristicRelevance relevance = 2;
  98. }
  99. // Whether a role includes a specific permission.
  100. enum RolePermission {
  101. // Reserved for future use.
  102. ROLE_PERMISSION_UNSPECIFIED = 0;
  103. // The permission is included in the role.
  104. ROLE_PERMISSION_INCLUDED = 1;
  105. // The permission is not included in the role.
  106. ROLE_PERMISSION_NOT_INCLUDED = 2;
  107. // The sender of the request is not allowed to access the binding.
  108. ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3;
  109. }
  110. // Whether the binding includes the member.
  111. enum Membership {
  112. // Reserved for future use.
  113. MEMBERSHIP_UNSPECIFIED = 0;
  114. // The binding includes the member. The member can be included directly
  115. // or indirectly. For example:
  116. //
  117. // * A member is included directly if that member is listed in the binding.
  118. // * A member is included indirectly if that member is in a Google group or
  119. // G Suite domain that is listed in the binding.
  120. MEMBERSHIP_INCLUDED = 1;
  121. // The binding does not include the member.
  122. MEMBERSHIP_NOT_INCLUDED = 2;
  123. // The sender of the request is not allowed to access the binding.
  124. MEMBERSHIP_UNKNOWN_INFO_DENIED = 3;
  125. // The member is an unsupported type. Only Google Accounts and service
  126. // accounts are supported.
  127. MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4;
  128. }
  129. // Required. Indicates whether _this binding_ provides the specified permission to the
  130. // specified member for the specified resource.
  131. //
  132. // This field does _not_ indicate whether the member actually has the
  133. // permission for the resource. There might be another binding that overrides
  134. // this binding. To determine whether the member actually has the permission,
  135. // use the `access` field in the
  136. // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
  137. AccessState access = 1 [(google.api.field_behavior) = REQUIRED];
  138. // The role that this binding grants. For example,
  139. // `roles/compute.serviceAgent`.
  140. //
  141. // For a complete list of predefined IAM roles, as well as the permissions in
  142. // each role, see https://cloud.google.com/iam/help/roles/reference.
  143. string role = 2;
  144. // Indicates whether the role granted by this binding contains the specified
  145. // permission.
  146. RolePermission role_permission = 3;
  147. // The relevance of the permission's existence, or nonexistence, in the role
  148. // to the overall determination for the entire policy.
  149. HeuristicRelevance role_permission_relevance = 4;
  150. // Indicates whether each member in the binding includes the member specified
  151. // in the request, either directly or indirectly. Each key identifies a member
  152. // in the binding, and each value indicates whether the member in the binding
  153. // includes the member in the request.
  154. //
  155. // For example, suppose that a binding includes the following members:
  156. //
  157. // * `user:alice@example.com`
  158. // * `group:product-eng@example.com`
  159. //
  160. // You want to troubleshoot access for `user:bob@example.com`. This user is a
  161. // member of the group `group:product-eng@example.com`.
  162. //
  163. // For the first member in the binding, the key is `user:alice@example.com`,
  164. // and the `membership` field in the value is set to
  165. // `MEMBERSHIP_NOT_INCLUDED`.
  166. //
  167. // For the second member in the binding, the key is
  168. // `group:product-eng@example.com`, and the `membership` field in the value is
  169. // set to `MEMBERSHIP_INCLUDED`.
  170. map<string, AnnotatedMembership> memberships = 5;
  171. // The relevance of this binding to the overall determination for the entire
  172. // policy.
  173. HeuristicRelevance relevance = 6;
  174. // A condition expression that prevents access unless the expression evaluates
  175. // to `true`.
  176. //
  177. // To learn about IAM Conditions, see
  178. // http://cloud.google.com/iam/help/conditions/overview.
  179. google.type.Expr condition = 7;
  180. }
  181. // Whether a member has a permission for a resource.
  182. enum AccessState {
  183. // Reserved for future use.
  184. ACCESS_STATE_UNSPECIFIED = 0;
  185. // The member has the permission.
  186. GRANTED = 1;
  187. // The member does not have the permission.
  188. NOT_GRANTED = 2;
  189. // The member has the permission only if a condition expression evaluates to
  190. // `true`.
  191. UNKNOWN_CONDITIONAL = 3;
  192. // The sender of the request does not have access to all of the policies that
  193. // Policy Troubleshooter needs to evaluate.
  194. UNKNOWN_INFO_DENIED = 4;
  195. }
  196. // The extent to which a single data point contributes to an overall
  197. // determination.
  198. enum HeuristicRelevance {
  199. // Reserved for future use.
  200. HEURISTIC_RELEVANCE_UNSPECIFIED = 0;
  201. // The data point has a limited effect on the result. Changing the data point
  202. // is unlikely to affect the overall determination.
  203. NORMAL = 1;
  204. // The data point has a strong effect on the result. Changing the data point
  205. // is likely to affect the overall determination.
  206. HIGH = 2;
  207. }