• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 
17 package com.google.cloud.vision.v1.stub;
18 
19 import com.google.api.core.ApiFunction;
20 import com.google.api.core.BetaApi;
21 import com.google.api.gax.core.GaxProperties;
22 import com.google.api.gax.core.GoogleCredentialsProvider;
23 import com.google.api.gax.core.InstantiatingExecutorProvider;
24 import com.google.api.gax.grpc.GaxGrpcProperties;
25 import com.google.api.gax.grpc.GrpcTransportChannel;
26 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
27 import com.google.api.gax.grpc.ProtoOperationTransformers;
28 import com.google.api.gax.httpjson.GaxHttpJsonProperties;
29 import com.google.api.gax.httpjson.HttpJsonTransportChannel;
30 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
31 import com.google.api.gax.longrunning.OperationSnapshot;
32 import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
33 import com.google.api.gax.retrying.RetrySettings;
34 import com.google.api.gax.rpc.ApiClientHeaderProvider;
35 import com.google.api.gax.rpc.ClientContext;
36 import com.google.api.gax.rpc.OperationCallSettings;
37 import com.google.api.gax.rpc.StatusCode;
38 import com.google.api.gax.rpc.StubSettings;
39 import com.google.api.gax.rpc.TransportChannelProvider;
40 import com.google.api.gax.rpc.UnaryCallSettings;
41 import com.google.cloud.vision.v1.AsyncBatchAnnotateFilesRequest;
42 import com.google.cloud.vision.v1.AsyncBatchAnnotateFilesResponse;
43 import com.google.cloud.vision.v1.AsyncBatchAnnotateImagesRequest;
44 import com.google.cloud.vision.v1.AsyncBatchAnnotateImagesResponse;
45 import com.google.cloud.vision.v1.BatchAnnotateFilesRequest;
46 import com.google.cloud.vision.v1.BatchAnnotateFilesResponse;
47 import com.google.cloud.vision.v1.BatchAnnotateImagesRequest;
48 import com.google.cloud.vision.v1.BatchAnnotateImagesResponse;
49 import com.google.cloud.vision.v1.OperationMetadata;
50 import com.google.common.collect.ImmutableList;
51 import com.google.common.collect.ImmutableMap;
52 import com.google.common.collect.ImmutableSet;
53 import com.google.common.collect.Lists;
54 import com.google.longrunning.Operation;
55 import java.io.IOException;
56 import java.util.List;
57 import javax.annotation.Generated;
58 import org.threeten.bp.Duration;
59 
60 // AUTO-GENERATED DOCUMENTATION AND CLASS.
61 /**
62  * Settings class to configure an instance of {@link ImageAnnotatorStub}.
63  *
64  * <p>The default instance has everything set to sensible defaults:
65  *
66  * <ul>
67  *   <li>The default service address (vision.googleapis.com) and default port (443) are used.
68  *   <li>Credentials are acquired automatically through Application Default Credentials.
69  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
70  * </ul>
71  *
72  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
73  * build() is called, the tree of builders is called to create the complete settings object.
74  *
75  * <p>For example, to set the total timeout of batchAnnotateImages to 30 seconds:
76  *
77  * <pre>{@code
78  * // This snippet has been automatically generated and should be regarded as a code template only.
79  * // It will require modifications to work:
80  * // - It may require correct/in-range values for request initialization.
81  * // - It may require specifying regional endpoints when creating the service client as shown in
82  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
83  * ImageAnnotatorStubSettings.Builder imageAnnotatorSettingsBuilder =
84  *     ImageAnnotatorStubSettings.newBuilder();
85  * imageAnnotatorSettingsBuilder
86  *     .batchAnnotateImagesSettings()
87  *     .setRetrySettings(
88  *         imageAnnotatorSettingsBuilder
89  *             .batchAnnotateImagesSettings()
90  *             .getRetrySettings()
91  *             .toBuilder()
92  *             .setTotalTimeout(Duration.ofSeconds(30))
93  *             .build());
94  * ImageAnnotatorStubSettings imageAnnotatorSettings = imageAnnotatorSettingsBuilder.build();
95  * }</pre>
96  */
97 @Generated("by gapic-generator-java")
98 public class ImageAnnotatorStubSettings extends StubSettings<ImageAnnotatorStubSettings> {
99   /** The default scopes of the service. */
100   private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
101       ImmutableList.<String>builder()
102           .add("https://www.googleapis.com/auth/cloud-platform")
103           .add("https://www.googleapis.com/auth/cloud-vision")
104           .build();
105 
106   private final UnaryCallSettings<BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>
107       batchAnnotateImagesSettings;
108   private final UnaryCallSettings<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>
109       batchAnnotateFilesSettings;
110   private final UnaryCallSettings<AsyncBatchAnnotateImagesRequest, Operation>
111       asyncBatchAnnotateImagesSettings;
112   private final OperationCallSettings<
113           AsyncBatchAnnotateImagesRequest, AsyncBatchAnnotateImagesResponse, OperationMetadata>
114       asyncBatchAnnotateImagesOperationSettings;
115   private final UnaryCallSettings<AsyncBatchAnnotateFilesRequest, Operation>
116       asyncBatchAnnotateFilesSettings;
117   private final OperationCallSettings<
118           AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
119       asyncBatchAnnotateFilesOperationSettings;
120 
121   /** Returns the object with the settings used for calls to batchAnnotateImages. */
122   public UnaryCallSettings<BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>
batchAnnotateImagesSettings()123       batchAnnotateImagesSettings() {
124     return batchAnnotateImagesSettings;
125   }
126 
127   /** Returns the object with the settings used for calls to batchAnnotateFiles. */
128   public UnaryCallSettings<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>
batchAnnotateFilesSettings()129       batchAnnotateFilesSettings() {
130     return batchAnnotateFilesSettings;
131   }
132 
133   /** Returns the object with the settings used for calls to asyncBatchAnnotateImages. */
134   public UnaryCallSettings<AsyncBatchAnnotateImagesRequest, Operation>
asyncBatchAnnotateImagesSettings()135       asyncBatchAnnotateImagesSettings() {
136     return asyncBatchAnnotateImagesSettings;
137   }
138 
139   /** Returns the object with the settings used for calls to asyncBatchAnnotateImages. */
140   public OperationCallSettings<
141           AsyncBatchAnnotateImagesRequest, AsyncBatchAnnotateImagesResponse, OperationMetadata>
asyncBatchAnnotateImagesOperationSettings()142       asyncBatchAnnotateImagesOperationSettings() {
143     return asyncBatchAnnotateImagesOperationSettings;
144   }
145 
146   /** Returns the object with the settings used for calls to asyncBatchAnnotateFiles. */
147   public UnaryCallSettings<AsyncBatchAnnotateFilesRequest, Operation>
asyncBatchAnnotateFilesSettings()148       asyncBatchAnnotateFilesSettings() {
149     return asyncBatchAnnotateFilesSettings;
150   }
151 
152   /** Returns the object with the settings used for calls to asyncBatchAnnotateFiles. */
153   public OperationCallSettings<
154           AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
asyncBatchAnnotateFilesOperationSettings()155       asyncBatchAnnotateFilesOperationSettings() {
156     return asyncBatchAnnotateFilesOperationSettings;
157   }
158 
createStub()159   public ImageAnnotatorStub createStub() throws IOException {
160     if (getTransportChannelProvider()
161         .getTransportName()
162         .equals(GrpcTransportChannel.getGrpcTransportName())) {
163       return GrpcImageAnnotatorStub.create(this);
164     }
165     if (getTransportChannelProvider()
166         .getTransportName()
167         .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
168       return HttpJsonImageAnnotatorStub.create(this);
169     }
170     throw new UnsupportedOperationException(
171         String.format(
172             "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
173   }
174 
175   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()176   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
177     return InstantiatingExecutorProvider.newBuilder();
178   }
179 
180   /** Returns the default service endpoint. */
getDefaultEndpoint()181   public static String getDefaultEndpoint() {
182     return "vision.googleapis.com:443";
183   }
184 
185   /** Returns the default mTLS service endpoint. */
getDefaultMtlsEndpoint()186   public static String getDefaultMtlsEndpoint() {
187     return "vision.mtls.googleapis.com:443";
188   }
189 
190   /** Returns the default service scopes. */
getDefaultServiceScopes()191   public static List<String> getDefaultServiceScopes() {
192     return DEFAULT_SERVICE_SCOPES;
193   }
194 
195   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()196   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
197     return GoogleCredentialsProvider.newBuilder()
198         .setScopesToApply(DEFAULT_SERVICE_SCOPES)
199         .setUseJwtAccessWithScope(true);
200   }
201 
202   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()203   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
204     return InstantiatingGrpcChannelProvider.newBuilder()
205         .setMaxInboundMessageSize(Integer.MAX_VALUE);
206   }
207 
208   /** Returns a builder for the default REST ChannelProvider for this service. */
209   @BetaApi
210   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()211       defaultHttpJsonTransportProviderBuilder() {
212     return InstantiatingHttpJsonChannelProvider.newBuilder();
213   }
214 
defaultTransportChannelProvider()215   public static TransportChannelProvider defaultTransportChannelProvider() {
216     return defaultGrpcTransportProviderBuilder().build();
217   }
218 
219   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultGrpcApiClientHeaderProviderBuilder()220   public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
221     return ApiClientHeaderProvider.newBuilder()
222         .setGeneratedLibToken(
223             "gapic", GaxProperties.getLibraryVersion(ImageAnnotatorStubSettings.class))
224         .setTransportToken(
225             GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
226   }
227 
228   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultHttpJsonApiClientHeaderProviderBuilder()229   public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
230     return ApiClientHeaderProvider.newBuilder()
231         .setGeneratedLibToken(
232             "gapic", GaxProperties.getLibraryVersion(ImageAnnotatorStubSettings.class))
233         .setTransportToken(
234             GaxHttpJsonProperties.getHttpJsonTokenName(),
235             GaxHttpJsonProperties.getHttpJsonVersion());
236   }
237 
defaultApiClientHeaderProviderBuilder()238   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
239     return ImageAnnotatorStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
240   }
241 
242   /** Returns a new gRPC builder for this class. */
newBuilder()243   public static Builder newBuilder() {
244     return Builder.createDefault();
245   }
246 
247   /** Returns a new REST builder for this class. */
newHttpJsonBuilder()248   public static Builder newHttpJsonBuilder() {
249     return Builder.createHttpJsonDefault();
250   }
251 
252   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)253   public static Builder newBuilder(ClientContext clientContext) {
254     return new Builder(clientContext);
255   }
256 
257   /** Returns a builder containing all the values of this settings class. */
toBuilder()258   public Builder toBuilder() {
259     return new Builder(this);
260   }
261 
ImageAnnotatorStubSettings(Builder settingsBuilder)262   protected ImageAnnotatorStubSettings(Builder settingsBuilder) throws IOException {
263     super(settingsBuilder);
264 
265     batchAnnotateImagesSettings = settingsBuilder.batchAnnotateImagesSettings().build();
266     batchAnnotateFilesSettings = settingsBuilder.batchAnnotateFilesSettings().build();
267     asyncBatchAnnotateImagesSettings = settingsBuilder.asyncBatchAnnotateImagesSettings().build();
268     asyncBatchAnnotateImagesOperationSettings =
269         settingsBuilder.asyncBatchAnnotateImagesOperationSettings().build();
270     asyncBatchAnnotateFilesSettings = settingsBuilder.asyncBatchAnnotateFilesSettings().build();
271     asyncBatchAnnotateFilesOperationSettings =
272         settingsBuilder.asyncBatchAnnotateFilesOperationSettings().build();
273   }
274 
275   /** Builder for ImageAnnotatorStubSettings. */
276   public static class Builder extends StubSettings.Builder<ImageAnnotatorStubSettings, Builder> {
277     private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
278     private final UnaryCallSettings.Builder<BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>
279         batchAnnotateImagesSettings;
280     private final UnaryCallSettings.Builder<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>
281         batchAnnotateFilesSettings;
282     private final UnaryCallSettings.Builder<AsyncBatchAnnotateImagesRequest, Operation>
283         asyncBatchAnnotateImagesSettings;
284     private final OperationCallSettings.Builder<
285             AsyncBatchAnnotateImagesRequest, AsyncBatchAnnotateImagesResponse, OperationMetadata>
286         asyncBatchAnnotateImagesOperationSettings;
287     private final UnaryCallSettings.Builder<AsyncBatchAnnotateFilesRequest, Operation>
288         asyncBatchAnnotateFilesSettings;
289     private final OperationCallSettings.Builder<
290             AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
291         asyncBatchAnnotateFilesOperationSettings;
292     private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
293         RETRYABLE_CODE_DEFINITIONS;
294 
295     static {
296       ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
297           ImmutableMap.builder();
298       definitions.put(
299           "retry_policy_0_codes",
300           ImmutableSet.copyOf(
301               Lists.<StatusCode.Code>newArrayList(
302                   StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
303       RETRYABLE_CODE_DEFINITIONS = definitions.build();
304     }
305 
306     private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
307 
308     static {
309       ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
310       RetrySettings settings = null;
311       settings =
312           RetrySettings.newBuilder()
313               .setInitialRetryDelay(Duration.ofMillis(100L))
314               .setRetryDelayMultiplier(1.3)
315               .setMaxRetryDelay(Duration.ofMillis(60000L))
316               .setInitialRpcTimeout(Duration.ofMillis(600000L))
317               .setRpcTimeoutMultiplier(1.0)
318               .setMaxRpcTimeout(Duration.ofMillis(600000L))
319               .setTotalTimeout(Duration.ofMillis(600000L))
320               .build();
321       definitions.put("retry_policy_0_params", settings);
322       RETRY_PARAM_DEFINITIONS = definitions.build();
323     }
324 
Builder()325     protected Builder() {
326       this(((ClientContext) null));
327     }
328 
Builder(ClientContext clientContext)329     protected Builder(ClientContext clientContext) {
330       super(clientContext);
331 
332       batchAnnotateImagesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
333       batchAnnotateFilesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
334       asyncBatchAnnotateImagesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
335       asyncBatchAnnotateImagesOperationSettings = OperationCallSettings.newBuilder();
336       asyncBatchAnnotateFilesSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
337       asyncBatchAnnotateFilesOperationSettings = OperationCallSettings.newBuilder();
338 
339       unaryMethodSettingsBuilders =
340           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
341               batchAnnotateImagesSettings,
342               batchAnnotateFilesSettings,
343               asyncBatchAnnotateImagesSettings,
344               asyncBatchAnnotateFilesSettings);
345       initDefaults(this);
346     }
347 
Builder(ImageAnnotatorStubSettings settings)348     protected Builder(ImageAnnotatorStubSettings settings) {
349       super(settings);
350 
351       batchAnnotateImagesSettings = settings.batchAnnotateImagesSettings.toBuilder();
352       batchAnnotateFilesSettings = settings.batchAnnotateFilesSettings.toBuilder();
353       asyncBatchAnnotateImagesSettings = settings.asyncBatchAnnotateImagesSettings.toBuilder();
354       asyncBatchAnnotateImagesOperationSettings =
355           settings.asyncBatchAnnotateImagesOperationSettings.toBuilder();
356       asyncBatchAnnotateFilesSettings = settings.asyncBatchAnnotateFilesSettings.toBuilder();
357       asyncBatchAnnotateFilesOperationSettings =
358           settings.asyncBatchAnnotateFilesOperationSettings.toBuilder();
359 
360       unaryMethodSettingsBuilders =
361           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
362               batchAnnotateImagesSettings,
363               batchAnnotateFilesSettings,
364               asyncBatchAnnotateImagesSettings,
365               asyncBatchAnnotateFilesSettings);
366     }
367 
createDefault()368     private static Builder createDefault() {
369       Builder builder = new Builder(((ClientContext) null));
370 
371       builder.setTransportChannelProvider(defaultTransportChannelProvider());
372       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
373       builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
374       builder.setEndpoint(getDefaultEndpoint());
375       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
376       builder.setSwitchToMtlsEndpointAllowed(true);
377 
378       return initDefaults(builder);
379     }
380 
createHttpJsonDefault()381     private static Builder createHttpJsonDefault() {
382       Builder builder = new Builder(((ClientContext) null));
383 
384       builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
385       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
386       builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
387       builder.setEndpoint(getDefaultEndpoint());
388       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
389       builder.setSwitchToMtlsEndpointAllowed(true);
390 
391       return initDefaults(builder);
392     }
393 
initDefaults(Builder builder)394     private static Builder initDefaults(Builder builder) {
395       builder
396           .batchAnnotateImagesSettings()
397           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
398           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
399 
400       builder
401           .batchAnnotateFilesSettings()
402           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
403           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
404 
405       builder
406           .asyncBatchAnnotateImagesSettings()
407           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
408           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
409 
410       builder
411           .asyncBatchAnnotateFilesSettings()
412           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
413           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));
414 
415       builder
416           .asyncBatchAnnotateImagesOperationSettings()
417           .setInitialCallSettings(
418               UnaryCallSettings
419                   .<AsyncBatchAnnotateImagesRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
420                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
421                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
422                   .build())
423           .setResponseTransformer(
424               ProtoOperationTransformers.ResponseTransformer.create(
425                   AsyncBatchAnnotateImagesResponse.class))
426           .setMetadataTransformer(
427               ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
428           .setPollingAlgorithm(
429               OperationTimedPollAlgorithm.create(
430                   RetrySettings.newBuilder()
431                       .setInitialRetryDelay(Duration.ofMillis(20000L))
432                       .setRetryDelayMultiplier(1.5)
433                       .setMaxRetryDelay(Duration.ofMillis(45000L))
434                       .setInitialRpcTimeout(Duration.ZERO)
435                       .setRpcTimeoutMultiplier(1.0)
436                       .setMaxRpcTimeout(Duration.ZERO)
437                       .setTotalTimeout(Duration.ofMillis(86400000L))
438                       .build()));
439 
440       builder
441           .asyncBatchAnnotateFilesOperationSettings()
442           .setInitialCallSettings(
443               UnaryCallSettings
444                   .<AsyncBatchAnnotateFilesRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
445                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
446                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
447                   .build())
448           .setResponseTransformer(
449               ProtoOperationTransformers.ResponseTransformer.create(
450                   AsyncBatchAnnotateFilesResponse.class))
451           .setMetadataTransformer(
452               ProtoOperationTransformers.MetadataTransformer.create(OperationMetadata.class))
453           .setPollingAlgorithm(
454               OperationTimedPollAlgorithm.create(
455                   RetrySettings.newBuilder()
456                       .setInitialRetryDelay(Duration.ofMillis(20000L))
457                       .setRetryDelayMultiplier(1.5)
458                       .setMaxRetryDelay(Duration.ofMillis(45000L))
459                       .setInitialRpcTimeout(Duration.ZERO)
460                       .setRpcTimeoutMultiplier(1.0)
461                       .setMaxRpcTimeout(Duration.ZERO)
462                       .setTotalTimeout(Duration.ofMillis(86400000L))
463                       .build()));
464 
465       return builder;
466     }
467 
468     /**
469      * Applies the given settings updater function to all of the unary API methods in this service.
470      *
471      * <p>Note: This method does not support applying settings to streaming methods.
472      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)473     public Builder applyToAllUnaryMethods(
474         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
475       super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
476       return this;
477     }
478 
unaryMethodSettingsBuilders()479     public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
480       return unaryMethodSettingsBuilders;
481     }
482 
483     /** Returns the builder for the settings used for calls to batchAnnotateImages. */
484     public UnaryCallSettings.Builder<BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>
batchAnnotateImagesSettings()485         batchAnnotateImagesSettings() {
486       return batchAnnotateImagesSettings;
487     }
488 
489     /** Returns the builder for the settings used for calls to batchAnnotateFiles. */
490     public UnaryCallSettings.Builder<BatchAnnotateFilesRequest, BatchAnnotateFilesResponse>
batchAnnotateFilesSettings()491         batchAnnotateFilesSettings() {
492       return batchAnnotateFilesSettings;
493     }
494 
495     /** Returns the builder for the settings used for calls to asyncBatchAnnotateImages. */
496     public UnaryCallSettings.Builder<AsyncBatchAnnotateImagesRequest, Operation>
asyncBatchAnnotateImagesSettings()497         asyncBatchAnnotateImagesSettings() {
498       return asyncBatchAnnotateImagesSettings;
499     }
500 
501     /** Returns the builder for the settings used for calls to asyncBatchAnnotateImages. */
502     @BetaApi(
503         "The surface for use by generated code is not stable yet and may change in the future.")
504     public OperationCallSettings.Builder<
505             AsyncBatchAnnotateImagesRequest, AsyncBatchAnnotateImagesResponse, OperationMetadata>
asyncBatchAnnotateImagesOperationSettings()506         asyncBatchAnnotateImagesOperationSettings() {
507       return asyncBatchAnnotateImagesOperationSettings;
508     }
509 
510     /** Returns the builder for the settings used for calls to asyncBatchAnnotateFiles. */
511     public UnaryCallSettings.Builder<AsyncBatchAnnotateFilesRequest, Operation>
asyncBatchAnnotateFilesSettings()512         asyncBatchAnnotateFilesSettings() {
513       return asyncBatchAnnotateFilesSettings;
514     }
515 
516     /** Returns the builder for the settings used for calls to asyncBatchAnnotateFiles. */
517     @BetaApi(
518         "The surface for use by generated code is not stable yet and may change in the future.")
519     public OperationCallSettings.Builder<
520             AsyncBatchAnnotateFilesRequest, AsyncBatchAnnotateFilesResponse, OperationMetadata>
asyncBatchAnnotateFilesOperationSettings()521         asyncBatchAnnotateFilesOperationSettings() {
522       return asyncBatchAnnotateFilesOperationSettings;
523     }
524 
525     @Override
build()526     public ImageAnnotatorStubSettings build() throws IOException {
527       return new ImageAnnotatorStubSettings(this);
528     }
529   }
530 }
531