• 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 static com.google.cloud.vision.v1.ProductSearchClient.ListProductSetsPagedResponse;
20 import static com.google.cloud.vision.v1.ProductSearchClient.ListProductsInProductSetPagedResponse;
21 import static com.google.cloud.vision.v1.ProductSearchClient.ListProductsPagedResponse;
22 import static com.google.cloud.vision.v1.ProductSearchClient.ListReferenceImagesPagedResponse;
23 
24 import com.google.api.core.ApiFunction;
25 import com.google.api.core.ApiFuture;
26 import com.google.api.core.BetaApi;
27 import com.google.api.gax.core.GaxProperties;
28 import com.google.api.gax.core.GoogleCredentialsProvider;
29 import com.google.api.gax.core.InstantiatingExecutorProvider;
30 import com.google.api.gax.grpc.GaxGrpcProperties;
31 import com.google.api.gax.grpc.GrpcTransportChannel;
32 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
33 import com.google.api.gax.grpc.ProtoOperationTransformers;
34 import com.google.api.gax.httpjson.GaxHttpJsonProperties;
35 import com.google.api.gax.httpjson.HttpJsonTransportChannel;
36 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
37 import com.google.api.gax.longrunning.OperationSnapshot;
38 import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
39 import com.google.api.gax.retrying.RetrySettings;
40 import com.google.api.gax.rpc.ApiCallContext;
41 import com.google.api.gax.rpc.ApiClientHeaderProvider;
42 import com.google.api.gax.rpc.ClientContext;
43 import com.google.api.gax.rpc.OperationCallSettings;
44 import com.google.api.gax.rpc.PageContext;
45 import com.google.api.gax.rpc.PagedCallSettings;
46 import com.google.api.gax.rpc.PagedListDescriptor;
47 import com.google.api.gax.rpc.PagedListResponseFactory;
48 import com.google.api.gax.rpc.StatusCode;
49 import com.google.api.gax.rpc.StubSettings;
50 import com.google.api.gax.rpc.TransportChannelProvider;
51 import com.google.api.gax.rpc.UnaryCallSettings;
52 import com.google.api.gax.rpc.UnaryCallable;
53 import com.google.cloud.vision.v1.AddProductToProductSetRequest;
54 import com.google.cloud.vision.v1.BatchOperationMetadata;
55 import com.google.cloud.vision.v1.CreateProductRequest;
56 import com.google.cloud.vision.v1.CreateProductSetRequest;
57 import com.google.cloud.vision.v1.CreateReferenceImageRequest;
58 import com.google.cloud.vision.v1.DeleteProductRequest;
59 import com.google.cloud.vision.v1.DeleteProductSetRequest;
60 import com.google.cloud.vision.v1.DeleteReferenceImageRequest;
61 import com.google.cloud.vision.v1.GetProductRequest;
62 import com.google.cloud.vision.v1.GetProductSetRequest;
63 import com.google.cloud.vision.v1.GetReferenceImageRequest;
64 import com.google.cloud.vision.v1.ImportProductSetsRequest;
65 import com.google.cloud.vision.v1.ImportProductSetsResponse;
66 import com.google.cloud.vision.v1.ListProductSetsRequest;
67 import com.google.cloud.vision.v1.ListProductSetsResponse;
68 import com.google.cloud.vision.v1.ListProductsInProductSetRequest;
69 import com.google.cloud.vision.v1.ListProductsInProductSetResponse;
70 import com.google.cloud.vision.v1.ListProductsRequest;
71 import com.google.cloud.vision.v1.ListProductsResponse;
72 import com.google.cloud.vision.v1.ListReferenceImagesRequest;
73 import com.google.cloud.vision.v1.ListReferenceImagesResponse;
74 import com.google.cloud.vision.v1.Product;
75 import com.google.cloud.vision.v1.ProductSet;
76 import com.google.cloud.vision.v1.PurgeProductsRequest;
77 import com.google.cloud.vision.v1.ReferenceImage;
78 import com.google.cloud.vision.v1.RemoveProductFromProductSetRequest;
79 import com.google.cloud.vision.v1.UpdateProductRequest;
80 import com.google.cloud.vision.v1.UpdateProductSetRequest;
81 import com.google.common.collect.ImmutableList;
82 import com.google.common.collect.ImmutableMap;
83 import com.google.common.collect.ImmutableSet;
84 import com.google.common.collect.Lists;
85 import com.google.longrunning.Operation;
86 import com.google.protobuf.Empty;
87 import java.io.IOException;
88 import java.util.List;
89 import javax.annotation.Generated;
90 import org.threeten.bp.Duration;
91 
92 // AUTO-GENERATED DOCUMENTATION AND CLASS.
93 /**
94  * Settings class to configure an instance of {@link ProductSearchStub}.
95  *
96  * <p>The default instance has everything set to sensible defaults:
97  *
98  * <ul>
99  *   <li>The default service address (vision.googleapis.com) and default port (443) are used.
100  *   <li>Credentials are acquired automatically through Application Default Credentials.
101  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
102  * </ul>
103  *
104  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
105  * build() is called, the tree of builders is called to create the complete settings object.
106  *
107  * <p>For example, to set the total timeout of createProductSet to 30 seconds:
108  *
109  * <pre>{@code
110  * // This snippet has been automatically generated and should be regarded as a code template only.
111  * // It will require modifications to work:
112  * // - It may require correct/in-range values for request initialization.
113  * // - It may require specifying regional endpoints when creating the service client as shown in
114  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
115  * ProductSearchStubSettings.Builder productSearchSettingsBuilder =
116  *     ProductSearchStubSettings.newBuilder();
117  * productSearchSettingsBuilder
118  *     .createProductSetSettings()
119  *     .setRetrySettings(
120  *         productSearchSettingsBuilder
121  *             .createProductSetSettings()
122  *             .getRetrySettings()
123  *             .toBuilder()
124  *             .setTotalTimeout(Duration.ofSeconds(30))
125  *             .build());
126  * ProductSearchStubSettings productSearchSettings = productSearchSettingsBuilder.build();
127  * }</pre>
128  */
129 @Generated("by gapic-generator-java")
130 public class ProductSearchStubSettings extends StubSettings<ProductSearchStubSettings> {
131   /** The default scopes of the service. */
132   private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
133       ImmutableList.<String>builder()
134           .add("https://www.googleapis.com/auth/cloud-platform")
135           .add("https://www.googleapis.com/auth/cloud-vision")
136           .build();
137 
138   private final UnaryCallSettings<CreateProductSetRequest, ProductSet> createProductSetSettings;
139   private final PagedCallSettings<
140           ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>
141       listProductSetsSettings;
142   private final UnaryCallSettings<GetProductSetRequest, ProductSet> getProductSetSettings;
143   private final UnaryCallSettings<UpdateProductSetRequest, ProductSet> updateProductSetSettings;
144   private final UnaryCallSettings<DeleteProductSetRequest, Empty> deleteProductSetSettings;
145   private final UnaryCallSettings<CreateProductRequest, Product> createProductSettings;
146   private final PagedCallSettings<
147           ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
148       listProductsSettings;
149   private final UnaryCallSettings<GetProductRequest, Product> getProductSettings;
150   private final UnaryCallSettings<UpdateProductRequest, Product> updateProductSettings;
151   private final UnaryCallSettings<DeleteProductRequest, Empty> deleteProductSettings;
152   private final UnaryCallSettings<CreateReferenceImageRequest, ReferenceImage>
153       createReferenceImageSettings;
154   private final UnaryCallSettings<DeleteReferenceImageRequest, Empty> deleteReferenceImageSettings;
155   private final PagedCallSettings<
156           ListReferenceImagesRequest, ListReferenceImagesResponse, ListReferenceImagesPagedResponse>
157       listReferenceImagesSettings;
158   private final UnaryCallSettings<GetReferenceImageRequest, ReferenceImage>
159       getReferenceImageSettings;
160   private final UnaryCallSettings<AddProductToProductSetRequest, Empty>
161       addProductToProductSetSettings;
162   private final UnaryCallSettings<RemoveProductFromProductSetRequest, Empty>
163       removeProductFromProductSetSettings;
164   private final PagedCallSettings<
165           ListProductsInProductSetRequest,
166           ListProductsInProductSetResponse,
167           ListProductsInProductSetPagedResponse>
168       listProductsInProductSetSettings;
169   private final UnaryCallSettings<ImportProductSetsRequest, Operation> importProductSetsSettings;
170   private final OperationCallSettings<
171           ImportProductSetsRequest, ImportProductSetsResponse, BatchOperationMetadata>
172       importProductSetsOperationSettings;
173   private final UnaryCallSettings<PurgeProductsRequest, Operation> purgeProductsSettings;
174   private final OperationCallSettings<PurgeProductsRequest, Empty, BatchOperationMetadata>
175       purgeProductsOperationSettings;
176 
177   private static final PagedListDescriptor<
178           ListProductSetsRequest, ListProductSetsResponse, ProductSet>
179       LIST_PRODUCT_SETS_PAGE_STR_DESC =
180           new PagedListDescriptor<ListProductSetsRequest, ListProductSetsResponse, ProductSet>() {
181             @Override
182             public String emptyToken() {
183               return "";
184             }
185 
186             @Override
187             public ListProductSetsRequest injectToken(
188                 ListProductSetsRequest payload, String token) {
189               return ListProductSetsRequest.newBuilder(payload).setPageToken(token).build();
190             }
191 
192             @Override
193             public ListProductSetsRequest injectPageSize(
194                 ListProductSetsRequest payload, int pageSize) {
195               return ListProductSetsRequest.newBuilder(payload).setPageSize(pageSize).build();
196             }
197 
198             @Override
199             public Integer extractPageSize(ListProductSetsRequest payload) {
200               return payload.getPageSize();
201             }
202 
203             @Override
204             public String extractNextToken(ListProductSetsResponse payload) {
205               return payload.getNextPageToken();
206             }
207 
208             @Override
209             public Iterable<ProductSet> extractResources(ListProductSetsResponse payload) {
210               return payload.getProductSetsList() == null
211                   ? ImmutableList.<ProductSet>of()
212                   : payload.getProductSetsList();
213             }
214           };
215 
216   private static final PagedListDescriptor<ListProductsRequest, ListProductsResponse, Product>
217       LIST_PRODUCTS_PAGE_STR_DESC =
218           new PagedListDescriptor<ListProductsRequest, ListProductsResponse, Product>() {
219             @Override
220             public String emptyToken() {
221               return "";
222             }
223 
224             @Override
225             public ListProductsRequest injectToken(ListProductsRequest payload, String token) {
226               return ListProductsRequest.newBuilder(payload).setPageToken(token).build();
227             }
228 
229             @Override
230             public ListProductsRequest injectPageSize(ListProductsRequest payload, int pageSize) {
231               return ListProductsRequest.newBuilder(payload).setPageSize(pageSize).build();
232             }
233 
234             @Override
235             public Integer extractPageSize(ListProductsRequest payload) {
236               return payload.getPageSize();
237             }
238 
239             @Override
240             public String extractNextToken(ListProductsResponse payload) {
241               return payload.getNextPageToken();
242             }
243 
244             @Override
245             public Iterable<Product> extractResources(ListProductsResponse payload) {
246               return payload.getProductsList() == null
247                   ? ImmutableList.<Product>of()
248                   : payload.getProductsList();
249             }
250           };
251 
252   private static final PagedListDescriptor<
253           ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
254       LIST_REFERENCE_IMAGES_PAGE_STR_DESC =
255           new PagedListDescriptor<
256               ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>() {
257             @Override
258             public String emptyToken() {
259               return "";
260             }
261 
262             @Override
263             public ListReferenceImagesRequest injectToken(
264                 ListReferenceImagesRequest payload, String token) {
265               return ListReferenceImagesRequest.newBuilder(payload).setPageToken(token).build();
266             }
267 
268             @Override
269             public ListReferenceImagesRequest injectPageSize(
270                 ListReferenceImagesRequest payload, int pageSize) {
271               return ListReferenceImagesRequest.newBuilder(payload).setPageSize(pageSize).build();
272             }
273 
274             @Override
275             public Integer extractPageSize(ListReferenceImagesRequest payload) {
276               return payload.getPageSize();
277             }
278 
279             @Override
280             public String extractNextToken(ListReferenceImagesResponse payload) {
281               return payload.getNextPageToken();
282             }
283 
284             @Override
285             public Iterable<ReferenceImage> extractResources(ListReferenceImagesResponse payload) {
286               return payload.getReferenceImagesList() == null
287                   ? ImmutableList.<ReferenceImage>of()
288                   : payload.getReferenceImagesList();
289             }
290           };
291 
292   private static final PagedListDescriptor<
293           ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
294       LIST_PRODUCTS_IN_PRODUCT_SET_PAGE_STR_DESC =
295           new PagedListDescriptor<
296               ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>() {
297             @Override
298             public String emptyToken() {
299               return "";
300             }
301 
302             @Override
303             public ListProductsInProductSetRequest injectToken(
304                 ListProductsInProductSetRequest payload, String token) {
305               return ListProductsInProductSetRequest.newBuilder(payload)
306                   .setPageToken(token)
307                   .build();
308             }
309 
310             @Override
311             public ListProductsInProductSetRequest injectPageSize(
312                 ListProductsInProductSetRequest payload, int pageSize) {
313               return ListProductsInProductSetRequest.newBuilder(payload)
314                   .setPageSize(pageSize)
315                   .build();
316             }
317 
318             @Override
319             public Integer extractPageSize(ListProductsInProductSetRequest payload) {
320               return payload.getPageSize();
321             }
322 
323             @Override
324             public String extractNextToken(ListProductsInProductSetResponse payload) {
325               return payload.getNextPageToken();
326             }
327 
328             @Override
329             public Iterable<Product> extractResources(ListProductsInProductSetResponse payload) {
330               return payload.getProductsList() == null
331                   ? ImmutableList.<Product>of()
332                   : payload.getProductsList();
333             }
334           };
335 
336   private static final PagedListResponseFactory<
337           ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>
338       LIST_PRODUCT_SETS_PAGE_STR_FACT =
339           new PagedListResponseFactory<
340               ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>() {
341             @Override
342             public ApiFuture<ListProductSetsPagedResponse> getFuturePagedResponse(
343                 UnaryCallable<ListProductSetsRequest, ListProductSetsResponse> callable,
344                 ListProductSetsRequest request,
345                 ApiCallContext context,
346                 ApiFuture<ListProductSetsResponse> futureResponse) {
347               PageContext<ListProductSetsRequest, ListProductSetsResponse, ProductSet> pageContext =
348                   PageContext.create(callable, LIST_PRODUCT_SETS_PAGE_STR_DESC, request, context);
349               return ListProductSetsPagedResponse.createAsync(pageContext, futureResponse);
350             }
351           };
352 
353   private static final PagedListResponseFactory<
354           ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
355       LIST_PRODUCTS_PAGE_STR_FACT =
356           new PagedListResponseFactory<
357               ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>() {
358             @Override
359             public ApiFuture<ListProductsPagedResponse> getFuturePagedResponse(
360                 UnaryCallable<ListProductsRequest, ListProductsResponse> callable,
361                 ListProductsRequest request,
362                 ApiCallContext context,
363                 ApiFuture<ListProductsResponse> futureResponse) {
364               PageContext<ListProductsRequest, ListProductsResponse, Product> pageContext =
365                   PageContext.create(callable, LIST_PRODUCTS_PAGE_STR_DESC, request, context);
366               return ListProductsPagedResponse.createAsync(pageContext, futureResponse);
367             }
368           };
369 
370   private static final PagedListResponseFactory<
371           ListReferenceImagesRequest, ListReferenceImagesResponse, ListReferenceImagesPagedResponse>
372       LIST_REFERENCE_IMAGES_PAGE_STR_FACT =
373           new PagedListResponseFactory<
374               ListReferenceImagesRequest,
375               ListReferenceImagesResponse,
376               ListReferenceImagesPagedResponse>() {
377             @Override
378             public ApiFuture<ListReferenceImagesPagedResponse> getFuturePagedResponse(
379                 UnaryCallable<ListReferenceImagesRequest, ListReferenceImagesResponse> callable,
380                 ListReferenceImagesRequest request,
381                 ApiCallContext context,
382                 ApiFuture<ListReferenceImagesResponse> futureResponse) {
383               PageContext<ListReferenceImagesRequest, ListReferenceImagesResponse, ReferenceImage>
384                   pageContext =
385                       PageContext.create(
386                           callable, LIST_REFERENCE_IMAGES_PAGE_STR_DESC, request, context);
387               return ListReferenceImagesPagedResponse.createAsync(pageContext, futureResponse);
388             }
389           };
390 
391   private static final PagedListResponseFactory<
392           ListProductsInProductSetRequest,
393           ListProductsInProductSetResponse,
394           ListProductsInProductSetPagedResponse>
395       LIST_PRODUCTS_IN_PRODUCT_SET_PAGE_STR_FACT =
396           new PagedListResponseFactory<
397               ListProductsInProductSetRequest,
398               ListProductsInProductSetResponse,
399               ListProductsInProductSetPagedResponse>() {
400             @Override
401             public ApiFuture<ListProductsInProductSetPagedResponse> getFuturePagedResponse(
402                 UnaryCallable<ListProductsInProductSetRequest, ListProductsInProductSetResponse>
403                     callable,
404                 ListProductsInProductSetRequest request,
405                 ApiCallContext context,
406                 ApiFuture<ListProductsInProductSetResponse> futureResponse) {
407               PageContext<
408                       ListProductsInProductSetRequest, ListProductsInProductSetResponse, Product>
409                   pageContext =
410                       PageContext.create(
411                           callable, LIST_PRODUCTS_IN_PRODUCT_SET_PAGE_STR_DESC, request, context);
412               return ListProductsInProductSetPagedResponse.createAsync(pageContext, futureResponse);
413             }
414           };
415 
416   /** Returns the object with the settings used for calls to createProductSet. */
createProductSetSettings()417   public UnaryCallSettings<CreateProductSetRequest, ProductSet> createProductSetSettings() {
418     return createProductSetSettings;
419   }
420 
421   /** Returns the object with the settings used for calls to listProductSets. */
422   public PagedCallSettings<
423           ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>
listProductSetsSettings()424       listProductSetsSettings() {
425     return listProductSetsSettings;
426   }
427 
428   /** Returns the object with the settings used for calls to getProductSet. */
getProductSetSettings()429   public UnaryCallSettings<GetProductSetRequest, ProductSet> getProductSetSettings() {
430     return getProductSetSettings;
431   }
432 
433   /** Returns the object with the settings used for calls to updateProductSet. */
updateProductSetSettings()434   public UnaryCallSettings<UpdateProductSetRequest, ProductSet> updateProductSetSettings() {
435     return updateProductSetSettings;
436   }
437 
438   /** Returns the object with the settings used for calls to deleteProductSet. */
deleteProductSetSettings()439   public UnaryCallSettings<DeleteProductSetRequest, Empty> deleteProductSetSettings() {
440     return deleteProductSetSettings;
441   }
442 
443   /** Returns the object with the settings used for calls to createProduct. */
createProductSettings()444   public UnaryCallSettings<CreateProductRequest, Product> createProductSettings() {
445     return createProductSettings;
446   }
447 
448   /** Returns the object with the settings used for calls to listProducts. */
449   public PagedCallSettings<ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
listProductsSettings()450       listProductsSettings() {
451     return listProductsSettings;
452   }
453 
454   /** Returns the object with the settings used for calls to getProduct. */
getProductSettings()455   public UnaryCallSettings<GetProductRequest, Product> getProductSettings() {
456     return getProductSettings;
457   }
458 
459   /** Returns the object with the settings used for calls to updateProduct. */
updateProductSettings()460   public UnaryCallSettings<UpdateProductRequest, Product> updateProductSettings() {
461     return updateProductSettings;
462   }
463 
464   /** Returns the object with the settings used for calls to deleteProduct. */
deleteProductSettings()465   public UnaryCallSettings<DeleteProductRequest, Empty> deleteProductSettings() {
466     return deleteProductSettings;
467   }
468 
469   /** Returns the object with the settings used for calls to createReferenceImage. */
470   public UnaryCallSettings<CreateReferenceImageRequest, ReferenceImage>
createReferenceImageSettings()471       createReferenceImageSettings() {
472     return createReferenceImageSettings;
473   }
474 
475   /** Returns the object with the settings used for calls to deleteReferenceImage. */
deleteReferenceImageSettings()476   public UnaryCallSettings<DeleteReferenceImageRequest, Empty> deleteReferenceImageSettings() {
477     return deleteReferenceImageSettings;
478   }
479 
480   /** Returns the object with the settings used for calls to listReferenceImages. */
481   public PagedCallSettings<
482           ListReferenceImagesRequest, ListReferenceImagesResponse, ListReferenceImagesPagedResponse>
listReferenceImagesSettings()483       listReferenceImagesSettings() {
484     return listReferenceImagesSettings;
485   }
486 
487   /** Returns the object with the settings used for calls to getReferenceImage. */
getReferenceImageSettings()488   public UnaryCallSettings<GetReferenceImageRequest, ReferenceImage> getReferenceImageSettings() {
489     return getReferenceImageSettings;
490   }
491 
492   /** Returns the object with the settings used for calls to addProductToProductSet. */
addProductToProductSetSettings()493   public UnaryCallSettings<AddProductToProductSetRequest, Empty> addProductToProductSetSettings() {
494     return addProductToProductSetSettings;
495   }
496 
497   /** Returns the object with the settings used for calls to removeProductFromProductSet. */
498   public UnaryCallSettings<RemoveProductFromProductSetRequest, Empty>
removeProductFromProductSetSettings()499       removeProductFromProductSetSettings() {
500     return removeProductFromProductSetSettings;
501   }
502 
503   /** Returns the object with the settings used for calls to listProductsInProductSet. */
504   public PagedCallSettings<
505           ListProductsInProductSetRequest,
506           ListProductsInProductSetResponse,
507           ListProductsInProductSetPagedResponse>
listProductsInProductSetSettings()508       listProductsInProductSetSettings() {
509     return listProductsInProductSetSettings;
510   }
511 
512   /** Returns the object with the settings used for calls to importProductSets. */
importProductSetsSettings()513   public UnaryCallSettings<ImportProductSetsRequest, Operation> importProductSetsSettings() {
514     return importProductSetsSettings;
515   }
516 
517   /** Returns the object with the settings used for calls to importProductSets. */
518   public OperationCallSettings<
519           ImportProductSetsRequest, ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsOperationSettings()520       importProductSetsOperationSettings() {
521     return importProductSetsOperationSettings;
522   }
523 
524   /** Returns the object with the settings used for calls to purgeProducts. */
purgeProductsSettings()525   public UnaryCallSettings<PurgeProductsRequest, Operation> purgeProductsSettings() {
526     return purgeProductsSettings;
527   }
528 
529   /** Returns the object with the settings used for calls to purgeProducts. */
530   public OperationCallSettings<PurgeProductsRequest, Empty, BatchOperationMetadata>
purgeProductsOperationSettings()531       purgeProductsOperationSettings() {
532     return purgeProductsOperationSettings;
533   }
534 
createStub()535   public ProductSearchStub createStub() throws IOException {
536     if (getTransportChannelProvider()
537         .getTransportName()
538         .equals(GrpcTransportChannel.getGrpcTransportName())) {
539       return GrpcProductSearchStub.create(this);
540     }
541     if (getTransportChannelProvider()
542         .getTransportName()
543         .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) {
544       return HttpJsonProductSearchStub.create(this);
545     }
546     throw new UnsupportedOperationException(
547         String.format(
548             "Transport not supported: %s", getTransportChannelProvider().getTransportName()));
549   }
550 
551   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()552   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
553     return InstantiatingExecutorProvider.newBuilder();
554   }
555 
556   /** Returns the default service endpoint. */
getDefaultEndpoint()557   public static String getDefaultEndpoint() {
558     return "vision.googleapis.com:443";
559   }
560 
561   /** Returns the default mTLS service endpoint. */
getDefaultMtlsEndpoint()562   public static String getDefaultMtlsEndpoint() {
563     return "vision.mtls.googleapis.com:443";
564   }
565 
566   /** Returns the default service scopes. */
getDefaultServiceScopes()567   public static List<String> getDefaultServiceScopes() {
568     return DEFAULT_SERVICE_SCOPES;
569   }
570 
571   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()572   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
573     return GoogleCredentialsProvider.newBuilder()
574         .setScopesToApply(DEFAULT_SERVICE_SCOPES)
575         .setUseJwtAccessWithScope(true);
576   }
577 
578   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()579   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
580     return InstantiatingGrpcChannelProvider.newBuilder()
581         .setMaxInboundMessageSize(Integer.MAX_VALUE);
582   }
583 
584   /** Returns a builder for the default REST ChannelProvider for this service. */
585   @BetaApi
586   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()587       defaultHttpJsonTransportProviderBuilder() {
588     return InstantiatingHttpJsonChannelProvider.newBuilder();
589   }
590 
defaultTransportChannelProvider()591   public static TransportChannelProvider defaultTransportChannelProvider() {
592     return defaultGrpcTransportProviderBuilder().build();
593   }
594 
595   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultGrpcApiClientHeaderProviderBuilder()596   public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() {
597     return ApiClientHeaderProvider.newBuilder()
598         .setGeneratedLibToken(
599             "gapic", GaxProperties.getLibraryVersion(ProductSearchStubSettings.class))
600         .setTransportToken(
601             GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
602   }
603 
604   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultHttpJsonApiClientHeaderProviderBuilder()605   public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() {
606     return ApiClientHeaderProvider.newBuilder()
607         .setGeneratedLibToken(
608             "gapic", GaxProperties.getLibraryVersion(ProductSearchStubSettings.class))
609         .setTransportToken(
610             GaxHttpJsonProperties.getHttpJsonTokenName(),
611             GaxHttpJsonProperties.getHttpJsonVersion());
612   }
613 
defaultApiClientHeaderProviderBuilder()614   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
615     return ProductSearchStubSettings.defaultGrpcApiClientHeaderProviderBuilder();
616   }
617 
618   /** Returns a new gRPC builder for this class. */
newBuilder()619   public static Builder newBuilder() {
620     return Builder.createDefault();
621   }
622 
623   /** Returns a new REST builder for this class. */
newHttpJsonBuilder()624   public static Builder newHttpJsonBuilder() {
625     return Builder.createHttpJsonDefault();
626   }
627 
628   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)629   public static Builder newBuilder(ClientContext clientContext) {
630     return new Builder(clientContext);
631   }
632 
633   /** Returns a builder containing all the values of this settings class. */
toBuilder()634   public Builder toBuilder() {
635     return new Builder(this);
636   }
637 
ProductSearchStubSettings(Builder settingsBuilder)638   protected ProductSearchStubSettings(Builder settingsBuilder) throws IOException {
639     super(settingsBuilder);
640 
641     createProductSetSettings = settingsBuilder.createProductSetSettings().build();
642     listProductSetsSettings = settingsBuilder.listProductSetsSettings().build();
643     getProductSetSettings = settingsBuilder.getProductSetSettings().build();
644     updateProductSetSettings = settingsBuilder.updateProductSetSettings().build();
645     deleteProductSetSettings = settingsBuilder.deleteProductSetSettings().build();
646     createProductSettings = settingsBuilder.createProductSettings().build();
647     listProductsSettings = settingsBuilder.listProductsSettings().build();
648     getProductSettings = settingsBuilder.getProductSettings().build();
649     updateProductSettings = settingsBuilder.updateProductSettings().build();
650     deleteProductSettings = settingsBuilder.deleteProductSettings().build();
651     createReferenceImageSettings = settingsBuilder.createReferenceImageSettings().build();
652     deleteReferenceImageSettings = settingsBuilder.deleteReferenceImageSettings().build();
653     listReferenceImagesSettings = settingsBuilder.listReferenceImagesSettings().build();
654     getReferenceImageSettings = settingsBuilder.getReferenceImageSettings().build();
655     addProductToProductSetSettings = settingsBuilder.addProductToProductSetSettings().build();
656     removeProductFromProductSetSettings =
657         settingsBuilder.removeProductFromProductSetSettings().build();
658     listProductsInProductSetSettings = settingsBuilder.listProductsInProductSetSettings().build();
659     importProductSetsSettings = settingsBuilder.importProductSetsSettings().build();
660     importProductSetsOperationSettings =
661         settingsBuilder.importProductSetsOperationSettings().build();
662     purgeProductsSettings = settingsBuilder.purgeProductsSettings().build();
663     purgeProductsOperationSettings = settingsBuilder.purgeProductsOperationSettings().build();
664   }
665 
666   /** Builder for ProductSearchStubSettings. */
667   public static class Builder extends StubSettings.Builder<ProductSearchStubSettings, Builder> {
668     private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
669     private final UnaryCallSettings.Builder<CreateProductSetRequest, ProductSet>
670         createProductSetSettings;
671     private final PagedCallSettings.Builder<
672             ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>
673         listProductSetsSettings;
674     private final UnaryCallSettings.Builder<GetProductSetRequest, ProductSet> getProductSetSettings;
675     private final UnaryCallSettings.Builder<UpdateProductSetRequest, ProductSet>
676         updateProductSetSettings;
677     private final UnaryCallSettings.Builder<DeleteProductSetRequest, Empty>
678         deleteProductSetSettings;
679     private final UnaryCallSettings.Builder<CreateProductRequest, Product> createProductSettings;
680     private final PagedCallSettings.Builder<
681             ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
682         listProductsSettings;
683     private final UnaryCallSettings.Builder<GetProductRequest, Product> getProductSettings;
684     private final UnaryCallSettings.Builder<UpdateProductRequest, Product> updateProductSettings;
685     private final UnaryCallSettings.Builder<DeleteProductRequest, Empty> deleteProductSettings;
686     private final UnaryCallSettings.Builder<CreateReferenceImageRequest, ReferenceImage>
687         createReferenceImageSettings;
688     private final UnaryCallSettings.Builder<DeleteReferenceImageRequest, Empty>
689         deleteReferenceImageSettings;
690     private final PagedCallSettings.Builder<
691             ListReferenceImagesRequest,
692             ListReferenceImagesResponse,
693             ListReferenceImagesPagedResponse>
694         listReferenceImagesSettings;
695     private final UnaryCallSettings.Builder<GetReferenceImageRequest, ReferenceImage>
696         getReferenceImageSettings;
697     private final UnaryCallSettings.Builder<AddProductToProductSetRequest, Empty>
698         addProductToProductSetSettings;
699     private final UnaryCallSettings.Builder<RemoveProductFromProductSetRequest, Empty>
700         removeProductFromProductSetSettings;
701     private final PagedCallSettings.Builder<
702             ListProductsInProductSetRequest,
703             ListProductsInProductSetResponse,
704             ListProductsInProductSetPagedResponse>
705         listProductsInProductSetSettings;
706     private final UnaryCallSettings.Builder<ImportProductSetsRequest, Operation>
707         importProductSetsSettings;
708     private final OperationCallSettings.Builder<
709             ImportProductSetsRequest, ImportProductSetsResponse, BatchOperationMetadata>
710         importProductSetsOperationSettings;
711     private final UnaryCallSettings.Builder<PurgeProductsRequest, Operation> purgeProductsSettings;
712     private final OperationCallSettings.Builder<PurgeProductsRequest, Empty, BatchOperationMetadata>
713         purgeProductsOperationSettings;
714     private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
715         RETRYABLE_CODE_DEFINITIONS;
716 
717     static {
718       ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
719           ImmutableMap.builder();
720       definitions.put(
721           "retry_policy_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
722       definitions.put(
723           "retry_policy_2_codes",
724           ImmutableSet.copyOf(
725               Lists.<StatusCode.Code>newArrayList(
726                   StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
727       RETRYABLE_CODE_DEFINITIONS = definitions.build();
728     }
729 
730     private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
731 
732     static {
733       ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
734       RetrySettings settings = null;
735       settings =
736           RetrySettings.newBuilder()
737               .setInitialRetryDelay(Duration.ofMillis(100L))
738               .setRetryDelayMultiplier(1.3)
739               .setMaxRetryDelay(Duration.ofMillis(60000L))
740               .setInitialRpcTimeout(Duration.ofMillis(600000L))
741               .setRpcTimeoutMultiplier(1.0)
742               .setMaxRpcTimeout(Duration.ofMillis(600000L))
743               .setTotalTimeout(Duration.ofMillis(600000L))
744               .build();
745       definitions.put("retry_policy_1_params", settings);
746       settings =
747           RetrySettings.newBuilder()
748               .setInitialRetryDelay(Duration.ofMillis(100L))
749               .setRetryDelayMultiplier(1.3)
750               .setMaxRetryDelay(Duration.ofMillis(60000L))
751               .setInitialRpcTimeout(Duration.ofMillis(600000L))
752               .setRpcTimeoutMultiplier(1.0)
753               .setMaxRpcTimeout(Duration.ofMillis(600000L))
754               .setTotalTimeout(Duration.ofMillis(600000L))
755               .build();
756       definitions.put("retry_policy_2_params", settings);
757       RETRY_PARAM_DEFINITIONS = definitions.build();
758     }
759 
Builder()760     protected Builder() {
761       this(((ClientContext) null));
762     }
763 
Builder(ClientContext clientContext)764     protected Builder(ClientContext clientContext) {
765       super(clientContext);
766 
767       createProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
768       listProductSetsSettings = PagedCallSettings.newBuilder(LIST_PRODUCT_SETS_PAGE_STR_FACT);
769       getProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
770       updateProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
771       deleteProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
772       createProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
773       listProductsSettings = PagedCallSettings.newBuilder(LIST_PRODUCTS_PAGE_STR_FACT);
774       getProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
775       updateProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
776       deleteProductSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
777       createReferenceImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
778       deleteReferenceImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
779       listReferenceImagesSettings =
780           PagedCallSettings.newBuilder(LIST_REFERENCE_IMAGES_PAGE_STR_FACT);
781       getReferenceImageSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
782       addProductToProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
783       removeProductFromProductSetSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
784       listProductsInProductSetSettings =
785           PagedCallSettings.newBuilder(LIST_PRODUCTS_IN_PRODUCT_SET_PAGE_STR_FACT);
786       importProductSetsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
787       importProductSetsOperationSettings = OperationCallSettings.newBuilder();
788       purgeProductsSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
789       purgeProductsOperationSettings = OperationCallSettings.newBuilder();
790 
791       unaryMethodSettingsBuilders =
792           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
793               createProductSetSettings,
794               listProductSetsSettings,
795               getProductSetSettings,
796               updateProductSetSettings,
797               deleteProductSetSettings,
798               createProductSettings,
799               listProductsSettings,
800               getProductSettings,
801               updateProductSettings,
802               deleteProductSettings,
803               createReferenceImageSettings,
804               deleteReferenceImageSettings,
805               listReferenceImagesSettings,
806               getReferenceImageSettings,
807               addProductToProductSetSettings,
808               removeProductFromProductSetSettings,
809               listProductsInProductSetSettings,
810               importProductSetsSettings,
811               purgeProductsSettings);
812       initDefaults(this);
813     }
814 
Builder(ProductSearchStubSettings settings)815     protected Builder(ProductSearchStubSettings settings) {
816       super(settings);
817 
818       createProductSetSettings = settings.createProductSetSettings.toBuilder();
819       listProductSetsSettings = settings.listProductSetsSettings.toBuilder();
820       getProductSetSettings = settings.getProductSetSettings.toBuilder();
821       updateProductSetSettings = settings.updateProductSetSettings.toBuilder();
822       deleteProductSetSettings = settings.deleteProductSetSettings.toBuilder();
823       createProductSettings = settings.createProductSettings.toBuilder();
824       listProductsSettings = settings.listProductsSettings.toBuilder();
825       getProductSettings = settings.getProductSettings.toBuilder();
826       updateProductSettings = settings.updateProductSettings.toBuilder();
827       deleteProductSettings = settings.deleteProductSettings.toBuilder();
828       createReferenceImageSettings = settings.createReferenceImageSettings.toBuilder();
829       deleteReferenceImageSettings = settings.deleteReferenceImageSettings.toBuilder();
830       listReferenceImagesSettings = settings.listReferenceImagesSettings.toBuilder();
831       getReferenceImageSettings = settings.getReferenceImageSettings.toBuilder();
832       addProductToProductSetSettings = settings.addProductToProductSetSettings.toBuilder();
833       removeProductFromProductSetSettings =
834           settings.removeProductFromProductSetSettings.toBuilder();
835       listProductsInProductSetSettings = settings.listProductsInProductSetSettings.toBuilder();
836       importProductSetsSettings = settings.importProductSetsSettings.toBuilder();
837       importProductSetsOperationSettings = settings.importProductSetsOperationSettings.toBuilder();
838       purgeProductsSettings = settings.purgeProductsSettings.toBuilder();
839       purgeProductsOperationSettings = settings.purgeProductsOperationSettings.toBuilder();
840 
841       unaryMethodSettingsBuilders =
842           ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
843               createProductSetSettings,
844               listProductSetsSettings,
845               getProductSetSettings,
846               updateProductSetSettings,
847               deleteProductSetSettings,
848               createProductSettings,
849               listProductsSettings,
850               getProductSettings,
851               updateProductSettings,
852               deleteProductSettings,
853               createReferenceImageSettings,
854               deleteReferenceImageSettings,
855               listReferenceImagesSettings,
856               getReferenceImageSettings,
857               addProductToProductSetSettings,
858               removeProductFromProductSetSettings,
859               listProductsInProductSetSettings,
860               importProductSetsSettings,
861               purgeProductsSettings);
862     }
863 
createDefault()864     private static Builder createDefault() {
865       Builder builder = new Builder(((ClientContext) null));
866 
867       builder.setTransportChannelProvider(defaultTransportChannelProvider());
868       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
869       builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
870       builder.setEndpoint(getDefaultEndpoint());
871       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
872       builder.setSwitchToMtlsEndpointAllowed(true);
873 
874       return initDefaults(builder);
875     }
876 
createHttpJsonDefault()877     private static Builder createHttpJsonDefault() {
878       Builder builder = new Builder(((ClientContext) null));
879 
880       builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build());
881       builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
882       builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build());
883       builder.setEndpoint(getDefaultEndpoint());
884       builder.setMtlsEndpoint(getDefaultMtlsEndpoint());
885       builder.setSwitchToMtlsEndpointAllowed(true);
886 
887       return initDefaults(builder);
888     }
889 
initDefaults(Builder builder)890     private static Builder initDefaults(Builder builder) {
891       builder
892           .createProductSetSettings()
893           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
894           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
895 
896       builder
897           .listProductSetsSettings()
898           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
899           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
900 
901       builder
902           .getProductSetSettings()
903           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
904           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
905 
906       builder
907           .updateProductSetSettings()
908           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
909           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
910 
911       builder
912           .deleteProductSetSettings()
913           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
914           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
915 
916       builder
917           .createProductSettings()
918           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
919           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
920 
921       builder
922           .listProductsSettings()
923           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
924           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
925 
926       builder
927           .getProductSettings()
928           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
929           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
930 
931       builder
932           .updateProductSettings()
933           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
934           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
935 
936       builder
937           .deleteProductSettings()
938           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
939           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
940 
941       builder
942           .createReferenceImageSettings()
943           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
944           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
945 
946       builder
947           .deleteReferenceImageSettings()
948           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
949           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
950 
951       builder
952           .listReferenceImagesSettings()
953           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
954           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
955 
956       builder
957           .getReferenceImageSettings()
958           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
959           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
960 
961       builder
962           .addProductToProductSetSettings()
963           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
964           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
965 
966       builder
967           .removeProductFromProductSetSettings()
968           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
969           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
970 
971       builder
972           .listProductsInProductSetSettings()
973           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_2_codes"))
974           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_2_params"));
975 
976       builder
977           .importProductSetsSettings()
978           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
979           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
980 
981       builder
982           .purgeProductsSettings()
983           .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
984           .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
985 
986       builder
987           .importProductSetsOperationSettings()
988           .setInitialCallSettings(
989               UnaryCallSettings
990                   .<ImportProductSetsRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
991                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
992                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
993                   .build())
994           .setResponseTransformer(
995               ProtoOperationTransformers.ResponseTransformer.create(
996                   ImportProductSetsResponse.class))
997           .setMetadataTransformer(
998               ProtoOperationTransformers.MetadataTransformer.create(BatchOperationMetadata.class))
999           .setPollingAlgorithm(
1000               OperationTimedPollAlgorithm.create(
1001                   RetrySettings.newBuilder()
1002                       .setInitialRetryDelay(Duration.ofMillis(20000L))
1003                       .setRetryDelayMultiplier(1.5)
1004                       .setMaxRetryDelay(Duration.ofMillis(45000L))
1005                       .setInitialRpcTimeout(Duration.ZERO)
1006                       .setRpcTimeoutMultiplier(1.0)
1007                       .setMaxRpcTimeout(Duration.ZERO)
1008                       .setTotalTimeout(Duration.ofMillis(86400000L))
1009                       .build()));
1010 
1011       builder
1012           .purgeProductsOperationSettings()
1013           .setInitialCallSettings(
1014               UnaryCallSettings
1015                   .<PurgeProductsRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
1016                   .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
1017                   .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"))
1018                   .build())
1019           .setResponseTransformer(
1020               ProtoOperationTransformers.ResponseTransformer.create(Empty.class))
1021           .setMetadataTransformer(
1022               ProtoOperationTransformers.MetadataTransformer.create(BatchOperationMetadata.class))
1023           .setPollingAlgorithm(
1024               OperationTimedPollAlgorithm.create(
1025                   RetrySettings.newBuilder()
1026                       .setInitialRetryDelay(Duration.ofMillis(20000L))
1027                       .setRetryDelayMultiplier(1.5)
1028                       .setMaxRetryDelay(Duration.ofMillis(45000L))
1029                       .setInitialRpcTimeout(Duration.ZERO)
1030                       .setRpcTimeoutMultiplier(1.0)
1031                       .setMaxRpcTimeout(Duration.ZERO)
1032                       .setTotalTimeout(Duration.ofMillis(86400000L))
1033                       .build()));
1034 
1035       return builder;
1036     }
1037 
1038     /**
1039      * Applies the given settings updater function to all of the unary API methods in this service.
1040      *
1041      * <p>Note: This method does not support applying settings to streaming methods.
1042      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)1043     public Builder applyToAllUnaryMethods(
1044         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
1045       super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
1046       return this;
1047     }
1048 
unaryMethodSettingsBuilders()1049     public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
1050       return unaryMethodSettingsBuilders;
1051     }
1052 
1053     /** Returns the builder for the settings used for calls to createProductSet. */
1054     public UnaryCallSettings.Builder<CreateProductSetRequest, ProductSet>
createProductSetSettings()1055         createProductSetSettings() {
1056       return createProductSetSettings;
1057     }
1058 
1059     /** Returns the builder for the settings used for calls to listProductSets. */
1060     public PagedCallSettings.Builder<
1061             ListProductSetsRequest, ListProductSetsResponse, ListProductSetsPagedResponse>
listProductSetsSettings()1062         listProductSetsSettings() {
1063       return listProductSetsSettings;
1064     }
1065 
1066     /** Returns the builder for the settings used for calls to getProductSet. */
getProductSetSettings()1067     public UnaryCallSettings.Builder<GetProductSetRequest, ProductSet> getProductSetSettings() {
1068       return getProductSetSettings;
1069     }
1070 
1071     /** Returns the builder for the settings used for calls to updateProductSet. */
1072     public UnaryCallSettings.Builder<UpdateProductSetRequest, ProductSet>
updateProductSetSettings()1073         updateProductSetSettings() {
1074       return updateProductSetSettings;
1075     }
1076 
1077     /** Returns the builder for the settings used for calls to deleteProductSet. */
deleteProductSetSettings()1078     public UnaryCallSettings.Builder<DeleteProductSetRequest, Empty> deleteProductSetSettings() {
1079       return deleteProductSetSettings;
1080     }
1081 
1082     /** Returns the builder for the settings used for calls to createProduct. */
createProductSettings()1083     public UnaryCallSettings.Builder<CreateProductRequest, Product> createProductSettings() {
1084       return createProductSettings;
1085     }
1086 
1087     /** Returns the builder for the settings used for calls to listProducts. */
1088     public PagedCallSettings.Builder<
1089             ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
listProductsSettings()1090         listProductsSettings() {
1091       return listProductsSettings;
1092     }
1093 
1094     /** Returns the builder for the settings used for calls to getProduct. */
getProductSettings()1095     public UnaryCallSettings.Builder<GetProductRequest, Product> getProductSettings() {
1096       return getProductSettings;
1097     }
1098 
1099     /** Returns the builder for the settings used for calls to updateProduct. */
updateProductSettings()1100     public UnaryCallSettings.Builder<UpdateProductRequest, Product> updateProductSettings() {
1101       return updateProductSettings;
1102     }
1103 
1104     /** Returns the builder for the settings used for calls to deleteProduct. */
deleteProductSettings()1105     public UnaryCallSettings.Builder<DeleteProductRequest, Empty> deleteProductSettings() {
1106       return deleteProductSettings;
1107     }
1108 
1109     /** Returns the builder for the settings used for calls to createReferenceImage. */
1110     public UnaryCallSettings.Builder<CreateReferenceImageRequest, ReferenceImage>
createReferenceImageSettings()1111         createReferenceImageSettings() {
1112       return createReferenceImageSettings;
1113     }
1114 
1115     /** Returns the builder for the settings used for calls to deleteReferenceImage. */
1116     public UnaryCallSettings.Builder<DeleteReferenceImageRequest, Empty>
deleteReferenceImageSettings()1117         deleteReferenceImageSettings() {
1118       return deleteReferenceImageSettings;
1119     }
1120 
1121     /** Returns the builder for the settings used for calls to listReferenceImages. */
1122     public PagedCallSettings.Builder<
1123             ListReferenceImagesRequest,
1124             ListReferenceImagesResponse,
1125             ListReferenceImagesPagedResponse>
listReferenceImagesSettings()1126         listReferenceImagesSettings() {
1127       return listReferenceImagesSettings;
1128     }
1129 
1130     /** Returns the builder for the settings used for calls to getReferenceImage. */
1131     public UnaryCallSettings.Builder<GetReferenceImageRequest, ReferenceImage>
getReferenceImageSettings()1132         getReferenceImageSettings() {
1133       return getReferenceImageSettings;
1134     }
1135 
1136     /** Returns the builder for the settings used for calls to addProductToProductSet. */
1137     public UnaryCallSettings.Builder<AddProductToProductSetRequest, Empty>
addProductToProductSetSettings()1138         addProductToProductSetSettings() {
1139       return addProductToProductSetSettings;
1140     }
1141 
1142     /** Returns the builder for the settings used for calls to removeProductFromProductSet. */
1143     public UnaryCallSettings.Builder<RemoveProductFromProductSetRequest, Empty>
removeProductFromProductSetSettings()1144         removeProductFromProductSetSettings() {
1145       return removeProductFromProductSetSettings;
1146     }
1147 
1148     /** Returns the builder for the settings used for calls to listProductsInProductSet. */
1149     public PagedCallSettings.Builder<
1150             ListProductsInProductSetRequest,
1151             ListProductsInProductSetResponse,
1152             ListProductsInProductSetPagedResponse>
listProductsInProductSetSettings()1153         listProductsInProductSetSettings() {
1154       return listProductsInProductSetSettings;
1155     }
1156 
1157     /** Returns the builder for the settings used for calls to importProductSets. */
1158     public UnaryCallSettings.Builder<ImportProductSetsRequest, Operation>
importProductSetsSettings()1159         importProductSetsSettings() {
1160       return importProductSetsSettings;
1161     }
1162 
1163     /** Returns the builder for the settings used for calls to importProductSets. */
1164     @BetaApi(
1165         "The surface for use by generated code is not stable yet and may change in the future.")
1166     public OperationCallSettings.Builder<
1167             ImportProductSetsRequest, ImportProductSetsResponse, BatchOperationMetadata>
importProductSetsOperationSettings()1168         importProductSetsOperationSettings() {
1169       return importProductSetsOperationSettings;
1170     }
1171 
1172     /** Returns the builder for the settings used for calls to purgeProducts. */
purgeProductsSettings()1173     public UnaryCallSettings.Builder<PurgeProductsRequest, Operation> purgeProductsSettings() {
1174       return purgeProductsSettings;
1175     }
1176 
1177     /** Returns the builder for the settings used for calls to purgeProducts. */
1178     @BetaApi(
1179         "The surface for use by generated code is not stable yet and may change in the future.")
1180     public OperationCallSettings.Builder<PurgeProductsRequest, Empty, BatchOperationMetadata>
purgeProductsOperationSettings()1181         purgeProductsOperationSettings() {
1182       return purgeProductsOperationSettings;
1183     }
1184 
1185     @Override
build()1186     public ProductSearchStubSettings build() throws IOException {
1187       return new ProductSearchStubSettings(this);
1188     }
1189   }
1190 }
1191