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