• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     https://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.google.iam.v1;
17 
18 import static io.grpc.MethodDescriptor.generateFullMethodName;
19 
20 /**
21  *
22  *
23  * <pre>
24  * API Overview
25  * Manages Identity and Access Management (IAM) policies.
26  * Any implementation of an API that offers access control features
27  * implements the google.iam.v1.IAMPolicy interface.
28  * ## Data model
29  * Access control is applied when a principal (user or service account), takes
30  * some action on a resource exposed by a service. Resources, identified by
31  * URI-like names, are the unit of access control specification. Service
32  * implementations can choose the granularity of access control and the
33  * supported permissions for their resources.
34  * For example one database service may allow access control to be
35  * specified only at the Table level, whereas another might allow access control
36  * to also be specified at the Column level.
37  * ## Policy Structure
38  * See google.iam.v1.Policy
39  * This is intentionally not a CRUD style API because access control policies
40  * are created and deleted implicitly with the resources to which they are
41  * attached.
42  * </pre>
43  */
44 @javax.annotation.Generated(
45     value = "by gRPC proto compiler",
46     comments = "Source: google/iam/v1/iam_policy.proto")
47 @io.grpc.stub.annotations.GrpcGenerated
48 public final class IAMPolicyGrpc {
49 
IAMPolicyGrpc()50   private IAMPolicyGrpc() {}
51 
52   public static final String SERVICE_NAME = "google.iam.v1.IAMPolicy";
53 
54   // Static method descriptors that strictly reflect the proto.
55   private static volatile io.grpc.MethodDescriptor<
56           com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>
57       getSetIamPolicyMethod;
58 
59   @io.grpc.stub.annotations.RpcMethod(
60       fullMethodName = SERVICE_NAME + '/' + "SetIamPolicy",
61       requestType = com.google.iam.v1.SetIamPolicyRequest.class,
62       responseType = com.google.iam.v1.Policy.class,
63       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
64   public static io.grpc.MethodDescriptor<
65           com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>
getSetIamPolicyMethod()66       getSetIamPolicyMethod() {
67     io.grpc.MethodDescriptor<com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>
68         getSetIamPolicyMethod;
69     if ((getSetIamPolicyMethod = IAMPolicyGrpc.getSetIamPolicyMethod) == null) {
70       synchronized (IAMPolicyGrpc.class) {
71         if ((getSetIamPolicyMethod = IAMPolicyGrpc.getSetIamPolicyMethod) == null) {
72           IAMPolicyGrpc.getSetIamPolicyMethod =
73               getSetIamPolicyMethod =
74                   io.grpc.MethodDescriptor
75                       .<com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>newBuilder()
76                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
77                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "SetIamPolicy"))
78                       .setSampledToLocalTracing(true)
79                       .setRequestMarshaller(
80                           io.grpc.protobuf.ProtoUtils.marshaller(
81                               com.google.iam.v1.SetIamPolicyRequest.getDefaultInstance()))
82                       .setResponseMarshaller(
83                           io.grpc.protobuf.ProtoUtils.marshaller(
84                               com.google.iam.v1.Policy.getDefaultInstance()))
85                       .setSchemaDescriptor(new IAMPolicyMethodDescriptorSupplier("SetIamPolicy"))
86                       .build();
87         }
88       }
89     }
90     return getSetIamPolicyMethod;
91   }
92 
93   private static volatile io.grpc.MethodDescriptor<
94           com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>
95       getGetIamPolicyMethod;
96 
97   @io.grpc.stub.annotations.RpcMethod(
98       fullMethodName = SERVICE_NAME + '/' + "GetIamPolicy",
99       requestType = com.google.iam.v1.GetIamPolicyRequest.class,
100       responseType = com.google.iam.v1.Policy.class,
101       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
102   public static io.grpc.MethodDescriptor<
103           com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>
getGetIamPolicyMethod()104       getGetIamPolicyMethod() {
105     io.grpc.MethodDescriptor<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>
106         getGetIamPolicyMethod;
107     if ((getGetIamPolicyMethod = IAMPolicyGrpc.getGetIamPolicyMethod) == null) {
108       synchronized (IAMPolicyGrpc.class) {
109         if ((getGetIamPolicyMethod = IAMPolicyGrpc.getGetIamPolicyMethod) == null) {
110           IAMPolicyGrpc.getGetIamPolicyMethod =
111               getGetIamPolicyMethod =
112                   io.grpc.MethodDescriptor
113                       .<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>newBuilder()
114                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
115                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetIamPolicy"))
116                       .setSampledToLocalTracing(true)
117                       .setRequestMarshaller(
118                           io.grpc.protobuf.ProtoUtils.marshaller(
119                               com.google.iam.v1.GetIamPolicyRequest.getDefaultInstance()))
120                       .setResponseMarshaller(
121                           io.grpc.protobuf.ProtoUtils.marshaller(
122                               com.google.iam.v1.Policy.getDefaultInstance()))
123                       .setSchemaDescriptor(new IAMPolicyMethodDescriptorSupplier("GetIamPolicy"))
124                       .build();
125         }
126       }
127     }
128     return getGetIamPolicyMethod;
129   }
130 
131   private static volatile io.grpc.MethodDescriptor<
132           com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse>
133       getTestIamPermissionsMethod;
134 
135   @io.grpc.stub.annotations.RpcMethod(
136       fullMethodName = SERVICE_NAME + '/' + "TestIamPermissions",
137       requestType = com.google.iam.v1.TestIamPermissionsRequest.class,
138       responseType = com.google.iam.v1.TestIamPermissionsResponse.class,
139       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
140   public static io.grpc.MethodDescriptor<
141           com.google.iam.v1.TestIamPermissionsRequest, com.google.iam.v1.TestIamPermissionsResponse>
getTestIamPermissionsMethod()142       getTestIamPermissionsMethod() {
143     io.grpc.MethodDescriptor<
144             com.google.iam.v1.TestIamPermissionsRequest,
145             com.google.iam.v1.TestIamPermissionsResponse>
146         getTestIamPermissionsMethod;
147     if ((getTestIamPermissionsMethod = IAMPolicyGrpc.getTestIamPermissionsMethod) == null) {
148       synchronized (IAMPolicyGrpc.class) {
149         if ((getTestIamPermissionsMethod = IAMPolicyGrpc.getTestIamPermissionsMethod) == null) {
150           IAMPolicyGrpc.getTestIamPermissionsMethod =
151               getTestIamPermissionsMethod =
152                   io.grpc.MethodDescriptor
153                       .<com.google.iam.v1.TestIamPermissionsRequest,
154                           com.google.iam.v1.TestIamPermissionsResponse>
155                           newBuilder()
156                       .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
157                       .setFullMethodName(generateFullMethodName(SERVICE_NAME, "TestIamPermissions"))
158                       .setSampledToLocalTracing(true)
159                       .setRequestMarshaller(
160                           io.grpc.protobuf.ProtoUtils.marshaller(
161                               com.google.iam.v1.TestIamPermissionsRequest.getDefaultInstance()))
162                       .setResponseMarshaller(
163                           io.grpc.protobuf.ProtoUtils.marshaller(
164                               com.google.iam.v1.TestIamPermissionsResponse.getDefaultInstance()))
165                       .setSchemaDescriptor(
166                           new IAMPolicyMethodDescriptorSupplier("TestIamPermissions"))
167                       .build();
168         }
169       }
170     }
171     return getTestIamPermissionsMethod;
172   }
173 
174   /** Creates a new async stub that supports all call types for the service */
newStub(io.grpc.Channel channel)175   public static IAMPolicyStub newStub(io.grpc.Channel channel) {
176     io.grpc.stub.AbstractStub.StubFactory<IAMPolicyStub> factory =
177         new io.grpc.stub.AbstractStub.StubFactory<IAMPolicyStub>() {
178           @java.lang.Override
179           public IAMPolicyStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
180             return new IAMPolicyStub(channel, callOptions);
181           }
182         };
183     return IAMPolicyStub.newStub(factory, channel);
184   }
185 
186   /**
187    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
188    */
newBlockingStub(io.grpc.Channel channel)189   public static IAMPolicyBlockingStub newBlockingStub(io.grpc.Channel channel) {
190     io.grpc.stub.AbstractStub.StubFactory<IAMPolicyBlockingStub> factory =
191         new io.grpc.stub.AbstractStub.StubFactory<IAMPolicyBlockingStub>() {
192           @java.lang.Override
193           public IAMPolicyBlockingStub newStub(
194               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
195             return new IAMPolicyBlockingStub(channel, callOptions);
196           }
197         };
198     return IAMPolicyBlockingStub.newStub(factory, channel);
199   }
200 
201   /** Creates a new ListenableFuture-style stub that supports unary calls on the service */
newFutureStub(io.grpc.Channel channel)202   public static IAMPolicyFutureStub newFutureStub(io.grpc.Channel channel) {
203     io.grpc.stub.AbstractStub.StubFactory<IAMPolicyFutureStub> factory =
204         new io.grpc.stub.AbstractStub.StubFactory<IAMPolicyFutureStub>() {
205           @java.lang.Override
206           public IAMPolicyFutureStub newStub(
207               io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
208             return new IAMPolicyFutureStub(channel, callOptions);
209           }
210         };
211     return IAMPolicyFutureStub.newStub(factory, channel);
212   }
213 
214   /**
215    *
216    *
217    * <pre>
218    * API Overview
219    * Manages Identity and Access Management (IAM) policies.
220    * Any implementation of an API that offers access control features
221    * implements the google.iam.v1.IAMPolicy interface.
222    * ## Data model
223    * Access control is applied when a principal (user or service account), takes
224    * some action on a resource exposed by a service. Resources, identified by
225    * URI-like names, are the unit of access control specification. Service
226    * implementations can choose the granularity of access control and the
227    * supported permissions for their resources.
228    * For example one database service may allow access control to be
229    * specified only at the Table level, whereas another might allow access control
230    * to also be specified at the Column level.
231    * ## Policy Structure
232    * See google.iam.v1.Policy
233    * This is intentionally not a CRUD style API because access control policies
234    * are created and deleted implicitly with the resources to which they are
235    * attached.
236    * </pre>
237    */
238   public interface AsyncService {
239 
240     /**
241      *
242      *
243      * <pre>
244      * Sets the access control policy on the specified resource. Replaces any
245      * existing policy.
246      * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
247      * </pre>
248      */
setIamPolicy( com.google.iam.v1.SetIamPolicyRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver)249     default void setIamPolicy(
250         com.google.iam.v1.SetIamPolicyRequest request,
251         io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) {
252       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
253           getSetIamPolicyMethod(), responseObserver);
254     }
255 
256     /**
257      *
258      *
259      * <pre>
260      * Gets the access control policy for a resource.
261      * Returns an empty policy if the resource exists and does not have a policy
262      * set.
263      * </pre>
264      */
getIamPolicy( com.google.iam.v1.GetIamPolicyRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver)265     default void getIamPolicy(
266         com.google.iam.v1.GetIamPolicyRequest request,
267         io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) {
268       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
269           getGetIamPolicyMethod(), responseObserver);
270     }
271 
272     /**
273      *
274      *
275      * <pre>
276      * Returns permissions that a caller has on the specified resource.
277      * If the resource does not exist, this will return an empty set of
278      * permissions, not a `NOT_FOUND` error.
279      * Note: This operation is designed to be used for building permission-aware
280      * UIs and command-line tools, not for authorization checking. This operation
281      * may "fail open" without warning.
282      * </pre>
283      */
testIamPermissions( com.google.iam.v1.TestIamPermissionsRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.TestIamPermissionsResponse> responseObserver)284     default void testIamPermissions(
285         com.google.iam.v1.TestIamPermissionsRequest request,
286         io.grpc.stub.StreamObserver<com.google.iam.v1.TestIamPermissionsResponse>
287             responseObserver) {
288       io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(
289           getTestIamPermissionsMethod(), responseObserver);
290     }
291   }
292 
293   /**
294    * Base class for the server implementation of the service IAMPolicy.
295    *
296    * <pre>
297    * API Overview
298    * Manages Identity and Access Management (IAM) policies.
299    * Any implementation of an API that offers access control features
300    * implements the google.iam.v1.IAMPolicy interface.
301    * ## Data model
302    * Access control is applied when a principal (user or service account), takes
303    * some action on a resource exposed by a service. Resources, identified by
304    * URI-like names, are the unit of access control specification. Service
305    * implementations can choose the granularity of access control and the
306    * supported permissions for their resources.
307    * For example one database service may allow access control to be
308    * specified only at the Table level, whereas another might allow access control
309    * to also be specified at the Column level.
310    * ## Policy Structure
311    * See google.iam.v1.Policy
312    * This is intentionally not a CRUD style API because access control policies
313    * are created and deleted implicitly with the resources to which they are
314    * attached.
315    * </pre>
316    */
317   public abstract static class IAMPolicyImplBase implements io.grpc.BindableService, AsyncService {
318 
319     @java.lang.Override
bindService()320     public final io.grpc.ServerServiceDefinition bindService() {
321       return IAMPolicyGrpc.bindService(this);
322     }
323   }
324 
325   /**
326    * A stub to allow clients to do asynchronous rpc calls to service IAMPolicy.
327    *
328    * <pre>
329    * API Overview
330    * Manages Identity and Access Management (IAM) policies.
331    * Any implementation of an API that offers access control features
332    * implements the google.iam.v1.IAMPolicy interface.
333    * ## Data model
334    * Access control is applied when a principal (user or service account), takes
335    * some action on a resource exposed by a service. Resources, identified by
336    * URI-like names, are the unit of access control specification. Service
337    * implementations can choose the granularity of access control and the
338    * supported permissions for their resources.
339    * For example one database service may allow access control to be
340    * specified only at the Table level, whereas another might allow access control
341    * to also be specified at the Column level.
342    * ## Policy Structure
343    * See google.iam.v1.Policy
344    * This is intentionally not a CRUD style API because access control policies
345    * are created and deleted implicitly with the resources to which they are
346    * attached.
347    * </pre>
348    */
349   public static final class IAMPolicyStub extends io.grpc.stub.AbstractAsyncStub<IAMPolicyStub> {
IAMPolicyStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)350     private IAMPolicyStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
351       super(channel, callOptions);
352     }
353 
354     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)355     protected IAMPolicyStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
356       return new IAMPolicyStub(channel, callOptions);
357     }
358 
359     /**
360      *
361      *
362      * <pre>
363      * Sets the access control policy on the specified resource. Replaces any
364      * existing policy.
365      * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
366      * </pre>
367      */
setIamPolicy( com.google.iam.v1.SetIamPolicyRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver)368     public void setIamPolicy(
369         com.google.iam.v1.SetIamPolicyRequest request,
370         io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) {
371       io.grpc.stub.ClientCalls.asyncUnaryCall(
372           getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()),
373           request,
374           responseObserver);
375     }
376 
377     /**
378      *
379      *
380      * <pre>
381      * Gets the access control policy for a resource.
382      * Returns an empty policy if the resource exists and does not have a policy
383      * set.
384      * </pre>
385      */
getIamPolicy( com.google.iam.v1.GetIamPolicyRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver)386     public void getIamPolicy(
387         com.google.iam.v1.GetIamPolicyRequest request,
388         io.grpc.stub.StreamObserver<com.google.iam.v1.Policy> responseObserver) {
389       io.grpc.stub.ClientCalls.asyncUnaryCall(
390           getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()),
391           request,
392           responseObserver);
393     }
394 
395     /**
396      *
397      *
398      * <pre>
399      * Returns permissions that a caller has on the specified resource.
400      * If the resource does not exist, this will return an empty set of
401      * permissions, not a `NOT_FOUND` error.
402      * Note: This operation is designed to be used for building permission-aware
403      * UIs and command-line tools, not for authorization checking. This operation
404      * may "fail open" without warning.
405      * </pre>
406      */
testIamPermissions( com.google.iam.v1.TestIamPermissionsRequest request, io.grpc.stub.StreamObserver<com.google.iam.v1.TestIamPermissionsResponse> responseObserver)407     public void testIamPermissions(
408         com.google.iam.v1.TestIamPermissionsRequest request,
409         io.grpc.stub.StreamObserver<com.google.iam.v1.TestIamPermissionsResponse>
410             responseObserver) {
411       io.grpc.stub.ClientCalls.asyncUnaryCall(
412           getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()),
413           request,
414           responseObserver);
415     }
416   }
417 
418   /**
419    * A stub to allow clients to do synchronous rpc calls to service IAMPolicy.
420    *
421    * <pre>
422    * API Overview
423    * Manages Identity and Access Management (IAM) policies.
424    * Any implementation of an API that offers access control features
425    * implements the google.iam.v1.IAMPolicy interface.
426    * ## Data model
427    * Access control is applied when a principal (user or service account), takes
428    * some action on a resource exposed by a service. Resources, identified by
429    * URI-like names, are the unit of access control specification. Service
430    * implementations can choose the granularity of access control and the
431    * supported permissions for their resources.
432    * For example one database service may allow access control to be
433    * specified only at the Table level, whereas another might allow access control
434    * to also be specified at the Column level.
435    * ## Policy Structure
436    * See google.iam.v1.Policy
437    * This is intentionally not a CRUD style API because access control policies
438    * are created and deleted implicitly with the resources to which they are
439    * attached.
440    * </pre>
441    */
442   public static final class IAMPolicyBlockingStub
443       extends io.grpc.stub.AbstractBlockingStub<IAMPolicyBlockingStub> {
IAMPolicyBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)444     private IAMPolicyBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
445       super(channel, callOptions);
446     }
447 
448     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)449     protected IAMPolicyBlockingStub build(
450         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
451       return new IAMPolicyBlockingStub(channel, callOptions);
452     }
453 
454     /**
455      *
456      *
457      * <pre>
458      * Sets the access control policy on the specified resource. Replaces any
459      * existing policy.
460      * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
461      * </pre>
462      */
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)463     public com.google.iam.v1.Policy setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) {
464       return io.grpc.stub.ClientCalls.blockingUnaryCall(
465           getChannel(), getSetIamPolicyMethod(), getCallOptions(), request);
466     }
467 
468     /**
469      *
470      *
471      * <pre>
472      * Gets the access control policy for a resource.
473      * Returns an empty policy if the resource exists and does not have a policy
474      * set.
475      * </pre>
476      */
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)477     public com.google.iam.v1.Policy getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) {
478       return io.grpc.stub.ClientCalls.blockingUnaryCall(
479           getChannel(), getGetIamPolicyMethod(), getCallOptions(), request);
480     }
481 
482     /**
483      *
484      *
485      * <pre>
486      * Returns permissions that a caller has on the specified resource.
487      * If the resource does not exist, this will return an empty set of
488      * permissions, not a `NOT_FOUND` error.
489      * Note: This operation is designed to be used for building permission-aware
490      * UIs and command-line tools, not for authorization checking. This operation
491      * may "fail open" without warning.
492      * </pre>
493      */
testIamPermissions( com.google.iam.v1.TestIamPermissionsRequest request)494     public com.google.iam.v1.TestIamPermissionsResponse testIamPermissions(
495         com.google.iam.v1.TestIamPermissionsRequest request) {
496       return io.grpc.stub.ClientCalls.blockingUnaryCall(
497           getChannel(), getTestIamPermissionsMethod(), getCallOptions(), request);
498     }
499   }
500 
501   /**
502    * A stub to allow clients to do ListenableFuture-style rpc calls to service IAMPolicy.
503    *
504    * <pre>
505    * API Overview
506    * Manages Identity and Access Management (IAM) policies.
507    * Any implementation of an API that offers access control features
508    * implements the google.iam.v1.IAMPolicy interface.
509    * ## Data model
510    * Access control is applied when a principal (user or service account), takes
511    * some action on a resource exposed by a service. Resources, identified by
512    * URI-like names, are the unit of access control specification. Service
513    * implementations can choose the granularity of access control and the
514    * supported permissions for their resources.
515    * For example one database service may allow access control to be
516    * specified only at the Table level, whereas another might allow access control
517    * to also be specified at the Column level.
518    * ## Policy Structure
519    * See google.iam.v1.Policy
520    * This is intentionally not a CRUD style API because access control policies
521    * are created and deleted implicitly with the resources to which they are
522    * attached.
523    * </pre>
524    */
525   public static final class IAMPolicyFutureStub
526       extends io.grpc.stub.AbstractFutureStub<IAMPolicyFutureStub> {
IAMPolicyFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)527     private IAMPolicyFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
528       super(channel, callOptions);
529     }
530 
531     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)532     protected IAMPolicyFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
533       return new IAMPolicyFutureStub(channel, callOptions);
534     }
535 
536     /**
537      *
538      *
539      * <pre>
540      * Sets the access control policy on the specified resource. Replaces any
541      * existing policy.
542      * Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED` errors.
543      * </pre>
544      */
545     public com.google.common.util.concurrent.ListenableFuture<com.google.iam.v1.Policy>
setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request)546         setIamPolicy(com.google.iam.v1.SetIamPolicyRequest request) {
547       return io.grpc.stub.ClientCalls.futureUnaryCall(
548           getChannel().newCall(getSetIamPolicyMethod(), getCallOptions()), request);
549     }
550 
551     /**
552      *
553      *
554      * <pre>
555      * Gets the access control policy for a resource.
556      * Returns an empty policy if the resource exists and does not have a policy
557      * set.
558      * </pre>
559      */
560     public com.google.common.util.concurrent.ListenableFuture<com.google.iam.v1.Policy>
getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request)561         getIamPolicy(com.google.iam.v1.GetIamPolicyRequest request) {
562       return io.grpc.stub.ClientCalls.futureUnaryCall(
563           getChannel().newCall(getGetIamPolicyMethod(), getCallOptions()), request);
564     }
565 
566     /**
567      *
568      *
569      * <pre>
570      * Returns permissions that a caller has on the specified resource.
571      * If the resource does not exist, this will return an empty set of
572      * permissions, not a `NOT_FOUND` error.
573      * Note: This operation is designed to be used for building permission-aware
574      * UIs and command-line tools, not for authorization checking. This operation
575      * may "fail open" without warning.
576      * </pre>
577      */
578     public com.google.common.util.concurrent.ListenableFuture<
579             com.google.iam.v1.TestIamPermissionsResponse>
testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request)580         testIamPermissions(com.google.iam.v1.TestIamPermissionsRequest request) {
581       return io.grpc.stub.ClientCalls.futureUnaryCall(
582           getChannel().newCall(getTestIamPermissionsMethod(), getCallOptions()), request);
583     }
584   }
585 
586   private static final int METHODID_SET_IAM_POLICY = 0;
587   private static final int METHODID_GET_IAM_POLICY = 1;
588   private static final int METHODID_TEST_IAM_PERMISSIONS = 2;
589 
590   private static final class MethodHandlers<Req, Resp>
591       implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
592           io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
593           io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
594           io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
595     private final AsyncService serviceImpl;
596     private final int methodId;
597 
MethodHandlers(AsyncService serviceImpl, int methodId)598     MethodHandlers(AsyncService serviceImpl, int methodId) {
599       this.serviceImpl = serviceImpl;
600       this.methodId = methodId;
601     }
602 
603     @java.lang.Override
604     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)605     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
606       switch (methodId) {
607         case METHODID_SET_IAM_POLICY:
608           serviceImpl.setIamPolicy(
609               (com.google.iam.v1.SetIamPolicyRequest) request,
610               (io.grpc.stub.StreamObserver<com.google.iam.v1.Policy>) responseObserver);
611           break;
612         case METHODID_GET_IAM_POLICY:
613           serviceImpl.getIamPolicy(
614               (com.google.iam.v1.GetIamPolicyRequest) request,
615               (io.grpc.stub.StreamObserver<com.google.iam.v1.Policy>) responseObserver);
616           break;
617         case METHODID_TEST_IAM_PERMISSIONS:
618           serviceImpl.testIamPermissions(
619               (com.google.iam.v1.TestIamPermissionsRequest) request,
620               (io.grpc.stub.StreamObserver<com.google.iam.v1.TestIamPermissionsResponse>)
621                   responseObserver);
622           break;
623         default:
624           throw new AssertionError();
625       }
626     }
627 
628     @java.lang.Override
629     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)630     public io.grpc.stub.StreamObserver<Req> invoke(
631         io.grpc.stub.StreamObserver<Resp> responseObserver) {
632       switch (methodId) {
633         default:
634           throw new AssertionError();
635       }
636     }
637   }
638 
bindService(AsyncService service)639   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
640     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
641         .addMethod(
642             getSetIamPolicyMethod(),
643             io.grpc.stub.ServerCalls.asyncUnaryCall(
644                 new MethodHandlers<com.google.iam.v1.SetIamPolicyRequest, com.google.iam.v1.Policy>(
645                     service, METHODID_SET_IAM_POLICY)))
646         .addMethod(
647             getGetIamPolicyMethod(),
648             io.grpc.stub.ServerCalls.asyncUnaryCall(
649                 new MethodHandlers<com.google.iam.v1.GetIamPolicyRequest, com.google.iam.v1.Policy>(
650                     service, METHODID_GET_IAM_POLICY)))
651         .addMethod(
652             getTestIamPermissionsMethod(),
653             io.grpc.stub.ServerCalls.asyncUnaryCall(
654                 new MethodHandlers<
655                     com.google.iam.v1.TestIamPermissionsRequest,
656                     com.google.iam.v1.TestIamPermissionsResponse>(
657                     service, METHODID_TEST_IAM_PERMISSIONS)))
658         .build();
659   }
660 
661   private abstract static class IAMPolicyBaseDescriptorSupplier
662       implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
663           io.grpc.protobuf.ProtoServiceDescriptorSupplier {
IAMPolicyBaseDescriptorSupplier()664     IAMPolicyBaseDescriptorSupplier() {}
665 
666     @java.lang.Override
getFileDescriptor()667     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
668       return com.google.iam.v1.IamPolicyProto.getDescriptor();
669     }
670 
671     @java.lang.Override
getServiceDescriptor()672     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
673       return getFileDescriptor().findServiceByName("IAMPolicy");
674     }
675   }
676 
677   private static final class IAMPolicyFileDescriptorSupplier
678       extends IAMPolicyBaseDescriptorSupplier {
IAMPolicyFileDescriptorSupplier()679     IAMPolicyFileDescriptorSupplier() {}
680   }
681 
682   private static final class IAMPolicyMethodDescriptorSupplier
683       extends IAMPolicyBaseDescriptorSupplier
684       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
685     private final String methodName;
686 
IAMPolicyMethodDescriptorSupplier(String methodName)687     IAMPolicyMethodDescriptorSupplier(String methodName) {
688       this.methodName = methodName;
689     }
690 
691     @java.lang.Override
getMethodDescriptor()692     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
693       return getServiceDescriptor().findMethodByName(methodName);
694     }
695   }
696 
697   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
698 
getServiceDescriptor()699   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
700     io.grpc.ServiceDescriptor result = serviceDescriptor;
701     if (result == null) {
702       synchronized (IAMPolicyGrpc.class) {
703         result = serviceDescriptor;
704         if (result == null) {
705           serviceDescriptor =
706               result =
707                   io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
708                       .setSchemaDescriptor(new IAMPolicyFileDescriptorSupplier())
709                       .addMethod(getSetIamPolicyMethod())
710                       .addMethod(getGetIamPolicyMethod())
711                       .addMethod(getTestIamPermissionsMethod())
712                       .build();
713         }
714       }
715     }
716     return result;
717   }
718 }
719