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.GlobalForwardingRulesClient.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.GlobalForwardingRulesStubSettings; 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 GlobalForwardingRulesClient}. 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 * GlobalForwardingRulesSettings.Builder globalForwardingRulesSettingsBuilder = 62 * GlobalForwardingRulesSettings.newBuilder(); 63 * globalForwardingRulesSettingsBuilder 64 * .getSettings() 65 * .setRetrySettings( 66 * globalForwardingRulesSettingsBuilder 67 * .getSettings() 68 * .getRetrySettings() 69 * .toBuilder() 70 * .setTotalTimeout(Duration.ofSeconds(30)) 71 * .build()); 72 * GlobalForwardingRulesSettings globalForwardingRulesSettings = 73 * globalForwardingRulesSettingsBuilder.build(); 74 * }</pre> 75 */ 76 @Generated("by gapic-generator-java") 77 public class GlobalForwardingRulesSettings extends ClientSettings<GlobalForwardingRulesSettings> { 78 79 /** Returns the object with the settings used for calls to delete. */ deleteSettings()80 public UnaryCallSettings<DeleteGlobalForwardingRuleRequest, Operation> deleteSettings() { 81 return ((GlobalForwardingRulesStubSettings) getStubSettings()).deleteSettings(); 82 } 83 84 /** Returns the object with the settings used for calls to delete. */ 85 public OperationCallSettings<DeleteGlobalForwardingRuleRequest, Operation, Operation> deleteOperationSettings()86 deleteOperationSettings() { 87 return ((GlobalForwardingRulesStubSettings) getStubSettings()).deleteOperationSettings(); 88 } 89 90 /** Returns the object with the settings used for calls to get. */ getSettings()91 public UnaryCallSettings<GetGlobalForwardingRuleRequest, ForwardingRule> getSettings() { 92 return ((GlobalForwardingRulesStubSettings) getStubSettings()).getSettings(); 93 } 94 95 /** Returns the object with the settings used for calls to insert. */ insertSettings()96 public UnaryCallSettings<InsertGlobalForwardingRuleRequest, Operation> insertSettings() { 97 return ((GlobalForwardingRulesStubSettings) getStubSettings()).insertSettings(); 98 } 99 100 /** Returns the object with the settings used for calls to insert. */ 101 public OperationCallSettings<InsertGlobalForwardingRuleRequest, Operation, Operation> insertOperationSettings()102 insertOperationSettings() { 103 return ((GlobalForwardingRulesStubSettings) getStubSettings()).insertOperationSettings(); 104 } 105 106 /** Returns the object with the settings used for calls to list. */ 107 public PagedCallSettings<ListGlobalForwardingRulesRequest, ForwardingRuleList, ListPagedResponse> listSettings()108 listSettings() { 109 return ((GlobalForwardingRulesStubSettings) getStubSettings()).listSettings(); 110 } 111 112 /** Returns the object with the settings used for calls to patch. */ patchSettings()113 public UnaryCallSettings<PatchGlobalForwardingRuleRequest, Operation> patchSettings() { 114 return ((GlobalForwardingRulesStubSettings) getStubSettings()).patchSettings(); 115 } 116 117 /** Returns the object with the settings used for calls to patch. */ 118 public OperationCallSettings<PatchGlobalForwardingRuleRequest, Operation, Operation> patchOperationSettings()119 patchOperationSettings() { 120 return ((GlobalForwardingRulesStubSettings) getStubSettings()).patchOperationSettings(); 121 } 122 123 /** Returns the object with the settings used for calls to setLabels. */ setLabelsSettings()124 public UnaryCallSettings<SetLabelsGlobalForwardingRuleRequest, Operation> setLabelsSettings() { 125 return ((GlobalForwardingRulesStubSettings) getStubSettings()).setLabelsSettings(); 126 } 127 128 /** Returns the object with the settings used for calls to setLabels. */ 129 public OperationCallSettings<SetLabelsGlobalForwardingRuleRequest, Operation, Operation> setLabelsOperationSettings()130 setLabelsOperationSettings() { 131 return ((GlobalForwardingRulesStubSettings) getStubSettings()).setLabelsOperationSettings(); 132 } 133 134 /** Returns the object with the settings used for calls to setTarget. */ setTargetSettings()135 public UnaryCallSettings<SetTargetGlobalForwardingRuleRequest, Operation> setTargetSettings() { 136 return ((GlobalForwardingRulesStubSettings) getStubSettings()).setTargetSettings(); 137 } 138 139 /** Returns the object with the settings used for calls to setTarget. */ 140 public OperationCallSettings<SetTargetGlobalForwardingRuleRequest, Operation, Operation> setTargetOperationSettings()141 setTargetOperationSettings() { 142 return ((GlobalForwardingRulesStubSettings) getStubSettings()).setTargetOperationSettings(); 143 } 144 create(GlobalForwardingRulesStubSettings stub)145 public static final GlobalForwardingRulesSettings create(GlobalForwardingRulesStubSettings stub) 146 throws IOException { 147 return new GlobalForwardingRulesSettings.Builder(stub.toBuilder()).build(); 148 } 149 150 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()151 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 152 return GlobalForwardingRulesStubSettings.defaultExecutorProviderBuilder(); 153 } 154 155 /** Returns the default service endpoint. */ getDefaultEndpoint()156 public static String getDefaultEndpoint() { 157 return GlobalForwardingRulesStubSettings.getDefaultEndpoint(); 158 } 159 160 /** Returns the default service scopes. */ getDefaultServiceScopes()161 public static List<String> getDefaultServiceScopes() { 162 return GlobalForwardingRulesStubSettings.getDefaultServiceScopes(); 163 } 164 165 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()166 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 167 return GlobalForwardingRulesStubSettings.defaultCredentialsProviderBuilder(); 168 } 169 170 /** Returns a builder for the default ChannelProvider for this service. */ 171 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()172 defaultHttpJsonTransportProviderBuilder() { 173 return GlobalForwardingRulesStubSettings.defaultHttpJsonTransportProviderBuilder(); 174 } 175 defaultTransportChannelProvider()176 public static TransportChannelProvider defaultTransportChannelProvider() { 177 return GlobalForwardingRulesStubSettings.defaultTransportChannelProvider(); 178 } 179 180 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()181 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 182 return GlobalForwardingRulesStubSettings.defaultApiClientHeaderProviderBuilder(); 183 } 184 185 /** Returns a new builder for this class. */ newBuilder()186 public static Builder newBuilder() { 187 return Builder.createDefault(); 188 } 189 190 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)191 public static Builder newBuilder(ClientContext clientContext) { 192 return new Builder(clientContext); 193 } 194 195 /** Returns a builder containing all the values of this settings class. */ toBuilder()196 public Builder toBuilder() { 197 return new Builder(this); 198 } 199 GlobalForwardingRulesSettings(Builder settingsBuilder)200 protected GlobalForwardingRulesSettings(Builder settingsBuilder) throws IOException { 201 super(settingsBuilder); 202 } 203 204 /** Builder for GlobalForwardingRulesSettings. */ 205 public static class Builder 206 extends ClientSettings.Builder<GlobalForwardingRulesSettings, Builder> { 207 Builder()208 protected Builder() throws IOException { 209 this(((ClientContext) null)); 210 } 211 Builder(ClientContext clientContext)212 protected Builder(ClientContext clientContext) { 213 super(GlobalForwardingRulesStubSettings.newBuilder(clientContext)); 214 } 215 Builder(GlobalForwardingRulesSettings settings)216 protected Builder(GlobalForwardingRulesSettings settings) { 217 super(settings.getStubSettings().toBuilder()); 218 } 219 Builder(GlobalForwardingRulesStubSettings.Builder stubSettings)220 protected Builder(GlobalForwardingRulesStubSettings.Builder stubSettings) { 221 super(stubSettings); 222 } 223 createDefault()224 private static Builder createDefault() { 225 return new Builder(GlobalForwardingRulesStubSettings.newBuilder()); 226 } 227 getStubSettingsBuilder()228 public GlobalForwardingRulesStubSettings.Builder getStubSettingsBuilder() { 229 return ((GlobalForwardingRulesStubSettings.Builder) getStubSettings()); 230 } 231 232 /** 233 * Applies the given settings updater function to all of the unary API methods in this service. 234 * 235 * <p>Note: This method does not support applying settings to streaming methods. 236 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)237 public Builder applyToAllUnaryMethods( 238 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 239 super.applyToAllUnaryMethods( 240 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 241 return this; 242 } 243 244 /** Returns the builder for the settings used for calls to delete. */ 245 public UnaryCallSettings.Builder<DeleteGlobalForwardingRuleRequest, Operation> deleteSettings()246 deleteSettings() { 247 return getStubSettingsBuilder().deleteSettings(); 248 } 249 250 /** Returns the builder for the settings used for calls to delete. */ 251 public OperationCallSettings.Builder<DeleteGlobalForwardingRuleRequest, Operation, Operation> deleteOperationSettings()252 deleteOperationSettings() { 253 return getStubSettingsBuilder().deleteOperationSettings(); 254 } 255 256 /** Returns the builder for the settings used for calls to get. */ getSettings()257 public UnaryCallSettings.Builder<GetGlobalForwardingRuleRequest, ForwardingRule> getSettings() { 258 return getStubSettingsBuilder().getSettings(); 259 } 260 261 /** Returns the builder for the settings used for calls to insert. */ 262 public UnaryCallSettings.Builder<InsertGlobalForwardingRuleRequest, Operation> insertSettings()263 insertSettings() { 264 return getStubSettingsBuilder().insertSettings(); 265 } 266 267 /** Returns the builder for the settings used for calls to insert. */ 268 public OperationCallSettings.Builder<InsertGlobalForwardingRuleRequest, Operation, Operation> insertOperationSettings()269 insertOperationSettings() { 270 return getStubSettingsBuilder().insertOperationSettings(); 271 } 272 273 /** Returns the builder for the settings used for calls to list. */ 274 public PagedCallSettings.Builder< 275 ListGlobalForwardingRulesRequest, ForwardingRuleList, ListPagedResponse> listSettings()276 listSettings() { 277 return getStubSettingsBuilder().listSettings(); 278 } 279 280 /** Returns the builder for the settings used for calls to patch. */ patchSettings()281 public UnaryCallSettings.Builder<PatchGlobalForwardingRuleRequest, Operation> patchSettings() { 282 return getStubSettingsBuilder().patchSettings(); 283 } 284 285 /** Returns the builder for the settings used for calls to patch. */ 286 public OperationCallSettings.Builder<PatchGlobalForwardingRuleRequest, Operation, Operation> patchOperationSettings()287 patchOperationSettings() { 288 return getStubSettingsBuilder().patchOperationSettings(); 289 } 290 291 /** Returns the builder for the settings used for calls to setLabels. */ 292 public UnaryCallSettings.Builder<SetLabelsGlobalForwardingRuleRequest, Operation> setLabelsSettings()293 setLabelsSettings() { 294 return getStubSettingsBuilder().setLabelsSettings(); 295 } 296 297 /** Returns the builder for the settings used for calls to setLabels. */ 298 public OperationCallSettings.Builder<SetLabelsGlobalForwardingRuleRequest, Operation, Operation> setLabelsOperationSettings()299 setLabelsOperationSettings() { 300 return getStubSettingsBuilder().setLabelsOperationSettings(); 301 } 302 303 /** Returns the builder for the settings used for calls to setTarget. */ 304 public UnaryCallSettings.Builder<SetTargetGlobalForwardingRuleRequest, Operation> setTargetSettings()305 setTargetSettings() { 306 return getStubSettingsBuilder().setTargetSettings(); 307 } 308 309 /** Returns the builder for the settings used for calls to setTarget. */ 310 public OperationCallSettings.Builder<SetTargetGlobalForwardingRuleRequest, Operation, Operation> setTargetOperationSettings()311 setTargetOperationSettings() { 312 return getStubSettingsBuilder().setTargetOperationSettings(); 313 } 314 315 @Override build()316 public GlobalForwardingRulesSettings build() throws IOException { 317 return new GlobalForwardingRulesSettings(this); 318 } 319 } 320 } 321