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