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.v3beta1; 18 19 import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.ListFlowsPagedResponse; 20 import static com.google.cloud.dialogflow.cx.v3beta1.FlowsClient.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.cx.v3beta1.stub.FlowsStubSettings; 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 FlowsClient}. 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 createFlow 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 * FlowsSettings.Builder flowsSettingsBuilder = FlowsSettings.newBuilder(); 71 * flowsSettingsBuilder 72 * .createFlowSettings() 73 * .setRetrySettings( 74 * flowsSettingsBuilder 75 * .createFlowSettings() 76 * .getRetrySettings() 77 * .toBuilder() 78 * .setTotalTimeout(Duration.ofSeconds(30)) 79 * .build()); 80 * FlowsSettings flowsSettings = flowsSettingsBuilder.build(); 81 * }</pre> 82 */ 83 @BetaApi 84 @Generated("by gapic-generator-java") 85 public class FlowsSettings extends ClientSettings<FlowsSettings> { 86 87 /** Returns the object with the settings used for calls to createFlow. */ createFlowSettings()88 public UnaryCallSettings<CreateFlowRequest, Flow> createFlowSettings() { 89 return ((FlowsStubSettings) getStubSettings()).createFlowSettings(); 90 } 91 92 /** Returns the object with the settings used for calls to deleteFlow. */ deleteFlowSettings()93 public UnaryCallSettings<DeleteFlowRequest, Empty> deleteFlowSettings() { 94 return ((FlowsStubSettings) getStubSettings()).deleteFlowSettings(); 95 } 96 97 /** Returns the object with the settings used for calls to listFlows. */ 98 public PagedCallSettings<ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> listFlowsSettings()99 listFlowsSettings() { 100 return ((FlowsStubSettings) getStubSettings()).listFlowsSettings(); 101 } 102 103 /** Returns the object with the settings used for calls to getFlow. */ getFlowSettings()104 public UnaryCallSettings<GetFlowRequest, Flow> getFlowSettings() { 105 return ((FlowsStubSettings) getStubSettings()).getFlowSettings(); 106 } 107 108 /** Returns the object with the settings used for calls to updateFlow. */ updateFlowSettings()109 public UnaryCallSettings<UpdateFlowRequest, Flow> updateFlowSettings() { 110 return ((FlowsStubSettings) getStubSettings()).updateFlowSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to trainFlow. */ trainFlowSettings()114 public UnaryCallSettings<TrainFlowRequest, Operation> trainFlowSettings() { 115 return ((FlowsStubSettings) getStubSettings()).trainFlowSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to trainFlow. */ trainFlowOperationSettings()119 public OperationCallSettings<TrainFlowRequest, Empty, Struct> trainFlowOperationSettings() { 120 return ((FlowsStubSettings) getStubSettings()).trainFlowOperationSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to validateFlow. */ validateFlowSettings()124 public UnaryCallSettings<ValidateFlowRequest, FlowValidationResult> validateFlowSettings() { 125 return ((FlowsStubSettings) getStubSettings()).validateFlowSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to getFlowValidationResult. */ 129 public UnaryCallSettings<GetFlowValidationResultRequest, FlowValidationResult> getFlowValidationResultSettings()130 getFlowValidationResultSettings() { 131 return ((FlowsStubSettings) getStubSettings()).getFlowValidationResultSettings(); 132 } 133 134 /** Returns the object with the settings used for calls to importFlow. */ importFlowSettings()135 public UnaryCallSettings<ImportFlowRequest, Operation> importFlowSettings() { 136 return ((FlowsStubSettings) getStubSettings()).importFlowSettings(); 137 } 138 139 /** Returns the object with the settings used for calls to importFlow. */ 140 public OperationCallSettings<ImportFlowRequest, ImportFlowResponse, Struct> importFlowOperationSettings()141 importFlowOperationSettings() { 142 return ((FlowsStubSettings) getStubSettings()).importFlowOperationSettings(); 143 } 144 145 /** Returns the object with the settings used for calls to exportFlow. */ exportFlowSettings()146 public UnaryCallSettings<ExportFlowRequest, Operation> exportFlowSettings() { 147 return ((FlowsStubSettings) getStubSettings()).exportFlowSettings(); 148 } 149 150 /** Returns the object with the settings used for calls to exportFlow. */ 151 public OperationCallSettings<ExportFlowRequest, ExportFlowResponse, Struct> exportFlowOperationSettings()152 exportFlowOperationSettings() { 153 return ((FlowsStubSettings) getStubSettings()).exportFlowOperationSettings(); 154 } 155 156 /** Returns the object with the settings used for calls to listLocations. */ 157 public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()158 listLocationsSettings() { 159 return ((FlowsStubSettings) getStubSettings()).listLocationsSettings(); 160 } 161 162 /** Returns the object with the settings used for calls to getLocation. */ getLocationSettings()163 public UnaryCallSettings<GetLocationRequest, Location> getLocationSettings() { 164 return ((FlowsStubSettings) getStubSettings()).getLocationSettings(); 165 } 166 create(FlowsStubSettings stub)167 public static final FlowsSettings create(FlowsStubSettings stub) throws IOException { 168 return new FlowsSettings.Builder(stub.toBuilder()).build(); 169 } 170 171 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()172 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 173 return FlowsStubSettings.defaultExecutorProviderBuilder(); 174 } 175 176 /** Returns the default service endpoint. */ getDefaultEndpoint()177 public static String getDefaultEndpoint() { 178 return FlowsStubSettings.getDefaultEndpoint(); 179 } 180 181 /** Returns the default service scopes. */ getDefaultServiceScopes()182 public static List<String> getDefaultServiceScopes() { 183 return FlowsStubSettings.getDefaultServiceScopes(); 184 } 185 186 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()187 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 188 return FlowsStubSettings.defaultCredentialsProviderBuilder(); 189 } 190 191 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()192 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 193 return FlowsStubSettings.defaultGrpcTransportProviderBuilder(); 194 } 195 196 /** Returns a builder for the default REST ChannelProvider for this service. */ 197 @BetaApi 198 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()199 defaultHttpJsonTransportProviderBuilder() { 200 return FlowsStubSettings.defaultHttpJsonTransportProviderBuilder(); 201 } 202 defaultTransportChannelProvider()203 public static TransportChannelProvider defaultTransportChannelProvider() { 204 return FlowsStubSettings.defaultTransportChannelProvider(); 205 } 206 207 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()208 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 209 return FlowsStubSettings.defaultApiClientHeaderProviderBuilder(); 210 } 211 212 /** Returns a new gRPC builder for this class. */ newBuilder()213 public static Builder newBuilder() { 214 return Builder.createDefault(); 215 } 216 217 /** Returns a new REST builder for this class. */ 218 @BetaApi newHttpJsonBuilder()219 public static Builder newHttpJsonBuilder() { 220 return Builder.createHttpJsonDefault(); 221 } 222 223 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)224 public static Builder newBuilder(ClientContext clientContext) { 225 return new Builder(clientContext); 226 } 227 228 /** Returns a builder containing all the values of this settings class. */ toBuilder()229 public Builder toBuilder() { 230 return new Builder(this); 231 } 232 FlowsSettings(Builder settingsBuilder)233 protected FlowsSettings(Builder settingsBuilder) throws IOException { 234 super(settingsBuilder); 235 } 236 237 /** Builder for FlowsSettings. */ 238 public static class Builder extends ClientSettings.Builder<FlowsSettings, Builder> { 239 Builder()240 protected Builder() throws IOException { 241 this(((ClientContext) null)); 242 } 243 Builder(ClientContext clientContext)244 protected Builder(ClientContext clientContext) { 245 super(FlowsStubSettings.newBuilder(clientContext)); 246 } 247 Builder(FlowsSettings settings)248 protected Builder(FlowsSettings settings) { 249 super(settings.getStubSettings().toBuilder()); 250 } 251 Builder(FlowsStubSettings.Builder stubSettings)252 protected Builder(FlowsStubSettings.Builder stubSettings) { 253 super(stubSettings); 254 } 255 createDefault()256 private static Builder createDefault() { 257 return new Builder(FlowsStubSettings.newBuilder()); 258 } 259 260 @BetaApi createHttpJsonDefault()261 private static Builder createHttpJsonDefault() { 262 return new Builder(FlowsStubSettings.newHttpJsonBuilder()); 263 } 264 getStubSettingsBuilder()265 public FlowsStubSettings.Builder getStubSettingsBuilder() { 266 return ((FlowsStubSettings.Builder) getStubSettings()); 267 } 268 269 /** 270 * Applies the given settings updater function to all of the unary API methods in this service. 271 * 272 * <p>Note: This method does not support applying settings to streaming methods. 273 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)274 public Builder applyToAllUnaryMethods( 275 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 276 super.applyToAllUnaryMethods( 277 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 278 return this; 279 } 280 281 /** Returns the builder for the settings used for calls to createFlow. */ createFlowSettings()282 public UnaryCallSettings.Builder<CreateFlowRequest, Flow> createFlowSettings() { 283 return getStubSettingsBuilder().createFlowSettings(); 284 } 285 286 /** Returns the builder for the settings used for calls to deleteFlow. */ deleteFlowSettings()287 public UnaryCallSettings.Builder<DeleteFlowRequest, Empty> deleteFlowSettings() { 288 return getStubSettingsBuilder().deleteFlowSettings(); 289 } 290 291 /** Returns the builder for the settings used for calls to listFlows. */ 292 public PagedCallSettings.Builder<ListFlowsRequest, ListFlowsResponse, ListFlowsPagedResponse> listFlowsSettings()293 listFlowsSettings() { 294 return getStubSettingsBuilder().listFlowsSettings(); 295 } 296 297 /** Returns the builder for the settings used for calls to getFlow. */ getFlowSettings()298 public UnaryCallSettings.Builder<GetFlowRequest, Flow> getFlowSettings() { 299 return getStubSettingsBuilder().getFlowSettings(); 300 } 301 302 /** Returns the builder for the settings used for calls to updateFlow. */ updateFlowSettings()303 public UnaryCallSettings.Builder<UpdateFlowRequest, Flow> updateFlowSettings() { 304 return getStubSettingsBuilder().updateFlowSettings(); 305 } 306 307 /** Returns the builder for the settings used for calls to trainFlow. */ trainFlowSettings()308 public UnaryCallSettings.Builder<TrainFlowRequest, Operation> trainFlowSettings() { 309 return getStubSettingsBuilder().trainFlowSettings(); 310 } 311 312 /** Returns the builder for the settings used for calls to trainFlow. */ 313 public OperationCallSettings.Builder<TrainFlowRequest, Empty, Struct> trainFlowOperationSettings()314 trainFlowOperationSettings() { 315 return getStubSettingsBuilder().trainFlowOperationSettings(); 316 } 317 318 /** Returns the builder for the settings used for calls to validateFlow. */ 319 public UnaryCallSettings.Builder<ValidateFlowRequest, FlowValidationResult> validateFlowSettings()320 validateFlowSettings() { 321 return getStubSettingsBuilder().validateFlowSettings(); 322 } 323 324 /** Returns the builder for the settings used for calls to getFlowValidationResult. */ 325 public UnaryCallSettings.Builder<GetFlowValidationResultRequest, FlowValidationResult> getFlowValidationResultSettings()326 getFlowValidationResultSettings() { 327 return getStubSettingsBuilder().getFlowValidationResultSettings(); 328 } 329 330 /** Returns the builder for the settings used for calls to importFlow. */ importFlowSettings()331 public UnaryCallSettings.Builder<ImportFlowRequest, Operation> importFlowSettings() { 332 return getStubSettingsBuilder().importFlowSettings(); 333 } 334 335 /** Returns the builder for the settings used for calls to importFlow. */ 336 public OperationCallSettings.Builder<ImportFlowRequest, ImportFlowResponse, Struct> importFlowOperationSettings()337 importFlowOperationSettings() { 338 return getStubSettingsBuilder().importFlowOperationSettings(); 339 } 340 341 /** Returns the builder for the settings used for calls to exportFlow. */ exportFlowSettings()342 public UnaryCallSettings.Builder<ExportFlowRequest, Operation> exportFlowSettings() { 343 return getStubSettingsBuilder().exportFlowSettings(); 344 } 345 346 /** Returns the builder for the settings used for calls to exportFlow. */ 347 public OperationCallSettings.Builder<ExportFlowRequest, ExportFlowResponse, Struct> exportFlowOperationSettings()348 exportFlowOperationSettings() { 349 return getStubSettingsBuilder().exportFlowOperationSettings(); 350 } 351 352 /** Returns the builder for the settings used for calls to listLocations. */ 353 public PagedCallSettings.Builder< 354 ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()355 listLocationsSettings() { 356 return getStubSettingsBuilder().listLocationsSettings(); 357 } 358 359 /** Returns the builder for the settings used for calls to getLocation. */ getLocationSettings()360 public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { 361 return getStubSettingsBuilder().getLocationSettings(); 362 } 363 364 @Override build()365 public FlowsSettings build() throws IOException { 366 return new FlowsSettings(this); 367 } 368 } 369 } 370