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.SubnetworksClient.AggregatedListPagedResponse; 20 import static com.google.cloud.compute.v1.SubnetworksClient.ListPagedResponse; 21 import static com.google.cloud.compute.v1.SubnetworksClient.ListUsablePagedResponse; 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.SubnetworksStubSettings; 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 SubnetworksClient}. 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 * SubnetworksSettings.Builder subnetworksSettingsBuilder = SubnetworksSettings.newBuilder(); 64 * subnetworksSettingsBuilder 65 * .getSettings() 66 * .setRetrySettings( 67 * subnetworksSettingsBuilder 68 * .getSettings() 69 * .getRetrySettings() 70 * .toBuilder() 71 * .setTotalTimeout(Duration.ofSeconds(30)) 72 * .build()); 73 * SubnetworksSettings subnetworksSettings = subnetworksSettingsBuilder.build(); 74 * }</pre> 75 */ 76 @Generated("by gapic-generator-java") 77 public class SubnetworksSettings extends ClientSettings<SubnetworksSettings> { 78 79 /** Returns the object with the settings used for calls to aggregatedList. */ 80 public PagedCallSettings< 81 AggregatedListSubnetworksRequest, SubnetworkAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()82 aggregatedListSettings() { 83 return ((SubnetworksStubSettings) getStubSettings()).aggregatedListSettings(); 84 } 85 86 /** Returns the object with the settings used for calls to delete. */ deleteSettings()87 public UnaryCallSettings<DeleteSubnetworkRequest, Operation> deleteSettings() { 88 return ((SubnetworksStubSettings) getStubSettings()).deleteSettings(); 89 } 90 91 /** Returns the object with the settings used for calls to delete. */ 92 public OperationCallSettings<DeleteSubnetworkRequest, Operation, Operation> deleteOperationSettings()93 deleteOperationSettings() { 94 return ((SubnetworksStubSettings) getStubSettings()).deleteOperationSettings(); 95 } 96 97 /** Returns the object with the settings used for calls to expandIpCidrRange. */ 98 public UnaryCallSettings<ExpandIpCidrRangeSubnetworkRequest, Operation> expandIpCidrRangeSettings()99 expandIpCidrRangeSettings() { 100 return ((SubnetworksStubSettings) getStubSettings()).expandIpCidrRangeSettings(); 101 } 102 103 /** Returns the object with the settings used for calls to expandIpCidrRange. */ 104 public OperationCallSettings<ExpandIpCidrRangeSubnetworkRequest, Operation, Operation> expandIpCidrRangeOperationSettings()105 expandIpCidrRangeOperationSettings() { 106 return ((SubnetworksStubSettings) getStubSettings()).expandIpCidrRangeOperationSettings(); 107 } 108 109 /** Returns the object with the settings used for calls to get. */ getSettings()110 public UnaryCallSettings<GetSubnetworkRequest, Subnetwork> getSettings() { 111 return ((SubnetworksStubSettings) getStubSettings()).getSettings(); 112 } 113 114 /** Returns the object with the settings used for calls to getIamPolicy. */ getIamPolicySettings()115 public UnaryCallSettings<GetIamPolicySubnetworkRequest, Policy> getIamPolicySettings() { 116 return ((SubnetworksStubSettings) getStubSettings()).getIamPolicySettings(); 117 } 118 119 /** Returns the object with the settings used for calls to insert. */ insertSettings()120 public UnaryCallSettings<InsertSubnetworkRequest, Operation> insertSettings() { 121 return ((SubnetworksStubSettings) getStubSettings()).insertSettings(); 122 } 123 124 /** Returns the object with the settings used for calls to insert. */ 125 public OperationCallSettings<InsertSubnetworkRequest, Operation, Operation> insertOperationSettings()126 insertOperationSettings() { 127 return ((SubnetworksStubSettings) getStubSettings()).insertOperationSettings(); 128 } 129 130 /** Returns the object with the settings used for calls to list. */ 131 public PagedCallSettings<ListSubnetworksRequest, SubnetworkList, ListPagedResponse> listSettings()132 listSettings() { 133 return ((SubnetworksStubSettings) getStubSettings()).listSettings(); 134 } 135 136 /** Returns the object with the settings used for calls to listUsable. */ 137 public PagedCallSettings< 138 ListUsableSubnetworksRequest, UsableSubnetworksAggregatedList, ListUsablePagedResponse> listUsableSettings()139 listUsableSettings() { 140 return ((SubnetworksStubSettings) getStubSettings()).listUsableSettings(); 141 } 142 143 /** Returns the object with the settings used for calls to patch. */ patchSettings()144 public UnaryCallSettings<PatchSubnetworkRequest, Operation> patchSettings() { 145 return ((SubnetworksStubSettings) getStubSettings()).patchSettings(); 146 } 147 148 /** Returns the object with the settings used for calls to patch. */ 149 public OperationCallSettings<PatchSubnetworkRequest, Operation, Operation> patchOperationSettings()150 patchOperationSettings() { 151 return ((SubnetworksStubSettings) getStubSettings()).patchOperationSettings(); 152 } 153 154 /** Returns the object with the settings used for calls to setIamPolicy. */ setIamPolicySettings()155 public UnaryCallSettings<SetIamPolicySubnetworkRequest, Policy> setIamPolicySettings() { 156 return ((SubnetworksStubSettings) getStubSettings()).setIamPolicySettings(); 157 } 158 159 /** Returns the object with the settings used for calls to setPrivateIpGoogleAccess. */ 160 public UnaryCallSettings<SetPrivateIpGoogleAccessSubnetworkRequest, Operation> setPrivateIpGoogleAccessSettings()161 setPrivateIpGoogleAccessSettings() { 162 return ((SubnetworksStubSettings) getStubSettings()).setPrivateIpGoogleAccessSettings(); 163 } 164 165 /** Returns the object with the settings used for calls to setPrivateIpGoogleAccess. */ 166 public OperationCallSettings<SetPrivateIpGoogleAccessSubnetworkRequest, Operation, Operation> setPrivateIpGoogleAccessOperationSettings()167 setPrivateIpGoogleAccessOperationSettings() { 168 return ((SubnetworksStubSettings) getStubSettings()) 169 .setPrivateIpGoogleAccessOperationSettings(); 170 } 171 172 /** Returns the object with the settings used for calls to testIamPermissions. */ 173 public UnaryCallSettings<TestIamPermissionsSubnetworkRequest, TestPermissionsResponse> testIamPermissionsSettings()174 testIamPermissionsSettings() { 175 return ((SubnetworksStubSettings) getStubSettings()).testIamPermissionsSettings(); 176 } 177 create(SubnetworksStubSettings stub)178 public static final SubnetworksSettings create(SubnetworksStubSettings stub) throws IOException { 179 return new SubnetworksSettings.Builder(stub.toBuilder()).build(); 180 } 181 182 /** Returns a builder for the default ExecutorProvider for this service. */ defaultExecutorProviderBuilder()183 public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() { 184 return SubnetworksStubSettings.defaultExecutorProviderBuilder(); 185 } 186 187 /** Returns the default service endpoint. */ getDefaultEndpoint()188 public static String getDefaultEndpoint() { 189 return SubnetworksStubSettings.getDefaultEndpoint(); 190 } 191 192 /** Returns the default service scopes. */ getDefaultServiceScopes()193 public static List<String> getDefaultServiceScopes() { 194 return SubnetworksStubSettings.getDefaultServiceScopes(); 195 } 196 197 /** Returns a builder for the default credentials for this service. */ defaultCredentialsProviderBuilder()198 public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() { 199 return SubnetworksStubSettings.defaultCredentialsProviderBuilder(); 200 } 201 202 /** Returns a builder for the default ChannelProvider for this service. */ 203 public static InstantiatingHttpJsonChannelProvider.Builder defaultHttpJsonTransportProviderBuilder()204 defaultHttpJsonTransportProviderBuilder() { 205 return SubnetworksStubSettings.defaultHttpJsonTransportProviderBuilder(); 206 } 207 defaultTransportChannelProvider()208 public static TransportChannelProvider defaultTransportChannelProvider() { 209 return SubnetworksStubSettings.defaultTransportChannelProvider(); 210 } 211 212 @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") defaultApiClientHeaderProviderBuilder()213 public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { 214 return SubnetworksStubSettings.defaultApiClientHeaderProviderBuilder(); 215 } 216 217 /** Returns a new builder for this class. */ newBuilder()218 public static Builder newBuilder() { 219 return Builder.createDefault(); 220 } 221 222 /** Returns a new builder for this class. */ newBuilder(ClientContext clientContext)223 public static Builder newBuilder(ClientContext clientContext) { 224 return new Builder(clientContext); 225 } 226 227 /** Returns a builder containing all the values of this settings class. */ toBuilder()228 public Builder toBuilder() { 229 return new Builder(this); 230 } 231 SubnetworksSettings(Builder settingsBuilder)232 protected SubnetworksSettings(Builder settingsBuilder) throws IOException { 233 super(settingsBuilder); 234 } 235 236 /** Builder for SubnetworksSettings. */ 237 public static class Builder extends ClientSettings.Builder<SubnetworksSettings, Builder> { 238 Builder()239 protected Builder() throws IOException { 240 this(((ClientContext) null)); 241 } 242 Builder(ClientContext clientContext)243 protected Builder(ClientContext clientContext) { 244 super(SubnetworksStubSettings.newBuilder(clientContext)); 245 } 246 Builder(SubnetworksSettings settings)247 protected Builder(SubnetworksSettings settings) { 248 super(settings.getStubSettings().toBuilder()); 249 } 250 Builder(SubnetworksStubSettings.Builder stubSettings)251 protected Builder(SubnetworksStubSettings.Builder stubSettings) { 252 super(stubSettings); 253 } 254 createDefault()255 private static Builder createDefault() { 256 return new Builder(SubnetworksStubSettings.newBuilder()); 257 } 258 getStubSettingsBuilder()259 public SubnetworksStubSettings.Builder getStubSettingsBuilder() { 260 return ((SubnetworksStubSettings.Builder) getStubSettings()); 261 } 262 263 /** 264 * Applies the given settings updater function to all of the unary API methods in this service. 265 * 266 * <p>Note: This method does not support applying settings to streaming methods. 267 */ applyToAllUnaryMethods( ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater)268 public Builder applyToAllUnaryMethods( 269 ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) { 270 super.applyToAllUnaryMethods( 271 getStubSettingsBuilder().unaryMethodSettingsBuilders(), settingsUpdater); 272 return this; 273 } 274 275 /** Returns the builder for the settings used for calls to aggregatedList. */ 276 public PagedCallSettings.Builder< 277 AggregatedListSubnetworksRequest, SubnetworkAggregatedList, AggregatedListPagedResponse> aggregatedListSettings()278 aggregatedListSettings() { 279 return getStubSettingsBuilder().aggregatedListSettings(); 280 } 281 282 /** Returns the builder for the settings used for calls to delete. */ deleteSettings()283 public UnaryCallSettings.Builder<DeleteSubnetworkRequest, Operation> deleteSettings() { 284 return getStubSettingsBuilder().deleteSettings(); 285 } 286 287 /** Returns the builder for the settings used for calls to delete. */ 288 public OperationCallSettings.Builder<DeleteSubnetworkRequest, Operation, Operation> deleteOperationSettings()289 deleteOperationSettings() { 290 return getStubSettingsBuilder().deleteOperationSettings(); 291 } 292 293 /** Returns the builder for the settings used for calls to expandIpCidrRange. */ 294 public UnaryCallSettings.Builder<ExpandIpCidrRangeSubnetworkRequest, Operation> expandIpCidrRangeSettings()295 expandIpCidrRangeSettings() { 296 return getStubSettingsBuilder().expandIpCidrRangeSettings(); 297 } 298 299 /** Returns the builder for the settings used for calls to expandIpCidrRange. */ 300 public OperationCallSettings.Builder<ExpandIpCidrRangeSubnetworkRequest, Operation, Operation> expandIpCidrRangeOperationSettings()301 expandIpCidrRangeOperationSettings() { 302 return getStubSettingsBuilder().expandIpCidrRangeOperationSettings(); 303 } 304 305 /** Returns the builder for the settings used for calls to get. */ getSettings()306 public UnaryCallSettings.Builder<GetSubnetworkRequest, Subnetwork> getSettings() { 307 return getStubSettingsBuilder().getSettings(); 308 } 309 310 /** Returns the builder for the settings used for calls to getIamPolicy. */ getIamPolicySettings()311 public UnaryCallSettings.Builder<GetIamPolicySubnetworkRequest, Policy> getIamPolicySettings() { 312 return getStubSettingsBuilder().getIamPolicySettings(); 313 } 314 315 /** Returns the builder for the settings used for calls to insert. */ insertSettings()316 public UnaryCallSettings.Builder<InsertSubnetworkRequest, Operation> insertSettings() { 317 return getStubSettingsBuilder().insertSettings(); 318 } 319 320 /** Returns the builder for the settings used for calls to insert. */ 321 public OperationCallSettings.Builder<InsertSubnetworkRequest, Operation, Operation> insertOperationSettings()322 insertOperationSettings() { 323 return getStubSettingsBuilder().insertOperationSettings(); 324 } 325 326 /** Returns the builder for the settings used for calls to list. */ 327 public PagedCallSettings.Builder<ListSubnetworksRequest, SubnetworkList, ListPagedResponse> listSettings()328 listSettings() { 329 return getStubSettingsBuilder().listSettings(); 330 } 331 332 /** Returns the builder for the settings used for calls to listUsable. */ 333 public PagedCallSettings.Builder< 334 ListUsableSubnetworksRequest, UsableSubnetworksAggregatedList, ListUsablePagedResponse> listUsableSettings()335 listUsableSettings() { 336 return getStubSettingsBuilder().listUsableSettings(); 337 } 338 339 /** Returns the builder for the settings used for calls to patch. */ patchSettings()340 public UnaryCallSettings.Builder<PatchSubnetworkRequest, Operation> patchSettings() { 341 return getStubSettingsBuilder().patchSettings(); 342 } 343 344 /** Returns the builder for the settings used for calls to patch. */ 345 public OperationCallSettings.Builder<PatchSubnetworkRequest, Operation, Operation> patchOperationSettings()346 patchOperationSettings() { 347 return getStubSettingsBuilder().patchOperationSettings(); 348 } 349 350 /** Returns the builder for the settings used for calls to setIamPolicy. */ setIamPolicySettings()351 public UnaryCallSettings.Builder<SetIamPolicySubnetworkRequest, Policy> setIamPolicySettings() { 352 return getStubSettingsBuilder().setIamPolicySettings(); 353 } 354 355 /** Returns the builder for the settings used for calls to setPrivateIpGoogleAccess. */ 356 public UnaryCallSettings.Builder<SetPrivateIpGoogleAccessSubnetworkRequest, Operation> setPrivateIpGoogleAccessSettings()357 setPrivateIpGoogleAccessSettings() { 358 return getStubSettingsBuilder().setPrivateIpGoogleAccessSettings(); 359 } 360 361 /** Returns the builder for the settings used for calls to setPrivateIpGoogleAccess. */ 362 public OperationCallSettings.Builder< 363 SetPrivateIpGoogleAccessSubnetworkRequest, Operation, Operation> setPrivateIpGoogleAccessOperationSettings()364 setPrivateIpGoogleAccessOperationSettings() { 365 return getStubSettingsBuilder().setPrivateIpGoogleAccessOperationSettings(); 366 } 367 368 /** Returns the builder for the settings used for calls to testIamPermissions. */ 369 public UnaryCallSettings.Builder<TestIamPermissionsSubnetworkRequest, TestPermissionsResponse> testIamPermissionsSettings()370 testIamPermissionsSettings() { 371 return getStubSettingsBuilder().testIamPermissionsSettings(); 372 } 373 374 @Override build()375 public SubnetworksSettings build() throws IOException { 376 return new SubnetworksSettings(this); 377 } 378 } 379 } 380