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