• 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.speech.v1p1beta1;
18 
19 import static com.google.cloud.speech.v1p1beta1.AdaptationClient.ListCustomClassesPagedResponse;
20 import static com.google.cloud.speech.v1p1beta1.AdaptationClient.ListPhraseSetPagedResponse;
21 
22 import com.google.api.core.ApiFunction;
23 import com.google.api.core.BetaApi;
24 import com.google.api.gax.core.GoogleCredentialsProvider;
25 import com.google.api.gax.core.InstantiatingExecutorProvider;
26 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
27 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
28 import com.google.api.gax.rpc.ApiClientHeaderProvider;
29 import com.google.api.gax.rpc.ClientContext;
30 import com.google.api.gax.rpc.ClientSettings;
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.speech.v1p1beta1.stub.AdaptationStubSettings;
35 import com.google.protobuf.Empty;
36 import java.io.IOException;
37 import java.util.List;
38 import javax.annotation.Generated;
39 
40 // AUTO-GENERATED DOCUMENTATION AND CLASS.
41 /**
42  * Settings class to configure an instance of {@link AdaptationClient}.
43  *
44  * <p>The default instance has everything set to sensible defaults:
45  *
46  * <ul>
47  *   <li>The default service address (speech.googleapis.com) and default port (443) are used.
48  *   <li>Credentials are acquired automatically through Application Default Credentials.
49  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
50  * </ul>
51  *
52  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
53  * build() is called, the tree of builders is called to create the complete settings object.
54  *
55  * <p>For example, to set the total timeout of createPhraseSet to 30 seconds:
56  *
57  * <pre>{@code
58  * // This snippet has been automatically generated and should be regarded as a code template only.
59  * // It will require modifications to work:
60  * // - It may require correct/in-range values for request initialization.
61  * // - It may require specifying regional endpoints when creating the service client as shown in
62  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
63  * AdaptationSettings.Builder adaptationSettingsBuilder = AdaptationSettings.newBuilder();
64  * adaptationSettingsBuilder
65  *     .createPhraseSetSettings()
66  *     .setRetrySettings(
67  *         adaptationSettingsBuilder
68  *             .createPhraseSetSettings()
69  *             .getRetrySettings()
70  *             .toBuilder()
71  *             .setTotalTimeout(Duration.ofSeconds(30))
72  *             .build());
73  * AdaptationSettings adaptationSettings = adaptationSettingsBuilder.build();
74  * }</pre>
75  */
76 @BetaApi
77 @Generated("by gapic-generator-java")
78 public class AdaptationSettings extends ClientSettings<AdaptationSettings> {
79 
80   /** Returns the object with the settings used for calls to createPhraseSet. */
createPhraseSetSettings()81   public UnaryCallSettings<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() {
82     return ((AdaptationStubSettings) getStubSettings()).createPhraseSetSettings();
83   }
84 
85   /** Returns the object with the settings used for calls to getPhraseSet. */
getPhraseSetSettings()86   public UnaryCallSettings<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() {
87     return ((AdaptationStubSettings) getStubSettings()).getPhraseSetSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to listPhraseSet. */
91   public PagedCallSettings<ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse>
listPhraseSetSettings()92       listPhraseSetSettings() {
93     return ((AdaptationStubSettings) getStubSettings()).listPhraseSetSettings();
94   }
95 
96   /** Returns the object with the settings used for calls to updatePhraseSet. */
updatePhraseSetSettings()97   public UnaryCallSettings<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() {
98     return ((AdaptationStubSettings) getStubSettings()).updatePhraseSetSettings();
99   }
100 
101   /** Returns the object with the settings used for calls to deletePhraseSet. */
deletePhraseSetSettings()102   public UnaryCallSettings<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() {
103     return ((AdaptationStubSettings) getStubSettings()).deletePhraseSetSettings();
104   }
105 
106   /** Returns the object with the settings used for calls to createCustomClass. */
createCustomClassSettings()107   public UnaryCallSettings<CreateCustomClassRequest, CustomClass> createCustomClassSettings() {
108     return ((AdaptationStubSettings) getStubSettings()).createCustomClassSettings();
109   }
110 
111   /** Returns the object with the settings used for calls to getCustomClass. */
getCustomClassSettings()112   public UnaryCallSettings<GetCustomClassRequest, CustomClass> getCustomClassSettings() {
113     return ((AdaptationStubSettings) getStubSettings()).getCustomClassSettings();
114   }
115 
116   /** Returns the object with the settings used for calls to listCustomClasses. */
117   public PagedCallSettings<
118           ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse>
listCustomClassesSettings()119       listCustomClassesSettings() {
120     return ((AdaptationStubSettings) getStubSettings()).listCustomClassesSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to updateCustomClass. */
updateCustomClassSettings()124   public UnaryCallSettings<UpdateCustomClassRequest, CustomClass> updateCustomClassSettings() {
125     return ((AdaptationStubSettings) getStubSettings()).updateCustomClassSettings();
126   }
127 
128   /** Returns the object with the settings used for calls to deleteCustomClass. */
deleteCustomClassSettings()129   public UnaryCallSettings<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() {
130     return ((AdaptationStubSettings) getStubSettings()).deleteCustomClassSettings();
131   }
132 
create(AdaptationStubSettings stub)133   public static final AdaptationSettings create(AdaptationStubSettings stub) throws IOException {
134     return new AdaptationSettings.Builder(stub.toBuilder()).build();
135   }
136 
137   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()138   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
139     return AdaptationStubSettings.defaultExecutorProviderBuilder();
140   }
141 
142   /** Returns the default service endpoint. */
getDefaultEndpoint()143   public static String getDefaultEndpoint() {
144     return AdaptationStubSettings.getDefaultEndpoint();
145   }
146 
147   /** Returns the default service scopes. */
getDefaultServiceScopes()148   public static List<String> getDefaultServiceScopes() {
149     return AdaptationStubSettings.getDefaultServiceScopes();
150   }
151 
152   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()153   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
154     return AdaptationStubSettings.defaultCredentialsProviderBuilder();
155   }
156 
157   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()158   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
159     return AdaptationStubSettings.defaultGrpcTransportProviderBuilder();
160   }
161 
162   /** Returns a builder for the default REST ChannelProvider for this service. */
163   @BetaApi
164   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()165       defaultHttpJsonTransportProviderBuilder() {
166     return AdaptationStubSettings.defaultHttpJsonTransportProviderBuilder();
167   }
168 
defaultTransportChannelProvider()169   public static TransportChannelProvider defaultTransportChannelProvider() {
170     return AdaptationStubSettings.defaultTransportChannelProvider();
171   }
172 
173   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()174   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
175     return AdaptationStubSettings.defaultApiClientHeaderProviderBuilder();
176   }
177 
178   /** Returns a new gRPC builder for this class. */
newBuilder()179   public static Builder newBuilder() {
180     return Builder.createDefault();
181   }
182 
183   /** Returns a new REST builder for this class. */
184   @BetaApi
newHttpJsonBuilder()185   public static Builder newHttpJsonBuilder() {
186     return Builder.createHttpJsonDefault();
187   }
188 
189   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)190   public static Builder newBuilder(ClientContext clientContext) {
191     return new Builder(clientContext);
192   }
193 
194   /** Returns a builder containing all the values of this settings class. */
toBuilder()195   public Builder toBuilder() {
196     return new Builder(this);
197   }
198 
AdaptationSettings(Builder settingsBuilder)199   protected AdaptationSettings(Builder settingsBuilder) throws IOException {
200     super(settingsBuilder);
201   }
202 
203   /** Builder for AdaptationSettings. */
204   public static class Builder extends ClientSettings.Builder<AdaptationSettings, Builder> {
205 
Builder()206     protected Builder() throws IOException {
207       this(((ClientContext) null));
208     }
209 
Builder(ClientContext clientContext)210     protected Builder(ClientContext clientContext) {
211       super(AdaptationStubSettings.newBuilder(clientContext));
212     }
213 
Builder(AdaptationSettings settings)214     protected Builder(AdaptationSettings settings) {
215       super(settings.getStubSettings().toBuilder());
216     }
217 
Builder(AdaptationStubSettings.Builder stubSettings)218     protected Builder(AdaptationStubSettings.Builder stubSettings) {
219       super(stubSettings);
220     }
221 
createDefault()222     private static Builder createDefault() {
223       return new Builder(AdaptationStubSettings.newBuilder());
224     }
225 
226     @BetaApi
createHttpJsonDefault()227     private static Builder createHttpJsonDefault() {
228       return new Builder(AdaptationStubSettings.newHttpJsonBuilder());
229     }
230 
getStubSettingsBuilder()231     public AdaptationStubSettings.Builder getStubSettingsBuilder() {
232       return ((AdaptationStubSettings.Builder) getStubSettings());
233     }
234 
235     /**
236      * Applies the given settings updater function to all of the unary API methods in this service.
237      *
238      * <p>Note: This method does not support applying settings to streaming methods.
239      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)240     public Builder applyToAllUnaryMethods(
241         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
242       super.applyToAllUnaryMethods(
243           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
244       return this;
245     }
246 
247     /** Returns the builder for the settings used for calls to createPhraseSet. */
createPhraseSetSettings()248     public UnaryCallSettings.Builder<CreatePhraseSetRequest, PhraseSet> createPhraseSetSettings() {
249       return getStubSettingsBuilder().createPhraseSetSettings();
250     }
251 
252     /** Returns the builder for the settings used for calls to getPhraseSet. */
getPhraseSetSettings()253     public UnaryCallSettings.Builder<GetPhraseSetRequest, PhraseSet> getPhraseSetSettings() {
254       return getStubSettingsBuilder().getPhraseSetSettings();
255     }
256 
257     /** Returns the builder for the settings used for calls to listPhraseSet. */
258     public PagedCallSettings.Builder<
259             ListPhraseSetRequest, ListPhraseSetResponse, ListPhraseSetPagedResponse>
listPhraseSetSettings()260         listPhraseSetSettings() {
261       return getStubSettingsBuilder().listPhraseSetSettings();
262     }
263 
264     /** Returns the builder for the settings used for calls to updatePhraseSet. */
updatePhraseSetSettings()265     public UnaryCallSettings.Builder<UpdatePhraseSetRequest, PhraseSet> updatePhraseSetSettings() {
266       return getStubSettingsBuilder().updatePhraseSetSettings();
267     }
268 
269     /** Returns the builder for the settings used for calls to deletePhraseSet. */
deletePhraseSetSettings()270     public UnaryCallSettings.Builder<DeletePhraseSetRequest, Empty> deletePhraseSetSettings() {
271       return getStubSettingsBuilder().deletePhraseSetSettings();
272     }
273 
274     /** Returns the builder for the settings used for calls to createCustomClass. */
275     public UnaryCallSettings.Builder<CreateCustomClassRequest, CustomClass>
createCustomClassSettings()276         createCustomClassSettings() {
277       return getStubSettingsBuilder().createCustomClassSettings();
278     }
279 
280     /** Returns the builder for the settings used for calls to getCustomClass. */
getCustomClassSettings()281     public UnaryCallSettings.Builder<GetCustomClassRequest, CustomClass> getCustomClassSettings() {
282       return getStubSettingsBuilder().getCustomClassSettings();
283     }
284 
285     /** Returns the builder for the settings used for calls to listCustomClasses. */
286     public PagedCallSettings.Builder<
287             ListCustomClassesRequest, ListCustomClassesResponse, ListCustomClassesPagedResponse>
listCustomClassesSettings()288         listCustomClassesSettings() {
289       return getStubSettingsBuilder().listCustomClassesSettings();
290     }
291 
292     /** Returns the builder for the settings used for calls to updateCustomClass. */
293     public UnaryCallSettings.Builder<UpdateCustomClassRequest, CustomClass>
updateCustomClassSettings()294         updateCustomClassSettings() {
295       return getStubSettingsBuilder().updateCustomClassSettings();
296     }
297 
298     /** Returns the builder for the settings used for calls to deleteCustomClass. */
deleteCustomClassSettings()299     public UnaryCallSettings.Builder<DeleteCustomClassRequest, Empty> deleteCustomClassSettings() {
300       return getStubSettingsBuilder().deleteCustomClassSettings();
301     }
302 
303     @Override
build()304     public AdaptationSettings build() throws IOException {
305       return new AdaptationSettings(this);
306     }
307   }
308 }
309