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