-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathGrafeasStubSettings.java
817 lines (717 loc) · 35.2 KB
/
GrafeasStubSettings.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
/*
* Copyright 2023 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 io.grafeas.v1.stub;
import static io.grafeas.v1.GrafeasClient.ListNoteOccurrencesPagedResponse;
import static io.grafeas.v1.GrafeasClient.ListNotesPagedResponse;
import static io.grafeas.v1.GrafeasClient.ListOccurrencesPagedResponse;
import com.google.api.core.ApiFunction;
import com.google.api.core.ApiFuture;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiCallContext;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.PagedListDescriptor;
import com.google.api.gax.rpc.PagedListResponseFactory;
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.protobuf.Empty;
import io.grafeas.v1.BatchCreateNotesRequest;
import io.grafeas.v1.BatchCreateNotesResponse;
import io.grafeas.v1.BatchCreateOccurrencesRequest;
import io.grafeas.v1.BatchCreateOccurrencesResponse;
import io.grafeas.v1.CreateNoteRequest;
import io.grafeas.v1.CreateOccurrenceRequest;
import io.grafeas.v1.DeleteNoteRequest;
import io.grafeas.v1.DeleteOccurrenceRequest;
import io.grafeas.v1.GetNoteRequest;
import io.grafeas.v1.GetOccurrenceNoteRequest;
import io.grafeas.v1.GetOccurrenceRequest;
import io.grafeas.v1.ListNoteOccurrencesRequest;
import io.grafeas.v1.ListNoteOccurrencesResponse;
import io.grafeas.v1.ListNotesRequest;
import io.grafeas.v1.ListNotesResponse;
import io.grafeas.v1.ListOccurrencesRequest;
import io.grafeas.v1.ListOccurrencesResponse;
import io.grafeas.v1.Note;
import io.grafeas.v1.Occurrence;
import io.grafeas.v1.UpdateNoteRequest;
import io.grafeas.v1.UpdateOccurrenceRequest;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
import org.threeten.bp.Duration;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link GrafeasStub}.
*
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of getOccurrence to 30 seconds:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* GrafeasStubSettings.Builder grafeasSettingsBuilder = GrafeasStubSettings.newBuilder();
* grafeasSettingsBuilder
* .getOccurrenceSettings()
* .setRetrySettings(
* grafeasSettingsBuilder
* .getOccurrenceSettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* GrafeasStubSettings grafeasSettings = grafeasSettingsBuilder.build();
* }</pre>
*/
@Generated("by gapic-generator-java")
public class GrafeasStubSettings extends StubSettings<GrafeasStubSettings> {
/** The default scopes of the service. */
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().build();
private final UnaryCallSettings<GetOccurrenceRequest, Occurrence> getOccurrenceSettings;
private final PagedCallSettings<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>
listOccurrencesSettings;
private final UnaryCallSettings<DeleteOccurrenceRequest, Empty> deleteOccurrenceSettings;
private final UnaryCallSettings<CreateOccurrenceRequest, Occurrence> createOccurrenceSettings;
private final UnaryCallSettings<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>
batchCreateOccurrencesSettings;
private final UnaryCallSettings<UpdateOccurrenceRequest, Occurrence> updateOccurrenceSettings;
private final UnaryCallSettings<GetOccurrenceNoteRequest, Note> getOccurrenceNoteSettings;
private final UnaryCallSettings<GetNoteRequest, Note> getNoteSettings;
private final PagedCallSettings<ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>
listNotesSettings;
private final UnaryCallSettings<DeleteNoteRequest, Empty> deleteNoteSettings;
private final UnaryCallSettings<CreateNoteRequest, Note> createNoteSettings;
private final UnaryCallSettings<BatchCreateNotesRequest, BatchCreateNotesResponse>
batchCreateNotesSettings;
private final UnaryCallSettings<UpdateNoteRequest, Note> updateNoteSettings;
private final PagedCallSettings<
ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, ListNoteOccurrencesPagedResponse>
listNoteOccurrencesSettings;
private static final PagedListDescriptor<
ListOccurrencesRequest, ListOccurrencesResponse, Occurrence>
LIST_OCCURRENCES_PAGE_STR_DESC =
new PagedListDescriptor<ListOccurrencesRequest, ListOccurrencesResponse, Occurrence>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListOccurrencesRequest injectToken(
ListOccurrencesRequest payload, String token) {
return ListOccurrencesRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListOccurrencesRequest injectPageSize(
ListOccurrencesRequest payload, int pageSize) {
return ListOccurrencesRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListOccurrencesRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListOccurrencesResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable<Occurrence> extractResources(ListOccurrencesResponse payload) {
return payload.getOccurrencesList() == null
? ImmutableList.<Occurrence>of()
: payload.getOccurrencesList();
}
};
private static final PagedListDescriptor<ListNotesRequest, ListNotesResponse, Note>
LIST_NOTES_PAGE_STR_DESC =
new PagedListDescriptor<ListNotesRequest, ListNotesResponse, Note>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListNotesRequest injectToken(ListNotesRequest payload, String token) {
return ListNotesRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListNotesRequest injectPageSize(ListNotesRequest payload, int pageSize) {
return ListNotesRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListNotesRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListNotesResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable<Note> extractResources(ListNotesResponse payload) {
return payload.getNotesList() == null
? ImmutableList.<Note>of()
: payload.getNotesList();
}
};
private static final PagedListDescriptor<
ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, Occurrence>
LIST_NOTE_OCCURRENCES_PAGE_STR_DESC =
new PagedListDescriptor<
ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, Occurrence>() {
@Override
public String emptyToken() {
return "";
}
@Override
public ListNoteOccurrencesRequest injectToken(
ListNoteOccurrencesRequest payload, String token) {
return ListNoteOccurrencesRequest.newBuilder(payload).setPageToken(token).build();
}
@Override
public ListNoteOccurrencesRequest injectPageSize(
ListNoteOccurrencesRequest payload, int pageSize) {
return ListNoteOccurrencesRequest.newBuilder(payload).setPageSize(pageSize).build();
}
@Override
public Integer extractPageSize(ListNoteOccurrencesRequest payload) {
return payload.getPageSize();
}
@Override
public String extractNextToken(ListNoteOccurrencesResponse payload) {
return payload.getNextPageToken();
}
@Override
public Iterable<Occurrence> extractResources(ListNoteOccurrencesResponse payload) {
return payload.getOccurrencesList() == null
? ImmutableList.<Occurrence>of()
: payload.getOccurrencesList();
}
};
private static final PagedListResponseFactory<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>
LIST_OCCURRENCES_PAGE_STR_FACT =
new PagedListResponseFactory<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>() {
@Override
public ApiFuture<ListOccurrencesPagedResponse> getFuturePagedResponse(
UnaryCallable<ListOccurrencesRequest, ListOccurrencesResponse> callable,
ListOccurrencesRequest request,
ApiCallContext context,
ApiFuture<ListOccurrencesResponse> futureResponse) {
PageContext<ListOccurrencesRequest, ListOccurrencesResponse, Occurrence> pageContext =
PageContext.create(callable, LIST_OCCURRENCES_PAGE_STR_DESC, request, context);
return ListOccurrencesPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>
LIST_NOTES_PAGE_STR_FACT =
new PagedListResponseFactory<
ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>() {
@Override
public ApiFuture<ListNotesPagedResponse> getFuturePagedResponse(
UnaryCallable<ListNotesRequest, ListNotesResponse> callable,
ListNotesRequest request,
ApiCallContext context,
ApiFuture<ListNotesResponse> futureResponse) {
PageContext<ListNotesRequest, ListNotesResponse, Note> pageContext =
PageContext.create(callable, LIST_NOTES_PAGE_STR_DESC, request, context);
return ListNotesPagedResponse.createAsync(pageContext, futureResponse);
}
};
private static final PagedListResponseFactory<
ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, ListNoteOccurrencesPagedResponse>
LIST_NOTE_OCCURRENCES_PAGE_STR_FACT =
new PagedListResponseFactory<
ListNoteOccurrencesRequest,
ListNoteOccurrencesResponse,
ListNoteOccurrencesPagedResponse>() {
@Override
public ApiFuture<ListNoteOccurrencesPagedResponse> getFuturePagedResponse(
UnaryCallable<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse> callable,
ListNoteOccurrencesRequest request,
ApiCallContext context,
ApiFuture<ListNoteOccurrencesResponse> futureResponse) {
PageContext<ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, Occurrence>
pageContext =
PageContext.create(
callable, LIST_NOTE_OCCURRENCES_PAGE_STR_DESC, request, context);
return ListNoteOccurrencesPagedResponse.createAsync(pageContext, futureResponse);
}
};
/** Returns the object with the settings used for calls to getOccurrence. */
public UnaryCallSettings<GetOccurrenceRequest, Occurrence> getOccurrenceSettings() {
return getOccurrenceSettings;
}
/** Returns the object with the settings used for calls to listOccurrences. */
public PagedCallSettings<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>
listOccurrencesSettings() {
return listOccurrencesSettings;
}
/** Returns the object with the settings used for calls to deleteOccurrence. */
public UnaryCallSettings<DeleteOccurrenceRequest, Empty> deleteOccurrenceSettings() {
return deleteOccurrenceSettings;
}
/** Returns the object with the settings used for calls to createOccurrence. */
public UnaryCallSettings<CreateOccurrenceRequest, Occurrence> createOccurrenceSettings() {
return createOccurrenceSettings;
}
/** Returns the object with the settings used for calls to batchCreateOccurrences. */
public UnaryCallSettings<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>
batchCreateOccurrencesSettings() {
return batchCreateOccurrencesSettings;
}
/** Returns the object with the settings used for calls to updateOccurrence. */
public UnaryCallSettings<UpdateOccurrenceRequest, Occurrence> updateOccurrenceSettings() {
return updateOccurrenceSettings;
}
/** Returns the object with the settings used for calls to getOccurrenceNote. */
public UnaryCallSettings<GetOccurrenceNoteRequest, Note> getOccurrenceNoteSettings() {
return getOccurrenceNoteSettings;
}
/** Returns the object with the settings used for calls to getNote. */
public UnaryCallSettings<GetNoteRequest, Note> getNoteSettings() {
return getNoteSettings;
}
/** Returns the object with the settings used for calls to listNotes. */
public PagedCallSettings<ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>
listNotesSettings() {
return listNotesSettings;
}
/** Returns the object with the settings used for calls to deleteNote. */
public UnaryCallSettings<DeleteNoteRequest, Empty> deleteNoteSettings() {
return deleteNoteSettings;
}
/** Returns the object with the settings used for calls to createNote. */
public UnaryCallSettings<CreateNoteRequest, Note> createNoteSettings() {
return createNoteSettings;
}
/** Returns the object with the settings used for calls to batchCreateNotes. */
public UnaryCallSettings<BatchCreateNotesRequest, BatchCreateNotesResponse>
batchCreateNotesSettings() {
return batchCreateNotesSettings;
}
/** Returns the object with the settings used for calls to updateNote. */
public UnaryCallSettings<UpdateNoteRequest, Note> updateNoteSettings() {
return updateNoteSettings;
}
/** Returns the object with the settings used for calls to listNoteOccurrences. */
public PagedCallSettings<
ListNoteOccurrencesRequest, ListNoteOccurrencesResponse, ListNoteOccurrencesPagedResponse>
listNoteOccurrencesSettings() {
return listNoteOccurrencesSettings;
}
public GrafeasStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcGrafeasStub.create(this);
}
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return InstantiatingExecutorProvider.newBuilder();
}
/** Returns the default service endpoint. */
public static String getDefaultEndpoint() {
return null;
}
/** Returns the default mTLS service endpoint. */
public static String getDefaultMtlsEndpoint() {
return "containeranalysis.mtls.googleapis.com:443";
}
/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder()
.setScopesToApply(DEFAULT_SERVICE_SCOPES)
.setUseJwtAccessWithScope(true);
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken("gapic", GaxProperties.getLibraryVersion(GrafeasStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
/** Returns a new builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
}
/** Returns a builder containing all the values of this settings class. */
public Builder toBuilder() {
return new Builder(this);
}
protected GrafeasStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
getOccurrenceSettings = settingsBuilder.getOccurrenceSettings().build();
listOccurrencesSettings = settingsBuilder.listOccurrencesSettings().build();
deleteOccurrenceSettings = settingsBuilder.deleteOccurrenceSettings().build();
createOccurrenceSettings = settingsBuilder.createOccurrenceSettings().build();
batchCreateOccurrencesSettings = settingsBuilder.batchCreateOccurrencesSettings().build();
updateOccurrenceSettings = settingsBuilder.updateOccurrenceSettings().build();
getOccurrenceNoteSettings = settingsBuilder.getOccurrenceNoteSettings().build();
getNoteSettings = settingsBuilder.getNoteSettings().build();
listNotesSettings = settingsBuilder.listNotesSettings().build();
deleteNoteSettings = settingsBuilder.deleteNoteSettings().build();
createNoteSettings = settingsBuilder.createNoteSettings().build();
batchCreateNotesSettings = settingsBuilder.batchCreateNotesSettings().build();
updateNoteSettings = settingsBuilder.updateNoteSettings().build();
listNoteOccurrencesSettings = settingsBuilder.listNoteOccurrencesSettings().build();
}
/** Builder for GrafeasStubSettings. */
public static class Builder extends StubSettings.Builder<GrafeasStubSettings, Builder> {
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder<GetOccurrenceRequest, Occurrence> getOccurrenceSettings;
private final PagedCallSettings.Builder<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>
listOccurrencesSettings;
private final UnaryCallSettings.Builder<DeleteOccurrenceRequest, Empty>
deleteOccurrenceSettings;
private final UnaryCallSettings.Builder<CreateOccurrenceRequest, Occurrence>
createOccurrenceSettings;
private final UnaryCallSettings.Builder<
BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>
batchCreateOccurrencesSettings;
private final UnaryCallSettings.Builder<UpdateOccurrenceRequest, Occurrence>
updateOccurrenceSettings;
private final UnaryCallSettings.Builder<GetOccurrenceNoteRequest, Note>
getOccurrenceNoteSettings;
private final UnaryCallSettings.Builder<GetNoteRequest, Note> getNoteSettings;
private final PagedCallSettings.Builder<
ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>
listNotesSettings;
private final UnaryCallSettings.Builder<DeleteNoteRequest, Empty> deleteNoteSettings;
private final UnaryCallSettings.Builder<CreateNoteRequest, Note> createNoteSettings;
private final UnaryCallSettings.Builder<BatchCreateNotesRequest, BatchCreateNotesResponse>
batchCreateNotesSettings;
private final UnaryCallSettings.Builder<UpdateNoteRequest, Note> updateNoteSettings;
private final PagedCallSettings.Builder<
ListNoteOccurrencesRequest,
ListNoteOccurrencesResponse,
ListNoteOccurrencesPagedResponse>
listNoteOccurrencesSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
static {
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"retry_policy_0_codes",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.UNAVAILABLE, StatusCode.Code.DEADLINE_EXCEEDED)));
definitions.put(
"no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
static {
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(30000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(30000L))
.build();
definitions.put("retry_policy_0_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofMillis(30000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(30000L))
.setTotalTimeout(Duration.ofMillis(30000L))
.build();
definitions.put("no_retry_1_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
getOccurrenceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listOccurrencesSettings = PagedCallSettings.newBuilder(LIST_OCCURRENCES_PAGE_STR_FACT);
deleteOccurrenceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createOccurrenceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
batchCreateOccurrencesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateOccurrenceSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getOccurrenceNoteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getNoteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listNotesSettings = PagedCallSettings.newBuilder(LIST_NOTES_PAGE_STR_FACT);
deleteNoteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
createNoteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
batchCreateNotesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
updateNoteSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listNoteOccurrencesSettings =
PagedCallSettings.newBuilder(LIST_NOTE_OCCURRENCES_PAGE_STR_FACT);
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
getOccurrenceSettings,
listOccurrencesSettings,
deleteOccurrenceSettings,
createOccurrenceSettings,
batchCreateOccurrencesSettings,
updateOccurrenceSettings,
getOccurrenceNoteSettings,
getNoteSettings,
listNotesSettings,
deleteNoteSettings,
createNoteSettings,
batchCreateNotesSettings,
updateNoteSettings,
listNoteOccurrencesSettings);
initDefaults(this);
}
protected Builder(GrafeasStubSettings settings) {
super(settings);
getOccurrenceSettings = settings.getOccurrenceSettings.toBuilder();
listOccurrencesSettings = settings.listOccurrencesSettings.toBuilder();
deleteOccurrenceSettings = settings.deleteOccurrenceSettings.toBuilder();
createOccurrenceSettings = settings.createOccurrenceSettings.toBuilder();
batchCreateOccurrencesSettings = settings.batchCreateOccurrencesSettings.toBuilder();
updateOccurrenceSettings = settings.updateOccurrenceSettings.toBuilder();
getOccurrenceNoteSettings = settings.getOccurrenceNoteSettings.toBuilder();
getNoteSettings = settings.getNoteSettings.toBuilder();
listNotesSettings = settings.listNotesSettings.toBuilder();
deleteNoteSettings = settings.deleteNoteSettings.toBuilder();
createNoteSettings = settings.createNoteSettings.toBuilder();
batchCreateNotesSettings = settings.batchCreateNotesSettings.toBuilder();
updateNoteSettings = settings.updateNoteSettings.toBuilder();
listNoteOccurrencesSettings = settings.listNoteOccurrencesSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
getOccurrenceSettings,
listOccurrencesSettings,
deleteOccurrenceSettings,
createOccurrenceSettings,
batchCreateOccurrencesSettings,
updateOccurrenceSettings,
getOccurrenceNoteSettings,
getNoteSettings,
listNotesSettings,
deleteNoteSettings,
createNoteSettings,
batchCreateNotesSettings,
updateNoteSettings,
listNoteOccurrencesSettings);
}
private static Builder createDefault() {
Builder builder = new Builder(((ClientContext) null));
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
builder.setSwitchToMtlsEndpointAllowed(true);
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
builder
.getOccurrenceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.listOccurrencesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.deleteOccurrenceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.createOccurrenceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.batchCreateOccurrencesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.updateOccurrenceSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.getOccurrenceNoteSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.getNoteSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.listNotesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.deleteNoteSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
builder
.createNoteSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.batchCreateNotesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.updateNoteSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_1_params"));
builder
.listNoteOccurrencesSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
return builder;
}
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
return this;
}
public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
return unaryMethodSettingsBuilders;
}
/** Returns the builder for the settings used for calls to getOccurrence. */
public UnaryCallSettings.Builder<GetOccurrenceRequest, Occurrence> getOccurrenceSettings() {
return getOccurrenceSettings;
}
/** Returns the builder for the settings used for calls to listOccurrences. */
public PagedCallSettings.Builder<
ListOccurrencesRequest, ListOccurrencesResponse, ListOccurrencesPagedResponse>
listOccurrencesSettings() {
return listOccurrencesSettings;
}
/** Returns the builder for the settings used for calls to deleteOccurrence. */
public UnaryCallSettings.Builder<DeleteOccurrenceRequest, Empty> deleteOccurrenceSettings() {
return deleteOccurrenceSettings;
}
/** Returns the builder for the settings used for calls to createOccurrence. */
public UnaryCallSettings.Builder<CreateOccurrenceRequest, Occurrence>
createOccurrenceSettings() {
return createOccurrenceSettings;
}
/** Returns the builder for the settings used for calls to batchCreateOccurrences. */
public UnaryCallSettings.Builder<BatchCreateOccurrencesRequest, BatchCreateOccurrencesResponse>
batchCreateOccurrencesSettings() {
return batchCreateOccurrencesSettings;
}
/** Returns the builder for the settings used for calls to updateOccurrence. */
public UnaryCallSettings.Builder<UpdateOccurrenceRequest, Occurrence>
updateOccurrenceSettings() {
return updateOccurrenceSettings;
}
/** Returns the builder for the settings used for calls to getOccurrenceNote. */
public UnaryCallSettings.Builder<GetOccurrenceNoteRequest, Note> getOccurrenceNoteSettings() {
return getOccurrenceNoteSettings;
}
/** Returns the builder for the settings used for calls to getNote. */
public UnaryCallSettings.Builder<GetNoteRequest, Note> getNoteSettings() {
return getNoteSettings;
}
/** Returns the builder for the settings used for calls to listNotes. */
public PagedCallSettings.Builder<ListNotesRequest, ListNotesResponse, ListNotesPagedResponse>
listNotesSettings() {
return listNotesSettings;
}
/** Returns the builder for the settings used for calls to deleteNote. */
public UnaryCallSettings.Builder<DeleteNoteRequest, Empty> deleteNoteSettings() {
return deleteNoteSettings;
}
/** Returns the builder for the settings used for calls to createNote. */
public UnaryCallSettings.Builder<CreateNoteRequest, Note> createNoteSettings() {
return createNoteSettings;
}
/** Returns the builder for the settings used for calls to batchCreateNotes. */
public UnaryCallSettings.Builder<BatchCreateNotesRequest, BatchCreateNotesResponse>
batchCreateNotesSettings() {
return batchCreateNotesSettings;
}
/** Returns the builder for the settings used for calls to updateNote. */
public UnaryCallSettings.Builder<UpdateNoteRequest, Note> updateNoteSettings() {
return updateNoteSettings;
}
/** Returns the builder for the settings used for calls to listNoteOccurrences. */
public PagedCallSettings.Builder<
ListNoteOccurrencesRequest,
ListNoteOccurrencesResponse,
ListNoteOccurrencesPagedResponse>
listNoteOccurrencesSettings() {
return listNoteOccurrencesSettings;
}
@Override
public GrafeasStubSettings build() throws IOException {
return new GrafeasStubSettings(this);
}
}
}