• 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.v2;
18 
19 import static com.google.cloud.dialogflow.v2.FulfillmentsClient.ListLocationsPagedResponse;
20 
21 import com.google.api.core.ApiFunction;
22 import com.google.api.core.BetaApi;
23 import com.google.api.gax.core.GoogleCredentialsProvider;
24 import com.google.api.gax.core.InstantiatingExecutorProvider;
25 import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
26 import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider;
27 import com.google.api.gax.rpc.ApiClientHeaderProvider;
28 import com.google.api.gax.rpc.ClientContext;
29 import com.google.api.gax.rpc.ClientSettings;
30 import com.google.api.gax.rpc.PagedCallSettings;
31 import com.google.api.gax.rpc.TransportChannelProvider;
32 import com.google.api.gax.rpc.UnaryCallSettings;
33 import com.google.cloud.dialogflow.v2.stub.FulfillmentsStubSettings;
34 import com.google.cloud.location.GetLocationRequest;
35 import com.google.cloud.location.ListLocationsRequest;
36 import com.google.cloud.location.ListLocationsResponse;
37 import com.google.cloud.location.Location;
38 import java.io.IOException;
39 import java.util.List;
40 import javax.annotation.Generated;
41 
42 // AUTO-GENERATED DOCUMENTATION AND CLASS.
43 /**
44  * Settings class to configure an instance of {@link FulfillmentsClient}.
45  *
46  * <p>The default instance has everything set to sensible defaults:
47  *
48  * <ul>
49  *   <li>The default service address (dialogflow.googleapis.com) and default port (443) are used.
50  *   <li>Credentials are acquired automatically through Application Default Credentials.
51  *   <li>Retries are configured for idempotent methods but not for non-idempotent methods.
52  * </ul>
53  *
54  * <p>The builder of this class is recursive, so contained classes are themselves builders. When
55  * build() is called, the tree of builders is called to create the complete settings object.
56  *
57  * <p>For example, to set the total timeout of getFulfillment to 30 seconds:
58  *
59  * <pre>{@code
60  * // This snippet has been automatically generated and should be regarded as a code template only.
61  * // It will require modifications to work:
62  * // - It may require correct/in-range values for request initialization.
63  * // - It may require specifying regional endpoints when creating the service client as shown in
64  * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
65  * FulfillmentsSettings.Builder fulfillmentsSettingsBuilder = FulfillmentsSettings.newBuilder();
66  * fulfillmentsSettingsBuilder
67  *     .getFulfillmentSettings()
68  *     .setRetrySettings(
69  *         fulfillmentsSettingsBuilder
70  *             .getFulfillmentSettings()
71  *             .getRetrySettings()
72  *             .toBuilder()
73  *             .setTotalTimeout(Duration.ofSeconds(30))
74  *             .build());
75  * FulfillmentsSettings fulfillmentsSettings = fulfillmentsSettingsBuilder.build();
76  * }</pre>
77  */
78 @Generated("by gapic-generator-java")
79 public class FulfillmentsSettings extends ClientSettings<FulfillmentsSettings> {
80 
81   /** Returns the object with the settings used for calls to getFulfillment. */
getFulfillmentSettings()82   public UnaryCallSettings<GetFulfillmentRequest, Fulfillment> getFulfillmentSettings() {
83     return ((FulfillmentsStubSettings) getStubSettings()).getFulfillmentSettings();
84   }
85 
86   /** Returns the object with the settings used for calls to updateFulfillment. */
updateFulfillmentSettings()87   public UnaryCallSettings<UpdateFulfillmentRequest, Fulfillment> updateFulfillmentSettings() {
88     return ((FulfillmentsStubSettings) getStubSettings()).updateFulfillmentSettings();
89   }
90 
91   /** Returns the object with the settings used for calls to listLocations. */
92   public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()93       listLocationsSettings() {
94     return ((FulfillmentsStubSettings) getStubSettings()).listLocationsSettings();
95   }
96 
97   /** Returns the object with the settings used for calls to getLocation. */
getLocationSettings()98   public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() {
99     return ((FulfillmentsStubSettings) getStubSettings()).getLocationSettings();
100   }
101 
create(FulfillmentsStubSettings stub)102   public static final FulfillmentsSettings create(FulfillmentsStubSettings stub)
103       throws IOException {
104     return new FulfillmentsSettings.Builder(stub.toBuilder()).build();
105   }
106 
107   /** Returns a builder for the default ExecutorProvider for this service. */
defaultExecutorProviderBuilder()108   public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
109     return FulfillmentsStubSettings.defaultExecutorProviderBuilder();
110   }
111 
112   /** Returns the default service endpoint. */
getDefaultEndpoint()113   public static String getDefaultEndpoint() {
114     return FulfillmentsStubSettings.getDefaultEndpoint();
115   }
116 
117   /** Returns the default service scopes. */
getDefaultServiceScopes()118   public static List<String> getDefaultServiceScopes() {
119     return FulfillmentsStubSettings.getDefaultServiceScopes();
120   }
121 
122   /** Returns a builder for the default credentials for this service. */
defaultCredentialsProviderBuilder()123   public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
124     return FulfillmentsStubSettings.defaultCredentialsProviderBuilder();
125   }
126 
127   /** Returns a builder for the default gRPC ChannelProvider for this service. */
defaultGrpcTransportProviderBuilder()128   public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
129     return FulfillmentsStubSettings.defaultGrpcTransportProviderBuilder();
130   }
131 
132   /** Returns a builder for the default REST ChannelProvider for this service. */
133   @BetaApi
134   public static InstantiatingHttpJsonChannelProvider.Builder
defaultHttpJsonTransportProviderBuilder()135       defaultHttpJsonTransportProviderBuilder() {
136     return FulfillmentsStubSettings.defaultHttpJsonTransportProviderBuilder();
137   }
138 
defaultTransportChannelProvider()139   public static TransportChannelProvider defaultTransportChannelProvider() {
140     return FulfillmentsStubSettings.defaultTransportChannelProvider();
141   }
142 
143   @BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
defaultApiClientHeaderProviderBuilder()144   public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
145     return FulfillmentsStubSettings.defaultApiClientHeaderProviderBuilder();
146   }
147 
148   /** Returns a new gRPC builder for this class. */
newBuilder()149   public static Builder newBuilder() {
150     return Builder.createDefault();
151   }
152 
153   /** Returns a new REST builder for this class. */
154   @BetaApi
newHttpJsonBuilder()155   public static Builder newHttpJsonBuilder() {
156     return Builder.createHttpJsonDefault();
157   }
158 
159   /** Returns a new builder for this class. */
newBuilder(ClientContext clientContext)160   public static Builder newBuilder(ClientContext clientContext) {
161     return new Builder(clientContext);
162   }
163 
164   /** Returns a builder containing all the values of this settings class. */
toBuilder()165   public Builder toBuilder() {
166     return new Builder(this);
167   }
168 
FulfillmentsSettings(Builder settingsBuilder)169   protected FulfillmentsSettings(Builder settingsBuilder) throws IOException {
170     super(settingsBuilder);
171   }
172 
173   /** Builder for FulfillmentsSettings. */
174   public static class Builder extends ClientSettings.Builder<FulfillmentsSettings, Builder> {
175 
Builder()176     protected Builder() throws IOException {
177       this(((ClientContext) null));
178     }
179 
Builder(ClientContext clientContext)180     protected Builder(ClientContext clientContext) {
181       super(FulfillmentsStubSettings.newBuilder(clientContext));
182     }
183 
Builder(FulfillmentsSettings settings)184     protected Builder(FulfillmentsSettings settings) {
185       super(settings.getStubSettings().toBuilder());
186     }
187 
Builder(FulfillmentsStubSettings.Builder stubSettings)188     protected Builder(FulfillmentsStubSettings.Builder stubSettings) {
189       super(stubSettings);
190     }
191 
createDefault()192     private static Builder createDefault() {
193       return new Builder(FulfillmentsStubSettings.newBuilder());
194     }
195 
196     @BetaApi
createHttpJsonDefault()197     private static Builder createHttpJsonDefault() {
198       return new Builder(FulfillmentsStubSettings.newHttpJsonBuilder());
199     }
200 
getStubSettingsBuilder()201     public FulfillmentsStubSettings.Builder getStubSettingsBuilder() {
202       return ((FulfillmentsStubSettings.Builder) getStubSettings());
203     }
204 
205     /**
206      * Applies the given settings updater function to all of the unary API methods in this service.
207      *
208      * <p>Note: This method does not support applying settings to streaming methods.
209      */
applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)210     public Builder applyToAllUnaryMethods(
211         ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) {
212       super.applyToAllUnaryMethods(
213           getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater);
214       return this;
215     }
216 
217     /** Returns the builder for the settings used for calls to getFulfillment. */
getFulfillmentSettings()218     public UnaryCallSettings.Builder<GetFulfillmentRequest, Fulfillment> getFulfillmentSettings() {
219       return getStubSettingsBuilder().getFulfillmentSettings();
220     }
221 
222     /** Returns the builder for the settings used for calls to updateFulfillment. */
223     public UnaryCallSettings.Builder<UpdateFulfillmentRequest, Fulfillment>
updateFulfillmentSettings()224         updateFulfillmentSettings() {
225       return getStubSettingsBuilder().updateFulfillmentSettings();
226     }
227 
228     /** Returns the builder for the settings used for calls to listLocations. */
229     public PagedCallSettings.Builder<
230             ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings()231         listLocationsSettings() {
232       return getStubSettingsBuilder().listLocationsSettings();
233     }
234 
235     /** Returns the builder for the settings used for calls to getLocation. */
getLocationSettings()236     public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() {
237       return getStubSettingsBuilder().getLocationSettings();
238     }
239 
240     @Override
build()241     public FulfillmentsSettings build() throws IOException {
242       return new FulfillmentsSettings(this);
243     }
244   }
245 }
246