• 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.retail.v2;
18 
19 import static com.google.cloud.retail.v2.ProductServiceClient.ListProductsPagedResponse;
20 
21 import com.google.api.core.ApiFunction;
22 import com.google.api.core.BetaApi;
23 import com.google.api.gax.core.GoogleCredentialsProvider;
24 import com.google.api.gax.core.InstantiatingExecutorProvider;
25 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
26 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
27 import com.google.api.gax.rpc.ApiClientHeaderProvider;
28 import com.google.api.gax.rpc.ClientContext;
29 import com.google.api.gax.rpc.ClientSettings;
30 import com.google.api.gax.rpc.OperationCallSettings;
31 import com.google.api.gax.rpc.PagedCallSettings;
32 import com.google.api.gax.rpc.TransportChannelProvider;
33 import com.google.api.gax.rpc.UnaryCallSettings;
34 import com.google.cloud.retail.v2.stub.ProductServiceStubSettings;
35 import com.google.longrunning.Operation;
36 import com.google.protobuf.Empty;
37 import java.io.IOException;
38 import java.util.List;
39 import javax.annotation.Generated;
40 
41 // AUTO-GENERATED DOCUMENTATION AND CLASS.
42 /**
43  * Settings class to configure an instance of {@link ProductServiceClient}.
44  *
45  * <p>The default instance has everything set to sensible defaults:
46  *
47  * <ul>
48  *   <li>The default service address (retail.googleapis.com) and default port (443) are used.
49  *   <li>Credentials are acquired automatically through Application Default Credentials.
50  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
51  * </ul>
52  *
53  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
54  * build() is called, the tree of builders is called to create the complete settings object.
55  *
56  * <p>For example, to set the total timeout of createProduct to 30 seconds:
57  *
58  * <pre>{@code
59  * // This snippet has been automatically generated and should be regarded as a code template only.
60  * // It will require modifications to work:
61  * // - It may require correct/in-range values for request initialization.
62  * // - It may require specifying regional endpoints when creating the service client as shown in
63  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
64  * ProductServiceSettings.Builder productServiceSettingsBuilder =
65  *     ProductServiceSettings.newBuilder();
66  * productServiceSettingsBuilder
67  *     .createProductSettings()
68  *     .setRetrySettings(
69  *         productServiceSettingsBuilder
70  *             .createProductSettings()
71  *             .getRetrySettings()
72  *             .toBuilder()
73  *             .setTotalTimeout(Duration.ofSeconds(30))
74  *             .build());
75  * ProductServiceSettings productServiceSettings = productServiceSettingsBuilder.build();
76  * }</pre>
77  */
78 @Generated("by gapic-generator-java")
79 public class ProductServiceSettings extends ClientSettings<ProductServiceSettings> {
80 
81   /** Returns the object with the settings used for calls to createProduct. */
createProductSettings()82   public UnaryCallSettings<CreateProductRequest, Product> createProductSettings() {
83     return ((ProductServiceStubSettings) getStubSettings()).createProductSettings();
84   }
85 
86   /** Returns the object with the settings used for calls to getProduct. */
getProductSettings()87   public UnaryCallSettings<GetProductRequest, Product> getProductSettings() {
88     return ((ProductServiceStubSettings) getStubSettings()).getProductSettings();
89   }
90 
91   /** Returns the object with the settings used for calls to listProducts. */
92   public PagedCallSettings<ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
listProductsSettings()93       listProductsSettings() {
94     return ((ProductServiceStubSettings) getStubSettings()).listProductsSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to updateProduct. */
updateProductSettings()98   public UnaryCallSettings<UpdateProductRequest, Product> updateProductSettings() {
99     return ((ProductServiceStubSettings) getStubSettings()).updateProductSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to deleteProduct. */
deleteProductSettings()103   public UnaryCallSettings<DeleteProductRequest, Empty> deleteProductSettings() {
104     return ((ProductServiceStubSettings) getStubSettings()).deleteProductSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to importProducts. */
importProductsSettings()108   public UnaryCallSettings<ImportProductsRequest, Operation> importProductsSettings() {
109     return ((ProductServiceStubSettings) getStubSettings()).importProductsSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to importProducts. */
113   public OperationCallSettings<ImportProductsRequest, ImportProductsResponse, ImportMetadata>
importProductsOperationSettings()114       importProductsOperationSettings() {
115     return ((ProductServiceStubSettings) getStubSettings()).importProductsOperationSettings();
116   }
117 
118   /** Returns the object with the settings used for calls to setInventory. */
setInventorySettings()119   public UnaryCallSettings<SetInventoryRequest, Operation> setInventorySettings() {
120     return ((ProductServiceStubSettings) getStubSettings()).setInventorySettings();
121   }
122 
123   /** Returns the object with the settings used for calls to setInventory. */
124   public OperationCallSettings<SetInventoryRequest, SetInventoryResponse, SetInventoryMetadata>
setInventoryOperationSettings()125       setInventoryOperationSettings() {
126     return ((ProductServiceStubSettings) getStubSettings()).setInventoryOperationSettings();
127   }
128 
129   /** Returns the object with the settings used for calls to addFulfillmentPlaces. */
addFulfillmentPlacesSettings()130   public UnaryCallSettings<AddFulfillmentPlacesRequest, Operation> addFulfillmentPlacesSettings() {
131     return ((ProductServiceStubSettings) getStubSettings()).addFulfillmentPlacesSettings();
132   }
133 
134   /** Returns the object with the settings used for calls to addFulfillmentPlaces. */
135   public OperationCallSettings<
136           AddFulfillmentPlacesRequest, AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata>
addFulfillmentPlacesOperationSettings()137       addFulfillmentPlacesOperationSettings() {
138     return ((ProductServiceStubSettings) getStubSettings()).addFulfillmentPlacesOperationSettings();
139   }
140 
141   /** Returns the object with the settings used for calls to removeFulfillmentPlaces. */
142   public UnaryCallSettings<RemoveFulfillmentPlacesRequest, Operation>
removeFulfillmentPlacesSettings()143       removeFulfillmentPlacesSettings() {
144     return ((ProductServiceStubSettings) getStubSettings()).removeFulfillmentPlacesSettings();
145   }
146 
147   /** Returns the object with the settings used for calls to removeFulfillmentPlaces. */
148   public OperationCallSettings<
149           RemoveFulfillmentPlacesRequest,
150           RemoveFulfillmentPlacesResponse,
151           RemoveFulfillmentPlacesMetadata>
removeFulfillmentPlacesOperationSettings()152       removeFulfillmentPlacesOperationSettings() {
153     return ((ProductServiceStubSettings) getStubSettings())
154         .removeFulfillmentPlacesOperationSettings();
155   }
156 
157   /** Returns the object with the settings used for calls to addLocalInventories. */
addLocalInventoriesSettings()158   public UnaryCallSettings<AddLocalInventoriesRequest, Operation> addLocalInventoriesSettings() {
159     return ((ProductServiceStubSettings) getStubSettings()).addLocalInventoriesSettings();
160   }
161 
162   /** Returns the object with the settings used for calls to addLocalInventories. */
163   public OperationCallSettings<
164           AddLocalInventoriesRequest, AddLocalInventoriesResponse, AddLocalInventoriesMetadata>
addLocalInventoriesOperationSettings()165       addLocalInventoriesOperationSettings() {
166     return ((ProductServiceStubSettings) getStubSettings()).addLocalInventoriesOperationSettings();
167   }
168 
169   /** Returns the object with the settings used for calls to removeLocalInventories. */
170   public UnaryCallSettings<RemoveLocalInventoriesRequest, Operation>
removeLocalInventoriesSettings()171       removeLocalInventoriesSettings() {
172     return ((ProductServiceStubSettings) getStubSettings()).removeLocalInventoriesSettings();
173   }
174 
175   /** Returns the object with the settings used for calls to removeLocalInventories. */
176   public OperationCallSettings<
177           RemoveLocalInventoriesRequest,
178           RemoveLocalInventoriesResponse,
179           RemoveLocalInventoriesMetadata>
removeLocalInventoriesOperationSettings()180       removeLocalInventoriesOperationSettings() {
181     return ((ProductServiceStubSettings) getStubSettings())
182         .removeLocalInventoriesOperationSettings();
183   }
184 
create(ProductServiceStubSettings stub)185   public static final ProductServiceSettings create(ProductServiceStubSettings stub)
186       throws IOException {
187     return new ProductServiceSettings.Builder(stub.toBuilder()).build();
188   }
189 
190   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()191   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
192     return ProductServiceStubSettings.defaultExecutorProviderBuilder();
193   }
194 
195   /** Returns the default service endpoint. */
getDefaultEndpoint()196   public static String getDefaultEndpoint() {
197     return ProductServiceStubSettings.getDefaultEndpoint();
198   }
199 
200   /** Returns the default service scopes. */
getDefaultServiceScopes()201   public static List<String> getDefaultServiceScopes() {
202     return ProductServiceStubSettings.getDefaultServiceScopes();
203   }
204 
205   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()206   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
207     return ProductServiceStubSettings.defaultCredentialsProviderBuilder();
208   }
209 
210   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()211   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
212     return ProductServiceStubSettings.defaultGrpcTransportProviderBuilder();
213   }
214 
215   /** Returns a builder for the default REST ChannelProvider for this service. */
216   @BetaApi
217   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()218       defaultHttpJsonTransportProviderBuilder() {
219     return ProductServiceStubSettings.defaultHttpJsonTransportProviderBuilder();
220   }
221 
defaultTransportChannelProvider()222   public static TransportChannelProvider defaultTransportChannelProvider() {
223     return ProductServiceStubSettings.defaultTransportChannelProvider();
224   }
225 
226   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()227   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
228     return ProductServiceStubSettings.defaultApiClientHeaderProviderBuilder();
229   }
230 
231   /** Returns a new gRPC builder for this class. */
newBuilder()232   public static Builder newBuilder() {
233     return Builder.createDefault();
234   }
235 
236   /** Returns a new REST builder for this class. */
237   @BetaApi
newHttpJsonBuilder()238   public static Builder newHttpJsonBuilder() {
239     return Builder.createHttpJsonDefault();
240   }
241 
242   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)243   public static Builder newBuilder(ClientContext clientContext) {
244     return new Builder(clientContext);
245   }
246 
247   /** Returns a builder containing all the values of this settings class. */
toBuilder()248   public Builder toBuilder() {
249     return new Builder(this);
250   }
251 
ProductServiceSettings(Builder settingsBuilder)252   protected ProductServiceSettings(Builder settingsBuilder) throws IOException {
253     super(settingsBuilder);
254   }
255 
256   /** Builder for ProductServiceSettings. */
257   public static class Builder extends ClientSettings.Builder<ProductServiceSettings, Builder> {
258 
Builder()259     protected Builder() throws IOException {
260       this(((ClientContext) null));
261     }
262 
Builder(ClientContext clientContext)263     protected Builder(ClientContext clientContext) {
264       super(ProductServiceStubSettings.newBuilder(clientContext));
265     }
266 
Builder(ProductServiceSettings settings)267     protected Builder(ProductServiceSettings settings) {
268       super(settings.getStubSettings().toBuilder());
269     }
270 
Builder(ProductServiceStubSettings.Builder stubSettings)271     protected Builder(ProductServiceStubSettings.Builder stubSettings) {
272       super(stubSettings);
273     }
274 
createDefault()275     private static Builder createDefault() {
276       return new Builder(ProductServiceStubSettings.newBuilder());
277     }
278 
279     @BetaApi
createHttpJsonDefault()280     private static Builder createHttpJsonDefault() {
281       return new Builder(ProductServiceStubSettings.newHttpJsonBuilder());
282     }
283 
getStubSettingsBuilder()284     public ProductServiceStubSettings.Builder getStubSettingsBuilder() {
285       return ((ProductServiceStubSettings.Builder) getStubSettings());
286     }
287 
288     /**
289      * Applies the given settings updater function to all of the unary API methods in this service.
290      *
291      * <p>Note: This method does not support applying settings to streaming methods.
292      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)293     public Builder applyToAllUnaryMethods(
294         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
295       super.applyToAllUnaryMethods(
296           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
297       return this;
298     }
299 
300     /** Returns the builder for the settings used for calls to createProduct. */
createProductSettings()301     public UnaryCallSettings.Builder<CreateProductRequest, Product> createProductSettings() {
302       return getStubSettingsBuilder().createProductSettings();
303     }
304 
305     /** Returns the builder for the settings used for calls to getProduct. */
getProductSettings()306     public UnaryCallSettings.Builder<GetProductRequest, Product> getProductSettings() {
307       return getStubSettingsBuilder().getProductSettings();
308     }
309 
310     /** Returns the builder for the settings used for calls to listProducts. */
311     public PagedCallSettings.Builder<
312             ListProductsRequest, ListProductsResponse, ListProductsPagedResponse>
listProductsSettings()313         listProductsSettings() {
314       return getStubSettingsBuilder().listProductsSettings();
315     }
316 
317     /** Returns the builder for the settings used for calls to updateProduct. */
updateProductSettings()318     public UnaryCallSettings.Builder<UpdateProductRequest, Product> updateProductSettings() {
319       return getStubSettingsBuilder().updateProductSettings();
320     }
321 
322     /** Returns the builder for the settings used for calls to deleteProduct. */
deleteProductSettings()323     public UnaryCallSettings.Builder<DeleteProductRequest, Empty> deleteProductSettings() {
324       return getStubSettingsBuilder().deleteProductSettings();
325     }
326 
327     /** Returns the builder for the settings used for calls to importProducts. */
importProductsSettings()328     public UnaryCallSettings.Builder<ImportProductsRequest, Operation> importProductsSettings() {
329       return getStubSettingsBuilder().importProductsSettings();
330     }
331 
332     /** Returns the builder for the settings used for calls to importProducts. */
333     public OperationCallSettings.Builder<
334             ImportProductsRequest, ImportProductsResponse, ImportMetadata>
importProductsOperationSettings()335         importProductsOperationSettings() {
336       return getStubSettingsBuilder().importProductsOperationSettings();
337     }
338 
339     /** Returns the builder for the settings used for calls to setInventory. */
setInventorySettings()340     public UnaryCallSettings.Builder<SetInventoryRequest, Operation> setInventorySettings() {
341       return getStubSettingsBuilder().setInventorySettings();
342     }
343 
344     /** Returns the builder for the settings used for calls to setInventory. */
345     public OperationCallSettings.Builder<
346             SetInventoryRequest, SetInventoryResponse, SetInventoryMetadata>
setInventoryOperationSettings()347         setInventoryOperationSettings() {
348       return getStubSettingsBuilder().setInventoryOperationSettings();
349     }
350 
351     /** Returns the builder for the settings used for calls to addFulfillmentPlaces. */
352     public UnaryCallSettings.Builder<AddFulfillmentPlacesRequest, Operation>
addFulfillmentPlacesSettings()353         addFulfillmentPlacesSettings() {
354       return getStubSettingsBuilder().addFulfillmentPlacesSettings();
355     }
356 
357     /** Returns the builder for the settings used for calls to addFulfillmentPlaces. */
358     public OperationCallSettings.Builder<
359             AddFulfillmentPlacesRequest, AddFulfillmentPlacesResponse, AddFulfillmentPlacesMetadata>
addFulfillmentPlacesOperationSettings()360         addFulfillmentPlacesOperationSettings() {
361       return getStubSettingsBuilder().addFulfillmentPlacesOperationSettings();
362     }
363 
364     /** Returns the builder for the settings used for calls to removeFulfillmentPlaces. */
365     public UnaryCallSettings.Builder<RemoveFulfillmentPlacesRequest, Operation>
removeFulfillmentPlacesSettings()366         removeFulfillmentPlacesSettings() {
367       return getStubSettingsBuilder().removeFulfillmentPlacesSettings();
368     }
369 
370     /** Returns the builder for the settings used for calls to removeFulfillmentPlaces. */
371     public OperationCallSettings.Builder<
372             RemoveFulfillmentPlacesRequest,
373             RemoveFulfillmentPlacesResponse,
374             RemoveFulfillmentPlacesMetadata>
removeFulfillmentPlacesOperationSettings()375         removeFulfillmentPlacesOperationSettings() {
376       return getStubSettingsBuilder().removeFulfillmentPlacesOperationSettings();
377     }
378 
379     /** Returns the builder for the settings used for calls to addLocalInventories. */
380     public UnaryCallSettings.Builder<AddLocalInventoriesRequest, Operation>
addLocalInventoriesSettings()381         addLocalInventoriesSettings() {
382       return getStubSettingsBuilder().addLocalInventoriesSettings();
383     }
384 
385     /** Returns the builder for the settings used for calls to addLocalInventories. */
386     public OperationCallSettings.Builder<
387             AddLocalInventoriesRequest, AddLocalInventoriesResponse, AddLocalInventoriesMetadata>
addLocalInventoriesOperationSettings()388         addLocalInventoriesOperationSettings() {
389       return getStubSettingsBuilder().addLocalInventoriesOperationSettings();
390     }
391 
392     /** Returns the builder for the settings used for calls to removeLocalInventories. */
393     public UnaryCallSettings.Builder<RemoveLocalInventoriesRequest, Operation>
removeLocalInventoriesSettings()394         removeLocalInventoriesSettings() {
395       return getStubSettingsBuilder().removeLocalInventoriesSettings();
396     }
397 
398     /** Returns the builder for the settings used for calls to removeLocalInventories. */
399     public OperationCallSettings.Builder<
400             RemoveLocalInventoriesRequest,
401             RemoveLocalInventoriesResponse,
402             RemoveLocalInventoriesMetadata>
removeLocalInventoriesOperationSettings()403         removeLocalInventoriesOperationSettings() {
404       return getStubSettingsBuilder().removeLocalInventoriesOperationSettings();
405     }
406 
407     @Override
build()408     public ProductServiceSettings build() throws IOException {
409       return new ProductServiceSettings(this);
410     }
411   }
412 }
413