• 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.v2beta1;
18 
19 import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.GetEnvironmentHistoryPagedResponse;
20 import static com.google.cloud.dialogflow.v2beta1.EnvironmentsClient.ListEnvironmentsPagedResponse;
21 import static com.google.cloud.dialogflow.v2beta1.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.v2beta1.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 @BetaApi
82 @Generated("by gapic-generator-java")
83 public class EnvironmentsSettings extends ClientSettings<EnvironmentsSettings> {
84 
85   /** Returns the object with the settings used for calls to listEnvironments. */
86   public PagedCallSettings<
87           ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>
listEnvironmentsSettings()88       listEnvironmentsSettings() {
89     return ((EnvironmentsStubSettings) getStubSettings()).listEnvironmentsSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to getEnvironment. */
getEnvironmentSettings()93   public UnaryCallSettings<GetEnvironmentRequest, Environment> getEnvironmentSettings() {
94     return ((EnvironmentsStubSettings) getStubSettings()).getEnvironmentSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to createEnvironment. */
createEnvironmentSettings()98   public UnaryCallSettings<CreateEnvironmentRequest, Environment> createEnvironmentSettings() {
99     return ((EnvironmentsStubSettings) getStubSettings()).createEnvironmentSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to updateEnvironment. */
updateEnvironmentSettings()103   public UnaryCallSettings<UpdateEnvironmentRequest, Environment> updateEnvironmentSettings() {
104     return ((EnvironmentsStubSettings) getStubSettings()).updateEnvironmentSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to deleteEnvironment. */
deleteEnvironmentSettings()108   public UnaryCallSettings<DeleteEnvironmentRequest, Empty> deleteEnvironmentSettings() {
109     return ((EnvironmentsStubSettings) getStubSettings()).deleteEnvironmentSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to getEnvironmentHistory. */
113   public PagedCallSettings<
114           GetEnvironmentHistoryRequest, EnvironmentHistory, GetEnvironmentHistoryPagedResponse>
getEnvironmentHistorySettings()115       getEnvironmentHistorySettings() {
116     return ((EnvironmentsStubSettings) getStubSettings()).getEnvironmentHistorySettings();
117   }
118 
119   /** Returns the object with the settings used for calls to listLocations. */
120   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()121       listLocationsSettings() {
122     return ((EnvironmentsStubSettings) getStubSettings()).listLocationsSettings();
123   }
124 
125   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()126   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
127     return ((EnvironmentsStubSettings) getStubSettings()).getLocationSettings();
128   }
129 
create(EnvironmentsStubSettings stub)130   public static final EnvironmentsSettings create(EnvironmentsStubSettings stub)
131       throws IOException {
132     return new EnvironmentsSettings.Builder(stub.toBuilder()).build();
133   }
134 
135   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()136   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
137     return EnvironmentsStubSettings.defaultExecutorProviderBuilder();
138   }
139 
140   /** Returns the default service endpoint. */
getDefaultEndpoint()141   public static String getDefaultEndpoint() {
142     return EnvironmentsStubSettings.getDefaultEndpoint();
143   }
144 
145   /** Returns the default service scopes. */
getDefaultServiceScopes()146   public static List<String> getDefaultServiceScopes() {
147     return EnvironmentsStubSettings.getDefaultServiceScopes();
148   }
149 
150   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()151   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
152     return EnvironmentsStubSettings.defaultCredentialsProviderBuilder();
153   }
154 
155   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()156   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
157     return EnvironmentsStubSettings.defaultGrpcTransportProviderBuilder();
158   }
159 
160   /** Returns a builder for the default REST ChannelProvider for this service. */
161   @BetaApi
162   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()163       defaultHttpJsonTransportProviderBuilder() {
164     return EnvironmentsStubSettings.defaultHttpJsonTransportProviderBuilder();
165   }
166 
defaultTransportChannelProvider()167   public static TransportChannelProvider defaultTransportChannelProvider() {
168     return EnvironmentsStubSettings.defaultTransportChannelProvider();
169   }
170 
171   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()172   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
173     return EnvironmentsStubSettings.defaultApiClientHeaderProviderBuilder();
174   }
175 
176   /** Returns a new gRPC builder for this class. */
newBuilder()177   public static Builder newBuilder() {
178     return Builder.createDefault();
179   }
180 
181   /** Returns a new REST builder for this class. */
182   @BetaApi
newHttpJsonBuilder()183   public static Builder newHttpJsonBuilder() {
184     return Builder.createHttpJsonDefault();
185   }
186 
187   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)188   public static Builder newBuilder(ClientContext clientContext) {
189     return new Builder(clientContext);
190   }
191 
192   /** Returns a builder containing all the values of this settings class. */
toBuilder()193   public Builder toBuilder() {
194     return new Builder(this);
195   }
196 
EnvironmentsSettings(Builder settingsBuilder)197   protected EnvironmentsSettings(Builder settingsBuilder) throws IOException {
198     super(settingsBuilder);
199   }
200 
201   /** Builder for EnvironmentsSettings. */
202   public static class Builder extends ClientSettings.Builder<EnvironmentsSettings, Builder> {
203 
Builder()204     protected Builder() throws IOException {
205       this(((ClientContext) null));
206     }
207 
Builder(ClientContext clientContext)208     protected Builder(ClientContext clientContext) {
209       super(EnvironmentsStubSettings.newBuilder(clientContext));
210     }
211 
Builder(EnvironmentsSettings settings)212     protected Builder(EnvironmentsSettings settings) {
213       super(settings.getStubSettings().toBuilder());
214     }
215 
Builder(EnvironmentsStubSettings.Builder stubSettings)216     protected Builder(EnvironmentsStubSettings.Builder stubSettings) {
217       super(stubSettings);
218     }
219 
createDefault()220     private static Builder createDefault() {
221       return new Builder(EnvironmentsStubSettings.newBuilder());
222     }
223 
224     @BetaApi
createHttpJsonDefault()225     private static Builder createHttpJsonDefault() {
226       return new Builder(EnvironmentsStubSettings.newHttpJsonBuilder());
227     }
228 
getStubSettingsBuilder()229     public EnvironmentsStubSettings.Builder getStubSettingsBuilder() {
230       return ((EnvironmentsStubSettings.Builder) getStubSettings());
231     }
232 
233     /**
234      * Applies the given settings updater function to all of the unary API methods in this service.
235      *
236      * <p>Note: This method does not support applying settings to streaming methods.
237      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)238     public Builder applyToAllUnaryMethods(
239         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
240       super.applyToAllUnaryMethods(
241           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
242       return this;
243     }
244 
245     /** Returns the builder for the settings used for calls to listEnvironments. */
246     public PagedCallSettings.Builder<
247             ListEnvironmentsRequest, ListEnvironmentsResponse, ListEnvironmentsPagedResponse>
listEnvironmentsSettings()248         listEnvironmentsSettings() {
249       return getStubSettingsBuilder().listEnvironmentsSettings();
250     }
251 
252     /** Returns the builder for the settings used for calls to getEnvironment. */
getEnvironmentSettings()253     public UnaryCallSettings.Builder<GetEnvironmentRequest, Environment> getEnvironmentSettings() {
254       return getStubSettingsBuilder().getEnvironmentSettings();
255     }
256 
257     /** Returns the builder for the settings used for calls to createEnvironment. */
258     public UnaryCallSettings.Builder<CreateEnvironmentRequest, Environment>
createEnvironmentSettings()259         createEnvironmentSettings() {
260       return getStubSettingsBuilder().createEnvironmentSettings();
261     }
262 
263     /** Returns the builder for the settings used for calls to updateEnvironment. */
264     public UnaryCallSettings.Builder<UpdateEnvironmentRequest, Environment>
updateEnvironmentSettings()265         updateEnvironmentSettings() {
266       return getStubSettingsBuilder().updateEnvironmentSettings();
267     }
268 
269     /** Returns the builder for the settings used for calls to deleteEnvironment. */
deleteEnvironmentSettings()270     public UnaryCallSettings.Builder<DeleteEnvironmentRequest, Empty> deleteEnvironmentSettings() {
271       return getStubSettingsBuilder().deleteEnvironmentSettings();
272     }
273 
274     /** Returns the builder for the settings used for calls to getEnvironmentHistory. */
275     public PagedCallSettings.Builder<
276             GetEnvironmentHistoryRequest, EnvironmentHistory, GetEnvironmentHistoryPagedResponse>
getEnvironmentHistorySettings()277         getEnvironmentHistorySettings() {
278       return getStubSettingsBuilder().getEnvironmentHistorySettings();
279     }
280 
281     /** Returns the builder for the settings used for calls to listLocations. */
282     public PagedCallSettings.Builder<
283             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()284         listLocationsSettings() {
285       return getStubSettingsBuilder().listLocationsSettings();
286     }
287 
288     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()289     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
290       return getStubSettingsBuilder().getLocationSettings();
291     }
292 
293     @Override
build()294     public EnvironmentsSettings build() throws IOException {
295       return new EnvironmentsSettings(this);
296     }
297   }
298 }
299