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