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