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.VersionsClient.ListLocationsPagedResponse; 20 import static com.google.cloud.dialogflow.cx.v3.VersionsClient.ListVersionsPagedResponse; 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.v3.stub.VersionsStubSettings; 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 VersionsClient}. 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 getVersion 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 * VersionsSettings.Builder versionsSettingsBuilder = VersionsSettings.newBuilder(); 71 * versionsSettingsBuilder 72 * .getVersionSettings() 73 * .setRetrySettings( 74 * versionsSettingsBuilder 75 * .getVersionSettings() 76 * .getRetrySettings() 77 * .toBuilder() 78 * .setTotalTimeout(Duration.ofSeconds(30)) 79 * .build()); 80 * VersionsSettings versionsSettings = versionsSettingsBuilder.build(); 81 * }</pre> 82 */ 83 @Generated("by gapic-generator-java") 84 public class VersionsSettings extends ClientSettings<VersionsSettings> { 85 86 /** Returns the object with the settings used for calls to listVersions. */ 87 public PagedCallSettings<ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> listVersionsSettings()88 listVersionsSettings() { 89 return ((VersionsStubSettings) getStubSettings()).listVersionsSettings(); 90 } 91 92 /** Returns the object with the settings used for calls to getVersion. */ getVersionSettings()93 public UnaryCallSettings<GetVersionRequest, Version> getVersionSettings() { 94 return ((VersionsStubSettings) getStubSettings()).getVersionSettings(); 95 } 96 97 /** Returns the object with the settings used for calls to createVersion. */ createVersionSettings()98 public UnaryCallSettings<CreateVersionRequest, Operation> createVersionSettings() { 99 return ((VersionsStubSettings) getStubSettings()).createVersionSettings(); 100 } 101 102 /** Returns the object with the settings used for calls to createVersion. */ 103 public OperationCallSettings<CreateVersionRequest, Version, CreateVersionOperationMetadata> createVersionOperationSettings()104 createVersionOperationSettings() { 105 return ((VersionsStubSettings) getStubSettings()).createVersionOperationSettings(); 106 } 107 108 /** Returns the object with the settings used for calls to updateVersion. */ updateVersionSettings()109 public UnaryCallSettings<UpdateVersionRequest, Version> updateVersionSettings() { 110 return ((VersionsStubSettings) getStubSettings()).updateVersionSettings(); 111 } 112 113 /** Returns the object with the settings used for calls to deleteVersion. */ deleteVersionSettings()114 public UnaryCallSettings<DeleteVersionRequest, Empty> deleteVersionSettings() { 115 return ((VersionsStubSettings) getStubSettings()).deleteVersionSettings(); 116 } 117 118 /** Returns the object with the settings used for calls to loadVersion. */ loadVersionSettings()119 public UnaryCallSettings<LoadVersionRequest, Operation> loadVersionSettings() { 120 return ((VersionsStubSettings) getStubSettings()).loadVersionSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to loadVersion. */ loadVersionOperationSettings()124 public OperationCallSettings<LoadVersionRequest, Empty, Struct> loadVersionOperationSettings() { 125 return ((VersionsStubSettings) getStubSettings()).loadVersionOperationSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to compareVersions. */ 129 public UnaryCallSettings<CompareVersionsRequest, CompareVersionsResponse> compareVersionsSettings()130 compareVersionsSettings() { 131 return ((VersionsStubSettings) getStubSettings()).compareVersionsSettings(); 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 ((VersionsStubSettings) 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 ((VersionsStubSettings) getStubSettings()).getLocationSettings(); 143 } 144 create(VersionsStubSettings stub)145 public static final VersionsSettings create(VersionsStubSettings stub) throws IOException { 146 return new VersionsSettings.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 VersionsStubSettings.defaultExecutorProviderBuilder(); 152 } 153 154 /** Returns the default service endpoint. */ getDefaultEndpoint()155 public static String getDefaultEndpoint() { 156 return VersionsStubSettings.getDefaultEndpoint(); 157 } 158 159 /** Returns the default service scopes. */ getDefaultServiceScopes()160 public static List<String> getDefaultServiceScopes() { 161 return VersionsStubSettings.getDefaultServiceScopes(); 162 } 163 164 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()165 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 166 return VersionsStubSettings.defaultCredentialsProviderBuilder(); 167 } 168 169 /** Returns a builder for the default gRPC ChannelProvider for this service. */ defaultGrpcTransportProviderBuilder()170 public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { 171 return VersionsStubSettings.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 VersionsStubSettings.defaultHttpJsonTransportProviderBuilder(); 179 } 180 defaultTransportChannelProvider()181 public static TransportChannelProvider defaultTransportChannelProvider() { 182 return VersionsStubSettings.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 VersionsStubSettings.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 VersionsSettings(Builder settingsBuilder)211 protected VersionsSettings(Builder settingsBuilder) throws IOException { 212 super(settingsBuilder); 213 } 214 215 /** Builder for VersionsSettings. */ 216 public static class Builder extends ClientSettings.Builder<VersionsSettings, Builder> { 217 Builder()218 protected Builder() throws IOException { 219 this(((ClientContext) null)); 220 } 221 Builder(ClientContext clientContext)222 protected Builder(ClientContext clientContext) { 223 super(VersionsStubSettings.newBuilder(clientContext)); 224 } 225 Builder(VersionsSettings settings)226 protected Builder(VersionsSettings settings) { 227 super(settings.getStubSettings().toBuilder()); 228 } 229 Builder(VersionsStubSettings.Builder stubSettings)230 protected Builder(VersionsStubSettings.Builder stubSettings) { 231 super(stubSettings); 232 } 233 createDefault()234 private static Builder createDefault() { 235 return new Builder(VersionsStubSettings.newBuilder()); 236 } 237 238 @BetaApi createHttpJsonDefault()239 private static Builder createHttpJsonDefault() { 240 return new Builder(VersionsStubSettings.newHttpJsonBuilder()); 241 } 242 getStubSettingsBuilder()243 public VersionsStubSettings.Builder getStubSettingsBuilder() { 244 return ((VersionsStubSettings.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 listVersions. */ 260 public PagedCallSettings.Builder< 261 ListVersionsRequest, ListVersionsResponse, ListVersionsPagedResponse> listVersionsSettings()262 listVersionsSettings() { 263 return getStubSettingsBuilder().listVersionsSettings(); 264 } 265 266 /** Returns the builder for the settings used for calls to getVersion. */ getVersionSettings()267 public UnaryCallSettings.Builder<GetVersionRequest, Version> getVersionSettings() { 268 return getStubSettingsBuilder().getVersionSettings(); 269 } 270 271 /** Returns the builder for the settings used for calls to createVersion. */ createVersionSettings()272 public UnaryCallSettings.Builder<CreateVersionRequest, Operation> createVersionSettings() { 273 return getStubSettingsBuilder().createVersionSettings(); 274 } 275 276 /** Returns the builder for the settings used for calls to createVersion. */ 277 public OperationCallSettings.Builder< 278 CreateVersionRequest, Version, CreateVersionOperationMetadata> createVersionOperationSettings()279 createVersionOperationSettings() { 280 return getStubSettingsBuilder().createVersionOperationSettings(); 281 } 282 283 /** Returns the builder for the settings used for calls to updateVersion. */ updateVersionSettings()284 public UnaryCallSettings.Builder<UpdateVersionRequest, Version> updateVersionSettings() { 285 return getStubSettingsBuilder().updateVersionSettings(); 286 } 287 288 /** Returns the builder for the settings used for calls to deleteVersion. */ deleteVersionSettings()289 public UnaryCallSettings.Builder<DeleteVersionRequest, Empty> deleteVersionSettings() { 290 return getStubSettingsBuilder().deleteVersionSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to loadVersion. */ loadVersionSettings()294 public UnaryCallSettings.Builder<LoadVersionRequest, Operation> loadVersionSettings() { 295 return getStubSettingsBuilder().loadVersionSettings(); 296 } 297 298 /** Returns the builder for the settings used for calls to loadVersion. */ 299 public OperationCallSettings.Builder<LoadVersionRequest, Empty, Struct> loadVersionOperationSettings()300 loadVersionOperationSettings() { 301 return getStubSettingsBuilder().loadVersionOperationSettings(); 302 } 303 304 /** Returns the builder for the settings used for calls to compareVersions. */ 305 public UnaryCallSettings.Builder<CompareVersionsRequest, CompareVersionsResponse> compareVersionsSettings()306 compareVersionsSettings() { 307 return getStubSettingsBuilder().compareVersionsSettings(); 308 } 309 310 /** Returns the builder for the settings used for calls to listLocations. */ 311 public PagedCallSettings.Builder< 312 ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse> listLocationsSettings()313 listLocationsSettings() { 314 return getStubSettingsBuilder().listLocationsSettings(); 315 } 316 317 /** Returns the builder for the settings used for calls to getLocation. */ getLocationSettings()318 public UnaryCallSettings.Builder<GetLocationRequest, Location> getLocationSettings() { 319 return getStubSettingsBuilder().getLocationSettings(); 320 } 321 322 @Override build()323 public VersionsSettings build() throws IOException { 324 return new VersionsSettings(this); 325 } 326 } 327 } 328