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.compute.v1; 18 19 import static com.google.cloud.compute.v1.UrlMapsClient.AggregatedListPagedResponse; 20 import static com.google.cloud.compute.v1.UrlMapsClient.ListPagedResponse; 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.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.OperationCallSettings; 31 import com.google.api.gax.rpc.PagedCallSettings; 32 import com.google.api.gax.rpc.TransportChannelProvider; 33 import com.google.api.gax.rpc.UnaryCallSettings; 34 import com.google.cloud.compute.v1.stub.UrlMapsStubSettings; 35 import java.io.IOException; 36 import java.util.List; 37 import javax.annotation.Generated; 38 39 // AUTO-GENERATED DOCUMENTATION AND CLASS. 40 /** 41 * Settings class to configure an instance of {@link UrlMapsClient}. 42 * 43 * <p>The default instance has everything set to sensible defaults: 44 * 45 * <ul> 46 * <li>The default service address (compute.googleapis.com) and default port (443) are used. 47 * <li>Credentials are acquired automatically through Application Default Credentials. 48 * <li>Retries are configured for idempotent methods but not for non-idempotent methods. 49 * </ul> 50 * 51 * <p>The builder of this class is recursive, so contained classes are themselves builders. When 52 * build() is called, the tree of builders is called to create the complete settings object. 53 * 54 * <p>For example, to set the total timeout of get to 30 seconds: 55 * 56 * <pre>{@code 57 * // This snippet has been automatically generated and should be regarded as a code template only. 58 * // It will require modifications to work: 59 * // - It may require correct/in-range values for request initialization. 60 * // - It may require specifying regional endpoints when creating the service client as shown in 61 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 62 * UrlMapsSettings.Builder urlMapsSettingsBuilder = UrlMapsSettings.newBuilder(); 63 * urlMapsSettingsBuilder 64 * .getSettings() 65 * .setRetrySettings( 66 * urlMapsSettingsBuilder 67 * .getSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * UrlMapsSettings urlMapsSettings = urlMapsSettingsBuilder.build(); 73 * }</pre> 74 */ 75 @Generated("by gapic-generator-java") 76 public class UrlMapsSettings extends ClientSettings<UrlMapsSettings> { 77 78 /** Returns the object with the settings used for calls to aggregatedList. */ 79 public PagedCallSettings< 80 AggregatedListUrlMapsRequest, UrlMapsAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()81 aggregatedListSettings() { 82 return ((UrlMapsStubSettings) getStubSettings()).aggregatedListSettings(); 83 } 84 85 /** Returns the object with the settings used for calls to delete. */ deleteSettings()86 public UnaryCallSettings<DeleteUrlMapRequest, Operation> deleteSettings() { 87 return ((UrlMapsStubSettings) getStubSettings()).deleteSettings(); 88 } 89 90 /** Returns the object with the settings used for calls to delete. */ 91 public OperationCallSettings<DeleteUrlMapRequest, Operation, Operation> deleteOperationSettings()92 deleteOperationSettings() { 93 return ((UrlMapsStubSettings) getStubSettings()).deleteOperationSettings(); 94 } 95 96 /** Returns the object with the settings used for calls to get. */ getSettings()97 public UnaryCallSettings<GetUrlMapRequest, UrlMap> getSettings() { 98 return ((UrlMapsStubSettings) getStubSettings()).getSettings(); 99 } 100 101 /** Returns the object with the settings used for calls to insert. */ insertSettings()102 public UnaryCallSettings<InsertUrlMapRequest, Operation> insertSettings() { 103 return ((UrlMapsStubSettings) getStubSettings()).insertSettings(); 104 } 105 106 /** Returns the object with the settings used for calls to insert. */ 107 public OperationCallSettings<InsertUrlMapRequest, Operation, Operation> insertOperationSettings()108 insertOperationSettings() { 109 return ((UrlMapsStubSettings) getStubSettings()).insertOperationSettings(); 110 } 111 112 /** Returns the object with the settings used for calls to invalidateCache. */ invalidateCacheSettings()113 public UnaryCallSettings<InvalidateCacheUrlMapRequest, Operation> invalidateCacheSettings() { 114 return ((UrlMapsStubSettings) getStubSettings()).invalidateCacheSettings(); 115 } 116 117 /** Returns the object with the settings used for calls to invalidateCache. */ 118 public OperationCallSettings<InvalidateCacheUrlMapRequest, Operation, Operation> invalidateCacheOperationSettings()119 invalidateCacheOperationSettings() { 120 return ((UrlMapsStubSettings) getStubSettings()).invalidateCacheOperationSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to list. */ listSettings()124 public PagedCallSettings<ListUrlMapsRequest, UrlMapList, ListPagedResponse> listSettings() { 125 return ((UrlMapsStubSettings) getStubSettings()).listSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to patch. */ patchSettings()129 public UnaryCallSettings<PatchUrlMapRequest, Operation> patchSettings() { 130 return ((UrlMapsStubSettings) getStubSettings()).patchSettings(); 131 } 132 133 /** Returns the object with the settings used for calls to patch. */ patchOperationSettings()134 public OperationCallSettings<PatchUrlMapRequest, Operation, Operation> patchOperationSettings() { 135 return ((UrlMapsStubSettings) getStubSettings()).patchOperationSettings(); 136 } 137 138 /** Returns the object with the settings used for calls to update. */ updateSettings()139 public UnaryCallSettings<UpdateUrlMapRequest, Operation> updateSettings() { 140 return ((UrlMapsStubSettings) getStubSettings()).updateSettings(); 141 } 142 143 /** Returns the object with the settings used for calls to update. */ 144 public OperationCallSettings<UpdateUrlMapRequest, Operation, Operation> updateOperationSettings()145 updateOperationSettings() { 146 return ((UrlMapsStubSettings) getStubSettings()).updateOperationSettings(); 147 } 148 149 /** Returns the object with the settings used for calls to validate. */ validateSettings()150 public UnaryCallSettings<ValidateUrlMapRequest, UrlMapsValidateResponse> validateSettings() { 151 return ((UrlMapsStubSettings) getStubSettings()).validateSettings(); 152 } 153 create(UrlMapsStubSettings stub)154 public static final UrlMapsSettings create(UrlMapsStubSettings stub) throws IOException { 155 return new UrlMapsSettings.Builder(stub.toBuilder()).build(); 156 } 157 158 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()159 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 160 return UrlMapsStubSettings.defaultExecutorProviderBuilder(); 161 } 162 163 /** Returns the default service endpoint. */ getDefaultEndpoint()164 public static String getDefaultEndpoint() { 165 return UrlMapsStubSettings.getDefaultEndpoint(); 166 } 167 168 /** Returns the default service scopes. */ getDefaultServiceScopes()169 public static List<String> getDefaultServiceScopes() { 170 return UrlMapsStubSettings.getDefaultServiceScopes(); 171 } 172 173 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()174 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 175 return UrlMapsStubSettings.defaultCredentialsProviderBuilder(); 176 } 177 178 /** Returns a builder for the default ChannelProvider for this service. */ 179 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()180 defaultHttpJsonTransportProviderBuilder() { 181 return UrlMapsStubSettings.defaultHttpJsonTransportProviderBuilder(); 182 } 183 defaultTransportChannelProvider()184 public static TransportChannelProvider defaultTransportChannelProvider() { 185 return UrlMapsStubSettings.defaultTransportChannelProvider(); 186 } 187 188 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()189 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 190 return UrlMapsStubSettings.defaultApiClientHeaderProviderBuilder(); 191 } 192 193 /** Returns a new builder for this class. */ newBuilder()194 public static Builder newBuilder() { 195 return Builder.createDefault(); 196 } 197 198 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)199 public static Builder newBuilder(ClientContext clientContext) { 200 return new Builder(clientContext); 201 } 202 203 /** Returns a builder containing all the values of this settings class. */ toBuilder()204 public Builder toBuilder() { 205 return new Builder(this); 206 } 207 UrlMapsSettings(Builder settingsBuilder)208 protected UrlMapsSettings(Builder settingsBuilder) throws IOException { 209 super(settingsBuilder); 210 } 211 212 /** Builder for UrlMapsSettings. */ 213 public static class Builder extends ClientSettings.Builder<UrlMapsSettings, Builder> { 214 Builder()215 protected Builder() throws IOException { 216 this(((ClientContext) null)); 217 } 218 Builder(ClientContext clientContext)219 protected Builder(ClientContext clientContext) { 220 super(UrlMapsStubSettings.newBuilder(clientContext)); 221 } 222 Builder(UrlMapsSettings settings)223 protected Builder(UrlMapsSettings settings) { 224 super(settings.getStubSettings().toBuilder()); 225 } 226 Builder(UrlMapsStubSettings.Builder stubSettings)227 protected Builder(UrlMapsStubSettings.Builder stubSettings) { 228 super(stubSettings); 229 } 230 createDefault()231 private static Builder createDefault() { 232 return new Builder(UrlMapsStubSettings.newBuilder()); 233 } 234 getStubSettingsBuilder()235 public UrlMapsStubSettings.Builder getStubSettingsBuilder() { 236 return ((UrlMapsStubSettings.Builder) getStubSettings()); 237 } 238 239 /** 240 * Applies the given settings updater function to all of the unary API methods in this service. 241 * 242 * <p>Note: This method does not support applying settings to streaming methods. 243 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)244 public Builder applyToAllUnaryMethods( 245 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 246 super.applyToAllUnaryMethods( 247 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 248 return this; 249 } 250 251 /** Returns the builder for the settings used for calls to aggregatedList. */ 252 public PagedCallSettings.Builder< 253 AggregatedListUrlMapsRequest, UrlMapsAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()254 aggregatedListSettings() { 255 return getStubSettingsBuilder().aggregatedListSettings(); 256 } 257 258 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()259 public UnaryCallSettings.Builder<DeleteUrlMapRequest, Operation> deleteSettings() { 260 return getStubSettingsBuilder().deleteSettings(); 261 } 262 263 /** Returns the builder for the settings used for calls to delete. */ 264 public OperationCallSettings.Builder<DeleteUrlMapRequest, Operation, Operation> deleteOperationSettings()265 deleteOperationSettings() { 266 return getStubSettingsBuilder().deleteOperationSettings(); 267 } 268 269 /** Returns the builder for the settings used for calls to get. */ getSettings()270 public UnaryCallSettings.Builder<GetUrlMapRequest, UrlMap> getSettings() { 271 return getStubSettingsBuilder().getSettings(); 272 } 273 274 /** Returns the builder for the settings used for calls to insert. */ insertSettings()275 public UnaryCallSettings.Builder<InsertUrlMapRequest, Operation> insertSettings() { 276 return getStubSettingsBuilder().insertSettings(); 277 } 278 279 /** Returns the builder for the settings used for calls to insert. */ 280 public OperationCallSettings.Builder<InsertUrlMapRequest, Operation, Operation> insertOperationSettings()281 insertOperationSettings() { 282 return getStubSettingsBuilder().insertOperationSettings(); 283 } 284 285 /** Returns the builder for the settings used for calls to invalidateCache. */ 286 public UnaryCallSettings.Builder<InvalidateCacheUrlMapRequest, Operation> invalidateCacheSettings()287 invalidateCacheSettings() { 288 return getStubSettingsBuilder().invalidateCacheSettings(); 289 } 290 291 /** Returns the builder for the settings used for calls to invalidateCache. */ 292 public OperationCallSettings.Builder<InvalidateCacheUrlMapRequest, Operation, Operation> invalidateCacheOperationSettings()293 invalidateCacheOperationSettings() { 294 return getStubSettingsBuilder().invalidateCacheOperationSettings(); 295 } 296 297 /** Returns the builder for the settings used for calls to list. */ 298 public PagedCallSettings.Builder<ListUrlMapsRequest, UrlMapList, ListPagedResponse> listSettings()299 listSettings() { 300 return getStubSettingsBuilder().listSettings(); 301 } 302 303 /** Returns the builder for the settings used for calls to patch. */ patchSettings()304 public UnaryCallSettings.Builder<PatchUrlMapRequest, Operation> patchSettings() { 305 return getStubSettingsBuilder().patchSettings(); 306 } 307 308 /** Returns the builder for the settings used for calls to patch. */ 309 public OperationCallSettings.Builder<PatchUrlMapRequest, Operation, Operation> patchOperationSettings()310 patchOperationSettings() { 311 return getStubSettingsBuilder().patchOperationSettings(); 312 } 313 314 /** Returns the builder for the settings used for calls to update. */ updateSettings()315 public UnaryCallSettings.Builder<UpdateUrlMapRequest, Operation> updateSettings() { 316 return getStubSettingsBuilder().updateSettings(); 317 } 318 319 /** Returns the builder for the settings used for calls to update. */ 320 public OperationCallSettings.Builder<UpdateUrlMapRequest, Operation, Operation> updateOperationSettings()321 updateOperationSettings() { 322 return getStubSettingsBuilder().updateOperationSettings(); 323 } 324 325 /** Returns the builder for the settings used for calls to validate. */ 326 public UnaryCallSettings.Builder<ValidateUrlMapRequest, UrlMapsValidateResponse> validateSettings()327 validateSettings() { 328 return getStubSettingsBuilder().validateSettings(); 329 } 330 331 @Override build()332 public UrlMapsSettings build() throws IOException { 333 return new UrlMapsSettings(this); 334 } 335 } 336 } 337