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 com.google.api.core.ApiFuture; 20 import com.google.api.core.ApiFutures; 21 import com.google.api.core.BetaApi; 22 import com.google.api.gax.core.BackgroundResource; 23 import com.google.api.gax.longrunning.OperationFuture; 24 import com.google.api.gax.paging.AbstractFixedSizeCollection; 25 import com.google.api.gax.paging.AbstractPage; 26 import com.google.api.gax.paging.AbstractPagedListResponse; 27 import com.google.api.gax.rpc.OperationCallable; 28 import com.google.api.gax.rpc.PageContext; 29 import com.google.api.gax.rpc.UnaryCallable; 30 import com.google.cloud.compute.v1.stub.NodeGroupsStub; 31 import com.google.cloud.compute.v1.stub.NodeGroupsStubSettings; 32 import com.google.common.util.concurrent.MoreExecutors; 33 import java.io.IOException; 34 import java.util.List; 35 import java.util.Map; 36 import java.util.concurrent.TimeUnit; 37 import javax.annotation.Generated; 38 39 // AUTO-GENERATED DOCUMENTATION AND CLASS. 40 /** 41 * Service Description: The NodeGroups API. 42 * 43 * <p>This class provides the ability to make remote calls to the backing service through method 44 * calls that map to API methods. Sample code to get started: 45 * 46 * <pre>{@code 47 * // This snippet has been automatically generated and should be regarded as a code template only. 48 * // It will require modifications to work: 49 * // - It may require correct/in-range values for request initialization. 50 * // - It may require specifying regional endpoints when creating the service client as shown in 51 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 52 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 53 * String project = "project-309310695"; 54 * String zone = "zone3744684"; 55 * String nodeGroup = "nodeGroup443599261"; 56 * NodeGroup response = nodeGroupsClient.get(project, zone, nodeGroup); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the NodeGroupsClient object to clean up resources such as 61 * threads. In the example above, try-with-resources is used, which automatically calls close(). 62 * 63 * <p>The surface of this class includes several types of Java methods for each of the API's 64 * methods: 65 * 66 * <ol> 67 * <li>A "flattened" method. With this type of method, the fields of the request type have been 68 * converted into function parameters. It may be the case that not all fields are available as 69 * parameters, and not every API method will have a flattened method entry point. 70 * <li>A "request object" method. This type of method only takes one parameter, a request object, 71 * which must be constructed before the call. Not every API method will have a request object 72 * method. 73 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 74 * callable object, which can be used to initiate calls to the service. 75 * </ol> 76 * 77 * <p>See the individual methods for example code. 78 * 79 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 80 * these names, this class includes a format method for each type of name, and additionally a parse 81 * method to extract the individual identifiers contained within names that are returned. 82 * 83 * <p>This class can be customized by passing in a custom instance of NodeGroupsSettings to 84 * create(). For example: 85 * 86 * <p>To customize credentials: 87 * 88 * <pre>{@code 89 * // This snippet has been automatically generated and should be regarded as a code template only. 90 * // It will require modifications to work: 91 * // - It may require correct/in-range values for request initialization. 92 * // - It may require specifying regional endpoints when creating the service client as shown in 93 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 94 * NodeGroupsSettings nodeGroupsSettings = 95 * NodeGroupsSettings.newBuilder() 96 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 97 * .build(); 98 * NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create(nodeGroupsSettings); 99 * }</pre> 100 * 101 * <p>To customize the endpoint: 102 * 103 * <pre>{@code 104 * // This snippet has been automatically generated and should be regarded as a code template only. 105 * // It will require modifications to work: 106 * // - It may require correct/in-range values for request initialization. 107 * // - It may require specifying regional endpoints when creating the service client as shown in 108 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 109 * NodeGroupsSettings nodeGroupsSettings = 110 * NodeGroupsSettings.newBuilder().setEndpoint(myEndpoint).build(); 111 * NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create(nodeGroupsSettings); 112 * }</pre> 113 * 114 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 115 */ 116 @Generated("by gapic-generator-java") 117 public class NodeGroupsClient implements BackgroundResource { 118 private final NodeGroupsSettings settings; 119 private final NodeGroupsStub stub; 120 121 /** Constructs an instance of NodeGroupsClient with default settings. */ create()122 public static final NodeGroupsClient create() throws IOException { 123 return create(NodeGroupsSettings.newBuilder().build()); 124 } 125 126 /** 127 * Constructs an instance of NodeGroupsClient, using the given settings. The channels are created 128 * based on the settings passed in, or defaults for any settings that are not set. 129 */ create(NodeGroupsSettings settings)130 public static final NodeGroupsClient create(NodeGroupsSettings settings) throws IOException { 131 return new NodeGroupsClient(settings); 132 } 133 134 /** 135 * Constructs an instance of NodeGroupsClient, using the given stub for making calls. This is for 136 * advanced usage - prefer using create(NodeGroupsSettings). 137 */ create(NodeGroupsStub stub)138 public static final NodeGroupsClient create(NodeGroupsStub stub) { 139 return new NodeGroupsClient(stub); 140 } 141 142 /** 143 * Constructs an instance of NodeGroupsClient, using the given settings. This is protected so that 144 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 145 */ NodeGroupsClient(NodeGroupsSettings settings)146 protected NodeGroupsClient(NodeGroupsSettings settings) throws IOException { 147 this.settings = settings; 148 this.stub = ((NodeGroupsStubSettings) settings.getStubSettings()).createStub(); 149 } 150 NodeGroupsClient(NodeGroupsStub stub)151 protected NodeGroupsClient(NodeGroupsStub stub) { 152 this.settings = null; 153 this.stub = stub; 154 } 155 getSettings()156 public final NodeGroupsSettings getSettings() { 157 return settings; 158 } 159 getStub()160 public NodeGroupsStub getStub() { 161 return stub; 162 } 163 164 // AUTO-GENERATED DOCUMENTATION AND METHOD. 165 /** 166 * Adds specified number of nodes to the node group. 167 * 168 * <p>Sample code: 169 * 170 * <pre>{@code 171 * // This snippet has been automatically generated and should be regarded as a code template only. 172 * // It will require modifications to work: 173 * // - It may require correct/in-range values for request initialization. 174 * // - It may require specifying regional endpoints when creating the service client as shown in 175 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 176 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 177 * String project = "project-309310695"; 178 * String zone = "zone3744684"; 179 * String nodeGroup = "nodeGroup443599261"; 180 * NodeGroupsAddNodesRequest nodeGroupsAddNodesRequestResource = 181 * NodeGroupsAddNodesRequest.newBuilder().build(); 182 * Operation response = 183 * nodeGroupsClient 184 * .addNodesAsync(project, zone, nodeGroup, nodeGroupsAddNodesRequestResource) 185 * .get(); 186 * } 187 * }</pre> 188 * 189 * @param project Project ID for this request. 190 * @param zone The name of the zone for this request. 191 * @param nodeGroup Name of the NodeGroup resource. 192 * @param nodeGroupsAddNodesRequestResource The body resource for this request 193 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 194 */ addNodesAsync( String project, String zone, String nodeGroup, NodeGroupsAddNodesRequest nodeGroupsAddNodesRequestResource)195 public final OperationFuture<Operation, Operation> addNodesAsync( 196 String project, 197 String zone, 198 String nodeGroup, 199 NodeGroupsAddNodesRequest nodeGroupsAddNodesRequestResource) { 200 AddNodesNodeGroupRequest request = 201 AddNodesNodeGroupRequest.newBuilder() 202 .setProject(project) 203 .setZone(zone) 204 .setNodeGroup(nodeGroup) 205 .setNodeGroupsAddNodesRequestResource(nodeGroupsAddNodesRequestResource) 206 .build(); 207 return addNodesAsync(request); 208 } 209 210 // AUTO-GENERATED DOCUMENTATION AND METHOD. 211 /** 212 * Adds specified number of nodes to the node group. 213 * 214 * <p>Sample code: 215 * 216 * <pre>{@code 217 * // This snippet has been automatically generated and should be regarded as a code template only. 218 * // It will require modifications to work: 219 * // - It may require correct/in-range values for request initialization. 220 * // - It may require specifying regional endpoints when creating the service client as shown in 221 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 222 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 223 * AddNodesNodeGroupRequest request = 224 * AddNodesNodeGroupRequest.newBuilder() 225 * .setNodeGroup("nodeGroup443599261") 226 * .setNodeGroupsAddNodesRequestResource(NodeGroupsAddNodesRequest.newBuilder().build()) 227 * .setProject("project-309310695") 228 * .setRequestId("requestId693933066") 229 * .setZone("zone3744684") 230 * .build(); 231 * Operation response = nodeGroupsClient.addNodesAsync(request).get(); 232 * } 233 * }</pre> 234 * 235 * @param request The request object containing all of the parameters for the API call. 236 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 237 */ 238 @BetaApi( 239 "The surface for long-running operations is not stable yet and may change in the future.") addNodesAsync( AddNodesNodeGroupRequest request)240 public final OperationFuture<Operation, Operation> addNodesAsync( 241 AddNodesNodeGroupRequest request) { 242 return addNodesOperationCallable().futureCall(request); 243 } 244 245 // AUTO-GENERATED DOCUMENTATION AND METHOD. 246 /** 247 * Adds specified number of nodes to the node group. 248 * 249 * <p>Sample code: 250 * 251 * <pre>{@code 252 * // This snippet has been automatically generated and should be regarded as a code template only. 253 * // It will require modifications to work: 254 * // - It may require correct/in-range values for request initialization. 255 * // - It may require specifying regional endpoints when creating the service client as shown in 256 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 257 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 258 * AddNodesNodeGroupRequest request = 259 * AddNodesNodeGroupRequest.newBuilder() 260 * .setNodeGroup("nodeGroup443599261") 261 * .setNodeGroupsAddNodesRequestResource(NodeGroupsAddNodesRequest.newBuilder().build()) 262 * .setProject("project-309310695") 263 * .setRequestId("requestId693933066") 264 * .setZone("zone3744684") 265 * .build(); 266 * OperationFuture<Operation, Operation> future = 267 * nodeGroupsClient.addNodesOperationCallable().futureCall(request); 268 * // Do something. 269 * Operation response = future.get(); 270 * } 271 * }</pre> 272 */ 273 public final OperationCallable<AddNodesNodeGroupRequest, Operation, Operation> addNodesOperationCallable()274 addNodesOperationCallable() { 275 return stub.addNodesOperationCallable(); 276 } 277 278 // AUTO-GENERATED DOCUMENTATION AND METHOD. 279 /** 280 * Adds specified number of nodes to the node group. 281 * 282 * <p>Sample code: 283 * 284 * <pre>{@code 285 * // This snippet has been automatically generated and should be regarded as a code template only. 286 * // It will require modifications to work: 287 * // - It may require correct/in-range values for request initialization. 288 * // - It may require specifying regional endpoints when creating the service client as shown in 289 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 290 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 291 * AddNodesNodeGroupRequest request = 292 * AddNodesNodeGroupRequest.newBuilder() 293 * .setNodeGroup("nodeGroup443599261") 294 * .setNodeGroupsAddNodesRequestResource(NodeGroupsAddNodesRequest.newBuilder().build()) 295 * .setProject("project-309310695") 296 * .setRequestId("requestId693933066") 297 * .setZone("zone3744684") 298 * .build(); 299 * ApiFuture<Operation> future = nodeGroupsClient.addNodesCallable().futureCall(request); 300 * // Do something. 301 * Operation response = future.get(); 302 * } 303 * }</pre> 304 */ addNodesCallable()305 public final UnaryCallable<AddNodesNodeGroupRequest, Operation> addNodesCallable() { 306 return stub.addNodesCallable(); 307 } 308 309 // AUTO-GENERATED DOCUMENTATION AND METHOD. 310 /** 311 * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details 312 * about each group. 313 * 314 * <p>Sample code: 315 * 316 * <pre>{@code 317 * // This snippet has been automatically generated and should be regarded as a code template only. 318 * // It will require modifications to work: 319 * // - It may require correct/in-range values for request initialization. 320 * // - It may require specifying regional endpoints when creating the service client as shown in 321 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 322 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 323 * String project = "project-309310695"; 324 * for (Map.Entry<String, NodeGroupsScopedList> element : 325 * nodeGroupsClient.aggregatedList(project).iterateAll()) { 326 * // doThingsWith(element); 327 * } 328 * } 329 * }</pre> 330 * 331 * @param project Project ID for this request. 332 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 333 */ aggregatedList(String project)334 public final AggregatedListPagedResponse aggregatedList(String project) { 335 AggregatedListNodeGroupsRequest request = 336 AggregatedListNodeGroupsRequest.newBuilder().setProject(project).build(); 337 return aggregatedList(request); 338 } 339 340 // AUTO-GENERATED DOCUMENTATION AND METHOD. 341 /** 342 * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details 343 * about each group. 344 * 345 * <p>Sample code: 346 * 347 * <pre>{@code 348 * // This snippet has been automatically generated and should be regarded as a code template only. 349 * // It will require modifications to work: 350 * // - It may require correct/in-range values for request initialization. 351 * // - It may require specifying regional endpoints when creating the service client as shown in 352 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 353 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 354 * AggregatedListNodeGroupsRequest request = 355 * AggregatedListNodeGroupsRequest.newBuilder() 356 * .setFilter("filter-1274492040") 357 * .setIncludeAllScopes(true) 358 * .setMaxResults(1128457243) 359 * .setOrderBy("orderBy-1207110587") 360 * .setPageToken("pageToken873572522") 361 * .setProject("project-309310695") 362 * .setReturnPartialSuccess(true) 363 * .build(); 364 * for (Map.Entry<String, NodeGroupsScopedList> element : 365 * nodeGroupsClient.aggregatedList(request).iterateAll()) { 366 * // doThingsWith(element); 367 * } 368 * } 369 * }</pre> 370 * 371 * @param request The request object containing all of the parameters for the API call. 372 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 373 */ aggregatedList(AggregatedListNodeGroupsRequest request)374 public final AggregatedListPagedResponse aggregatedList(AggregatedListNodeGroupsRequest request) { 375 return aggregatedListPagedCallable().call(request); 376 } 377 378 // AUTO-GENERATED DOCUMENTATION AND METHOD. 379 /** 380 * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details 381 * about each group. 382 * 383 * <p>Sample code: 384 * 385 * <pre>{@code 386 * // This snippet has been automatically generated and should be regarded as a code template only. 387 * // It will require modifications to work: 388 * // - It may require correct/in-range values for request initialization. 389 * // - It may require specifying regional endpoints when creating the service client as shown in 390 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 391 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 392 * AggregatedListNodeGroupsRequest request = 393 * AggregatedListNodeGroupsRequest.newBuilder() 394 * .setFilter("filter-1274492040") 395 * .setIncludeAllScopes(true) 396 * .setMaxResults(1128457243) 397 * .setOrderBy("orderBy-1207110587") 398 * .setPageToken("pageToken873572522") 399 * .setProject("project-309310695") 400 * .setReturnPartialSuccess(true) 401 * .build(); 402 * ApiFuture<Map.Entry<String, NodeGroupsScopedList>> future = 403 * nodeGroupsClient.aggregatedListPagedCallable().futureCall(request); 404 * // Do something. 405 * for (Map.Entry<String, NodeGroupsScopedList> element : future.get().iterateAll()) { 406 * // doThingsWith(element); 407 * } 408 * } 409 * }</pre> 410 */ 411 public final UnaryCallable<AggregatedListNodeGroupsRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()412 aggregatedListPagedCallable() { 413 return stub.aggregatedListPagedCallable(); 414 } 415 416 // AUTO-GENERATED DOCUMENTATION AND METHOD. 417 /** 418 * Retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details 419 * about each group. 420 * 421 * <p>Sample code: 422 * 423 * <pre>{@code 424 * // This snippet has been automatically generated and should be regarded as a code template only. 425 * // It will require modifications to work: 426 * // - It may require correct/in-range values for request initialization. 427 * // - It may require specifying regional endpoints when creating the service client as shown in 428 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 429 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 430 * AggregatedListNodeGroupsRequest request = 431 * AggregatedListNodeGroupsRequest.newBuilder() 432 * .setFilter("filter-1274492040") 433 * .setIncludeAllScopes(true) 434 * .setMaxResults(1128457243) 435 * .setOrderBy("orderBy-1207110587") 436 * .setPageToken("pageToken873572522") 437 * .setProject("project-309310695") 438 * .setReturnPartialSuccess(true) 439 * .build(); 440 * while (true) { 441 * NodeGroupAggregatedList response = nodeGroupsClient.aggregatedListCallable().call(request); 442 * for (Map.Entry<String, NodeGroupsScopedList> element : response.getItemsList()) { 443 * // doThingsWith(element); 444 * } 445 * String nextPageToken = response.getNextPageToken(); 446 * if (!Strings.isNullOrEmpty(nextPageToken)) { 447 * request = request.toBuilder().setPageToken(nextPageToken).build(); 448 * } else { 449 * break; 450 * } 451 * } 452 * } 453 * }</pre> 454 */ 455 public final UnaryCallable<AggregatedListNodeGroupsRequest, NodeGroupAggregatedList> aggregatedListCallable()456 aggregatedListCallable() { 457 return stub.aggregatedListCallable(); 458 } 459 460 // AUTO-GENERATED DOCUMENTATION AND METHOD. 461 /** 462 * Deletes the specified NodeGroup resource. 463 * 464 * <p>Sample code: 465 * 466 * <pre>{@code 467 * // This snippet has been automatically generated and should be regarded as a code template only. 468 * // It will require modifications to work: 469 * // - It may require correct/in-range values for request initialization. 470 * // - It may require specifying regional endpoints when creating the service client as shown in 471 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 472 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 473 * String project = "project-309310695"; 474 * String zone = "zone3744684"; 475 * String nodeGroup = "nodeGroup443599261"; 476 * Operation response = nodeGroupsClient.deleteAsync(project, zone, nodeGroup).get(); 477 * } 478 * }</pre> 479 * 480 * @param project Project ID for this request. 481 * @param zone The name of the zone for this request. 482 * @param nodeGroup Name of the NodeGroup resource to delete. 483 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 484 */ deleteAsync( String project, String zone, String nodeGroup)485 public final OperationFuture<Operation, Operation> deleteAsync( 486 String project, String zone, String nodeGroup) { 487 DeleteNodeGroupRequest request = 488 DeleteNodeGroupRequest.newBuilder() 489 .setProject(project) 490 .setZone(zone) 491 .setNodeGroup(nodeGroup) 492 .build(); 493 return deleteAsync(request); 494 } 495 496 // AUTO-GENERATED DOCUMENTATION AND METHOD. 497 /** 498 * Deletes the specified NodeGroup resource. 499 * 500 * <p>Sample code: 501 * 502 * <pre>{@code 503 * // This snippet has been automatically generated and should be regarded as a code template only. 504 * // It will require modifications to work: 505 * // - It may require correct/in-range values for request initialization. 506 * // - It may require specifying regional endpoints when creating the service client as shown in 507 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 508 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 509 * DeleteNodeGroupRequest request = 510 * DeleteNodeGroupRequest.newBuilder() 511 * .setNodeGroup("nodeGroup443599261") 512 * .setProject("project-309310695") 513 * .setRequestId("requestId693933066") 514 * .setZone("zone3744684") 515 * .build(); 516 * Operation response = nodeGroupsClient.deleteAsync(request).get(); 517 * } 518 * }</pre> 519 * 520 * @param request The request object containing all of the parameters for the API call. 521 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 522 */ 523 @BetaApi( 524 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync(DeleteNodeGroupRequest request)525 public final OperationFuture<Operation, Operation> deleteAsync(DeleteNodeGroupRequest request) { 526 return deleteOperationCallable().futureCall(request); 527 } 528 529 // AUTO-GENERATED DOCUMENTATION AND METHOD. 530 /** 531 * Deletes the specified NodeGroup resource. 532 * 533 * <p>Sample code: 534 * 535 * <pre>{@code 536 * // This snippet has been automatically generated and should be regarded as a code template only. 537 * // It will require modifications to work: 538 * // - It may require correct/in-range values for request initialization. 539 * // - It may require specifying regional endpoints when creating the service client as shown in 540 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 541 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 542 * DeleteNodeGroupRequest request = 543 * DeleteNodeGroupRequest.newBuilder() 544 * .setNodeGroup("nodeGroup443599261") 545 * .setProject("project-309310695") 546 * .setRequestId("requestId693933066") 547 * .setZone("zone3744684") 548 * .build(); 549 * OperationFuture<Operation, Operation> future = 550 * nodeGroupsClient.deleteOperationCallable().futureCall(request); 551 * // Do something. 552 * Operation response = future.get(); 553 * } 554 * }</pre> 555 */ 556 public final OperationCallable<DeleteNodeGroupRequest, Operation, Operation> deleteOperationCallable()557 deleteOperationCallable() { 558 return stub.deleteOperationCallable(); 559 } 560 561 // AUTO-GENERATED DOCUMENTATION AND METHOD. 562 /** 563 * Deletes the specified NodeGroup resource. 564 * 565 * <p>Sample code: 566 * 567 * <pre>{@code 568 * // This snippet has been automatically generated and should be regarded as a code template only. 569 * // It will require modifications to work: 570 * // - It may require correct/in-range values for request initialization. 571 * // - It may require specifying regional endpoints when creating the service client as shown in 572 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 573 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 574 * DeleteNodeGroupRequest request = 575 * DeleteNodeGroupRequest.newBuilder() 576 * .setNodeGroup("nodeGroup443599261") 577 * .setProject("project-309310695") 578 * .setRequestId("requestId693933066") 579 * .setZone("zone3744684") 580 * .build(); 581 * ApiFuture<Operation> future = nodeGroupsClient.deleteCallable().futureCall(request); 582 * // Do something. 583 * Operation response = future.get(); 584 * } 585 * }</pre> 586 */ deleteCallable()587 public final UnaryCallable<DeleteNodeGroupRequest, Operation> deleteCallable() { 588 return stub.deleteCallable(); 589 } 590 591 // AUTO-GENERATED DOCUMENTATION AND METHOD. 592 /** 593 * Deletes specified nodes from the node group. 594 * 595 * <p>Sample code: 596 * 597 * <pre>{@code 598 * // This snippet has been automatically generated and should be regarded as a code template only. 599 * // It will require modifications to work: 600 * // - It may require correct/in-range values for request initialization. 601 * // - It may require specifying regional endpoints when creating the service client as shown in 602 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 603 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 604 * String project = "project-309310695"; 605 * String zone = "zone3744684"; 606 * String nodeGroup = "nodeGroup443599261"; 607 * NodeGroupsDeleteNodesRequest nodeGroupsDeleteNodesRequestResource = 608 * NodeGroupsDeleteNodesRequest.newBuilder().build(); 609 * Operation response = 610 * nodeGroupsClient 611 * .deleteNodesAsync(project, zone, nodeGroup, nodeGroupsDeleteNodesRequestResource) 612 * .get(); 613 * } 614 * }</pre> 615 * 616 * @param project Project ID for this request. 617 * @param zone The name of the zone for this request. 618 * @param nodeGroup Name of the NodeGroup resource whose nodes will be deleted. 619 * @param nodeGroupsDeleteNodesRequestResource The body resource for this request 620 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 621 */ deleteNodesAsync( String project, String zone, String nodeGroup, NodeGroupsDeleteNodesRequest nodeGroupsDeleteNodesRequestResource)622 public final OperationFuture<Operation, Operation> deleteNodesAsync( 623 String project, 624 String zone, 625 String nodeGroup, 626 NodeGroupsDeleteNodesRequest nodeGroupsDeleteNodesRequestResource) { 627 DeleteNodesNodeGroupRequest request = 628 DeleteNodesNodeGroupRequest.newBuilder() 629 .setProject(project) 630 .setZone(zone) 631 .setNodeGroup(nodeGroup) 632 .setNodeGroupsDeleteNodesRequestResource(nodeGroupsDeleteNodesRequestResource) 633 .build(); 634 return deleteNodesAsync(request); 635 } 636 637 // AUTO-GENERATED DOCUMENTATION AND METHOD. 638 /** 639 * Deletes specified nodes from the node group. 640 * 641 * <p>Sample code: 642 * 643 * <pre>{@code 644 * // This snippet has been automatically generated and should be regarded as a code template only. 645 * // It will require modifications to work: 646 * // - It may require correct/in-range values for request initialization. 647 * // - It may require specifying regional endpoints when creating the service client as shown in 648 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 649 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 650 * DeleteNodesNodeGroupRequest request = 651 * DeleteNodesNodeGroupRequest.newBuilder() 652 * .setNodeGroup("nodeGroup443599261") 653 * .setNodeGroupsDeleteNodesRequestResource( 654 * NodeGroupsDeleteNodesRequest.newBuilder().build()) 655 * .setProject("project-309310695") 656 * .setRequestId("requestId693933066") 657 * .setZone("zone3744684") 658 * .build(); 659 * Operation response = nodeGroupsClient.deleteNodesAsync(request).get(); 660 * } 661 * }</pre> 662 * 663 * @param request The request object containing all of the parameters for the API call. 664 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 665 */ 666 @BetaApi( 667 "The surface for long-running operations is not stable yet and may change in the future.") deleteNodesAsync( DeleteNodesNodeGroupRequest request)668 public final OperationFuture<Operation, Operation> deleteNodesAsync( 669 DeleteNodesNodeGroupRequest request) { 670 return deleteNodesOperationCallable().futureCall(request); 671 } 672 673 // AUTO-GENERATED DOCUMENTATION AND METHOD. 674 /** 675 * Deletes specified nodes from the node group. 676 * 677 * <p>Sample code: 678 * 679 * <pre>{@code 680 * // This snippet has been automatically generated and should be regarded as a code template only. 681 * // It will require modifications to work: 682 * // - It may require correct/in-range values for request initialization. 683 * // - It may require specifying regional endpoints when creating the service client as shown in 684 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 685 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 686 * DeleteNodesNodeGroupRequest request = 687 * DeleteNodesNodeGroupRequest.newBuilder() 688 * .setNodeGroup("nodeGroup443599261") 689 * .setNodeGroupsDeleteNodesRequestResource( 690 * NodeGroupsDeleteNodesRequest.newBuilder().build()) 691 * .setProject("project-309310695") 692 * .setRequestId("requestId693933066") 693 * .setZone("zone3744684") 694 * .build(); 695 * OperationFuture<Operation, Operation> future = 696 * nodeGroupsClient.deleteNodesOperationCallable().futureCall(request); 697 * // Do something. 698 * Operation response = future.get(); 699 * } 700 * }</pre> 701 */ 702 public final OperationCallable<DeleteNodesNodeGroupRequest, Operation, Operation> deleteNodesOperationCallable()703 deleteNodesOperationCallable() { 704 return stub.deleteNodesOperationCallable(); 705 } 706 707 // AUTO-GENERATED DOCUMENTATION AND METHOD. 708 /** 709 * Deletes specified nodes from the node group. 710 * 711 * <p>Sample code: 712 * 713 * <pre>{@code 714 * // This snippet has been automatically generated and should be regarded as a code template only. 715 * // It will require modifications to work: 716 * // - It may require correct/in-range values for request initialization. 717 * // - It may require specifying regional endpoints when creating the service client as shown in 718 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 719 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 720 * DeleteNodesNodeGroupRequest request = 721 * DeleteNodesNodeGroupRequest.newBuilder() 722 * .setNodeGroup("nodeGroup443599261") 723 * .setNodeGroupsDeleteNodesRequestResource( 724 * NodeGroupsDeleteNodesRequest.newBuilder().build()) 725 * .setProject("project-309310695") 726 * .setRequestId("requestId693933066") 727 * .setZone("zone3744684") 728 * .build(); 729 * ApiFuture<Operation> future = nodeGroupsClient.deleteNodesCallable().futureCall(request); 730 * // Do something. 731 * Operation response = future.get(); 732 * } 733 * }</pre> 734 */ deleteNodesCallable()735 public final UnaryCallable<DeleteNodesNodeGroupRequest, Operation> deleteNodesCallable() { 736 return stub.deleteNodesCallable(); 737 } 738 739 // AUTO-GENERATED DOCUMENTATION AND METHOD. 740 /** 741 * Returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. 742 * Note: the "nodes" field should not be used. Use nodeGroups.listNodes instead. 743 * 744 * <p>Sample code: 745 * 746 * <pre>{@code 747 * // This snippet has been automatically generated and should be regarded as a code template only. 748 * // It will require modifications to work: 749 * // - It may require correct/in-range values for request initialization. 750 * // - It may require specifying regional endpoints when creating the service client as shown in 751 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 752 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 753 * String project = "project-309310695"; 754 * String zone = "zone3744684"; 755 * String nodeGroup = "nodeGroup443599261"; 756 * NodeGroup response = nodeGroupsClient.get(project, zone, nodeGroup); 757 * } 758 * }</pre> 759 * 760 * @param project Project ID for this request. 761 * @param zone The name of the zone for this request. 762 * @param nodeGroup Name of the node group to return. 763 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 764 */ get(String project, String zone, String nodeGroup)765 public final NodeGroup get(String project, String zone, String nodeGroup) { 766 GetNodeGroupRequest request = 767 GetNodeGroupRequest.newBuilder() 768 .setProject(project) 769 .setZone(zone) 770 .setNodeGroup(nodeGroup) 771 .build(); 772 return get(request); 773 } 774 775 // AUTO-GENERATED DOCUMENTATION AND METHOD. 776 /** 777 * Returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. 778 * Note: the "nodes" field should not be used. Use nodeGroups.listNodes instead. 779 * 780 * <p>Sample code: 781 * 782 * <pre>{@code 783 * // This snippet has been automatically generated and should be regarded as a code template only. 784 * // It will require modifications to work: 785 * // - It may require correct/in-range values for request initialization. 786 * // - It may require specifying regional endpoints when creating the service client as shown in 787 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 788 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 789 * GetNodeGroupRequest request = 790 * GetNodeGroupRequest.newBuilder() 791 * .setNodeGroup("nodeGroup443599261") 792 * .setProject("project-309310695") 793 * .setZone("zone3744684") 794 * .build(); 795 * NodeGroup response = nodeGroupsClient.get(request); 796 * } 797 * }</pre> 798 * 799 * @param request The request object containing all of the parameters for the API call. 800 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 801 */ get(GetNodeGroupRequest request)802 public final NodeGroup get(GetNodeGroupRequest request) { 803 return getCallable().call(request); 804 } 805 806 // AUTO-GENERATED DOCUMENTATION AND METHOD. 807 /** 808 * Returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. 809 * Note: the "nodes" field should not be used. Use nodeGroups.listNodes instead. 810 * 811 * <p>Sample code: 812 * 813 * <pre>{@code 814 * // This snippet has been automatically generated and should be regarded as a code template only. 815 * // It will require modifications to work: 816 * // - It may require correct/in-range values for request initialization. 817 * // - It may require specifying regional endpoints when creating the service client as shown in 818 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 819 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 820 * GetNodeGroupRequest request = 821 * GetNodeGroupRequest.newBuilder() 822 * .setNodeGroup("nodeGroup443599261") 823 * .setProject("project-309310695") 824 * .setZone("zone3744684") 825 * .build(); 826 * ApiFuture<NodeGroup> future = nodeGroupsClient.getCallable().futureCall(request); 827 * // Do something. 828 * NodeGroup response = future.get(); 829 * } 830 * }</pre> 831 */ getCallable()832 public final UnaryCallable<GetNodeGroupRequest, NodeGroup> getCallable() { 833 return stub.getCallable(); 834 } 835 836 // AUTO-GENERATED DOCUMENTATION AND METHOD. 837 /** 838 * Gets the access control policy for a resource. May be empty if no such policy or resource 839 * exists. 840 * 841 * <p>Sample code: 842 * 843 * <pre>{@code 844 * // This snippet has been automatically generated and should be regarded as a code template only. 845 * // It will require modifications to work: 846 * // - It may require correct/in-range values for request initialization. 847 * // - It may require specifying regional endpoints when creating the service client as shown in 848 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 849 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 850 * String project = "project-309310695"; 851 * String zone = "zone3744684"; 852 * String resource = "resource-341064690"; 853 * Policy response = nodeGroupsClient.getIamPolicy(project, zone, resource); 854 * } 855 * }</pre> 856 * 857 * @param project Project ID for this request. 858 * @param zone The name of the zone for this request. 859 * @param resource Name or id of the resource for this request. 860 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 861 */ getIamPolicy(String project, String zone, String resource)862 public final Policy getIamPolicy(String project, String zone, String resource) { 863 GetIamPolicyNodeGroupRequest request = 864 GetIamPolicyNodeGroupRequest.newBuilder() 865 .setProject(project) 866 .setZone(zone) 867 .setResource(resource) 868 .build(); 869 return getIamPolicy(request); 870 } 871 872 // AUTO-GENERATED DOCUMENTATION AND METHOD. 873 /** 874 * Gets the access control policy for a resource. May be empty if no such policy or resource 875 * exists. 876 * 877 * <p>Sample code: 878 * 879 * <pre>{@code 880 * // This snippet has been automatically generated and should be regarded as a code template only. 881 * // It will require modifications to work: 882 * // - It may require correct/in-range values for request initialization. 883 * // - It may require specifying regional endpoints when creating the service client as shown in 884 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 885 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 886 * GetIamPolicyNodeGroupRequest request = 887 * GetIamPolicyNodeGroupRequest.newBuilder() 888 * .setOptionsRequestedPolicyVersion(-574521795) 889 * .setProject("project-309310695") 890 * .setResource("resource-341064690") 891 * .setZone("zone3744684") 892 * .build(); 893 * Policy response = nodeGroupsClient.getIamPolicy(request); 894 * } 895 * }</pre> 896 * 897 * @param request The request object containing all of the parameters for the API call. 898 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 899 */ getIamPolicy(GetIamPolicyNodeGroupRequest request)900 public final Policy getIamPolicy(GetIamPolicyNodeGroupRequest request) { 901 return getIamPolicyCallable().call(request); 902 } 903 904 // AUTO-GENERATED DOCUMENTATION AND METHOD. 905 /** 906 * Gets the access control policy for a resource. May be empty if no such policy or resource 907 * exists. 908 * 909 * <p>Sample code: 910 * 911 * <pre>{@code 912 * // This snippet has been automatically generated and should be regarded as a code template only. 913 * // It will require modifications to work: 914 * // - It may require correct/in-range values for request initialization. 915 * // - It may require specifying regional endpoints when creating the service client as shown in 916 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 917 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 918 * GetIamPolicyNodeGroupRequest request = 919 * GetIamPolicyNodeGroupRequest.newBuilder() 920 * .setOptionsRequestedPolicyVersion(-574521795) 921 * .setProject("project-309310695") 922 * .setResource("resource-341064690") 923 * .setZone("zone3744684") 924 * .build(); 925 * ApiFuture<Policy> future = nodeGroupsClient.getIamPolicyCallable().futureCall(request); 926 * // Do something. 927 * Policy response = future.get(); 928 * } 929 * }</pre> 930 */ getIamPolicyCallable()931 public final UnaryCallable<GetIamPolicyNodeGroupRequest, Policy> getIamPolicyCallable() { 932 return stub.getIamPolicyCallable(); 933 } 934 935 // AUTO-GENERATED DOCUMENTATION AND METHOD. 936 /** 937 * Creates a NodeGroup resource in the specified project using the data included in the request. 938 * 939 * <p>Sample code: 940 * 941 * <pre>{@code 942 * // This snippet has been automatically generated and should be regarded as a code template only. 943 * // It will require modifications to work: 944 * // - It may require correct/in-range values for request initialization. 945 * // - It may require specifying regional endpoints when creating the service client as shown in 946 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 947 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 948 * String project = "project-309310695"; 949 * String zone = "zone3744684"; 950 * int initialNodeCount = 1682564205; 951 * NodeGroup nodeGroupResource = NodeGroup.newBuilder().build(); 952 * Operation response = 953 * nodeGroupsClient.insertAsync(project, zone, initialNodeCount, nodeGroupResource).get(); 954 * } 955 * }</pre> 956 * 957 * @param project Project ID for this request. 958 * @param zone The name of the zone for this request. 959 * @param initialNodeCount Initial count of nodes in the node group. 960 * @param nodeGroupResource The body resource for this request 961 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 962 */ insertAsync( String project, String zone, int initialNodeCount, NodeGroup nodeGroupResource)963 public final OperationFuture<Operation, Operation> insertAsync( 964 String project, String zone, int initialNodeCount, NodeGroup nodeGroupResource) { 965 InsertNodeGroupRequest request = 966 InsertNodeGroupRequest.newBuilder() 967 .setProject(project) 968 .setZone(zone) 969 .setInitialNodeCount(initialNodeCount) 970 .setNodeGroupResource(nodeGroupResource) 971 .build(); 972 return insertAsync(request); 973 } 974 975 // AUTO-GENERATED DOCUMENTATION AND METHOD. 976 /** 977 * Creates a NodeGroup resource in the specified project using the data included in the request. 978 * 979 * <p>Sample code: 980 * 981 * <pre>{@code 982 * // This snippet has been automatically generated and should be regarded as a code template only. 983 * // It will require modifications to work: 984 * // - It may require correct/in-range values for request initialization. 985 * // - It may require specifying regional endpoints when creating the service client as shown in 986 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 987 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 988 * InsertNodeGroupRequest request = 989 * InsertNodeGroupRequest.newBuilder() 990 * .setInitialNodeCount(1682564205) 991 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 992 * .setProject("project-309310695") 993 * .setRequestId("requestId693933066") 994 * .setZone("zone3744684") 995 * .build(); 996 * Operation response = nodeGroupsClient.insertAsync(request).get(); 997 * } 998 * }</pre> 999 * 1000 * @param request The request object containing all of the parameters for the API call. 1001 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1002 */ 1003 @BetaApi( 1004 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync(InsertNodeGroupRequest request)1005 public final OperationFuture<Operation, Operation> insertAsync(InsertNodeGroupRequest request) { 1006 return insertOperationCallable().futureCall(request); 1007 } 1008 1009 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1010 /** 1011 * Creates a NodeGroup resource in the specified project using the data included in the request. 1012 * 1013 * <p>Sample code: 1014 * 1015 * <pre>{@code 1016 * // This snippet has been automatically generated and should be regarded as a code template only. 1017 * // It will require modifications to work: 1018 * // - It may require correct/in-range values for request initialization. 1019 * // - It may require specifying regional endpoints when creating the service client as shown in 1020 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1021 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1022 * InsertNodeGroupRequest request = 1023 * InsertNodeGroupRequest.newBuilder() 1024 * .setInitialNodeCount(1682564205) 1025 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 1026 * .setProject("project-309310695") 1027 * .setRequestId("requestId693933066") 1028 * .setZone("zone3744684") 1029 * .build(); 1030 * OperationFuture<Operation, Operation> future = 1031 * nodeGroupsClient.insertOperationCallable().futureCall(request); 1032 * // Do something. 1033 * Operation response = future.get(); 1034 * } 1035 * }</pre> 1036 */ 1037 public final OperationCallable<InsertNodeGroupRequest, Operation, Operation> insertOperationCallable()1038 insertOperationCallable() { 1039 return stub.insertOperationCallable(); 1040 } 1041 1042 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1043 /** 1044 * Creates a NodeGroup resource in the specified project using the data included in the request. 1045 * 1046 * <p>Sample code: 1047 * 1048 * <pre>{@code 1049 * // This snippet has been automatically generated and should be regarded as a code template only. 1050 * // It will require modifications to work: 1051 * // - It may require correct/in-range values for request initialization. 1052 * // - It may require specifying regional endpoints when creating the service client as shown in 1053 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1054 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1055 * InsertNodeGroupRequest request = 1056 * InsertNodeGroupRequest.newBuilder() 1057 * .setInitialNodeCount(1682564205) 1058 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 1059 * .setProject("project-309310695") 1060 * .setRequestId("requestId693933066") 1061 * .setZone("zone3744684") 1062 * .build(); 1063 * ApiFuture<Operation> future = nodeGroupsClient.insertCallable().futureCall(request); 1064 * // Do something. 1065 * Operation response = future.get(); 1066 * } 1067 * }</pre> 1068 */ insertCallable()1069 public final UnaryCallable<InsertNodeGroupRequest, Operation> insertCallable() { 1070 return stub.insertCallable(); 1071 } 1072 1073 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1074 /** 1075 * Retrieves a list of node groups available to the specified project. Note: use 1076 * nodeGroups.listNodes for more details about each group. 1077 * 1078 * <p>Sample code: 1079 * 1080 * <pre>{@code 1081 * // This snippet has been automatically generated and should be regarded as a code template only. 1082 * // It will require modifications to work: 1083 * // - It may require correct/in-range values for request initialization. 1084 * // - It may require specifying regional endpoints when creating the service client as shown in 1085 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1086 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1087 * String project = "project-309310695"; 1088 * String zone = "zone3744684"; 1089 * for (NodeGroup element : nodeGroupsClient.list(project, zone).iterateAll()) { 1090 * // doThingsWith(element); 1091 * } 1092 * } 1093 * }</pre> 1094 * 1095 * @param project Project ID for this request. 1096 * @param zone The name of the zone for this request. 1097 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1098 */ list(String project, String zone)1099 public final ListPagedResponse list(String project, String zone) { 1100 ListNodeGroupsRequest request = 1101 ListNodeGroupsRequest.newBuilder().setProject(project).setZone(zone).build(); 1102 return list(request); 1103 } 1104 1105 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1106 /** 1107 * Retrieves a list of node groups available to the specified project. Note: use 1108 * nodeGroups.listNodes for more details about each group. 1109 * 1110 * <p>Sample code: 1111 * 1112 * <pre>{@code 1113 * // This snippet has been automatically generated and should be regarded as a code template only. 1114 * // It will require modifications to work: 1115 * // - It may require correct/in-range values for request initialization. 1116 * // - It may require specifying regional endpoints when creating the service client as shown in 1117 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1118 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1119 * ListNodeGroupsRequest request = 1120 * ListNodeGroupsRequest.newBuilder() 1121 * .setFilter("filter-1274492040") 1122 * .setMaxResults(1128457243) 1123 * .setOrderBy("orderBy-1207110587") 1124 * .setPageToken("pageToken873572522") 1125 * .setProject("project-309310695") 1126 * .setReturnPartialSuccess(true) 1127 * .setZone("zone3744684") 1128 * .build(); 1129 * for (NodeGroup element : nodeGroupsClient.list(request).iterateAll()) { 1130 * // doThingsWith(element); 1131 * } 1132 * } 1133 * }</pre> 1134 * 1135 * @param request The request object containing all of the parameters for the API call. 1136 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1137 */ list(ListNodeGroupsRequest request)1138 public final ListPagedResponse list(ListNodeGroupsRequest request) { 1139 return listPagedCallable().call(request); 1140 } 1141 1142 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1143 /** 1144 * Retrieves a list of node groups available to the specified project. Note: use 1145 * nodeGroups.listNodes for more details about each group. 1146 * 1147 * <p>Sample code: 1148 * 1149 * <pre>{@code 1150 * // This snippet has been automatically generated and should be regarded as a code template only. 1151 * // It will require modifications to work: 1152 * // - It may require correct/in-range values for request initialization. 1153 * // - It may require specifying regional endpoints when creating the service client as shown in 1154 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1155 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1156 * ListNodeGroupsRequest request = 1157 * ListNodeGroupsRequest.newBuilder() 1158 * .setFilter("filter-1274492040") 1159 * .setMaxResults(1128457243) 1160 * .setOrderBy("orderBy-1207110587") 1161 * .setPageToken("pageToken873572522") 1162 * .setProject("project-309310695") 1163 * .setReturnPartialSuccess(true) 1164 * .setZone("zone3744684") 1165 * .build(); 1166 * ApiFuture<NodeGroup> future = nodeGroupsClient.listPagedCallable().futureCall(request); 1167 * // Do something. 1168 * for (NodeGroup element : future.get().iterateAll()) { 1169 * // doThingsWith(element); 1170 * } 1171 * } 1172 * }</pre> 1173 */ listPagedCallable()1174 public final UnaryCallable<ListNodeGroupsRequest, ListPagedResponse> listPagedCallable() { 1175 return stub.listPagedCallable(); 1176 } 1177 1178 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1179 /** 1180 * Retrieves a list of node groups available to the specified project. Note: use 1181 * nodeGroups.listNodes for more details about each group. 1182 * 1183 * <p>Sample code: 1184 * 1185 * <pre>{@code 1186 * // This snippet has been automatically generated and should be regarded as a code template only. 1187 * // It will require modifications to work: 1188 * // - It may require correct/in-range values for request initialization. 1189 * // - It may require specifying regional endpoints when creating the service client as shown in 1190 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1191 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1192 * ListNodeGroupsRequest request = 1193 * ListNodeGroupsRequest.newBuilder() 1194 * .setFilter("filter-1274492040") 1195 * .setMaxResults(1128457243) 1196 * .setOrderBy("orderBy-1207110587") 1197 * .setPageToken("pageToken873572522") 1198 * .setProject("project-309310695") 1199 * .setReturnPartialSuccess(true) 1200 * .setZone("zone3744684") 1201 * .build(); 1202 * while (true) { 1203 * NodeGroupList response = nodeGroupsClient.listCallable().call(request); 1204 * for (NodeGroup element : response.getItemsList()) { 1205 * // doThingsWith(element); 1206 * } 1207 * String nextPageToken = response.getNextPageToken(); 1208 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1209 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1210 * } else { 1211 * break; 1212 * } 1213 * } 1214 * } 1215 * }</pre> 1216 */ listCallable()1217 public final UnaryCallable<ListNodeGroupsRequest, NodeGroupList> listCallable() { 1218 return stub.listCallable(); 1219 } 1220 1221 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1222 /** 1223 * Lists nodes in the node group. 1224 * 1225 * <p>Sample code: 1226 * 1227 * <pre>{@code 1228 * // This snippet has been automatically generated and should be regarded as a code template only. 1229 * // It will require modifications to work: 1230 * // - It may require correct/in-range values for request initialization. 1231 * // - It may require specifying regional endpoints when creating the service client as shown in 1232 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1233 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1234 * String project = "project-309310695"; 1235 * String zone = "zone3744684"; 1236 * String nodeGroup = "nodeGroup443599261"; 1237 * for (NodeGroupNode element : 1238 * nodeGroupsClient.listNodes(project, zone, nodeGroup).iterateAll()) { 1239 * // doThingsWith(element); 1240 * } 1241 * } 1242 * }</pre> 1243 * 1244 * @param project Project ID for this request. 1245 * @param zone The name of the zone for this request. 1246 * @param nodeGroup Name of the NodeGroup resource whose nodes you want to list. 1247 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1248 */ listNodes(String project, String zone, String nodeGroup)1249 public final ListNodesPagedResponse listNodes(String project, String zone, String nodeGroup) { 1250 ListNodesNodeGroupsRequest request = 1251 ListNodesNodeGroupsRequest.newBuilder() 1252 .setProject(project) 1253 .setZone(zone) 1254 .setNodeGroup(nodeGroup) 1255 .build(); 1256 return listNodes(request); 1257 } 1258 1259 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1260 /** 1261 * Lists nodes in the node group. 1262 * 1263 * <p>Sample code: 1264 * 1265 * <pre>{@code 1266 * // This snippet has been automatically generated and should be regarded as a code template only. 1267 * // It will require modifications to work: 1268 * // - It may require correct/in-range values for request initialization. 1269 * // - It may require specifying regional endpoints when creating the service client as shown in 1270 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1271 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1272 * ListNodesNodeGroupsRequest request = 1273 * ListNodesNodeGroupsRequest.newBuilder() 1274 * .setFilter("filter-1274492040") 1275 * .setMaxResults(1128457243) 1276 * .setNodeGroup("nodeGroup443599261") 1277 * .setOrderBy("orderBy-1207110587") 1278 * .setPageToken("pageToken873572522") 1279 * .setProject("project-309310695") 1280 * .setReturnPartialSuccess(true) 1281 * .setZone("zone3744684") 1282 * .build(); 1283 * for (NodeGroupNode element : nodeGroupsClient.listNodes(request).iterateAll()) { 1284 * // doThingsWith(element); 1285 * } 1286 * } 1287 * }</pre> 1288 * 1289 * @param request The request object containing all of the parameters for the API call. 1290 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1291 */ listNodes(ListNodesNodeGroupsRequest request)1292 public final ListNodesPagedResponse listNodes(ListNodesNodeGroupsRequest request) { 1293 return listNodesPagedCallable().call(request); 1294 } 1295 1296 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1297 /** 1298 * Lists nodes in the node group. 1299 * 1300 * <p>Sample code: 1301 * 1302 * <pre>{@code 1303 * // This snippet has been automatically generated and should be regarded as a code template only. 1304 * // It will require modifications to work: 1305 * // - It may require correct/in-range values for request initialization. 1306 * // - It may require specifying regional endpoints when creating the service client as shown in 1307 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1308 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1309 * ListNodesNodeGroupsRequest request = 1310 * ListNodesNodeGroupsRequest.newBuilder() 1311 * .setFilter("filter-1274492040") 1312 * .setMaxResults(1128457243) 1313 * .setNodeGroup("nodeGroup443599261") 1314 * .setOrderBy("orderBy-1207110587") 1315 * .setPageToken("pageToken873572522") 1316 * .setProject("project-309310695") 1317 * .setReturnPartialSuccess(true) 1318 * .setZone("zone3744684") 1319 * .build(); 1320 * ApiFuture<NodeGroupNode> future = 1321 * nodeGroupsClient.listNodesPagedCallable().futureCall(request); 1322 * // Do something. 1323 * for (NodeGroupNode element : future.get().iterateAll()) { 1324 * // doThingsWith(element); 1325 * } 1326 * } 1327 * }</pre> 1328 */ 1329 public final UnaryCallable<ListNodesNodeGroupsRequest, ListNodesPagedResponse> listNodesPagedCallable()1330 listNodesPagedCallable() { 1331 return stub.listNodesPagedCallable(); 1332 } 1333 1334 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1335 /** 1336 * Lists nodes in the node group. 1337 * 1338 * <p>Sample code: 1339 * 1340 * <pre>{@code 1341 * // This snippet has been automatically generated and should be regarded as a code template only. 1342 * // It will require modifications to work: 1343 * // - It may require correct/in-range values for request initialization. 1344 * // - It may require specifying regional endpoints when creating the service client as shown in 1345 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1346 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1347 * ListNodesNodeGroupsRequest request = 1348 * ListNodesNodeGroupsRequest.newBuilder() 1349 * .setFilter("filter-1274492040") 1350 * .setMaxResults(1128457243) 1351 * .setNodeGroup("nodeGroup443599261") 1352 * .setOrderBy("orderBy-1207110587") 1353 * .setPageToken("pageToken873572522") 1354 * .setProject("project-309310695") 1355 * .setReturnPartialSuccess(true) 1356 * .setZone("zone3744684") 1357 * .build(); 1358 * while (true) { 1359 * NodeGroupsListNodes response = nodeGroupsClient.listNodesCallable().call(request); 1360 * for (NodeGroupNode element : response.getItemsList()) { 1361 * // doThingsWith(element); 1362 * } 1363 * String nextPageToken = response.getNextPageToken(); 1364 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1365 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1366 * } else { 1367 * break; 1368 * } 1369 * } 1370 * } 1371 * }</pre> 1372 */ listNodesCallable()1373 public final UnaryCallable<ListNodesNodeGroupsRequest, NodeGroupsListNodes> listNodesCallable() { 1374 return stub.listNodesCallable(); 1375 } 1376 1377 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1378 /** 1379 * Updates the specified node group. 1380 * 1381 * <p>Sample code: 1382 * 1383 * <pre>{@code 1384 * // This snippet has been automatically generated and should be regarded as a code template only. 1385 * // It will require modifications to work: 1386 * // - It may require correct/in-range values for request initialization. 1387 * // - It may require specifying regional endpoints when creating the service client as shown in 1388 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1389 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1390 * String project = "project-309310695"; 1391 * String zone = "zone3744684"; 1392 * String nodeGroup = "nodeGroup443599261"; 1393 * NodeGroup nodeGroupResource = NodeGroup.newBuilder().build(); 1394 * Operation response = 1395 * nodeGroupsClient.patchAsync(project, zone, nodeGroup, nodeGroupResource).get(); 1396 * } 1397 * }</pre> 1398 * 1399 * @param project Project ID for this request. 1400 * @param zone The name of the zone for this request. 1401 * @param nodeGroup Name of the NodeGroup resource to update. 1402 * @param nodeGroupResource The body resource for this request 1403 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1404 */ patchAsync( String project, String zone, String nodeGroup, NodeGroup nodeGroupResource)1405 public final OperationFuture<Operation, Operation> patchAsync( 1406 String project, String zone, String nodeGroup, NodeGroup nodeGroupResource) { 1407 PatchNodeGroupRequest request = 1408 PatchNodeGroupRequest.newBuilder() 1409 .setProject(project) 1410 .setZone(zone) 1411 .setNodeGroup(nodeGroup) 1412 .setNodeGroupResource(nodeGroupResource) 1413 .build(); 1414 return patchAsync(request); 1415 } 1416 1417 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1418 /** 1419 * Updates the specified node group. 1420 * 1421 * <p>Sample code: 1422 * 1423 * <pre>{@code 1424 * // This snippet has been automatically generated and should be regarded as a code template only. 1425 * // It will require modifications to work: 1426 * // - It may require correct/in-range values for request initialization. 1427 * // - It may require specifying regional endpoints when creating the service client as shown in 1428 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1429 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1430 * PatchNodeGroupRequest request = 1431 * PatchNodeGroupRequest.newBuilder() 1432 * .setNodeGroup("nodeGroup443599261") 1433 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 1434 * .setProject("project-309310695") 1435 * .setRequestId("requestId693933066") 1436 * .setZone("zone3744684") 1437 * .build(); 1438 * Operation response = nodeGroupsClient.patchAsync(request).get(); 1439 * } 1440 * }</pre> 1441 * 1442 * @param request The request object containing all of the parameters for the API call. 1443 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1444 */ 1445 @BetaApi( 1446 "The surface for long-running operations is not stable yet and may change in the future.") patchAsync(PatchNodeGroupRequest request)1447 public final OperationFuture<Operation, Operation> patchAsync(PatchNodeGroupRequest request) { 1448 return patchOperationCallable().futureCall(request); 1449 } 1450 1451 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1452 /** 1453 * Updates the specified node group. 1454 * 1455 * <p>Sample code: 1456 * 1457 * <pre>{@code 1458 * // This snippet has been automatically generated and should be regarded as a code template only. 1459 * // It will require modifications to work: 1460 * // - It may require correct/in-range values for request initialization. 1461 * // - It may require specifying regional endpoints when creating the service client as shown in 1462 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1463 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1464 * PatchNodeGroupRequest request = 1465 * PatchNodeGroupRequest.newBuilder() 1466 * .setNodeGroup("nodeGroup443599261") 1467 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 1468 * .setProject("project-309310695") 1469 * .setRequestId("requestId693933066") 1470 * .setZone("zone3744684") 1471 * .build(); 1472 * OperationFuture<Operation, Operation> future = 1473 * nodeGroupsClient.patchOperationCallable().futureCall(request); 1474 * // Do something. 1475 * Operation response = future.get(); 1476 * } 1477 * }</pre> 1478 */ 1479 public final OperationCallable<PatchNodeGroupRequest, Operation, Operation> patchOperationCallable()1480 patchOperationCallable() { 1481 return stub.patchOperationCallable(); 1482 } 1483 1484 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1485 /** 1486 * Updates the specified node group. 1487 * 1488 * <p>Sample code: 1489 * 1490 * <pre>{@code 1491 * // This snippet has been automatically generated and should be regarded as a code template only. 1492 * // It will require modifications to work: 1493 * // - It may require correct/in-range values for request initialization. 1494 * // - It may require specifying regional endpoints when creating the service client as shown in 1495 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1496 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1497 * PatchNodeGroupRequest request = 1498 * PatchNodeGroupRequest.newBuilder() 1499 * .setNodeGroup("nodeGroup443599261") 1500 * .setNodeGroupResource(NodeGroup.newBuilder().build()) 1501 * .setProject("project-309310695") 1502 * .setRequestId("requestId693933066") 1503 * .setZone("zone3744684") 1504 * .build(); 1505 * ApiFuture<Operation> future = nodeGroupsClient.patchCallable().futureCall(request); 1506 * // Do something. 1507 * Operation response = future.get(); 1508 * } 1509 * }</pre> 1510 */ patchCallable()1511 public final UnaryCallable<PatchNodeGroupRequest, Operation> patchCallable() { 1512 return stub.patchCallable(); 1513 } 1514 1515 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1516 /** 1517 * Sets the access control policy on the specified resource. Replaces any existing policy. 1518 * 1519 * <p>Sample code: 1520 * 1521 * <pre>{@code 1522 * // This snippet has been automatically generated and should be regarded as a code template only. 1523 * // It will require modifications to work: 1524 * // - It may require correct/in-range values for request initialization. 1525 * // - It may require specifying regional endpoints when creating the service client as shown in 1526 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1527 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1528 * String project = "project-309310695"; 1529 * String zone = "zone3744684"; 1530 * String resource = "resource-341064690"; 1531 * ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build(); 1532 * Policy response = 1533 * nodeGroupsClient.setIamPolicy(project, zone, resource, zoneSetPolicyRequestResource); 1534 * } 1535 * }</pre> 1536 * 1537 * @param project Project ID for this request. 1538 * @param zone The name of the zone for this request. 1539 * @param resource Name or id of the resource for this request. 1540 * @param zoneSetPolicyRequestResource The body resource for this request 1541 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1542 */ setIamPolicy( String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)1543 public final Policy setIamPolicy( 1544 String project, 1545 String zone, 1546 String resource, 1547 ZoneSetPolicyRequest zoneSetPolicyRequestResource) { 1548 SetIamPolicyNodeGroupRequest request = 1549 SetIamPolicyNodeGroupRequest.newBuilder() 1550 .setProject(project) 1551 .setZone(zone) 1552 .setResource(resource) 1553 .setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource) 1554 .build(); 1555 return setIamPolicy(request); 1556 } 1557 1558 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1559 /** 1560 * Sets the access control policy on the specified resource. Replaces any existing policy. 1561 * 1562 * <p>Sample code: 1563 * 1564 * <pre>{@code 1565 * // This snippet has been automatically generated and should be regarded as a code template only. 1566 * // It will require modifications to work: 1567 * // - It may require correct/in-range values for request initialization. 1568 * // - It may require specifying regional endpoints when creating the service client as shown in 1569 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1570 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1571 * SetIamPolicyNodeGroupRequest request = 1572 * SetIamPolicyNodeGroupRequest.newBuilder() 1573 * .setProject("project-309310695") 1574 * .setResource("resource-341064690") 1575 * .setZone("zone3744684") 1576 * .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build()) 1577 * .build(); 1578 * Policy response = nodeGroupsClient.setIamPolicy(request); 1579 * } 1580 * }</pre> 1581 * 1582 * @param request The request object containing all of the parameters for the API call. 1583 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1584 */ setIamPolicy(SetIamPolicyNodeGroupRequest request)1585 public final Policy setIamPolicy(SetIamPolicyNodeGroupRequest request) { 1586 return setIamPolicyCallable().call(request); 1587 } 1588 1589 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1590 /** 1591 * Sets the access control policy on the specified resource. Replaces any existing policy. 1592 * 1593 * <p>Sample code: 1594 * 1595 * <pre>{@code 1596 * // This snippet has been automatically generated and should be regarded as a code template only. 1597 * // It will require modifications to work: 1598 * // - It may require correct/in-range values for request initialization. 1599 * // - It may require specifying regional endpoints when creating the service client as shown in 1600 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1601 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1602 * SetIamPolicyNodeGroupRequest request = 1603 * SetIamPolicyNodeGroupRequest.newBuilder() 1604 * .setProject("project-309310695") 1605 * .setResource("resource-341064690") 1606 * .setZone("zone3744684") 1607 * .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build()) 1608 * .build(); 1609 * ApiFuture<Policy> future = nodeGroupsClient.setIamPolicyCallable().futureCall(request); 1610 * // Do something. 1611 * Policy response = future.get(); 1612 * } 1613 * }</pre> 1614 */ setIamPolicyCallable()1615 public final UnaryCallable<SetIamPolicyNodeGroupRequest, Policy> setIamPolicyCallable() { 1616 return stub.setIamPolicyCallable(); 1617 } 1618 1619 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1620 /** 1621 * Updates the node template of the node group. 1622 * 1623 * <p>Sample code: 1624 * 1625 * <pre>{@code 1626 * // This snippet has been automatically generated and should be regarded as a code template only. 1627 * // It will require modifications to work: 1628 * // - It may require correct/in-range values for request initialization. 1629 * // - It may require specifying regional endpoints when creating the service client as shown in 1630 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1631 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1632 * String project = "project-309310695"; 1633 * String zone = "zone3744684"; 1634 * String nodeGroup = "nodeGroup443599261"; 1635 * NodeGroupsSetNodeTemplateRequest nodeGroupsSetNodeTemplateRequestResource = 1636 * NodeGroupsSetNodeTemplateRequest.newBuilder().build(); 1637 * Operation response = 1638 * nodeGroupsClient 1639 * .setNodeTemplateAsync( 1640 * project, zone, nodeGroup, nodeGroupsSetNodeTemplateRequestResource) 1641 * .get(); 1642 * } 1643 * }</pre> 1644 * 1645 * @param project Project ID for this request. 1646 * @param zone The name of the zone for this request. 1647 * @param nodeGroup Name of the NodeGroup resource to update. 1648 * @param nodeGroupsSetNodeTemplateRequestResource The body resource for this request 1649 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1650 */ setNodeTemplateAsync( String project, String zone, String nodeGroup, NodeGroupsSetNodeTemplateRequest nodeGroupsSetNodeTemplateRequestResource)1651 public final OperationFuture<Operation, Operation> setNodeTemplateAsync( 1652 String project, 1653 String zone, 1654 String nodeGroup, 1655 NodeGroupsSetNodeTemplateRequest nodeGroupsSetNodeTemplateRequestResource) { 1656 SetNodeTemplateNodeGroupRequest request = 1657 SetNodeTemplateNodeGroupRequest.newBuilder() 1658 .setProject(project) 1659 .setZone(zone) 1660 .setNodeGroup(nodeGroup) 1661 .setNodeGroupsSetNodeTemplateRequestResource(nodeGroupsSetNodeTemplateRequestResource) 1662 .build(); 1663 return setNodeTemplateAsync(request); 1664 } 1665 1666 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1667 /** 1668 * Updates the node template of the node group. 1669 * 1670 * <p>Sample code: 1671 * 1672 * <pre>{@code 1673 * // This snippet has been automatically generated and should be regarded as a code template only. 1674 * // It will require modifications to work: 1675 * // - It may require correct/in-range values for request initialization. 1676 * // - It may require specifying regional endpoints when creating the service client as shown in 1677 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1678 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1679 * SetNodeTemplateNodeGroupRequest request = 1680 * SetNodeTemplateNodeGroupRequest.newBuilder() 1681 * .setNodeGroup("nodeGroup443599261") 1682 * .setNodeGroupsSetNodeTemplateRequestResource( 1683 * NodeGroupsSetNodeTemplateRequest.newBuilder().build()) 1684 * .setProject("project-309310695") 1685 * .setRequestId("requestId693933066") 1686 * .setZone("zone3744684") 1687 * .build(); 1688 * Operation response = nodeGroupsClient.setNodeTemplateAsync(request).get(); 1689 * } 1690 * }</pre> 1691 * 1692 * @param request The request object containing all of the parameters for the API call. 1693 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1694 */ 1695 @BetaApi( 1696 "The surface for long-running operations is not stable yet and may change in the future.") setNodeTemplateAsync( SetNodeTemplateNodeGroupRequest request)1697 public final OperationFuture<Operation, Operation> setNodeTemplateAsync( 1698 SetNodeTemplateNodeGroupRequest request) { 1699 return setNodeTemplateOperationCallable().futureCall(request); 1700 } 1701 1702 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1703 /** 1704 * Updates the node template of the node group. 1705 * 1706 * <p>Sample code: 1707 * 1708 * <pre>{@code 1709 * // This snippet has been automatically generated and should be regarded as a code template only. 1710 * // It will require modifications to work: 1711 * // - It may require correct/in-range values for request initialization. 1712 * // - It may require specifying regional endpoints when creating the service client as shown in 1713 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1714 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1715 * SetNodeTemplateNodeGroupRequest request = 1716 * SetNodeTemplateNodeGroupRequest.newBuilder() 1717 * .setNodeGroup("nodeGroup443599261") 1718 * .setNodeGroupsSetNodeTemplateRequestResource( 1719 * NodeGroupsSetNodeTemplateRequest.newBuilder().build()) 1720 * .setProject("project-309310695") 1721 * .setRequestId("requestId693933066") 1722 * .setZone("zone3744684") 1723 * .build(); 1724 * OperationFuture<Operation, Operation> future = 1725 * nodeGroupsClient.setNodeTemplateOperationCallable().futureCall(request); 1726 * // Do something. 1727 * Operation response = future.get(); 1728 * } 1729 * }</pre> 1730 */ 1731 public final OperationCallable<SetNodeTemplateNodeGroupRequest, Operation, Operation> setNodeTemplateOperationCallable()1732 setNodeTemplateOperationCallable() { 1733 return stub.setNodeTemplateOperationCallable(); 1734 } 1735 1736 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1737 /** 1738 * Updates the node template of the node group. 1739 * 1740 * <p>Sample code: 1741 * 1742 * <pre>{@code 1743 * // This snippet has been automatically generated and should be regarded as a code template only. 1744 * // It will require modifications to work: 1745 * // - It may require correct/in-range values for request initialization. 1746 * // - It may require specifying regional endpoints when creating the service client as shown in 1747 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1748 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1749 * SetNodeTemplateNodeGroupRequest request = 1750 * SetNodeTemplateNodeGroupRequest.newBuilder() 1751 * .setNodeGroup("nodeGroup443599261") 1752 * .setNodeGroupsSetNodeTemplateRequestResource( 1753 * NodeGroupsSetNodeTemplateRequest.newBuilder().build()) 1754 * .setProject("project-309310695") 1755 * .setRequestId("requestId693933066") 1756 * .setZone("zone3744684") 1757 * .build(); 1758 * ApiFuture<Operation> future = nodeGroupsClient.setNodeTemplateCallable().futureCall(request); 1759 * // Do something. 1760 * Operation response = future.get(); 1761 * } 1762 * }</pre> 1763 */ setNodeTemplateCallable()1764 public final UnaryCallable<SetNodeTemplateNodeGroupRequest, Operation> setNodeTemplateCallable() { 1765 return stub.setNodeTemplateCallable(); 1766 } 1767 1768 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1769 /** 1770 * Simulates maintenance event on specified nodes from the node group. 1771 * 1772 * <p>Sample code: 1773 * 1774 * <pre>{@code 1775 * // This snippet has been automatically generated and should be regarded as a code template only. 1776 * // It will require modifications to work: 1777 * // - It may require correct/in-range values for request initialization. 1778 * // - It may require specifying regional endpoints when creating the service client as shown in 1779 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1780 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1781 * String project = "project-309310695"; 1782 * String zone = "zone3744684"; 1783 * String nodeGroup = "nodeGroup443599261"; 1784 * NodeGroupsSimulateMaintenanceEventRequest nodeGroupsSimulateMaintenanceEventRequestResource = 1785 * NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build(); 1786 * Operation response = 1787 * nodeGroupsClient 1788 * .simulateMaintenanceEventAsync( 1789 * project, zone, nodeGroup, nodeGroupsSimulateMaintenanceEventRequestResource) 1790 * .get(); 1791 * } 1792 * }</pre> 1793 * 1794 * @param project Project ID for this request. 1795 * @param zone The name of the zone for this request. 1796 * @param nodeGroup Name of the NodeGroup resource whose nodes will go under maintenance 1797 * simulation. 1798 * @param nodeGroupsSimulateMaintenanceEventRequestResource The body resource for this request 1799 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1800 */ simulateMaintenanceEventAsync( String project, String zone, String nodeGroup, NodeGroupsSimulateMaintenanceEventRequest nodeGroupsSimulateMaintenanceEventRequestResource)1801 public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync( 1802 String project, 1803 String zone, 1804 String nodeGroup, 1805 NodeGroupsSimulateMaintenanceEventRequest nodeGroupsSimulateMaintenanceEventRequestResource) { 1806 SimulateMaintenanceEventNodeGroupRequest request = 1807 SimulateMaintenanceEventNodeGroupRequest.newBuilder() 1808 .setProject(project) 1809 .setZone(zone) 1810 .setNodeGroup(nodeGroup) 1811 .setNodeGroupsSimulateMaintenanceEventRequestResource( 1812 nodeGroupsSimulateMaintenanceEventRequestResource) 1813 .build(); 1814 return simulateMaintenanceEventAsync(request); 1815 } 1816 1817 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1818 /** 1819 * Simulates maintenance event on specified nodes from the node group. 1820 * 1821 * <p>Sample code: 1822 * 1823 * <pre>{@code 1824 * // This snippet has been automatically generated and should be regarded as a code template only. 1825 * // It will require modifications to work: 1826 * // - It may require correct/in-range values for request initialization. 1827 * // - It may require specifying regional endpoints when creating the service client as shown in 1828 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1829 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1830 * SimulateMaintenanceEventNodeGroupRequest request = 1831 * SimulateMaintenanceEventNodeGroupRequest.newBuilder() 1832 * .setNodeGroup("nodeGroup443599261") 1833 * .setNodeGroupsSimulateMaintenanceEventRequestResource( 1834 * NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build()) 1835 * .setProject("project-309310695") 1836 * .setRequestId("requestId693933066") 1837 * .setZone("zone3744684") 1838 * .build(); 1839 * Operation response = nodeGroupsClient.simulateMaintenanceEventAsync(request).get(); 1840 * } 1841 * }</pre> 1842 * 1843 * @param request The request object containing all of the parameters for the API call. 1844 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1845 */ 1846 @BetaApi( 1847 "The surface for long-running operations is not stable yet and may change in the future.") simulateMaintenanceEventAsync( SimulateMaintenanceEventNodeGroupRequest request)1848 public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync( 1849 SimulateMaintenanceEventNodeGroupRequest request) { 1850 return simulateMaintenanceEventOperationCallable().futureCall(request); 1851 } 1852 1853 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1854 /** 1855 * Simulates maintenance event on specified nodes from the node group. 1856 * 1857 * <p>Sample code: 1858 * 1859 * <pre>{@code 1860 * // This snippet has been automatically generated and should be regarded as a code template only. 1861 * // It will require modifications to work: 1862 * // - It may require correct/in-range values for request initialization. 1863 * // - It may require specifying regional endpoints when creating the service client as shown in 1864 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1865 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1866 * SimulateMaintenanceEventNodeGroupRequest request = 1867 * SimulateMaintenanceEventNodeGroupRequest.newBuilder() 1868 * .setNodeGroup("nodeGroup443599261") 1869 * .setNodeGroupsSimulateMaintenanceEventRequestResource( 1870 * NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build()) 1871 * .setProject("project-309310695") 1872 * .setRequestId("requestId693933066") 1873 * .setZone("zone3744684") 1874 * .build(); 1875 * OperationFuture<Operation, Operation> future = 1876 * nodeGroupsClient.simulateMaintenanceEventOperationCallable().futureCall(request); 1877 * // Do something. 1878 * Operation response = future.get(); 1879 * } 1880 * }</pre> 1881 */ 1882 public final OperationCallable<SimulateMaintenanceEventNodeGroupRequest, Operation, Operation> simulateMaintenanceEventOperationCallable()1883 simulateMaintenanceEventOperationCallable() { 1884 return stub.simulateMaintenanceEventOperationCallable(); 1885 } 1886 1887 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1888 /** 1889 * Simulates maintenance event on specified nodes from the node group. 1890 * 1891 * <p>Sample code: 1892 * 1893 * <pre>{@code 1894 * // This snippet has been automatically generated and should be regarded as a code template only. 1895 * // It will require modifications to work: 1896 * // - It may require correct/in-range values for request initialization. 1897 * // - It may require specifying regional endpoints when creating the service client as shown in 1898 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1899 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1900 * SimulateMaintenanceEventNodeGroupRequest request = 1901 * SimulateMaintenanceEventNodeGroupRequest.newBuilder() 1902 * .setNodeGroup("nodeGroup443599261") 1903 * .setNodeGroupsSimulateMaintenanceEventRequestResource( 1904 * NodeGroupsSimulateMaintenanceEventRequest.newBuilder().build()) 1905 * .setProject("project-309310695") 1906 * .setRequestId("requestId693933066") 1907 * .setZone("zone3744684") 1908 * .build(); 1909 * ApiFuture<Operation> future = 1910 * nodeGroupsClient.simulateMaintenanceEventCallable().futureCall(request); 1911 * // Do something. 1912 * Operation response = future.get(); 1913 * } 1914 * }</pre> 1915 */ 1916 public final UnaryCallable<SimulateMaintenanceEventNodeGroupRequest, Operation> simulateMaintenanceEventCallable()1917 simulateMaintenanceEventCallable() { 1918 return stub.simulateMaintenanceEventCallable(); 1919 } 1920 1921 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1922 /** 1923 * Returns permissions that a caller has on the specified resource. 1924 * 1925 * <p>Sample code: 1926 * 1927 * <pre>{@code 1928 * // This snippet has been automatically generated and should be regarded as a code template only. 1929 * // It will require modifications to work: 1930 * // - It may require correct/in-range values for request initialization. 1931 * // - It may require specifying regional endpoints when creating the service client as shown in 1932 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1933 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1934 * String project = "project-309310695"; 1935 * String zone = "zone3744684"; 1936 * String resource = "resource-341064690"; 1937 * TestPermissionsRequest testPermissionsRequestResource = 1938 * TestPermissionsRequest.newBuilder().build(); 1939 * TestPermissionsResponse response = 1940 * nodeGroupsClient.testIamPermissions( 1941 * project, zone, resource, testPermissionsRequestResource); 1942 * } 1943 * }</pre> 1944 * 1945 * @param project Project ID for this request. 1946 * @param zone The name of the zone for this request. 1947 * @param resource Name or id of the resource for this request. 1948 * @param testPermissionsRequestResource The body resource for this request 1949 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1950 */ testIamPermissions( String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)1951 public final TestPermissionsResponse testIamPermissions( 1952 String project, 1953 String zone, 1954 String resource, 1955 TestPermissionsRequest testPermissionsRequestResource) { 1956 TestIamPermissionsNodeGroupRequest request = 1957 TestIamPermissionsNodeGroupRequest.newBuilder() 1958 .setProject(project) 1959 .setZone(zone) 1960 .setResource(resource) 1961 .setTestPermissionsRequestResource(testPermissionsRequestResource) 1962 .build(); 1963 return testIamPermissions(request); 1964 } 1965 1966 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1967 /** 1968 * Returns permissions that a caller has on the specified resource. 1969 * 1970 * <p>Sample code: 1971 * 1972 * <pre>{@code 1973 * // This snippet has been automatically generated and should be regarded as a code template only. 1974 * // It will require modifications to work: 1975 * // - It may require correct/in-range values for request initialization. 1976 * // - It may require specifying regional endpoints when creating the service client as shown in 1977 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1978 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 1979 * TestIamPermissionsNodeGroupRequest request = 1980 * TestIamPermissionsNodeGroupRequest.newBuilder() 1981 * .setProject("project-309310695") 1982 * .setResource("resource-341064690") 1983 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 1984 * .setZone("zone3744684") 1985 * .build(); 1986 * TestPermissionsResponse response = nodeGroupsClient.testIamPermissions(request); 1987 * } 1988 * }</pre> 1989 * 1990 * @param request The request object containing all of the parameters for the API call. 1991 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1992 */ testIamPermissions( TestIamPermissionsNodeGroupRequest request)1993 public final TestPermissionsResponse testIamPermissions( 1994 TestIamPermissionsNodeGroupRequest request) { 1995 return testIamPermissionsCallable().call(request); 1996 } 1997 1998 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1999 /** 2000 * Returns permissions that a caller has on the specified resource. 2001 * 2002 * <p>Sample code: 2003 * 2004 * <pre>{@code 2005 * // This snippet has been automatically generated and should be regarded as a code template only. 2006 * // It will require modifications to work: 2007 * // - It may require correct/in-range values for request initialization. 2008 * // - It may require specifying regional endpoints when creating the service client as shown in 2009 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2010 * try (NodeGroupsClient nodeGroupsClient = NodeGroupsClient.create()) { 2011 * TestIamPermissionsNodeGroupRequest request = 2012 * TestIamPermissionsNodeGroupRequest.newBuilder() 2013 * .setProject("project-309310695") 2014 * .setResource("resource-341064690") 2015 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 2016 * .setZone("zone3744684") 2017 * .build(); 2018 * ApiFuture<TestPermissionsResponse> future = 2019 * nodeGroupsClient.testIamPermissionsCallable().futureCall(request); 2020 * // Do something. 2021 * TestPermissionsResponse response = future.get(); 2022 * } 2023 * }</pre> 2024 */ 2025 public final UnaryCallable<TestIamPermissionsNodeGroupRequest, TestPermissionsResponse> testIamPermissionsCallable()2026 testIamPermissionsCallable() { 2027 return stub.testIamPermissionsCallable(); 2028 } 2029 2030 @Override close()2031 public final void close() { 2032 stub.close(); 2033 } 2034 2035 @Override shutdown()2036 public void shutdown() { 2037 stub.shutdown(); 2038 } 2039 2040 @Override isShutdown()2041 public boolean isShutdown() { 2042 return stub.isShutdown(); 2043 } 2044 2045 @Override isTerminated()2046 public boolean isTerminated() { 2047 return stub.isTerminated(); 2048 } 2049 2050 @Override shutdownNow()2051 public void shutdownNow() { 2052 stub.shutdownNow(); 2053 } 2054 2055 @Override awaitTermination(long duration, TimeUnit unit)2056 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 2057 return stub.awaitTermination(duration, unit); 2058 } 2059 2060 public static class AggregatedListPagedResponse 2061 extends AbstractPagedListResponse< 2062 AggregatedListNodeGroupsRequest, 2063 NodeGroupAggregatedList, 2064 Map.Entry<String, NodeGroupsScopedList>, 2065 AggregatedListPage, 2066 AggregatedListFixedSizeCollection> { 2067 createAsync( PageContext< AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, Map.Entry<String, NodeGroupsScopedList>> context, ApiFuture<NodeGroupAggregatedList> futureResponse)2068 public static ApiFuture<AggregatedListPagedResponse> createAsync( 2069 PageContext< 2070 AggregatedListNodeGroupsRequest, 2071 NodeGroupAggregatedList, 2072 Map.Entry<String, NodeGroupsScopedList>> 2073 context, 2074 ApiFuture<NodeGroupAggregatedList> futureResponse) { 2075 ApiFuture<AggregatedListPage> futurePage = 2076 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 2077 return ApiFutures.transform( 2078 futurePage, 2079 input -> new AggregatedListPagedResponse(input), 2080 MoreExecutors.directExecutor()); 2081 } 2082 AggregatedListPagedResponse(AggregatedListPage page)2083 private AggregatedListPagedResponse(AggregatedListPage page) { 2084 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 2085 } 2086 } 2087 2088 public static class AggregatedListPage 2089 extends AbstractPage< 2090 AggregatedListNodeGroupsRequest, 2091 NodeGroupAggregatedList, 2092 Map.Entry<String, NodeGroupsScopedList>, 2093 AggregatedListPage> { 2094 AggregatedListPage( PageContext< AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, Map.Entry<String, NodeGroupsScopedList>> context, NodeGroupAggregatedList response)2095 private AggregatedListPage( 2096 PageContext< 2097 AggregatedListNodeGroupsRequest, 2098 NodeGroupAggregatedList, 2099 Map.Entry<String, NodeGroupsScopedList>> 2100 context, 2101 NodeGroupAggregatedList response) { 2102 super(context, response); 2103 } 2104 createEmptyPage()2105 private static AggregatedListPage createEmptyPage() { 2106 return new AggregatedListPage(null, null); 2107 } 2108 2109 @Override createPage( PageContext< AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, Map.Entry<String, NodeGroupsScopedList>> context, NodeGroupAggregatedList response)2110 protected AggregatedListPage createPage( 2111 PageContext< 2112 AggregatedListNodeGroupsRequest, 2113 NodeGroupAggregatedList, 2114 Map.Entry<String, NodeGroupsScopedList>> 2115 context, 2116 NodeGroupAggregatedList response) { 2117 return new AggregatedListPage(context, response); 2118 } 2119 2120 @Override createPageAsync( PageContext< AggregatedListNodeGroupsRequest, NodeGroupAggregatedList, Map.Entry<String, NodeGroupsScopedList>> context, ApiFuture<NodeGroupAggregatedList> futureResponse)2121 public ApiFuture<AggregatedListPage> createPageAsync( 2122 PageContext< 2123 AggregatedListNodeGroupsRequest, 2124 NodeGroupAggregatedList, 2125 Map.Entry<String, NodeGroupsScopedList>> 2126 context, 2127 ApiFuture<NodeGroupAggregatedList> futureResponse) { 2128 return super.createPageAsync(context, futureResponse); 2129 } 2130 } 2131 2132 public static class AggregatedListFixedSizeCollection 2133 extends AbstractFixedSizeCollection< 2134 AggregatedListNodeGroupsRequest, 2135 NodeGroupAggregatedList, 2136 Map.Entry<String, NodeGroupsScopedList>, 2137 AggregatedListPage, 2138 AggregatedListFixedSizeCollection> { 2139 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)2140 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 2141 super(pages, collectionSize); 2142 } 2143 createEmptyCollection()2144 private static AggregatedListFixedSizeCollection createEmptyCollection() { 2145 return new AggregatedListFixedSizeCollection(null, 0); 2146 } 2147 2148 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)2149 protected AggregatedListFixedSizeCollection createCollection( 2150 List<AggregatedListPage> pages, int collectionSize) { 2151 return new AggregatedListFixedSizeCollection(pages, collectionSize); 2152 } 2153 } 2154 2155 public static class ListPagedResponse 2156 extends AbstractPagedListResponse< 2157 ListNodeGroupsRequest, NodeGroupList, NodeGroup, ListPage, ListFixedSizeCollection> { 2158 createAsync( PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, ApiFuture<NodeGroupList> futureResponse)2159 public static ApiFuture<ListPagedResponse> createAsync( 2160 PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, 2161 ApiFuture<NodeGroupList> futureResponse) { 2162 ApiFuture<ListPage> futurePage = 2163 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 2164 return ApiFutures.transform( 2165 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 2166 } 2167 ListPagedResponse(ListPage page)2168 private ListPagedResponse(ListPage page) { 2169 super(page, ListFixedSizeCollection.createEmptyCollection()); 2170 } 2171 } 2172 2173 public static class ListPage 2174 extends AbstractPage<ListNodeGroupsRequest, NodeGroupList, NodeGroup, ListPage> { 2175 ListPage( PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, NodeGroupList response)2176 private ListPage( 2177 PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, 2178 NodeGroupList response) { 2179 super(context, response); 2180 } 2181 createEmptyPage()2182 private static ListPage createEmptyPage() { 2183 return new ListPage(null, null); 2184 } 2185 2186 @Override createPage( PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, NodeGroupList response)2187 protected ListPage createPage( 2188 PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, 2189 NodeGroupList response) { 2190 return new ListPage(context, response); 2191 } 2192 2193 @Override createPageAsync( PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, ApiFuture<NodeGroupList> futureResponse)2194 public ApiFuture<ListPage> createPageAsync( 2195 PageContext<ListNodeGroupsRequest, NodeGroupList, NodeGroup> context, 2196 ApiFuture<NodeGroupList> futureResponse) { 2197 return super.createPageAsync(context, futureResponse); 2198 } 2199 } 2200 2201 public static class ListFixedSizeCollection 2202 extends AbstractFixedSizeCollection< 2203 ListNodeGroupsRequest, NodeGroupList, NodeGroup, ListPage, ListFixedSizeCollection> { 2204 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)2205 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 2206 super(pages, collectionSize); 2207 } 2208 createEmptyCollection()2209 private static ListFixedSizeCollection createEmptyCollection() { 2210 return new ListFixedSizeCollection(null, 0); 2211 } 2212 2213 @Override createCollection(List<ListPage> pages, int collectionSize)2214 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 2215 return new ListFixedSizeCollection(pages, collectionSize); 2216 } 2217 } 2218 2219 public static class ListNodesPagedResponse 2220 extends AbstractPagedListResponse< 2221 ListNodesNodeGroupsRequest, 2222 NodeGroupsListNodes, 2223 NodeGroupNode, 2224 ListNodesPage, 2225 ListNodesFixedSizeCollection> { 2226 createAsync( PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, ApiFuture<NodeGroupsListNodes> futureResponse)2227 public static ApiFuture<ListNodesPagedResponse> createAsync( 2228 PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, 2229 ApiFuture<NodeGroupsListNodes> futureResponse) { 2230 ApiFuture<ListNodesPage> futurePage = 2231 ListNodesPage.createEmptyPage().createPageAsync(context, futureResponse); 2232 return ApiFutures.transform( 2233 futurePage, input -> new ListNodesPagedResponse(input), MoreExecutors.directExecutor()); 2234 } 2235 ListNodesPagedResponse(ListNodesPage page)2236 private ListNodesPagedResponse(ListNodesPage page) { 2237 super(page, ListNodesFixedSizeCollection.createEmptyCollection()); 2238 } 2239 } 2240 2241 public static class ListNodesPage 2242 extends AbstractPage< 2243 ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode, ListNodesPage> { 2244 ListNodesPage( PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, NodeGroupsListNodes response)2245 private ListNodesPage( 2246 PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, 2247 NodeGroupsListNodes response) { 2248 super(context, response); 2249 } 2250 createEmptyPage()2251 private static ListNodesPage createEmptyPage() { 2252 return new ListNodesPage(null, null); 2253 } 2254 2255 @Override createPage( PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, NodeGroupsListNodes response)2256 protected ListNodesPage createPage( 2257 PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, 2258 NodeGroupsListNodes response) { 2259 return new ListNodesPage(context, response); 2260 } 2261 2262 @Override createPageAsync( PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, ApiFuture<NodeGroupsListNodes> futureResponse)2263 public ApiFuture<ListNodesPage> createPageAsync( 2264 PageContext<ListNodesNodeGroupsRequest, NodeGroupsListNodes, NodeGroupNode> context, 2265 ApiFuture<NodeGroupsListNodes> futureResponse) { 2266 return super.createPageAsync(context, futureResponse); 2267 } 2268 } 2269 2270 public static class ListNodesFixedSizeCollection 2271 extends AbstractFixedSizeCollection< 2272 ListNodesNodeGroupsRequest, 2273 NodeGroupsListNodes, 2274 NodeGroupNode, 2275 ListNodesPage, 2276 ListNodesFixedSizeCollection> { 2277 ListNodesFixedSizeCollection(List<ListNodesPage> pages, int collectionSize)2278 private ListNodesFixedSizeCollection(List<ListNodesPage> pages, int collectionSize) { 2279 super(pages, collectionSize); 2280 } 2281 createEmptyCollection()2282 private static ListNodesFixedSizeCollection createEmptyCollection() { 2283 return new ListNodesFixedSizeCollection(null, 0); 2284 } 2285 2286 @Override createCollection( List<ListNodesPage> pages, int collectionSize)2287 protected ListNodesFixedSizeCollection createCollection( 2288 List<ListNodesPage> pages, int collectionSize) { 2289 return new ListNodesFixedSizeCollection(pages, collectionSize); 2290 } 2291 } 2292 } 2293