• 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.WebhooksClient.ListLocationsPagedResponse;
20 import static com.google.cloud.dialogflow.cx.v3.WebhooksClient.ListWebhooksPagedResponse;
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.WebhooksStubSettings;
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 WebhooksClient}.
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 getWebhook 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  * WebhooksSettings.Builder webhooksSettingsBuilder = WebhooksSettings.newBuilder();
68  * webhooksSettingsBuilder
69  *     .getWebhookSettings()
70  *     .setRetrySettings(
71  *         webhooksSettingsBuilder
72  *             .getWebhookSettings()
73  *             .getRetrySettings()
74  *             .toBuilder()
75  *             .setTotalTimeout(Duration.ofSeconds(30))
76  *             .build());
77  * WebhooksSettings webhooksSettings = webhooksSettingsBuilder.build();
78  * }</pre>
79  */
80 @Generated("by gapic-generator-java")
81 public class WebhooksSettings extends ClientSettings<WebhooksSettings> {
82 
83   /** Returns the object with the settings used for calls to listWebhooks. */
84   public PagedCallSettings<ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>
listWebhooksSettings()85       listWebhooksSettings() {
86     return ((WebhooksStubSettings) getStubSettings()).listWebhooksSettings();
87   }
88 
89   /** Returns the object with the settings used for calls to getWebhook. */
getWebhookSettings()90   public UnaryCallSettings<GetWebhookRequest, Webhook> getWebhookSettings() {
91     return ((WebhooksStubSettings) getStubSettings()).getWebhookSettings();
92   }
93 
94   /** Returns the object with the settings used for calls to createWebhook. */
createWebhookSettings()95   public UnaryCallSettings<CreateWebhookRequest, Webhook> createWebhookSettings() {
96     return ((WebhooksStubSettings) getStubSettings()).createWebhookSettings();
97   }
98 
99   /** Returns the object with the settings used for calls to updateWebhook. */
updateWebhookSettings()100   public UnaryCallSettings<UpdateWebhookRequest, Webhook> updateWebhookSettings() {
101     return ((WebhooksStubSettings) getStubSettings()).updateWebhookSettings();
102   }
103 
104   /** Returns the object with the settings used for calls to deleteWebhook. */
deleteWebhookSettings()105   public UnaryCallSettings<DeleteWebhookRequest, Empty> deleteWebhookSettings() {
106     return ((WebhooksStubSettings) getStubSettings()).deleteWebhookSettings();
107   }
108 
109   /** Returns the object with the settings used for calls to listLocations. */
110   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()111       listLocationsSettings() {
112     return ((WebhooksStubSettings) getStubSettings()).listLocationsSettings();
113   }
114 
115   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()116   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
117     return ((WebhooksStubSettings) getStubSettings()).getLocationSettings();
118   }
119 
create(WebhooksStubSettings stub)120   public static final WebhooksSettings create(WebhooksStubSettings stub) throws IOException {
121     return new WebhooksSettings.Builder(stub.toBuilder()).build();
122   }
123 
124   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()125   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
126     return WebhooksStubSettings.defaultExecutorProviderBuilder();
127   }
128 
129   /** Returns the default service endpoint. */
getDefaultEndpoint()130   public static String getDefaultEndpoint() {
131     return WebhooksStubSettings.getDefaultEndpoint();
132   }
133 
134   /** Returns the default service scopes. */
getDefaultServiceScopes()135   public static List<String> getDefaultServiceScopes() {
136     return WebhooksStubSettings.getDefaultServiceScopes();
137   }
138 
139   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()140   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
141     return WebhooksStubSettings.defaultCredentialsProviderBuilder();
142   }
143 
144   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()145   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
146     return WebhooksStubSettings.defaultGrpcTransportProviderBuilder();
147   }
148 
149   /** Returns a builder for the default REST ChannelProvider for this service. */
150   @BetaApi
151   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()152       defaultHttpJsonTransportProviderBuilder() {
153     return WebhooksStubSettings.defaultHttpJsonTransportProviderBuilder();
154   }
155 
defaultTransportChannelProvider()156   public static TransportChannelProvider defaultTransportChannelProvider() {
157     return WebhooksStubSettings.defaultTransportChannelProvider();
158   }
159 
160   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()161   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
162     return WebhooksStubSettings.defaultApiClientHeaderProviderBuilder();
163   }
164 
165   /** Returns a new gRPC builder for this class. */
newBuilder()166   public static Builder newBuilder() {
167     return Builder.createDefault();
168   }
169 
170   /** Returns a new REST builder for this class. */
171   @BetaApi
newHttpJsonBuilder()172   public static Builder newHttpJsonBuilder() {
173     return Builder.createHttpJsonDefault();
174   }
175 
176   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)177   public static Builder newBuilder(ClientContext clientContext) {
178     return new Builder(clientContext);
179   }
180 
181   /** Returns a builder containing all the values of this settings class. */
toBuilder()182   public Builder toBuilder() {
183     return new Builder(this);
184   }
185 
WebhooksSettings(Builder settingsBuilder)186   protected WebhooksSettings(Builder settingsBuilder) throws IOException {
187     super(settingsBuilder);
188   }
189 
190   /** Builder for WebhooksSettings. */
191   public static class Builder extends ClientSettings.Builder<WebhooksSettings, Builder> {
192 
Builder()193     protected Builder() throws IOException {
194       this(((ClientContext) null));
195     }
196 
Builder(ClientContext clientContext)197     protected Builder(ClientContext clientContext) {
198       super(WebhooksStubSettings.newBuilder(clientContext));
199     }
200 
Builder(WebhooksSettings settings)201     protected Builder(WebhooksSettings settings) {
202       super(settings.getStubSettings().toBuilder());
203     }
204 
Builder(WebhooksStubSettings.Builder stubSettings)205     protected Builder(WebhooksStubSettings.Builder stubSettings) {
206       super(stubSettings);
207     }
208 
createDefault()209     private static Builder createDefault() {
210       return new Builder(WebhooksStubSettings.newBuilder());
211     }
212 
213     @BetaApi
createHttpJsonDefault()214     private static Builder createHttpJsonDefault() {
215       return new Builder(WebhooksStubSettings.newHttpJsonBuilder());
216     }
217 
getStubSettingsBuilder()218     public WebhooksStubSettings.Builder getStubSettingsBuilder() {
219       return ((WebhooksStubSettings.Builder) getStubSettings());
220     }
221 
222     /**
223      * Applies the given settings updater function to all of the unary API methods in this service.
224      *
225      * <p>Note: This method does not support applying settings to streaming methods.
226      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)227     public Builder applyToAllUnaryMethods(
228         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
229       super.applyToAllUnaryMethods(
230           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
231       return this;
232     }
233 
234     /** Returns the builder for the settings used for calls to listWebhooks. */
235     public PagedCallSettings.Builder<
236             ListWebhooksRequest, ListWebhooksResponse, ListWebhooksPagedResponse>
listWebhooksSettings()237         listWebhooksSettings() {
238       return getStubSettingsBuilder().listWebhooksSettings();
239     }
240 
241     /** Returns the builder for the settings used for calls to getWebhook. */
getWebhookSettings()242     public UnaryCallSettings.Builder<GetWebhookRequest, Webhook> getWebhookSettings() {
243       return getStubSettingsBuilder().getWebhookSettings();
244     }
245 
246     /** Returns the builder for the settings used for calls to createWebhook. */
createWebhookSettings()247     public UnaryCallSettings.Builder<CreateWebhookRequest, Webhook> createWebhookSettings() {
248       return getStubSettingsBuilder().createWebhookSettings();
249     }
250 
251     /** Returns the builder for the settings used for calls to updateWebhook. */
updateWebhookSettings()252     public UnaryCallSettings.Builder<UpdateWebhookRequest, Webhook> updateWebhookSettings() {
253       return getStubSettingsBuilder().updateWebhookSettings();
254     }
255 
256     /** Returns the builder for the settings used for calls to deleteWebhook. */
deleteWebhookSettings()257     public UnaryCallSettings.Builder<DeleteWebhookRequest, Empty> deleteWebhookSettings() {
258       return getStubSettingsBuilder().deleteWebhookSettings();
259     }
260 
261     /** Returns the builder for the settings used for calls to listLocations. */
262     public PagedCallSettings.Builder<
263             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()264         listLocationsSettings() {
265       return getStubSettingsBuilder().listLocationsSettings();
266     }
267 
268     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()269     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
270       return getStubSettingsBuilder().getLocationSettings();
271     }
272 
273     @Override
build()274     public WebhooksSettings build() throws IOException {
275       return new WebhooksSettings(this);
276     }
277   }
278 }
279