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