xref: /aosp_15_r20/external/googleapis/google/cloud/policytroubleshooter/v1/explanations.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard Worker// Copyright 2023 Google LLC
2*d5c09012SAndroid Build Coastguard Worker//
3*d5c09012SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*d5c09012SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*d5c09012SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*d5c09012SAndroid Build Coastguard Worker//
7*d5c09012SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*d5c09012SAndroid Build Coastguard Worker//
9*d5c09012SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*d5c09012SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*d5c09012SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*d5c09012SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*d5c09012SAndroid Build Coastguard Worker// limitations under the License.
14*d5c09012SAndroid Build Coastguard Worker
15*d5c09012SAndroid Build Coastguard Workersyntax = "proto3";
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard Workerpackage google.cloud.policytroubleshooter.v1;
18*d5c09012SAndroid Build Coastguard Worker
19*d5c09012SAndroid Build Coastguard Workerimport "google/api/field_behavior.proto";
20*d5c09012SAndroid Build Coastguard Workerimport "google/iam/v1/policy.proto";
21*d5c09012SAndroid Build Coastguard Workerimport "google/type/expr.proto";
22*d5c09012SAndroid Build Coastguard Worker
23*d5c09012SAndroid Build Coastguard Workeroption csharp_namespace = "Google.Cloud.PolicyTroubleshooter.V1";
24*d5c09012SAndroid Build Coastguard Workeroption go_package = "cloud.google.com/go/policytroubleshooter/apiv1/policytroubleshooterpb;policytroubleshooterpb";
25*d5c09012SAndroid Build Coastguard Workeroption php_namespace = "Google\\Cloud\\PolicyTroubleshooter\\V1";
26*d5c09012SAndroid Build Coastguard Workeroption ruby_package = "Google::Cloud::PolicyTroubleshooter::V1";
27*d5c09012SAndroid Build Coastguard Worker
28*d5c09012SAndroid Build Coastguard Worker// Information about the principal, resource, and permission to check.
29*d5c09012SAndroid Build Coastguard Workermessage AccessTuple {
30*d5c09012SAndroid Build Coastguard Worker  // Required. The principal whose access you want to check, in the form of
31*d5c09012SAndroid Build Coastguard Worker  // the email address that represents that principal. For example,
32*d5c09012SAndroid Build Coastguard Worker  // `[email protected]` or
33*d5c09012SAndroid Build Coastguard Worker  // `[email protected]`.
34*d5c09012SAndroid Build Coastguard Worker  //
35*d5c09012SAndroid Build Coastguard Worker  // The principal must be a Google Account or a service account. Other types of
36*d5c09012SAndroid Build Coastguard Worker  // principals are not supported.
37*d5c09012SAndroid Build Coastguard Worker  string principal = 1 [(google.api.field_behavior) = REQUIRED];
38*d5c09012SAndroid Build Coastguard Worker
39*d5c09012SAndroid Build Coastguard Worker  // Required. The full resource name that identifies the resource. For example,
40*d5c09012SAndroid Build Coastguard Worker  // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
41*d5c09012SAndroid Build Coastguard Worker  //
42*d5c09012SAndroid Build Coastguard Worker  // For examples of full resource names for Google Cloud services, see
43*d5c09012SAndroid Build Coastguard Worker  // https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
44*d5c09012SAndroid Build Coastguard Worker  string full_resource_name = 2 [(google.api.field_behavior) = REQUIRED];
45*d5c09012SAndroid Build Coastguard Worker
46*d5c09012SAndroid Build Coastguard Worker  // Required. The IAM permission to check for the specified principal and
47*d5c09012SAndroid Build Coastguard Worker  // resource.
48*d5c09012SAndroid Build Coastguard Worker  //
49*d5c09012SAndroid Build Coastguard Worker  // For a complete list of IAM permissions, see
50*d5c09012SAndroid Build Coastguard Worker  // https://cloud.google.com/iam/help/permissions/reference.
51*d5c09012SAndroid Build Coastguard Worker  //
52*d5c09012SAndroid Build Coastguard Worker  // For a complete list of predefined IAM roles and the permissions in each
53*d5c09012SAndroid Build Coastguard Worker  // role, see https://cloud.google.com/iam/help/roles/reference.
54*d5c09012SAndroid Build Coastguard Worker  string permission = 3 [(google.api.field_behavior) = REQUIRED];
55*d5c09012SAndroid Build Coastguard Worker}
56*d5c09012SAndroid Build Coastguard Worker
57*d5c09012SAndroid Build Coastguard Worker// Details about how a specific IAM [Policy][google.iam.v1.Policy] contributed
58*d5c09012SAndroid Build Coastguard Worker// to the access check.
59*d5c09012SAndroid Build Coastguard Workermessage ExplainedPolicy {
60*d5c09012SAndroid Build Coastguard Worker  // Indicates whether _this policy_ provides the specified permission to the
61*d5c09012SAndroid Build Coastguard Worker  // specified principal for the specified resource.
62*d5c09012SAndroid Build Coastguard Worker  //
63*d5c09012SAndroid Build Coastguard Worker  // This field does _not_ indicate whether the principal actually has the
64*d5c09012SAndroid Build Coastguard Worker  // permission for the resource. There might be another policy that overrides
65*d5c09012SAndroid Build Coastguard Worker  // this policy. To determine whether the principal actually has the
66*d5c09012SAndroid Build Coastguard Worker  // permission, use the `access` field in the
67*d5c09012SAndroid Build Coastguard Worker  // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
68*d5c09012SAndroid Build Coastguard Worker  AccessState access = 1;
69*d5c09012SAndroid Build Coastguard Worker
70*d5c09012SAndroid Build Coastguard Worker  // The full resource name that identifies the resource. For example,
71*d5c09012SAndroid Build Coastguard Worker  // `//compute.googleapis.com/projects/my-project/zones/us-central1-a/instances/my-instance`.
72*d5c09012SAndroid Build Coastguard Worker  //
73*d5c09012SAndroid Build Coastguard Worker  // If the sender of the request does not have access to the policy, this field
74*d5c09012SAndroid Build Coastguard Worker  // is omitted.
75*d5c09012SAndroid Build Coastguard Worker  //
76*d5c09012SAndroid Build Coastguard Worker  // For examples of full resource names for Google Cloud services, see
77*d5c09012SAndroid Build Coastguard Worker  // https://cloud.google.com/iam/help/troubleshooter/full-resource-names.
78*d5c09012SAndroid Build Coastguard Worker  string full_resource_name = 2;
79*d5c09012SAndroid Build Coastguard Worker
80*d5c09012SAndroid Build Coastguard Worker  // The IAM policy attached to the resource.
81*d5c09012SAndroid Build Coastguard Worker  //
82*d5c09012SAndroid Build Coastguard Worker  // If the sender of the request does not have access to the policy, this field
83*d5c09012SAndroid Build Coastguard Worker  // is empty.
84*d5c09012SAndroid Build Coastguard Worker  google.iam.v1.Policy policy = 3;
85*d5c09012SAndroid Build Coastguard Worker
86*d5c09012SAndroid Build Coastguard Worker  // Details about how each binding in the policy affects the principal's
87*d5c09012SAndroid Build Coastguard Worker  // ability, or inability, to use the permission for the resource.
88*d5c09012SAndroid Build Coastguard Worker  //
89*d5c09012SAndroid Build Coastguard Worker  // If the sender of the request does not have access to the policy, this field
90*d5c09012SAndroid Build Coastguard Worker  // is omitted.
91*d5c09012SAndroid Build Coastguard Worker  repeated BindingExplanation binding_explanations = 4;
92*d5c09012SAndroid Build Coastguard Worker
93*d5c09012SAndroid Build Coastguard Worker  // The relevance of this policy to the overall determination in the
94*d5c09012SAndroid Build Coastguard Worker  // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
95*d5c09012SAndroid Build Coastguard Worker  //
96*d5c09012SAndroid Build Coastguard Worker  // If the sender of the request does not have access to the policy, this field
97*d5c09012SAndroid Build Coastguard Worker  // is omitted.
98*d5c09012SAndroid Build Coastguard Worker  HeuristicRelevance relevance = 5;
99*d5c09012SAndroid Build Coastguard Worker}
100*d5c09012SAndroid Build Coastguard Worker
101*d5c09012SAndroid Build Coastguard Worker// Details about how a binding in a policy affects a principal's ability to use
102*d5c09012SAndroid Build Coastguard Worker// a permission.
103*d5c09012SAndroid Build Coastguard Workermessage BindingExplanation {
104*d5c09012SAndroid Build Coastguard Worker  // Whether a role includes a specific permission.
105*d5c09012SAndroid Build Coastguard Worker  enum RolePermission {
106*d5c09012SAndroid Build Coastguard Worker    // Default value. This value is unused.
107*d5c09012SAndroid Build Coastguard Worker    ROLE_PERMISSION_UNSPECIFIED = 0;
108*d5c09012SAndroid Build Coastguard Worker
109*d5c09012SAndroid Build Coastguard Worker    // The permission is included in the role.
110*d5c09012SAndroid Build Coastguard Worker    ROLE_PERMISSION_INCLUDED = 1;
111*d5c09012SAndroid Build Coastguard Worker
112*d5c09012SAndroid Build Coastguard Worker    // The permission is not included in the role.
113*d5c09012SAndroid Build Coastguard Worker    ROLE_PERMISSION_NOT_INCLUDED = 2;
114*d5c09012SAndroid Build Coastguard Worker
115*d5c09012SAndroid Build Coastguard Worker    // The sender of the request is not allowed to access the binding.
116*d5c09012SAndroid Build Coastguard Worker    ROLE_PERMISSION_UNKNOWN_INFO_DENIED = 3;
117*d5c09012SAndroid Build Coastguard Worker  }
118*d5c09012SAndroid Build Coastguard Worker
119*d5c09012SAndroid Build Coastguard Worker  // Whether the binding includes the principal.
120*d5c09012SAndroid Build Coastguard Worker  enum Membership {
121*d5c09012SAndroid Build Coastguard Worker    // Default value. This value is unused.
122*d5c09012SAndroid Build Coastguard Worker    MEMBERSHIP_UNSPECIFIED = 0;
123*d5c09012SAndroid Build Coastguard Worker
124*d5c09012SAndroid Build Coastguard Worker    // The binding includes the principal. The principal can be included
125*d5c09012SAndroid Build Coastguard Worker    // directly or indirectly. For example:
126*d5c09012SAndroid Build Coastguard Worker    //
127*d5c09012SAndroid Build Coastguard Worker    // * A principal is included directly if that principal is listed in the
128*d5c09012SAndroid Build Coastguard Worker    //   binding.
129*d5c09012SAndroid Build Coastguard Worker    // * A principal is included indirectly if that principal is in a Google
130*d5c09012SAndroid Build Coastguard Worker    //   group or Google Workspace domain that is listed in the binding.
131*d5c09012SAndroid Build Coastguard Worker    MEMBERSHIP_INCLUDED = 1;
132*d5c09012SAndroid Build Coastguard Worker
133*d5c09012SAndroid Build Coastguard Worker    // The binding does not include the principal.
134*d5c09012SAndroid Build Coastguard Worker    MEMBERSHIP_NOT_INCLUDED = 2;
135*d5c09012SAndroid Build Coastguard Worker
136*d5c09012SAndroid Build Coastguard Worker    // The sender of the request is not allowed to access the binding.
137*d5c09012SAndroid Build Coastguard Worker    MEMBERSHIP_UNKNOWN_INFO_DENIED = 3;
138*d5c09012SAndroid Build Coastguard Worker
139*d5c09012SAndroid Build Coastguard Worker    // The principal is an unsupported type. Only Google Accounts and service
140*d5c09012SAndroid Build Coastguard Worker    // accounts are supported.
141*d5c09012SAndroid Build Coastguard Worker    MEMBERSHIP_UNKNOWN_UNSUPPORTED = 4;
142*d5c09012SAndroid Build Coastguard Worker  }
143*d5c09012SAndroid Build Coastguard Worker
144*d5c09012SAndroid Build Coastguard Worker  // Details about whether the binding includes the principal.
145*d5c09012SAndroid Build Coastguard Worker  message AnnotatedMembership {
146*d5c09012SAndroid Build Coastguard Worker    // Indicates whether the binding includes the principal.
147*d5c09012SAndroid Build Coastguard Worker    Membership membership = 1;
148*d5c09012SAndroid Build Coastguard Worker
149*d5c09012SAndroid Build Coastguard Worker    // The relevance of the principal's status to the overall determination for
150*d5c09012SAndroid Build Coastguard Worker    // the binding.
151*d5c09012SAndroid Build Coastguard Worker    HeuristicRelevance relevance = 2;
152*d5c09012SAndroid Build Coastguard Worker  }
153*d5c09012SAndroid Build Coastguard Worker
154*d5c09012SAndroid Build Coastguard Worker  // Required. Indicates whether _this binding_ provides the specified
155*d5c09012SAndroid Build Coastguard Worker  // permission to the specified principal for the specified resource.
156*d5c09012SAndroid Build Coastguard Worker  //
157*d5c09012SAndroid Build Coastguard Worker  // This field does _not_ indicate whether the principal actually has the
158*d5c09012SAndroid Build Coastguard Worker  // permission for the resource. There might be another binding that overrides
159*d5c09012SAndroid Build Coastguard Worker  // this binding. To determine whether the principal actually has the
160*d5c09012SAndroid Build Coastguard Worker  // permission, use the `access` field in the
161*d5c09012SAndroid Build Coastguard Worker  // [TroubleshootIamPolicyResponse][IamChecker.TroubleshootIamPolicyResponse].
162*d5c09012SAndroid Build Coastguard Worker  AccessState access = 1 [(google.api.field_behavior) = REQUIRED];
163*d5c09012SAndroid Build Coastguard Worker
164*d5c09012SAndroid Build Coastguard Worker  // The role that this binding grants. For example,
165*d5c09012SAndroid Build Coastguard Worker  // `roles/compute.serviceAgent`.
166*d5c09012SAndroid Build Coastguard Worker  //
167*d5c09012SAndroid Build Coastguard Worker  // For a complete list of predefined IAM roles, as well as the permissions in
168*d5c09012SAndroid Build Coastguard Worker  // each role, see https://cloud.google.com/iam/help/roles/reference.
169*d5c09012SAndroid Build Coastguard Worker  string role = 2;
170*d5c09012SAndroid Build Coastguard Worker
171*d5c09012SAndroid Build Coastguard Worker  // Indicates whether the role granted by this binding contains the specified
172*d5c09012SAndroid Build Coastguard Worker  // permission.
173*d5c09012SAndroid Build Coastguard Worker  RolePermission role_permission = 3;
174*d5c09012SAndroid Build Coastguard Worker
175*d5c09012SAndroid Build Coastguard Worker  // The relevance of the permission's existence, or nonexistence, in the role
176*d5c09012SAndroid Build Coastguard Worker  // to the overall determination for the entire policy.
177*d5c09012SAndroid Build Coastguard Worker  HeuristicRelevance role_permission_relevance = 4;
178*d5c09012SAndroid Build Coastguard Worker
179*d5c09012SAndroid Build Coastguard Worker  // Indicates whether each principal in the binding includes the principal
180*d5c09012SAndroid Build Coastguard Worker  // specified in the request, either directly or indirectly. Each key
181*d5c09012SAndroid Build Coastguard Worker  // identifies a principal in the binding, and each value indicates whether the
182*d5c09012SAndroid Build Coastguard Worker  // principal in the binding includes the principal in the request.
183*d5c09012SAndroid Build Coastguard Worker  //
184*d5c09012SAndroid Build Coastguard Worker  // For example, suppose that a binding includes the following principals:
185*d5c09012SAndroid Build Coastguard Worker  //
186*d5c09012SAndroid Build Coastguard Worker  // * `user:[email protected]`
187*d5c09012SAndroid Build Coastguard Worker  // * `group:[email protected]`
188*d5c09012SAndroid Build Coastguard Worker  //
189*d5c09012SAndroid Build Coastguard Worker  // You want to troubleshoot access for `user:[email protected]`. This user is a
190*d5c09012SAndroid Build Coastguard Worker  // principal of the group `group:[email protected]`.
191*d5c09012SAndroid Build Coastguard Worker  //
192*d5c09012SAndroid Build Coastguard Worker  // For the first principal in the binding, the key is
193*d5c09012SAndroid Build Coastguard Worker  // `user:[email protected]`, and the `membership` field in the value is set to
194*d5c09012SAndroid Build Coastguard Worker  // `MEMBERSHIP_NOT_INCLUDED`.
195*d5c09012SAndroid Build Coastguard Worker  //
196*d5c09012SAndroid Build Coastguard Worker  // For the second principal in the binding, the key is
197*d5c09012SAndroid Build Coastguard Worker  // `group:[email protected]`, and the `membership` field in the value is
198*d5c09012SAndroid Build Coastguard Worker  // set to `MEMBERSHIP_INCLUDED`.
199*d5c09012SAndroid Build Coastguard Worker  map<string, AnnotatedMembership> memberships = 5;
200*d5c09012SAndroid Build Coastguard Worker
201*d5c09012SAndroid Build Coastguard Worker  // The relevance of this binding to the overall determination for the entire
202*d5c09012SAndroid Build Coastguard Worker  // policy.
203*d5c09012SAndroid Build Coastguard Worker  HeuristicRelevance relevance = 6;
204*d5c09012SAndroid Build Coastguard Worker
205*d5c09012SAndroid Build Coastguard Worker  // A condition expression that prevents this binding from granting access
206*d5c09012SAndroid Build Coastguard Worker  // unless the expression evaluates to `true`.
207*d5c09012SAndroid Build Coastguard Worker  //
208*d5c09012SAndroid Build Coastguard Worker  // To learn about IAM Conditions, see
209*d5c09012SAndroid Build Coastguard Worker  // https://cloud.google.com/iam/help/conditions/overview.
210*d5c09012SAndroid Build Coastguard Worker  google.type.Expr condition = 7;
211*d5c09012SAndroid Build Coastguard Worker}
212*d5c09012SAndroid Build Coastguard Worker
213*d5c09012SAndroid Build Coastguard Worker// Whether a principal has a permission for a resource.
214*d5c09012SAndroid Build Coastguard Workerenum AccessState {
215*d5c09012SAndroid Build Coastguard Worker  // Default value. This value is unused.
216*d5c09012SAndroid Build Coastguard Worker  ACCESS_STATE_UNSPECIFIED = 0;
217*d5c09012SAndroid Build Coastguard Worker
218*d5c09012SAndroid Build Coastguard Worker  // The principal has the permission.
219*d5c09012SAndroid Build Coastguard Worker  GRANTED = 1;
220*d5c09012SAndroid Build Coastguard Worker
221*d5c09012SAndroid Build Coastguard Worker  // The principal does not have the permission.
222*d5c09012SAndroid Build Coastguard Worker  NOT_GRANTED = 2;
223*d5c09012SAndroid Build Coastguard Worker
224*d5c09012SAndroid Build Coastguard Worker  // The principal has the permission only if a condition expression evaluates
225*d5c09012SAndroid Build Coastguard Worker  // to `true`.
226*d5c09012SAndroid Build Coastguard Worker  UNKNOWN_CONDITIONAL = 3;
227*d5c09012SAndroid Build Coastguard Worker
228*d5c09012SAndroid Build Coastguard Worker  // The sender of the request does not have access to all of the policies that
229*d5c09012SAndroid Build Coastguard Worker  // Policy Troubleshooter needs to evaluate.
230*d5c09012SAndroid Build Coastguard Worker  UNKNOWN_INFO_DENIED = 4;
231*d5c09012SAndroid Build Coastguard Worker}
232*d5c09012SAndroid Build Coastguard Worker
233*d5c09012SAndroid Build Coastguard Worker// The extent to which a single data point, such as the existence of a binding
234*d5c09012SAndroid Build Coastguard Worker// or whether a binding includes a specific principal, contributes to an overall
235*d5c09012SAndroid Build Coastguard Worker// determination.
236*d5c09012SAndroid Build Coastguard Workerenum HeuristicRelevance {
237*d5c09012SAndroid Build Coastguard Worker  // Default value. This value is unused.
238*d5c09012SAndroid Build Coastguard Worker  HEURISTIC_RELEVANCE_UNSPECIFIED = 0;
239*d5c09012SAndroid Build Coastguard Worker
240*d5c09012SAndroid Build Coastguard Worker  // The data point has a limited effect on the result. Changing the data point
241*d5c09012SAndroid Build Coastguard Worker  // is unlikely to affect the overall determination.
242*d5c09012SAndroid Build Coastguard Worker  NORMAL = 1;
243*d5c09012SAndroid Build Coastguard Worker
244*d5c09012SAndroid Build Coastguard Worker  // The data point has a strong effect on the result. Changing the data point
245*d5c09012SAndroid Build Coastguard Worker  // is likely to affect the overall determination.
246*d5c09012SAndroid Build Coastguard Worker  HIGH = 2;
247*d5c09012SAndroid Build Coastguard Worker}
248