• 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.cx.v3;
18 
19 import static com.google.cloud.dialogflow.cx.v3.ExperimentsClient.ListExperimentsPagedResponse;
20 import static com.google.cloud.dialogflow.cx.v3.ExperimentsClient.ListLocationsPagedResponse;
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.dialogflow.cx.v3.stub.ExperimentsStubSettings;
35 import com.google.cloud.location.GetLocationRequest;
36 import com.google.cloud.location.ListLocationsRequest;
37 import com.google.cloud.location.ListLocationsResponse;
38 import com.google.cloud.location.Location;
39 import com.google.protobuf.Empty;
40 import java.io.IOException;
41 import java.util.List;
42 import javax.annotation.Generated;
43 
44 // AUTO-GENERATED DOCUMENTATION AND CLASS.
45 /**
46  * Settings class to configure an instance of {@link ExperimentsClient}.
47  *
48  * <p>The default instance has everything set to sensible defaults:
49  *
50  * <ul>
51  *   <li>The default service address (dialogflow.googleapis.com) and default port (443) are used.
52  *   <li>Credentials are acquired automatically through Application Default Credentials.
53  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
54  * </ul>
55  *
56  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
57  * build() is called, the tree of builders is called to create the complete settings object.
58  *
59  * <p>For example, to set the total timeout of getExperiment to 30 seconds:
60  *
61  * <pre>{@code
62  * // This snippet has been automatically generated and should be regarded as a code template only.
63  * // It will require modifications to work:
64  * // - It may require correct/in-range values for request initialization.
65  * // - It may require specifying regional endpoints when creating the service client as shown in
66  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
67  * ExperimentsSettings.Builder experimentsSettingsBuilder = ExperimentsSettings.newBuilder();
68  * experimentsSettingsBuilder
69  *     .getExperimentSettings()
70  *     .setRetrySettings(
71  *         experimentsSettingsBuilder
72  *             .getExperimentSettings()
73  *             .getRetrySettings()
74  *             .toBuilder()
75  *             .setTotalTimeout(Duration.ofSeconds(30))
76  *             .build());
77  * ExperimentsSettings experimentsSettings = experimentsSettingsBuilder.build();
78  * }</pre>
79  */
80 @Generated("by gapic-generator-java")
81 public class ExperimentsSettings extends ClientSettings<ExperimentsSettings> {
82 
83   /** Returns the object with the settings used for calls to listExperiments. */
84   public PagedCallSettings<
85           ListExperimentsRequest, ListExperimentsResponse, ListExperimentsPagedResponse>
listExperimentsSettings()86       listExperimentsSettings() {
87     return ((ExperimentsStubSettings) getStubSettings()).listExperimentsSettings();
88   }
89 
90   /** Returns the object with the settings used for calls to getExperiment. */
getExperimentSettings()91   public UnaryCallSettings<GetExperimentRequest, Experiment> getExperimentSettings() {
92     return ((ExperimentsStubSettings) getStubSettings()).getExperimentSettings();
93   }
94 
95   /** Returns the object with the settings used for calls to createExperiment. */
createExperimentSettings()96   public UnaryCallSettings<CreateExperimentRequest, Experiment> createExperimentSettings() {
97     return ((ExperimentsStubSettings) getStubSettings()).createExperimentSettings();
98   }
99 
100   /** Returns the object with the settings used for calls to updateExperiment. */
updateExperimentSettings()101   public UnaryCallSettings<UpdateExperimentRequest, Experiment> updateExperimentSettings() {
102     return ((ExperimentsStubSettings) getStubSettings()).updateExperimentSettings();
103   }
104 
105   /** Returns the object with the settings used for calls to deleteExperiment. */
deleteExperimentSettings()106   public UnaryCallSettings<DeleteExperimentRequest, Empty> deleteExperimentSettings() {
107     return ((ExperimentsStubSettings) getStubSettings()).deleteExperimentSettings();
108   }
109 
110   /** Returns the object with the settings used for calls to startExperiment. */
startExperimentSettings()111   public UnaryCallSettings<StartExperimentRequest, Experiment> startExperimentSettings() {
112     return ((ExperimentsStubSettings) getStubSettings()).startExperimentSettings();
113   }
114 
115   /** Returns the object with the settings used for calls to stopExperiment. */
stopExperimentSettings()116   public UnaryCallSettings<StopExperimentRequest, Experiment> stopExperimentSettings() {
117     return ((ExperimentsStubSettings) getStubSettings()).stopExperimentSettings();
118   }
119 
120   /** Returns the object with the settings used for calls to listLocations. */
121   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()122       listLocationsSettings() {
123     return ((ExperimentsStubSettings) getStubSettings()).listLocationsSettings();
124   }
125 
126   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()127   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
128     return ((ExperimentsStubSettings) getStubSettings()).getLocationSettings();
129   }
130 
create(ExperimentsStubSettings stub)131   public static final ExperimentsSettings create(ExperimentsStubSettings stub) throws IOException {
132     return new ExperimentsSettings.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 ExperimentsStubSettings.defaultExecutorProviderBuilder();
138   }
139 
140   /** Returns the default service endpoint. */
getDefaultEndpoint()141   public static String getDefaultEndpoint() {
142     return ExperimentsStubSettings.getDefaultEndpoint();
143   }
144 
145   /** Returns the default service scopes. */
getDefaultServiceScopes()146   public static List<String> getDefaultServiceScopes() {
147     return ExperimentsStubSettings.getDefaultServiceScopes();
148   }
149 
150   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()151   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
152     return ExperimentsStubSettings.defaultCredentialsProviderBuilder();
153   }
154 
155   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()156   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
157     return ExperimentsStubSettings.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 ExperimentsStubSettings.defaultHttpJsonTransportProviderBuilder();
165   }
166 
defaultTransportChannelProvider()167   public static TransportChannelProvider defaultTransportChannelProvider() {
168     return ExperimentsStubSettings.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 ExperimentsStubSettings.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 
ExperimentsSettings(Builder settingsBuilder)197   protected ExperimentsSettings(Builder settingsBuilder) throws IOException {
198     super(settingsBuilder);
199   }
200 
201   /** Builder for ExperimentsSettings. */
202   public static class Builder extends ClientSettings.Builder<ExperimentsSettings, Builder> {
203 
Builder()204     protected Builder() throws IOException {
205       this(((ClientContext) null));
206     }
207 
Builder(ClientContext clientContext)208     protected Builder(ClientContext clientContext) {
209       super(ExperimentsStubSettings.newBuilder(clientContext));
210     }
211 
Builder(ExperimentsSettings settings)212     protected Builder(ExperimentsSettings settings) {
213       super(settings.getStubSettings().toBuilder());
214     }
215 
Builder(ExperimentsStubSettings.Builder stubSettings)216     protected Builder(ExperimentsStubSettings.Builder stubSettings) {
217       super(stubSettings);
218     }
219 
createDefault()220     private static Builder createDefault() {
221       return new Builder(ExperimentsStubSettings.newBuilder());
222     }
223 
224     @BetaApi
createHttpJsonDefault()225     private static Builder createHttpJsonDefault() {
226       return new Builder(ExperimentsStubSettings.newHttpJsonBuilder());
227     }
228 
getStubSettingsBuilder()229     public ExperimentsStubSettings.Builder getStubSettingsBuilder() {
230       return ((ExperimentsStubSettings.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 listExperiments. */
246     public PagedCallSettings.Builder<
247             ListExperimentsRequest, ListExperimentsResponse, ListExperimentsPagedResponse>
listExperimentsSettings()248         listExperimentsSettings() {
249       return getStubSettingsBuilder().listExperimentsSettings();
250     }
251 
252     /** Returns the builder for the settings used for calls to getExperiment. */
getExperimentSettings()253     public UnaryCallSettings.Builder<GetExperimentRequest, Experiment> getExperimentSettings() {
254       return getStubSettingsBuilder().getExperimentSettings();
255     }
256 
257     /** Returns the builder for the settings used for calls to createExperiment. */
258     public UnaryCallSettings.Builder<CreateExperimentRequest, Experiment>
createExperimentSettings()259         createExperimentSettings() {
260       return getStubSettingsBuilder().createExperimentSettings();
261     }
262 
263     /** Returns the builder for the settings used for calls to updateExperiment. */
264     public UnaryCallSettings.Builder<UpdateExperimentRequest, Experiment>
updateExperimentSettings()265         updateExperimentSettings() {
266       return getStubSettingsBuilder().updateExperimentSettings();
267     }
268 
269     /** Returns the builder for the settings used for calls to deleteExperiment. */
deleteExperimentSettings()270     public UnaryCallSettings.Builder<DeleteExperimentRequest, Empty> deleteExperimentSettings() {
271       return getStubSettingsBuilder().deleteExperimentSettings();
272     }
273 
274     /** Returns the builder for the settings used for calls to startExperiment. */
startExperimentSettings()275     public UnaryCallSettings.Builder<StartExperimentRequest, Experiment> startExperimentSettings() {
276       return getStubSettingsBuilder().startExperimentSettings();
277     }
278 
279     /** Returns the builder for the settings used for calls to stopExperiment. */
stopExperimentSettings()280     public UnaryCallSettings.Builder<StopExperimentRequest, Experiment> stopExperimentSettings() {
281       return getStubSettingsBuilder().stopExperimentSettings();
282     }
283 
284     /** Returns the builder for the settings used for calls to listLocations. */
285     public PagedCallSettings.Builder<
286             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()287         listLocationsSettings() {
288       return getStubSettingsBuilder().listLocationsSettings();
289     }
290 
291     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()292     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
293       return getStubSettingsBuilder().getLocationSettings();
294     }
295 
296     @Override
build()297     public ExperimentsSettings build() throws IOException {
298       return new ExperimentsSettings(this);
299     }
300   }
301 }
302