• 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.AgentsClient.ListAgentsPagedResponse;
20 import static com.google.cloud.dialogflow.cx.v3.AgentsClient.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.AgentsStubSettings;
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 AgentsClient}.
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 getAgent 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  * AgentsSettings.Builder agentsSettingsBuilder = AgentsSettings.newBuilder();
71  * agentsSettingsBuilder
72  *     .getAgentSettings()
73  *     .setRetrySettings(
74  *         agentsSettingsBuilder
75  *             .getAgentSettings()
76  *             .getRetrySettings()
77  *             .toBuilder()
78  *             .setTotalTimeout(Duration.ofSeconds(30))
79  *             .build());
80  * AgentsSettings agentsSettings = agentsSettingsBuilder.build();
81  * }</pre>
82  */
83 @Generated("by gapic-generator-java")
84 public class AgentsSettings extends ClientSettings<AgentsSettings> {
85 
86   /** Returns the object with the settings used for calls to listAgents. */
87   public PagedCallSettings<ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>
listAgentsSettings()88       listAgentsSettings() {
89     return ((AgentsStubSettings) getStubSettings()).listAgentsSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to getAgent. */
getAgentSettings()93   public UnaryCallSettings<GetAgentRequest, Agent> getAgentSettings() {
94     return ((AgentsStubSettings) getStubSettings()).getAgentSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to createAgent. */
createAgentSettings()98   public UnaryCallSettings<CreateAgentRequest, Agent> createAgentSettings() {
99     return ((AgentsStubSettings) getStubSettings()).createAgentSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to updateAgent. */
updateAgentSettings()103   public UnaryCallSettings<UpdateAgentRequest, Agent> updateAgentSettings() {
104     return ((AgentsStubSettings) getStubSettings()).updateAgentSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to deleteAgent. */
deleteAgentSettings()108   public UnaryCallSettings<DeleteAgentRequest, Empty> deleteAgentSettings() {
109     return ((AgentsStubSettings) getStubSettings()).deleteAgentSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to exportAgent. */
exportAgentSettings()113   public UnaryCallSettings<ExportAgentRequest, Operation> exportAgentSettings() {
114     return ((AgentsStubSettings) getStubSettings()).exportAgentSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to exportAgent. */
118   public OperationCallSettings<ExportAgentRequest, ExportAgentResponse, Struct>
exportAgentOperationSettings()119       exportAgentOperationSettings() {
120     return ((AgentsStubSettings) getStubSettings()).exportAgentOperationSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to restoreAgent. */
restoreAgentSettings()124   public UnaryCallSettings<RestoreAgentRequest, Operation> restoreAgentSettings() {
125     return ((AgentsStubSettings) getStubSettings()).restoreAgentSettings();
126   }
127 
128   /** Returns the object with the settings used for calls to restoreAgent. */
restoreAgentOperationSettings()129   public OperationCallSettings<RestoreAgentRequest, Empty, Struct> restoreAgentOperationSettings() {
130     return ((AgentsStubSettings) getStubSettings()).restoreAgentOperationSettings();
131   }
132 
133   /** Returns the object with the settings used for calls to validateAgent. */
validateAgentSettings()134   public UnaryCallSettings<ValidateAgentRequest, AgentValidationResult> validateAgentSettings() {
135     return ((AgentsStubSettings) getStubSettings()).validateAgentSettings();
136   }
137 
138   /** Returns the object with the settings used for calls to getAgentValidationResult. */
139   public UnaryCallSettings<GetAgentValidationResultRequest, AgentValidationResult>
getAgentValidationResultSettings()140       getAgentValidationResultSettings() {
141     return ((AgentsStubSettings) getStubSettings()).getAgentValidationResultSettings();
142   }
143 
144   /** Returns the object with the settings used for calls to listLocations. */
145   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()146       listLocationsSettings() {
147     return ((AgentsStubSettings) getStubSettings()).listLocationsSettings();
148   }
149 
150   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()151   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
152     return ((AgentsStubSettings) getStubSettings()).getLocationSettings();
153   }
154 
create(AgentsStubSettings stub)155   public static final AgentsSettings create(AgentsStubSettings stub) throws IOException {
156     return new AgentsSettings.Builder(stub.toBuilder()).build();
157   }
158 
159   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()160   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
161     return AgentsStubSettings.defaultExecutorProviderBuilder();
162   }
163 
164   /** Returns the default service endpoint. */
getDefaultEndpoint()165   public static String getDefaultEndpoint() {
166     return AgentsStubSettings.getDefaultEndpoint();
167   }
168 
169   /** Returns the default service scopes. */
getDefaultServiceScopes()170   public static List<String> getDefaultServiceScopes() {
171     return AgentsStubSettings.getDefaultServiceScopes();
172   }
173 
174   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()175   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
176     return AgentsStubSettings.defaultCredentialsProviderBuilder();
177   }
178 
179   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()180   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
181     return AgentsStubSettings.defaultGrpcTransportProviderBuilder();
182   }
183 
184   /** Returns a builder for the default REST ChannelProvider for this service. */
185   @BetaApi
186   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()187       defaultHttpJsonTransportProviderBuilder() {
188     return AgentsStubSettings.defaultHttpJsonTransportProviderBuilder();
189   }
190 
defaultTransportChannelProvider()191   public static TransportChannelProvider defaultTransportChannelProvider() {
192     return AgentsStubSettings.defaultTransportChannelProvider();
193   }
194 
195   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()196   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
197     return AgentsStubSettings.defaultApiClientHeaderProviderBuilder();
198   }
199 
200   /** Returns a new gRPC builder for this class. */
newBuilder()201   public static Builder newBuilder() {
202     return Builder.createDefault();
203   }
204 
205   /** Returns a new REST builder for this class. */
206   @BetaApi
newHttpJsonBuilder()207   public static Builder newHttpJsonBuilder() {
208     return Builder.createHttpJsonDefault();
209   }
210 
211   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)212   public static Builder newBuilder(ClientContext clientContext) {
213     return new Builder(clientContext);
214   }
215 
216   /** Returns a builder containing all the values of this settings class. */
toBuilder()217   public Builder toBuilder() {
218     return new Builder(this);
219   }
220 
AgentsSettings(Builder settingsBuilder)221   protected AgentsSettings(Builder settingsBuilder) throws IOException {
222     super(settingsBuilder);
223   }
224 
225   /** Builder for AgentsSettings. */
226   public static class Builder extends ClientSettings.Builder<AgentsSettings, Builder> {
227 
Builder()228     protected Builder() throws IOException {
229       this(((ClientContext) null));
230     }
231 
Builder(ClientContext clientContext)232     protected Builder(ClientContext clientContext) {
233       super(AgentsStubSettings.newBuilder(clientContext));
234     }
235 
Builder(AgentsSettings settings)236     protected Builder(AgentsSettings settings) {
237       super(settings.getStubSettings().toBuilder());
238     }
239 
Builder(AgentsStubSettings.Builder stubSettings)240     protected Builder(AgentsStubSettings.Builder stubSettings) {
241       super(stubSettings);
242     }
243 
createDefault()244     private static Builder createDefault() {
245       return new Builder(AgentsStubSettings.newBuilder());
246     }
247 
248     @BetaApi
createHttpJsonDefault()249     private static Builder createHttpJsonDefault() {
250       return new Builder(AgentsStubSettings.newHttpJsonBuilder());
251     }
252 
getStubSettingsBuilder()253     public AgentsStubSettings.Builder getStubSettingsBuilder() {
254       return ((AgentsStubSettings.Builder) getStubSettings());
255     }
256 
257     /**
258      * Applies the given settings updater function to all of the unary API methods in this service.
259      *
260      * <p>Note: This method does not support applying settings to streaming methods.
261      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)262     public Builder applyToAllUnaryMethods(
263         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
264       super.applyToAllUnaryMethods(
265           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
266       return this;
267     }
268 
269     /** Returns the builder for the settings used for calls to listAgents. */
270     public PagedCallSettings.Builder<ListAgentsRequest, ListAgentsResponse, ListAgentsPagedResponse>
listAgentsSettings()271         listAgentsSettings() {
272       return getStubSettingsBuilder().listAgentsSettings();
273     }
274 
275     /** Returns the builder for the settings used for calls to getAgent. */
getAgentSettings()276     public UnaryCallSettings.Builder<GetAgentRequest, Agent> getAgentSettings() {
277       return getStubSettingsBuilder().getAgentSettings();
278     }
279 
280     /** Returns the builder for the settings used for calls to createAgent. */
createAgentSettings()281     public UnaryCallSettings.Builder<CreateAgentRequest, Agent> createAgentSettings() {
282       return getStubSettingsBuilder().createAgentSettings();
283     }
284 
285     /** Returns the builder for the settings used for calls to updateAgent. */
updateAgentSettings()286     public UnaryCallSettings.Builder<UpdateAgentRequest, Agent> updateAgentSettings() {
287       return getStubSettingsBuilder().updateAgentSettings();
288     }
289 
290     /** Returns the builder for the settings used for calls to deleteAgent. */
deleteAgentSettings()291     public UnaryCallSettings.Builder<DeleteAgentRequest, Empty> deleteAgentSettings() {
292       return getStubSettingsBuilder().deleteAgentSettings();
293     }
294 
295     /** Returns the builder for the settings used for calls to exportAgent. */
exportAgentSettings()296     public UnaryCallSettings.Builder<ExportAgentRequest, Operation> exportAgentSettings() {
297       return getStubSettingsBuilder().exportAgentSettings();
298     }
299 
300     /** Returns the builder for the settings used for calls to exportAgent. */
301     public OperationCallSettings.Builder<ExportAgentRequest, ExportAgentResponse, Struct>
exportAgentOperationSettings()302         exportAgentOperationSettings() {
303       return getStubSettingsBuilder().exportAgentOperationSettings();
304     }
305 
306     /** Returns the builder for the settings used for calls to restoreAgent. */
restoreAgentSettings()307     public UnaryCallSettings.Builder<RestoreAgentRequest, Operation> restoreAgentSettings() {
308       return getStubSettingsBuilder().restoreAgentSettings();
309     }
310 
311     /** Returns the builder for the settings used for calls to restoreAgent. */
312     public OperationCallSettings.Builder<RestoreAgentRequest, Empty, Struct>
restoreAgentOperationSettings()313         restoreAgentOperationSettings() {
314       return getStubSettingsBuilder().restoreAgentOperationSettings();
315     }
316 
317     /** Returns the builder for the settings used for calls to validateAgent. */
318     public UnaryCallSettings.Builder<ValidateAgentRequest, AgentValidationResult>
validateAgentSettings()319         validateAgentSettings() {
320       return getStubSettingsBuilder().validateAgentSettings();
321     }
322 
323     /** Returns the builder for the settings used for calls to getAgentValidationResult. */
324     public UnaryCallSettings.Builder<GetAgentValidationResultRequest, AgentValidationResult>
getAgentValidationResultSettings()325         getAgentValidationResultSettings() {
326       return getStubSettingsBuilder().getAgentValidationResultSettings();
327     }
328 
329     /** Returns the builder for the settings used for calls to listLocations. */
330     public PagedCallSettings.Builder<
331             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()332         listLocationsSettings() {
333       return getStubSettingsBuilder().listLocationsSettings();
334     }
335 
336     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()337     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
338       return getStubSettingsBuilder().getLocationSettings();
339     }
340 
341     @Override
build()342     public AgentsSettings build() throws IOException {
343       return new AgentsSettings(this);
344     }
345   }
346 }
347