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