This repository has been archived by the owner on Sep 18, 2023. It is now read-only.
/
OperationsGrpc.java
946 lines (887 loc) · 41.2 KB
/
OperationsGrpc.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
/*
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.longrunning;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
*
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: google/longrunning/operations.proto")
public final class OperationsGrpc {
private OperationsGrpc() {}
public static final String SERVICE_NAME = "google.longrunning.Operations";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>
getListOperationsMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "ListOperations",
requestType = com.google.longrunning.ListOperationsRequest.class,
responseType = com.google.longrunning.ListOperationsResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>
getListOperationsMethod() {
io.grpc.MethodDescriptor<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>
getListOperationsMethod;
if ((getListOperationsMethod = OperationsGrpc.getListOperationsMethod) == null) {
synchronized (OperationsGrpc.class) {
if ((getListOperationsMethod = OperationsGrpc.getListOperationsMethod) == null) {
OperationsGrpc.getListOperationsMethod =
getListOperationsMethod =
io.grpc.MethodDescriptor
.<com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ListOperations"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.ListOperationsRequest.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.ListOperationsResponse.getDefaultInstance()))
.setSchemaDescriptor(new OperationsMethodDescriptorSupplier("ListOperations"))
.build();
}
}
}
return getListOperationsMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>
getGetOperationMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetOperation",
requestType = com.google.longrunning.GetOperationRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>
getGetOperationMethod() {
io.grpc.MethodDescriptor<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>
getGetOperationMethod;
if ((getGetOperationMethod = OperationsGrpc.getGetOperationMethod) == null) {
synchronized (OperationsGrpc.class) {
if ((getGetOperationMethod = OperationsGrpc.getGetOperationMethod) == null) {
OperationsGrpc.getGetOperationMethod =
getGetOperationMethod =
io.grpc.MethodDescriptor
.<com.google.longrunning.GetOperationRequest,
com.google.longrunning.Operation>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetOperation"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.GetOperationRequest.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.Operation.getDefaultInstance()))
.setSchemaDescriptor(new OperationsMethodDescriptorSupplier("GetOperation"))
.build();
}
}
}
return getGetOperationMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>
getDeleteOperationMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "DeleteOperation",
requestType = com.google.longrunning.DeleteOperationRequest.class,
responseType = com.google.protobuf.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>
getDeleteOperationMethod() {
io.grpc.MethodDescriptor<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>
getDeleteOperationMethod;
if ((getDeleteOperationMethod = OperationsGrpc.getDeleteOperationMethod) == null) {
synchronized (OperationsGrpc.class) {
if ((getDeleteOperationMethod = OperationsGrpc.getDeleteOperationMethod) == null) {
OperationsGrpc.getDeleteOperationMethod =
getDeleteOperationMethod =
io.grpc.MethodDescriptor
.<com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "DeleteOperation"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.DeleteOperationRequest.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.protobuf.Empty.getDefaultInstance()))
.setSchemaDescriptor(
new OperationsMethodDescriptorSupplier("DeleteOperation"))
.build();
}
}
}
return getDeleteOperationMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>
getCancelOperationMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "CancelOperation",
requestType = com.google.longrunning.CancelOperationRequest.class,
responseType = com.google.protobuf.Empty.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>
getCancelOperationMethod() {
io.grpc.MethodDescriptor<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>
getCancelOperationMethod;
if ((getCancelOperationMethod = OperationsGrpc.getCancelOperationMethod) == null) {
synchronized (OperationsGrpc.class) {
if ((getCancelOperationMethod = OperationsGrpc.getCancelOperationMethod) == null) {
OperationsGrpc.getCancelOperationMethod =
getCancelOperationMethod =
io.grpc.MethodDescriptor
.<com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CancelOperation"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.CancelOperationRequest.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.protobuf.Empty.getDefaultInstance()))
.setSchemaDescriptor(
new OperationsMethodDescriptorSupplier("CancelOperation"))
.build();
}
}
}
return getCancelOperationMethod;
}
private static volatile io.grpc.MethodDescriptor<
com.google.longrunning.WaitOperationRequest, com.google.longrunning.Operation>
getWaitOperationMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "WaitOperation",
requestType = com.google.longrunning.WaitOperationRequest.class,
responseType = com.google.longrunning.Operation.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<
com.google.longrunning.WaitOperationRequest, com.google.longrunning.Operation>
getWaitOperationMethod() {
io.grpc.MethodDescriptor<
com.google.longrunning.WaitOperationRequest, com.google.longrunning.Operation>
getWaitOperationMethod;
if ((getWaitOperationMethod = OperationsGrpc.getWaitOperationMethod) == null) {
synchronized (OperationsGrpc.class) {
if ((getWaitOperationMethod = OperationsGrpc.getWaitOperationMethod) == null) {
OperationsGrpc.getWaitOperationMethod =
getWaitOperationMethod =
io.grpc.MethodDescriptor
.<com.google.longrunning.WaitOperationRequest,
com.google.longrunning.Operation>
newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "WaitOperation"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.WaitOperationRequest.getDefaultInstance()))
.setResponseMarshaller(
io.grpc.protobuf.ProtoUtils.marshaller(
com.google.longrunning.Operation.getDefaultInstance()))
.setSchemaDescriptor(new OperationsMethodDescriptorSupplier("WaitOperation"))
.build();
}
}
}
return getWaitOperationMethod;
}
/** Creates a new async stub that supports all call types for the service */
public static OperationsStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<OperationsStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<OperationsStub>() {
@java.lang.Override
public OperationsStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsStub(channel, callOptions);
}
};
return OperationsStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static OperationsBlockingStub newBlockingStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<OperationsBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<OperationsBlockingStub>() {
@java.lang.Override
public OperationsBlockingStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsBlockingStub(channel, callOptions);
}
};
return OperationsBlockingStub.newStub(factory, channel);
}
/** Creates a new ListenableFuture-style stub that supports unary calls on the service */
public static OperationsFutureStub newFutureStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<OperationsFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<OperationsFutureStub>() {
@java.lang.Override
public OperationsFutureStub newStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsFutureStub(channel, callOptions);
}
};
return OperationsFutureStub.newStub(factory, channel);
}
/**
*
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
public abstract static class OperationsImplBase implements io.grpc.BindableService {
/**
*
*
* <pre>
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
* NOTE: the `name` binding allows API services to override the binding
* to use different resource name schemes, such as `users/*/operations`. To
* override the binding, API services can add a binding such as
* `"/v1/{name=users/*}/operations"` to their service configuration.
* For backwards compatibility, the default name includes the operations
* collection id, however overriding users must ensure the name binding
* is the parent resource, without the operations collection id.
* </pre>
*/
public void listOperations(
com.google.longrunning.ListOperationsRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.ListOperationsResponse>
responseObserver) {
asyncUnimplementedUnaryCall(getListOperationsMethod(), responseObserver);
}
/**
*
*
* <pre>
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
* </pre>
*/
public void getOperation(
com.google.longrunning.GetOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnimplementedUnaryCall(getGetOperationMethod(), responseObserver);
}
/**
*
*
* <pre>
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* </pre>
*/
public void deleteOperation(
com.google.longrunning.DeleteOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getDeleteOperationMethod(), responseObserver);
}
/**
*
*
* <pre>
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
* corresponding to `Code.CANCELLED`.
* </pre>
*/
public void cancelOperation(
com.google.longrunning.CancelOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
asyncUnimplementedUnaryCall(getCancelOperationMethod(), responseObserver);
}
/**
*
*
* <pre>
* Waits until the specified long-running operation is done or reaches at most
* a specified timeout, returning the latest state. If the operation is
* already done, the latest state is immediately returned. If the timeout
* specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
* timeout is used. If the server does not support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* Note that this method is on a best-effort basis. It may return the latest
* state before the specified timeout (including immediately), meaning even an
* immediate response is no guarantee that the operation is done.
* </pre>
*/
public void waitOperation(
com.google.longrunning.WaitOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnimplementedUnaryCall(getWaitOperationMethod(), responseObserver);
}
@java.lang.Override
public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getListOperationsMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.ListOperationsRequest,
com.google.longrunning.ListOperationsResponse>(
this, METHODID_LIST_OPERATIONS)))
.addMethod(
getGetOperationMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.GetOperationRequest, com.google.longrunning.Operation>(
this, METHODID_GET_OPERATION)))
.addMethod(
getDeleteOperationMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.DeleteOperationRequest, com.google.protobuf.Empty>(
this, METHODID_DELETE_OPERATION)))
.addMethod(
getCancelOperationMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.CancelOperationRequest, com.google.protobuf.Empty>(
this, METHODID_CANCEL_OPERATION)))
.addMethod(
getWaitOperationMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.longrunning.WaitOperationRequest,
com.google.longrunning.Operation>(this, METHODID_WAIT_OPERATION)))
.build();
}
}
/**
*
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
public static final class OperationsStub extends io.grpc.stub.AbstractAsyncStub<OperationsStub> {
private OperationsStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected OperationsStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsStub(channel, callOptions);
}
/**
*
*
* <pre>
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
* NOTE: the `name` binding allows API services to override the binding
* to use different resource name schemes, such as `users/*/operations`. To
* override the binding, API services can add a binding such as
* `"/v1/{name=users/*}/operations"` to their service configuration.
* For backwards compatibility, the default name includes the operations
* collection id, however overriding users must ensure the name binding
* is the parent resource, without the operations collection id.
* </pre>
*/
public void listOperations(
com.google.longrunning.ListOperationsRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.ListOperationsResponse>
responseObserver) {
asyncUnaryCall(
getChannel().newCall(getListOperationsMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
* <pre>
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
* </pre>
*/
public void getOperation(
com.google.longrunning.GetOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetOperationMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
* <pre>
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* </pre>
*/
public void deleteOperation(
com.google.longrunning.DeleteOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getDeleteOperationMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
* <pre>
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
* corresponding to `Code.CANCELLED`.
* </pre>
*/
public void cancelOperation(
com.google.longrunning.CancelOperationRequest request,
io.grpc.stub.StreamObserver<com.google.protobuf.Empty> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getCancelOperationMethod(), getCallOptions()),
request,
responseObserver);
}
/**
*
*
* <pre>
* Waits until the specified long-running operation is done or reaches at most
* a specified timeout, returning the latest state. If the operation is
* already done, the latest state is immediately returned. If the timeout
* specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
* timeout is used. If the server does not support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* Note that this method is on a best-effort basis. It may return the latest
* state before the specified timeout (including immediately), meaning even an
* immediate response is no guarantee that the operation is done.
* </pre>
*/
public void waitOperation(
com.google.longrunning.WaitOperationRequest request,
io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getWaitOperationMethod(), getCallOptions()),
request,
responseObserver);
}
}
/**
*
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
public static final class OperationsBlockingStub
extends io.grpc.stub.AbstractBlockingStub<OperationsBlockingStub> {
private OperationsBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected OperationsBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsBlockingStub(channel, callOptions);
}
/**
*
*
* <pre>
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
* NOTE: the `name` binding allows API services to override the binding
* to use different resource name schemes, such as `users/*/operations`. To
* override the binding, API services can add a binding such as
* `"/v1/{name=users/*}/operations"` to their service configuration.
* For backwards compatibility, the default name includes the operations
* collection id, however overriding users must ensure the name binding
* is the parent resource, without the operations collection id.
* </pre>
*/
public com.google.longrunning.ListOperationsResponse listOperations(
com.google.longrunning.ListOperationsRequest request) {
return blockingUnaryCall(getChannel(), getListOperationsMethod(), getCallOptions(), request);
}
/**
*
*
* <pre>
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
* </pre>
*/
public com.google.longrunning.Operation getOperation(
com.google.longrunning.GetOperationRequest request) {
return blockingUnaryCall(getChannel(), getGetOperationMethod(), getCallOptions(), request);
}
/**
*
*
* <pre>
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* </pre>
*/
public com.google.protobuf.Empty deleteOperation(
com.google.longrunning.DeleteOperationRequest request) {
return blockingUnaryCall(getChannel(), getDeleteOperationMethod(), getCallOptions(), request);
}
/**
*
*
* <pre>
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
* corresponding to `Code.CANCELLED`.
* </pre>
*/
public com.google.protobuf.Empty cancelOperation(
com.google.longrunning.CancelOperationRequest request) {
return blockingUnaryCall(getChannel(), getCancelOperationMethod(), getCallOptions(), request);
}
/**
*
*
* <pre>
* Waits until the specified long-running operation is done or reaches at most
* a specified timeout, returning the latest state. If the operation is
* already done, the latest state is immediately returned. If the timeout
* specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
* timeout is used. If the server does not support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* Note that this method is on a best-effort basis. It may return the latest
* state before the specified timeout (including immediately), meaning even an
* immediate response is no guarantee that the operation is done.
* </pre>
*/
public com.google.longrunning.Operation waitOperation(
com.google.longrunning.WaitOperationRequest request) {
return blockingUnaryCall(getChannel(), getWaitOperationMethod(), getCallOptions(), request);
}
}
/**
*
*
* <pre>
* Manages long-running operations with an API service.
* When an API method normally takes long time to complete, it can be designed
* to return [Operation][google.longrunning.Operation] to the client, and the client can use this
* interface to receive the real response asynchronously by polling the
* operation resource, or pass the operation resource to another API (such as
* Google Cloud Pub/Sub API) to receive the response. Any API service that
* returns long-running operations should implement the `Operations` interface
* so developers can have a consistent client experience.
* </pre>
*/
public static final class OperationsFutureStub
extends io.grpc.stub.AbstractFutureStub<OperationsFutureStub> {
private OperationsFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected OperationsFutureStub build(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new OperationsFutureStub(channel, callOptions);
}
/**
*
*
* <pre>
* Lists operations that match the specified filter in the request. If the
* server doesn't support this method, it returns `UNIMPLEMENTED`.
* NOTE: the `name` binding allows API services to override the binding
* to use different resource name schemes, such as `users/*/operations`. To
* override the binding, API services can add a binding such as
* `"/v1/{name=users/*}/operations"` to their service configuration.
* For backwards compatibility, the default name includes the operations
* collection id, however overriding users must ensure the name binding
* is the parent resource, without the operations collection id.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<
com.google.longrunning.ListOperationsResponse>
listOperations(com.google.longrunning.ListOperationsRequest request) {
return futureUnaryCall(
getChannel().newCall(getListOperationsMethod(), getCallOptions()), request);
}
/**
*
*
* <pre>
* Gets the latest state of a long-running operation. Clients can use this
* method to poll the operation result at intervals as recommended by the API
* service.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation>
getOperation(com.google.longrunning.GetOperationRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetOperationMethod(), getCallOptions()), request);
}
/**
*
*
* <pre>
* Deletes a long-running operation. This method indicates that the client is
* no longer interested in the operation result. It does not cancel the
* operation. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty>
deleteOperation(com.google.longrunning.DeleteOperationRequest request) {
return futureUnaryCall(
getChannel().newCall(getDeleteOperationMethod(), getCallOptions()), request);
}
/**
*
*
* <pre>
* Starts asynchronous cancellation on a long-running operation. The server
* makes a best effort to cancel the operation, but success is not
* guaranteed. If the server doesn't support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`. Clients can use
* [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
* other methods to check whether the cancellation succeeded or whether the
* operation completed despite cancellation. On successful cancellation,
* the operation is not deleted; instead, it becomes an operation with
* an [Operation.error][google.longrunning.Operation.error] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1,
* corresponding to `Code.CANCELLED`.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.protobuf.Empty>
cancelOperation(com.google.longrunning.CancelOperationRequest request) {
return futureUnaryCall(
getChannel().newCall(getCancelOperationMethod(), getCallOptions()), request);
}
/**
*
*
* <pre>
* Waits until the specified long-running operation is done or reaches at most
* a specified timeout, returning the latest state. If the operation is
* already done, the latest state is immediately returned. If the timeout
* specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
* timeout is used. If the server does not support this method, it returns
* `google.rpc.Code.UNIMPLEMENTED`.
* Note that this method is on a best-effort basis. It may return the latest
* state before the specified timeout (including immediately), meaning even an
* immediate response is no guarantee that the operation is done.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.longrunning.Operation>
waitOperation(com.google.longrunning.WaitOperationRequest request) {
return futureUnaryCall(
getChannel().newCall(getWaitOperationMethod(), getCallOptions()), request);
}
}
private static final int METHODID_LIST_OPERATIONS = 0;
private static final int METHODID_GET_OPERATION = 1;
private static final int METHODID_DELETE_OPERATION = 2;
private static final int METHODID_CANCEL_OPERATION = 3;
private static final int METHODID_WAIT_OPERATION = 4;
private static final class MethodHandlers<Req, Resp>
implements io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final OperationsImplBase serviceImpl;
private final int methodId;
MethodHandlers(OperationsImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_LIST_OPERATIONS:
serviceImpl.listOperations(
(com.google.longrunning.ListOperationsRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.ListOperationsResponse>)
responseObserver);
break;
case METHODID_GET_OPERATION:
serviceImpl.getOperation(
(com.google.longrunning.GetOperationRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
break;
case METHODID_DELETE_OPERATION:
serviceImpl.deleteOperation(
(com.google.longrunning.DeleteOperationRequest) request,
(io.grpc.stub.StreamObserver<com.google.protobuf.Empty>) responseObserver);
break;
case METHODID_CANCEL_OPERATION:
serviceImpl.cancelOperation(
(com.google.longrunning.CancelOperationRequest) request,
(io.grpc.stub.StreamObserver<com.google.protobuf.Empty>) responseObserver);
break;
case METHODID_WAIT_OPERATION:
serviceImpl.waitOperation(
(com.google.longrunning.WaitOperationRequest) request,
(io.grpc.stub.StreamObserver<com.google.longrunning.Operation>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private abstract static class OperationsBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier,
io.grpc.protobuf.ProtoServiceDescriptorSupplier {
OperationsBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.google.longrunning.OperationsProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("Operations");
}
}
private static final class OperationsFileDescriptorSupplier
extends OperationsBaseDescriptorSupplier {
OperationsFileDescriptorSupplier() {}
}
private static final class OperationsMethodDescriptorSupplier
extends OperationsBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
OperationsMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (OperationsGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor =
result =
io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new OperationsFileDescriptorSupplier())
.addMethod(getListOperationsMethod())
.addMethod(getGetOperationMethod())
.addMethod(getDeleteOperationMethod())
.addMethod(getCancelOperationMethod())
.addMethod(getWaitOperationMethod())
.build();
}
}
}
return result;
}
}