• 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.FlowsClient.ListFlowsPagedResponse;
20 import static com.google.cloud.dialogflow.cx.v3.FlowsClient.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.OperationCallSettings;
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.cx.v3.stub.FlowsStubSettings;
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.longrunning.Operation;
41 import com.google.protobuf.Empty;
42 import com.google.protobuf.Struct;
43 import java.io.IOException;
44 import java.util.List;
45 import javax.annotation.Generated;
46 
47 // AUTO-GENERATED DOCUMENTATION AND CLASS.
48 /**
49  * Settings class to configure an instance of {@link FlowsClient}.
50  *
51  * <p>The default instance has everything set to sensible defaults:
52  *
53  * <ul>
54  *   <li>The default service address (dialogflow.googleapis.com) and default port (443) are used.
55  *   <li>Credentials are acquired automatically through Application Default Credentials.
56  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
57  * </ul>
58  *
59  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
60  * build() is called, the tree of builders is called to create the complete settings object.
61  *
62  * <p>For example, to set the total timeout of createFlow to 30 seconds:
63  *
64  * <pre>{@code
65  * // This snippet has been automatically generated and should be regarded as a code template only.
66  * // It will require modifications to work:
67  * // - It may require correct/in-range values for request initialization.
68  * // - It may require specifying regional endpoints when creating the service client as shown in
69  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
70  * FlowsSettings.Builder flowsSettingsBuilder = FlowsSettings.newBuilder();
71  * flowsSettingsBuilder
72  *     .createFlowSettings()
73  *     .setRetrySettings(
74  *         flowsSettingsBuilder
75  *             .createFlowSettings()
76  *             .getRetrySettings()
77  *             .toBuilder()
78  *             .setTotalTimeout(Duration.ofSeconds(30))
79  *             .build());
80  * FlowsSettings flowsSettings = flowsSettingsBuilder.build();
81  * }</pre>
82  */
83 @Generated("by gapic-generator-java")
84 public class FlowsSettings extends ClientSettings<FlowsSettings> {
85 
86   /** Returns the object with the settings used for calls to createFlow. */
createFlowSettings()87   public UnaryCallSettings<CreateFlowRequest, Flow> createFlowSettings() {
88     return ((FlowsStubSettings) getStubSettings()).createFlowSettings();
89   }
90 
91   /** Returns the object with the settings used for calls to deleteFlow. */
deleteFlowSettings()92   public UnaryCallSettings<DeleteFlowRequest, Empty> deleteFlowSettings() {
93     return ((FlowsStubSettings) getStubSettings()).deleteFlowSettings();
94   }
95 
96   /** Returns the object with the settings used for calls to listFlows. */
97   public PagedCallSettings<ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>
listFlowsSettings()98       listFlowsSettings() {
99     return ((FlowsStubSettings) getStubSettings()).listFlowsSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to getFlow. */
getFlowSettings()103   public UnaryCallSettings<GetFlowRequest, Flow> getFlowSettings() {
104     return ((FlowsStubSettings) getStubSettings()).getFlowSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to updateFlow. */
updateFlowSettings()108   public UnaryCallSettings<UpdateFlowRequest, Flow> updateFlowSettings() {
109     return ((FlowsStubSettings) getStubSettings()).updateFlowSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to trainFlow. */
trainFlowSettings()113   public UnaryCallSettings<TrainFlowRequest, Operation> trainFlowSettings() {
114     return ((FlowsStubSettings) getStubSettings()).trainFlowSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to trainFlow. */
trainFlowOperationSettings()118   public OperationCallSettings<TrainFlowRequest, Empty, Struct> trainFlowOperationSettings() {
119     return ((FlowsStubSettings) getStubSettings()).trainFlowOperationSettings();
120   }
121 
122   /** Returns the object with the settings used for calls to validateFlow. */
validateFlowSettings()123   public UnaryCallSettings<ValidateFlowRequest, FlowValidationResult> validateFlowSettings() {
124     return ((FlowsStubSettings) getStubSettings()).validateFlowSettings();
125   }
126 
127   /** Returns the object with the settings used for calls to getFlowValidationResult. */
128   public UnaryCallSettings<GetFlowValidationResultRequest, FlowValidationResult>
getFlowValidationResultSettings()129       getFlowValidationResultSettings() {
130     return ((FlowsStubSettings) getStubSettings()).getFlowValidationResultSettings();
131   }
132 
133   /** Returns the object with the settings used for calls to importFlow. */
importFlowSettings()134   public UnaryCallSettings<ImportFlowRequest, Operation> importFlowSettings() {
135     return ((FlowsStubSettings) getStubSettings()).importFlowSettings();
136   }
137 
138   /** Returns the object with the settings used for calls to importFlow. */
139   public OperationCallSettings<ImportFlowRequest, ImportFlowResponse, Struct>
importFlowOperationSettings()140       importFlowOperationSettings() {
141     return ((FlowsStubSettings) getStubSettings()).importFlowOperationSettings();
142   }
143 
144   /** Returns the object with the settings used for calls to exportFlow. */
exportFlowSettings()145   public UnaryCallSettings<ExportFlowRequest, Operation> exportFlowSettings() {
146     return ((FlowsStubSettings) getStubSettings()).exportFlowSettings();
147   }
148 
149   /** Returns the object with the settings used for calls to exportFlow. */
150   public OperationCallSettings<ExportFlowRequest, ExportFlowResponse, Struct>
exportFlowOperationSettings()151       exportFlowOperationSettings() {
152     return ((FlowsStubSettings) getStubSettings()).exportFlowOperationSettings();
153   }
154 
155   /** Returns the object with the settings used for calls to listLocations. */
156   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()157       listLocationsSettings() {
158     return ((FlowsStubSettings) getStubSettings()).listLocationsSettings();
159   }
160 
161   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()162   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
163     return ((FlowsStubSettings) getStubSettings()).getLocationSettings();
164   }
165 
create(FlowsStubSettings stub)166   public static final FlowsSettings create(FlowsStubSettings stub) throws IOException {
167     return new FlowsSettings.Builder(stub.toBuilder()).build();
168   }
169 
170   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()171   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
172     return FlowsStubSettings.defaultExecutorProviderBuilder();
173   }
174 
175   /** Returns the default service endpoint. */
getDefaultEndpoint()176   public static String getDefaultEndpoint() {
177     return FlowsStubSettings.getDefaultEndpoint();
178   }
179 
180   /** Returns the default service scopes. */
getDefaultServiceScopes()181   public static List<String> getDefaultServiceScopes() {
182     return FlowsStubSettings.getDefaultServiceScopes();
183   }
184 
185   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()186   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
187     return FlowsStubSettings.defaultCredentialsProviderBuilder();
188   }
189 
190   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()191   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
192     return FlowsStubSettings.defaultGrpcTransportProviderBuilder();
193   }
194 
195   /** Returns a builder for the default REST ChannelProvider for this service. */
196   @BetaApi
197   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()198       defaultHttpJsonTransportProviderBuilder() {
199     return FlowsStubSettings.defaultHttpJsonTransportProviderBuilder();
200   }
201 
defaultTransportChannelProvider()202   public static TransportChannelProvider defaultTransportChannelProvider() {
203     return FlowsStubSettings.defaultTransportChannelProvider();
204   }
205 
206   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()207   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
208     return FlowsStubSettings.defaultApiClientHeaderProviderBuilder();
209   }
210 
211   /** Returns a new gRPC builder for this class. */
newBuilder()212   public static Builder newBuilder() {
213     return Builder.createDefault();
214   }
215 
216   /** Returns a new REST builder for this class. */
217   @BetaApi
newHttpJsonBuilder()218   public static Builder newHttpJsonBuilder() {
219     return Builder.createHttpJsonDefault();
220   }
221 
222   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)223   public static Builder newBuilder(ClientContext clientContext) {
224     return new Builder(clientContext);
225   }
226 
227   /** Returns a builder containing all the values of this settings class. */
toBuilder()228   public Builder toBuilder() {
229     return new Builder(this);
230   }
231 
FlowsSettings(Builder settingsBuilder)232   protected FlowsSettings(Builder settingsBuilder) throws IOException {
233     super(settingsBuilder);
234   }
235 
236   /** Builder for FlowsSettings. */
237   public static class Builder extends ClientSettings.Builder<FlowsSettings, Builder> {
238 
Builder()239     protected Builder() throws IOException {
240       this(((ClientContext) null));
241     }
242 
Builder(ClientContext clientContext)243     protected Builder(ClientContext clientContext) {
244       super(FlowsStubSettings.newBuilder(clientContext));
245     }
246 
Builder(FlowsSettings settings)247     protected Builder(FlowsSettings settings) {
248       super(settings.getStubSettings().toBuilder());
249     }
250 
Builder(FlowsStubSettings.Builder stubSettings)251     protected Builder(FlowsStubSettings.Builder stubSettings) {
252       super(stubSettings);
253     }
254 
createDefault()255     private static Builder createDefault() {
256       return new Builder(FlowsStubSettings.newBuilder());
257     }
258 
259     @BetaApi
createHttpJsonDefault()260     private static Builder createHttpJsonDefault() {
261       return new Builder(FlowsStubSettings.newHttpJsonBuilder());
262     }
263 
getStubSettingsBuilder()264     public FlowsStubSettings.Builder getStubSettingsBuilder() {
265       return ((FlowsStubSettings.Builder) getStubSettings());
266     }
267 
268     /**
269      * Applies the given settings updater function to all of the unary API methods in this service.
270      *
271      * <p>Note: This method does not support applying settings to streaming methods.
272      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)273     public Builder applyToAllUnaryMethods(
274         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
275       super.applyToAllUnaryMethods(
276           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
277       return this;
278     }
279 
280     /** Returns the builder for the settings used for calls to createFlow. */
createFlowSettings()281     public UnaryCallSettings.Builder<CreateFlowRequest, Flow> createFlowSettings() {
282       return getStubSettingsBuilder().createFlowSettings();
283     }
284 
285     /** Returns the builder for the settings used for calls to deleteFlow. */
deleteFlowSettings()286     public UnaryCallSettings.Builder<DeleteFlowRequest, Empty> deleteFlowSettings() {
287       return getStubSettingsBuilder().deleteFlowSettings();
288     }
289 
290     /** Returns the builder for the settings used for calls to listFlows. */
291     public PagedCallSettings.Builder<ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse>
listFlowsSettings()292         listFlowsSettings() {
293       return getStubSettingsBuilder().listFlowsSettings();
294     }
295 
296     /** Returns the builder for the settings used for calls to getFlow. */
getFlowSettings()297     public UnaryCallSettings.Builder<GetFlowRequest, Flow> getFlowSettings() {
298       return getStubSettingsBuilder().getFlowSettings();
299     }
300 
301     /** Returns the builder for the settings used for calls to updateFlow. */
updateFlowSettings()302     public UnaryCallSettings.Builder<UpdateFlowRequest, Flow> updateFlowSettings() {
303       return getStubSettingsBuilder().updateFlowSettings();
304     }
305 
306     /** Returns the builder for the settings used for calls to trainFlow. */
trainFlowSettings()307     public UnaryCallSettings.Builder<TrainFlowRequest, Operation> trainFlowSettings() {
308       return getStubSettingsBuilder().trainFlowSettings();
309     }
310 
311     /** Returns the builder for the settings used for calls to trainFlow. */
312     public OperationCallSettings.Builder<TrainFlowRequest, Empty, Struct>
trainFlowOperationSettings()313         trainFlowOperationSettings() {
314       return getStubSettingsBuilder().trainFlowOperationSettings();
315     }
316 
317     /** Returns the builder for the settings used for calls to validateFlow. */
318     public UnaryCallSettings.Builder<ValidateFlowRequest, FlowValidationResult>
validateFlowSettings()319         validateFlowSettings() {
320       return getStubSettingsBuilder().validateFlowSettings();
321     }
322 
323     /** Returns the builder for the settings used for calls to getFlowValidationResult. */
324     public UnaryCallSettings.Builder<GetFlowValidationResultRequest, FlowValidationResult>
getFlowValidationResultSettings()325         getFlowValidationResultSettings() {
326       return getStubSettingsBuilder().getFlowValidationResultSettings();
327     }
328 
329     /** Returns the builder for the settings used for calls to importFlow. */
importFlowSettings()330     public UnaryCallSettings.Builder<ImportFlowRequest, Operation> importFlowSettings() {
331       return getStubSettingsBuilder().importFlowSettings();
332     }
333 
334     /** Returns the builder for the settings used for calls to importFlow. */
335     public OperationCallSettings.Builder<ImportFlowRequest, ImportFlowResponse, Struct>
importFlowOperationSettings()336         importFlowOperationSettings() {
337       return getStubSettingsBuilder().importFlowOperationSettings();
338     }
339 
340     /** Returns the builder for the settings used for calls to exportFlow. */
exportFlowSettings()341     public UnaryCallSettings.Builder<ExportFlowRequest, Operation> exportFlowSettings() {
342       return getStubSettingsBuilder().exportFlowSettings();
343     }
344 
345     /** Returns the builder for the settings used for calls to exportFlow. */
346     public OperationCallSettings.Builder<ExportFlowRequest, ExportFlowResponse, Struct>
exportFlowOperationSettings()347         exportFlowOperationSettings() {
348       return getStubSettingsBuilder().exportFlowOperationSettings();
349     }
350 
351     /** Returns the builder for the settings used for calls to listLocations. */
352     public PagedCallSettings.Builder<
353             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()354         listLocationsSettings() {
355       return getStubSettingsBuilder().listLocationsSettings();
356     }
357 
358     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()359     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
360       return getStubSettingsBuilder().getLocationSettings();
361     }
362 
363     @Override
build()364     public FlowsSettings build() throws IOException {
365       return new FlowsSettings(this);
366     }
367   }
368 }
369