• 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.TestCasesClient.ListLocationsPagedResponse;
20 import static com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCaseResultsPagedResponse;
21 import static com.google.cloud.dialogflow.cx.v3.TestCasesClient.ListTestCasesPagedResponse;
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.OperationCallSettings;
33 import com.google.api.gax.rpc.PagedCallSettings;
34 import com.google.api.gax.rpc.TransportChannelProvider;
35 import com.google.api.gax.rpc.UnaryCallSettings;
36 import com.google.cloud.dialogflow.cx.v3.stub.TestCasesStubSettings;
37 import com.google.cloud.location.GetLocationRequest;
38 import com.google.cloud.location.ListLocationsRequest;
39 import com.google.cloud.location.ListLocationsResponse;
40 import com.google.cloud.location.Location;
41 import com.google.longrunning.Operation;
42 import com.google.protobuf.Empty;
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 TestCasesClient}.
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 batchDeleteTestCases 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  * TestCasesSettings.Builder testCasesSettingsBuilder = TestCasesSettings.newBuilder();
71  * testCasesSettingsBuilder
72  *     .batchDeleteTestCasesSettings()
73  *     .setRetrySettings(
74  *         testCasesSettingsBuilder
75  *             .batchDeleteTestCasesSettings()
76  *             .getRetrySettings()
77  *             .toBuilder()
78  *             .setTotalTimeout(Duration.ofSeconds(30))
79  *             .build());
80  * TestCasesSettings testCasesSettings = testCasesSettingsBuilder.build();
81  * }</pre>
82  */
83 @Generated("by gapic-generator-java")
84 public class TestCasesSettings extends ClientSettings<TestCasesSettings> {
85 
86   /** Returns the object with the settings used for calls to listTestCases. */
87   public PagedCallSettings<ListTestCasesRequest, ListTestCasesResponse, ListTestCasesPagedResponse>
listTestCasesSettings()88       listTestCasesSettings() {
89     return ((TestCasesStubSettings) getStubSettings()).listTestCasesSettings();
90   }
91 
92   /** Returns the object with the settings used for calls to batchDeleteTestCases. */
batchDeleteTestCasesSettings()93   public UnaryCallSettings<BatchDeleteTestCasesRequest, Empty> batchDeleteTestCasesSettings() {
94     return ((TestCasesStubSettings) getStubSettings()).batchDeleteTestCasesSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to getTestCase. */
getTestCaseSettings()98   public UnaryCallSettings<GetTestCaseRequest, TestCase> getTestCaseSettings() {
99     return ((TestCasesStubSettings) getStubSettings()).getTestCaseSettings();
100   }
101 
102   /** Returns the object with the settings used for calls to createTestCase. */
createTestCaseSettings()103   public UnaryCallSettings<CreateTestCaseRequest, TestCase> createTestCaseSettings() {
104     return ((TestCasesStubSettings) getStubSettings()).createTestCaseSettings();
105   }
106 
107   /** Returns the object with the settings used for calls to updateTestCase. */
updateTestCaseSettings()108   public UnaryCallSettings<UpdateTestCaseRequest, TestCase> updateTestCaseSettings() {
109     return ((TestCasesStubSettings) getStubSettings()).updateTestCaseSettings();
110   }
111 
112   /** Returns the object with the settings used for calls to runTestCase. */
runTestCaseSettings()113   public UnaryCallSettings<RunTestCaseRequest, Operation> runTestCaseSettings() {
114     return ((TestCasesStubSettings) getStubSettings()).runTestCaseSettings();
115   }
116 
117   /** Returns the object with the settings used for calls to runTestCase. */
118   public OperationCallSettings<RunTestCaseRequest, RunTestCaseResponse, RunTestCaseMetadata>
runTestCaseOperationSettings()119       runTestCaseOperationSettings() {
120     return ((TestCasesStubSettings) getStubSettings()).runTestCaseOperationSettings();
121   }
122 
123   /** Returns the object with the settings used for calls to batchRunTestCases. */
batchRunTestCasesSettings()124   public UnaryCallSettings<BatchRunTestCasesRequest, Operation> batchRunTestCasesSettings() {
125     return ((TestCasesStubSettings) getStubSettings()).batchRunTestCasesSettings();
126   }
127 
128   /** Returns the object with the settings used for calls to batchRunTestCases. */
129   public OperationCallSettings<
130           BatchRunTestCasesRequest, BatchRunTestCasesResponse, BatchRunTestCasesMetadata>
batchRunTestCasesOperationSettings()131       batchRunTestCasesOperationSettings() {
132     return ((TestCasesStubSettings) getStubSettings()).batchRunTestCasesOperationSettings();
133   }
134 
135   /** Returns the object with the settings used for calls to calculateCoverage. */
136   public UnaryCallSettings<CalculateCoverageRequest, CalculateCoverageResponse>
calculateCoverageSettings()137       calculateCoverageSettings() {
138     return ((TestCasesStubSettings) getStubSettings()).calculateCoverageSettings();
139   }
140 
141   /** Returns the object with the settings used for calls to importTestCases. */
importTestCasesSettings()142   public UnaryCallSettings<ImportTestCasesRequest, Operation> importTestCasesSettings() {
143     return ((TestCasesStubSettings) getStubSettings()).importTestCasesSettings();
144   }
145 
146   /** Returns the object with the settings used for calls to importTestCases. */
147   public OperationCallSettings<
148           ImportTestCasesRequest, ImportTestCasesResponse, ImportTestCasesMetadata>
importTestCasesOperationSettings()149       importTestCasesOperationSettings() {
150     return ((TestCasesStubSettings) getStubSettings()).importTestCasesOperationSettings();
151   }
152 
153   /** Returns the object with the settings used for calls to exportTestCases. */
exportTestCasesSettings()154   public UnaryCallSettings<ExportTestCasesRequest, Operation> exportTestCasesSettings() {
155     return ((TestCasesStubSettings) getStubSettings()).exportTestCasesSettings();
156   }
157 
158   /** Returns the object with the settings used for calls to exportTestCases. */
159   public OperationCallSettings<
160           ExportTestCasesRequest, ExportTestCasesResponse, ExportTestCasesMetadata>
exportTestCasesOperationSettings()161       exportTestCasesOperationSettings() {
162     return ((TestCasesStubSettings) getStubSettings()).exportTestCasesOperationSettings();
163   }
164 
165   /** Returns the object with the settings used for calls to listTestCaseResults. */
166   public PagedCallSettings<
167           ListTestCaseResultsRequest, ListTestCaseResultsResponse, ListTestCaseResultsPagedResponse>
listTestCaseResultsSettings()168       listTestCaseResultsSettings() {
169     return ((TestCasesStubSettings) getStubSettings()).listTestCaseResultsSettings();
170   }
171 
172   /** Returns the object with the settings used for calls to getTestCaseResult. */
getTestCaseResultSettings()173   public UnaryCallSettings<GetTestCaseResultRequest, TestCaseResult> getTestCaseResultSettings() {
174     return ((TestCasesStubSettings) getStubSettings()).getTestCaseResultSettings();
175   }
176 
177   /** Returns the object with the settings used for calls to listLocations. */
178   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()179       listLocationsSettings() {
180     return ((TestCasesStubSettings) getStubSettings()).listLocationsSettings();
181   }
182 
183   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()184   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
185     return ((TestCasesStubSettings) getStubSettings()).getLocationSettings();
186   }
187 
create(TestCasesStubSettings stub)188   public static final TestCasesSettings create(TestCasesStubSettings stub) throws IOException {
189     return new TestCasesSettings.Builder(stub.toBuilder()).build();
190   }
191 
192   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()193   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
194     return TestCasesStubSettings.defaultExecutorProviderBuilder();
195   }
196 
197   /** Returns the default service endpoint. */
getDefaultEndpoint()198   public static String getDefaultEndpoint() {
199     return TestCasesStubSettings.getDefaultEndpoint();
200   }
201 
202   /** Returns the default service scopes. */
getDefaultServiceScopes()203   public static List<String> getDefaultServiceScopes() {
204     return TestCasesStubSettings.getDefaultServiceScopes();
205   }
206 
207   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()208   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
209     return TestCasesStubSettings.defaultCredentialsProviderBuilder();
210   }
211 
212   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()213   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
214     return TestCasesStubSettings.defaultGrpcTransportProviderBuilder();
215   }
216 
217   /** Returns a builder for the default REST ChannelProvider for this service. */
218   @BetaApi
219   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()220       defaultHttpJsonTransportProviderBuilder() {
221     return TestCasesStubSettings.defaultHttpJsonTransportProviderBuilder();
222   }
223 
defaultTransportChannelProvider()224   public static TransportChannelProvider defaultTransportChannelProvider() {
225     return TestCasesStubSettings.defaultTransportChannelProvider();
226   }
227 
228   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()229   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
230     return TestCasesStubSettings.defaultApiClientHeaderProviderBuilder();
231   }
232 
233   /** Returns a new gRPC builder for this class. */
newBuilder()234   public static Builder newBuilder() {
235     return Builder.createDefault();
236   }
237 
238   /** Returns a new REST builder for this class. */
239   @BetaApi
newHttpJsonBuilder()240   public static Builder newHttpJsonBuilder() {
241     return Builder.createHttpJsonDefault();
242   }
243 
244   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)245   public static Builder newBuilder(ClientContext clientContext) {
246     return new Builder(clientContext);
247   }
248 
249   /** Returns a builder containing all the values of this settings class. */
toBuilder()250   public Builder toBuilder() {
251     return new Builder(this);
252   }
253 
TestCasesSettings(Builder settingsBuilder)254   protected TestCasesSettings(Builder settingsBuilder) throws IOException {
255     super(settingsBuilder);
256   }
257 
258   /** Builder for TestCasesSettings. */
259   public static class Builder extends ClientSettings.Builder<TestCasesSettings, Builder> {
260 
Builder()261     protected Builder() throws IOException {
262       this(((ClientContext) null));
263     }
264 
Builder(ClientContext clientContext)265     protected Builder(ClientContext clientContext) {
266       super(TestCasesStubSettings.newBuilder(clientContext));
267     }
268 
Builder(TestCasesSettings settings)269     protected Builder(TestCasesSettings settings) {
270       super(settings.getStubSettings().toBuilder());
271     }
272 
Builder(TestCasesStubSettings.Builder stubSettings)273     protected Builder(TestCasesStubSettings.Builder stubSettings) {
274       super(stubSettings);
275     }
276 
createDefault()277     private static Builder createDefault() {
278       return new Builder(TestCasesStubSettings.newBuilder());
279     }
280 
281     @BetaApi
createHttpJsonDefault()282     private static Builder createHttpJsonDefault() {
283       return new Builder(TestCasesStubSettings.newHttpJsonBuilder());
284     }
285 
getStubSettingsBuilder()286     public TestCasesStubSettings.Builder getStubSettingsBuilder() {
287       return ((TestCasesStubSettings.Builder) getStubSettings());
288     }
289 
290     /**
291      * Applies the given settings updater function to all of the unary API methods in this service.
292      *
293      * <p>Note: This method does not support applying settings to streaming methods.
294      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)295     public Builder applyToAllUnaryMethods(
296         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
297       super.applyToAllUnaryMethods(
298           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
299       return this;
300     }
301 
302     /** Returns the builder for the settings used for calls to listTestCases. */
303     public PagedCallSettings.Builder<
304             ListTestCasesRequest, ListTestCasesResponse, ListTestCasesPagedResponse>
listTestCasesSettings()305         listTestCasesSettings() {
306       return getStubSettingsBuilder().listTestCasesSettings();
307     }
308 
309     /** Returns the builder for the settings used for calls to batchDeleteTestCases. */
310     public UnaryCallSettings.Builder<BatchDeleteTestCasesRequest, Empty>
batchDeleteTestCasesSettings()311         batchDeleteTestCasesSettings() {
312       return getStubSettingsBuilder().batchDeleteTestCasesSettings();
313     }
314 
315     /** Returns the builder for the settings used for calls to getTestCase. */
getTestCaseSettings()316     public UnaryCallSettings.Builder<GetTestCaseRequest, TestCase> getTestCaseSettings() {
317       return getStubSettingsBuilder().getTestCaseSettings();
318     }
319 
320     /** Returns the builder for the settings used for calls to createTestCase. */
createTestCaseSettings()321     public UnaryCallSettings.Builder<CreateTestCaseRequest, TestCase> createTestCaseSettings() {
322       return getStubSettingsBuilder().createTestCaseSettings();
323     }
324 
325     /** Returns the builder for the settings used for calls to updateTestCase. */
updateTestCaseSettings()326     public UnaryCallSettings.Builder<UpdateTestCaseRequest, TestCase> updateTestCaseSettings() {
327       return getStubSettingsBuilder().updateTestCaseSettings();
328     }
329 
330     /** Returns the builder for the settings used for calls to runTestCase. */
runTestCaseSettings()331     public UnaryCallSettings.Builder<RunTestCaseRequest, Operation> runTestCaseSettings() {
332       return getStubSettingsBuilder().runTestCaseSettings();
333     }
334 
335     /** Returns the builder for the settings used for calls to runTestCase. */
336     public OperationCallSettings.Builder<
337             RunTestCaseRequest, RunTestCaseResponse, RunTestCaseMetadata>
runTestCaseOperationSettings()338         runTestCaseOperationSettings() {
339       return getStubSettingsBuilder().runTestCaseOperationSettings();
340     }
341 
342     /** Returns the builder for the settings used for calls to batchRunTestCases. */
343     public UnaryCallSettings.Builder<BatchRunTestCasesRequest, Operation>
batchRunTestCasesSettings()344         batchRunTestCasesSettings() {
345       return getStubSettingsBuilder().batchRunTestCasesSettings();
346     }
347 
348     /** Returns the builder for the settings used for calls to batchRunTestCases. */
349     public OperationCallSettings.Builder<
350             BatchRunTestCasesRequest, BatchRunTestCasesResponse, BatchRunTestCasesMetadata>
batchRunTestCasesOperationSettings()351         batchRunTestCasesOperationSettings() {
352       return getStubSettingsBuilder().batchRunTestCasesOperationSettings();
353     }
354 
355     /** Returns the builder for the settings used for calls to calculateCoverage. */
356     public UnaryCallSettings.Builder<CalculateCoverageRequest, CalculateCoverageResponse>
calculateCoverageSettings()357         calculateCoverageSettings() {
358       return getStubSettingsBuilder().calculateCoverageSettings();
359     }
360 
361     /** Returns the builder for the settings used for calls to importTestCases. */
importTestCasesSettings()362     public UnaryCallSettings.Builder<ImportTestCasesRequest, Operation> importTestCasesSettings() {
363       return getStubSettingsBuilder().importTestCasesSettings();
364     }
365 
366     /** Returns the builder for the settings used for calls to importTestCases. */
367     public OperationCallSettings.Builder<
368             ImportTestCasesRequest, ImportTestCasesResponse, ImportTestCasesMetadata>
importTestCasesOperationSettings()369         importTestCasesOperationSettings() {
370       return getStubSettingsBuilder().importTestCasesOperationSettings();
371     }
372 
373     /** Returns the builder for the settings used for calls to exportTestCases. */
exportTestCasesSettings()374     public UnaryCallSettings.Builder<ExportTestCasesRequest, Operation> exportTestCasesSettings() {
375       return getStubSettingsBuilder().exportTestCasesSettings();
376     }
377 
378     /** Returns the builder for the settings used for calls to exportTestCases. */
379     public OperationCallSettings.Builder<
380             ExportTestCasesRequest, ExportTestCasesResponse, ExportTestCasesMetadata>
exportTestCasesOperationSettings()381         exportTestCasesOperationSettings() {
382       return getStubSettingsBuilder().exportTestCasesOperationSettings();
383     }
384 
385     /** Returns the builder for the settings used for calls to listTestCaseResults. */
386     public PagedCallSettings.Builder<
387             ListTestCaseResultsRequest,
388             ListTestCaseResultsResponse,
389             ListTestCaseResultsPagedResponse>
listTestCaseResultsSettings()390         listTestCaseResultsSettings() {
391       return getStubSettingsBuilder().listTestCaseResultsSettings();
392     }
393 
394     /** Returns the builder for the settings used for calls to getTestCaseResult. */
395     public UnaryCallSettings.Builder<GetTestCaseResultRequest, TestCaseResult>
getTestCaseResultSettings()396         getTestCaseResultSettings() {
397       return getStubSettingsBuilder().getTestCaseResultSettings();
398     }
399 
400     /** Returns the builder for the settings used for calls to listLocations. */
401     public PagedCallSettings.Builder<
402             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()403         listLocationsSettings() {
404       return getStubSettingsBuilder().listLocationsSettings();
405     }
406 
407     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()408     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
409       return getStubSettingsBuilder().getLocationSettings();
410     }
411 
412     @Override
build()413     public TestCasesSettings build() throws IOException {
414       return new TestCasesSettings(this);
415     }
416   }
417 }
418