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.TargetPoolsStub; 31 import com.google.cloud.compute.v1.stub.TargetPoolsStubSettings; 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 TargetPools 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 (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 53 * String project = "project-309310695"; 54 * String region = "region-934795532"; 55 * String targetPool = "targetPool486493517"; 56 * TargetPool response = targetPoolsClient.get(project, region, targetPool); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the TargetPoolsClient 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 TargetPoolsSettings 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 * TargetPoolsSettings targetPoolsSettings = 95 * TargetPoolsSettings.newBuilder() 96 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 97 * .build(); 98 * TargetPoolsClient targetPoolsClient = TargetPoolsClient.create(targetPoolsSettings); 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 * TargetPoolsSettings targetPoolsSettings = 110 * TargetPoolsSettings.newBuilder().setEndpoint(myEndpoint).build(); 111 * TargetPoolsClient targetPoolsClient = TargetPoolsClient.create(targetPoolsSettings); 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 TargetPoolsClient implements BackgroundResource { 118 private final TargetPoolsSettings settings; 119 private final TargetPoolsStub stub; 120 121 /** Constructs an instance of TargetPoolsClient with default settings. */ create()122 public static final TargetPoolsClient create() throws IOException { 123 return create(TargetPoolsSettings.newBuilder().build()); 124 } 125 126 /** 127 * Constructs an instance of TargetPoolsClient, 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(TargetPoolsSettings settings)130 public static final TargetPoolsClient create(TargetPoolsSettings settings) throws IOException { 131 return new TargetPoolsClient(settings); 132 } 133 134 /** 135 * Constructs an instance of TargetPoolsClient, using the given stub for making calls. This is for 136 * advanced usage - prefer using create(TargetPoolsSettings). 137 */ create(TargetPoolsStub stub)138 public static final TargetPoolsClient create(TargetPoolsStub stub) { 139 return new TargetPoolsClient(stub); 140 } 141 142 /** 143 * Constructs an instance of TargetPoolsClient, using the given settings. This is protected so 144 * that it is easy to make a subclass, but otherwise, the static factory methods should be 145 * preferred. 146 */ TargetPoolsClient(TargetPoolsSettings settings)147 protected TargetPoolsClient(TargetPoolsSettings settings) throws IOException { 148 this.settings = settings; 149 this.stub = ((TargetPoolsStubSettings) settings.getStubSettings()).createStub(); 150 } 151 TargetPoolsClient(TargetPoolsStub stub)152 protected TargetPoolsClient(TargetPoolsStub stub) { 153 this.settings = null; 154 this.stub = stub; 155 } 156 getSettings()157 public final TargetPoolsSettings getSettings() { 158 return settings; 159 } 160 getStub()161 public TargetPoolsStub getStub() { 162 return stub; 163 } 164 165 // AUTO-GENERATED DOCUMENTATION AND METHOD. 166 /** 167 * Adds health check URLs to a target pool. 168 * 169 * <p>Sample code: 170 * 171 * <pre>{@code 172 * // This snippet has been automatically generated and should be regarded as a code template only. 173 * // It will require modifications to work: 174 * // - It may require correct/in-range values for request initialization. 175 * // - It may require specifying regional endpoints when creating the service client as shown in 176 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 177 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 178 * String project = "project-309310695"; 179 * String region = "region-934795532"; 180 * String targetPool = "targetPool486493517"; 181 * TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = 182 * TargetPoolsAddHealthCheckRequest.newBuilder().build(); 183 * Operation response = 184 * targetPoolsClient 185 * .addHealthCheckAsync( 186 * project, region, targetPool, targetPoolsAddHealthCheckRequestResource) 187 * .get(); 188 * } 189 * }</pre> 190 * 191 * @param project Project ID for this request. 192 * @param region Name of the region scoping this request. 193 * @param targetPool Name of the target pool to add a health check to. 194 * @param targetPoolsAddHealthCheckRequestResource The body resource for this request 195 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 196 */ addHealthCheckAsync( String project, String region, String targetPool, TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource)197 public final OperationFuture<Operation, Operation> addHealthCheckAsync( 198 String project, 199 String region, 200 String targetPool, 201 TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource) { 202 AddHealthCheckTargetPoolRequest request = 203 AddHealthCheckTargetPoolRequest.newBuilder() 204 .setProject(project) 205 .setRegion(region) 206 .setTargetPool(targetPool) 207 .setTargetPoolsAddHealthCheckRequestResource(targetPoolsAddHealthCheckRequestResource) 208 .build(); 209 return addHealthCheckAsync(request); 210 } 211 212 // AUTO-GENERATED DOCUMENTATION AND METHOD. 213 /** 214 * Adds health check URLs to a target pool. 215 * 216 * <p>Sample code: 217 * 218 * <pre>{@code 219 * // This snippet has been automatically generated and should be regarded as a code template only. 220 * // It will require modifications to work: 221 * // - It may require correct/in-range values for request initialization. 222 * // - It may require specifying regional endpoints when creating the service client as shown in 223 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 224 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 225 * AddHealthCheckTargetPoolRequest request = 226 * AddHealthCheckTargetPoolRequest.newBuilder() 227 * .setProject("project-309310695") 228 * .setRegion("region-934795532") 229 * .setRequestId("requestId693933066") 230 * .setTargetPool("targetPool486493517") 231 * .setTargetPoolsAddHealthCheckRequestResource( 232 * TargetPoolsAddHealthCheckRequest.newBuilder().build()) 233 * .build(); 234 * Operation response = targetPoolsClient.addHealthCheckAsync(request).get(); 235 * } 236 * }</pre> 237 * 238 * @param request The request object containing all of the parameters for the API call. 239 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 240 */ 241 @BetaApi( 242 "The surface for long-running operations is not stable yet and may change in the future.") addHealthCheckAsync( AddHealthCheckTargetPoolRequest request)243 public final OperationFuture<Operation, Operation> addHealthCheckAsync( 244 AddHealthCheckTargetPoolRequest request) { 245 return addHealthCheckOperationCallable().futureCall(request); 246 } 247 248 // AUTO-GENERATED DOCUMENTATION AND METHOD. 249 /** 250 * Adds health check URLs to a target pool. 251 * 252 * <p>Sample code: 253 * 254 * <pre>{@code 255 * // This snippet has been automatically generated and should be regarded as a code template only. 256 * // It will require modifications to work: 257 * // - It may require correct/in-range values for request initialization. 258 * // - It may require specifying regional endpoints when creating the service client as shown in 259 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 260 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 261 * AddHealthCheckTargetPoolRequest request = 262 * AddHealthCheckTargetPoolRequest.newBuilder() 263 * .setProject("project-309310695") 264 * .setRegion("region-934795532") 265 * .setRequestId("requestId693933066") 266 * .setTargetPool("targetPool486493517") 267 * .setTargetPoolsAddHealthCheckRequestResource( 268 * TargetPoolsAddHealthCheckRequest.newBuilder().build()) 269 * .build(); 270 * OperationFuture<Operation, Operation> future = 271 * targetPoolsClient.addHealthCheckOperationCallable().futureCall(request); 272 * // Do something. 273 * Operation response = future.get(); 274 * } 275 * }</pre> 276 */ 277 public final OperationCallable<AddHealthCheckTargetPoolRequest, Operation, Operation> addHealthCheckOperationCallable()278 addHealthCheckOperationCallable() { 279 return stub.addHealthCheckOperationCallable(); 280 } 281 282 // AUTO-GENERATED DOCUMENTATION AND METHOD. 283 /** 284 * Adds health check URLs to a target pool. 285 * 286 * <p>Sample code: 287 * 288 * <pre>{@code 289 * // This snippet has been automatically generated and should be regarded as a code template only. 290 * // It will require modifications to work: 291 * // - It may require correct/in-range values for request initialization. 292 * // - It may require specifying regional endpoints when creating the service client as shown in 293 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 294 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 295 * AddHealthCheckTargetPoolRequest request = 296 * AddHealthCheckTargetPoolRequest.newBuilder() 297 * .setProject("project-309310695") 298 * .setRegion("region-934795532") 299 * .setRequestId("requestId693933066") 300 * .setTargetPool("targetPool486493517") 301 * .setTargetPoolsAddHealthCheckRequestResource( 302 * TargetPoolsAddHealthCheckRequest.newBuilder().build()) 303 * .build(); 304 * ApiFuture<Operation> future = targetPoolsClient.addHealthCheckCallable().futureCall(request); 305 * // Do something. 306 * Operation response = future.get(); 307 * } 308 * }</pre> 309 */ addHealthCheckCallable()310 public final UnaryCallable<AddHealthCheckTargetPoolRequest, Operation> addHealthCheckCallable() { 311 return stub.addHealthCheckCallable(); 312 } 313 314 // AUTO-GENERATED DOCUMENTATION AND METHOD. 315 /** 316 * Adds an instance to a target pool. 317 * 318 * <p>Sample code: 319 * 320 * <pre>{@code 321 * // This snippet has been automatically generated and should be regarded as a code template only. 322 * // It will require modifications to work: 323 * // - It may require correct/in-range values for request initialization. 324 * // - It may require specifying regional endpoints when creating the service client as shown in 325 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 326 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 327 * String project = "project-309310695"; 328 * String region = "region-934795532"; 329 * String targetPool = "targetPool486493517"; 330 * TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource = 331 * TargetPoolsAddInstanceRequest.newBuilder().build(); 332 * Operation response = 333 * targetPoolsClient 334 * .addInstanceAsync(project, region, targetPool, targetPoolsAddInstanceRequestResource) 335 * .get(); 336 * } 337 * }</pre> 338 * 339 * @param project Project ID for this request. 340 * @param region Name of the region scoping this request. 341 * @param targetPool Name of the TargetPool resource to add instances to. 342 * @param targetPoolsAddInstanceRequestResource The body resource for this request 343 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 344 */ addInstanceAsync( String project, String region, String targetPool, TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource)345 public final OperationFuture<Operation, Operation> addInstanceAsync( 346 String project, 347 String region, 348 String targetPool, 349 TargetPoolsAddInstanceRequest targetPoolsAddInstanceRequestResource) { 350 AddInstanceTargetPoolRequest request = 351 AddInstanceTargetPoolRequest.newBuilder() 352 .setProject(project) 353 .setRegion(region) 354 .setTargetPool(targetPool) 355 .setTargetPoolsAddInstanceRequestResource(targetPoolsAddInstanceRequestResource) 356 .build(); 357 return addInstanceAsync(request); 358 } 359 360 // AUTO-GENERATED DOCUMENTATION AND METHOD. 361 /** 362 * Adds an instance to a target pool. 363 * 364 * <p>Sample code: 365 * 366 * <pre>{@code 367 * // This snippet has been automatically generated and should be regarded as a code template only. 368 * // It will require modifications to work: 369 * // - It may require correct/in-range values for request initialization. 370 * // - It may require specifying regional endpoints when creating the service client as shown in 371 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 372 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 373 * AddInstanceTargetPoolRequest request = 374 * AddInstanceTargetPoolRequest.newBuilder() 375 * .setProject("project-309310695") 376 * .setRegion("region-934795532") 377 * .setRequestId("requestId693933066") 378 * .setTargetPool("targetPool486493517") 379 * .setTargetPoolsAddInstanceRequestResource( 380 * TargetPoolsAddInstanceRequest.newBuilder().build()) 381 * .build(); 382 * Operation response = targetPoolsClient.addInstanceAsync(request).get(); 383 * } 384 * }</pre> 385 * 386 * @param request The request object containing all of the parameters for the API call. 387 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 388 */ 389 @BetaApi( 390 "The surface for long-running operations is not stable yet and may change in the future.") addInstanceAsync( AddInstanceTargetPoolRequest request)391 public final OperationFuture<Operation, Operation> addInstanceAsync( 392 AddInstanceTargetPoolRequest request) { 393 return addInstanceOperationCallable().futureCall(request); 394 } 395 396 // AUTO-GENERATED DOCUMENTATION AND METHOD. 397 /** 398 * Adds an instance to a target pool. 399 * 400 * <p>Sample code: 401 * 402 * <pre>{@code 403 * // This snippet has been automatically generated and should be regarded as a code template only. 404 * // It will require modifications to work: 405 * // - It may require correct/in-range values for request initialization. 406 * // - It may require specifying regional endpoints when creating the service client as shown in 407 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 408 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 409 * AddInstanceTargetPoolRequest request = 410 * AddInstanceTargetPoolRequest.newBuilder() 411 * .setProject("project-309310695") 412 * .setRegion("region-934795532") 413 * .setRequestId("requestId693933066") 414 * .setTargetPool("targetPool486493517") 415 * .setTargetPoolsAddInstanceRequestResource( 416 * TargetPoolsAddInstanceRequest.newBuilder().build()) 417 * .build(); 418 * OperationFuture<Operation, Operation> future = 419 * targetPoolsClient.addInstanceOperationCallable().futureCall(request); 420 * // Do something. 421 * Operation response = future.get(); 422 * } 423 * }</pre> 424 */ 425 public final OperationCallable<AddInstanceTargetPoolRequest, Operation, Operation> addInstanceOperationCallable()426 addInstanceOperationCallable() { 427 return stub.addInstanceOperationCallable(); 428 } 429 430 // AUTO-GENERATED DOCUMENTATION AND METHOD. 431 /** 432 * Adds an instance to a target pool. 433 * 434 * <p>Sample code: 435 * 436 * <pre>{@code 437 * // This snippet has been automatically generated and should be regarded as a code template only. 438 * // It will require modifications to work: 439 * // - It may require correct/in-range values for request initialization. 440 * // - It may require specifying regional endpoints when creating the service client as shown in 441 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 442 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 443 * AddInstanceTargetPoolRequest request = 444 * AddInstanceTargetPoolRequest.newBuilder() 445 * .setProject("project-309310695") 446 * .setRegion("region-934795532") 447 * .setRequestId("requestId693933066") 448 * .setTargetPool("targetPool486493517") 449 * .setTargetPoolsAddInstanceRequestResource( 450 * TargetPoolsAddInstanceRequest.newBuilder().build()) 451 * .build(); 452 * ApiFuture<Operation> future = targetPoolsClient.addInstanceCallable().futureCall(request); 453 * // Do something. 454 * Operation response = future.get(); 455 * } 456 * }</pre> 457 */ addInstanceCallable()458 public final UnaryCallable<AddInstanceTargetPoolRequest, Operation> addInstanceCallable() { 459 return stub.addInstanceCallable(); 460 } 461 462 // AUTO-GENERATED DOCUMENTATION AND METHOD. 463 /** 464 * Retrieves an aggregated list of target pools. 465 * 466 * <p>Sample code: 467 * 468 * <pre>{@code 469 * // This snippet has been automatically generated and should be regarded as a code template only. 470 * // It will require modifications to work: 471 * // - It may require correct/in-range values for request initialization. 472 * // - It may require specifying regional endpoints when creating the service client as shown in 473 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 474 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 475 * String project = "project-309310695"; 476 * for (Map.Entry<String, TargetPoolsScopedList> element : 477 * targetPoolsClient.aggregatedList(project).iterateAll()) { 478 * // doThingsWith(element); 479 * } 480 * } 481 * }</pre> 482 * 483 * @param project Project ID for this request. 484 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 485 */ aggregatedList(String project)486 public final AggregatedListPagedResponse aggregatedList(String project) { 487 AggregatedListTargetPoolsRequest request = 488 AggregatedListTargetPoolsRequest.newBuilder().setProject(project).build(); 489 return aggregatedList(request); 490 } 491 492 // AUTO-GENERATED DOCUMENTATION AND METHOD. 493 /** 494 * Retrieves an aggregated list of target pools. 495 * 496 * <p>Sample code: 497 * 498 * <pre>{@code 499 * // This snippet has been automatically generated and should be regarded as a code template only. 500 * // It will require modifications to work: 501 * // - It may require correct/in-range values for request initialization. 502 * // - It may require specifying regional endpoints when creating the service client as shown in 503 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 504 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 505 * AggregatedListTargetPoolsRequest request = 506 * AggregatedListTargetPoolsRequest.newBuilder() 507 * .setFilter("filter-1274492040") 508 * .setIncludeAllScopes(true) 509 * .setMaxResults(1128457243) 510 * .setOrderBy("orderBy-1207110587") 511 * .setPageToken("pageToken873572522") 512 * .setProject("project-309310695") 513 * .setReturnPartialSuccess(true) 514 * .build(); 515 * for (Map.Entry<String, TargetPoolsScopedList> element : 516 * targetPoolsClient.aggregatedList(request).iterateAll()) { 517 * // doThingsWith(element); 518 * } 519 * } 520 * }</pre> 521 * 522 * @param request The request object containing all of the parameters for the API call. 523 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 524 */ aggregatedList( AggregatedListTargetPoolsRequest request)525 public final AggregatedListPagedResponse aggregatedList( 526 AggregatedListTargetPoolsRequest request) { 527 return aggregatedListPagedCallable().call(request); 528 } 529 530 // AUTO-GENERATED DOCUMENTATION AND METHOD. 531 /** 532 * Retrieves an aggregated list of target pools. 533 * 534 * <p>Sample code: 535 * 536 * <pre>{@code 537 * // This snippet has been automatically generated and should be regarded as a code template only. 538 * // It will require modifications to work: 539 * // - It may require correct/in-range values for request initialization. 540 * // - It may require specifying regional endpoints when creating the service client as shown in 541 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 542 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 543 * AggregatedListTargetPoolsRequest request = 544 * AggregatedListTargetPoolsRequest.newBuilder() 545 * .setFilter("filter-1274492040") 546 * .setIncludeAllScopes(true) 547 * .setMaxResults(1128457243) 548 * .setOrderBy("orderBy-1207110587") 549 * .setPageToken("pageToken873572522") 550 * .setProject("project-309310695") 551 * .setReturnPartialSuccess(true) 552 * .build(); 553 * ApiFuture<Map.Entry<String, TargetPoolsScopedList>> future = 554 * targetPoolsClient.aggregatedListPagedCallable().futureCall(request); 555 * // Do something. 556 * for (Map.Entry<String, TargetPoolsScopedList> element : future.get().iterateAll()) { 557 * // doThingsWith(element); 558 * } 559 * } 560 * }</pre> 561 */ 562 public final UnaryCallable<AggregatedListTargetPoolsRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()563 aggregatedListPagedCallable() { 564 return stub.aggregatedListPagedCallable(); 565 } 566 567 // AUTO-GENERATED DOCUMENTATION AND METHOD. 568 /** 569 * Retrieves an aggregated list of target pools. 570 * 571 * <p>Sample code: 572 * 573 * <pre>{@code 574 * // This snippet has been automatically generated and should be regarded as a code template only. 575 * // It will require modifications to work: 576 * // - It may require correct/in-range values for request initialization. 577 * // - It may require specifying regional endpoints when creating the service client as shown in 578 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 579 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 580 * AggregatedListTargetPoolsRequest request = 581 * AggregatedListTargetPoolsRequest.newBuilder() 582 * .setFilter("filter-1274492040") 583 * .setIncludeAllScopes(true) 584 * .setMaxResults(1128457243) 585 * .setOrderBy("orderBy-1207110587") 586 * .setPageToken("pageToken873572522") 587 * .setProject("project-309310695") 588 * .setReturnPartialSuccess(true) 589 * .build(); 590 * while (true) { 591 * TargetPoolAggregatedList response = 592 * targetPoolsClient.aggregatedListCallable().call(request); 593 * for (Map.Entry<String, TargetPoolsScopedList> element : response.getItemsList()) { 594 * // doThingsWith(element); 595 * } 596 * String nextPageToken = response.getNextPageToken(); 597 * if (!Strings.isNullOrEmpty(nextPageToken)) { 598 * request = request.toBuilder().setPageToken(nextPageToken).build(); 599 * } else { 600 * break; 601 * } 602 * } 603 * } 604 * }</pre> 605 */ 606 public final UnaryCallable<AggregatedListTargetPoolsRequest, TargetPoolAggregatedList> aggregatedListCallable()607 aggregatedListCallable() { 608 return stub.aggregatedListCallable(); 609 } 610 611 // AUTO-GENERATED DOCUMENTATION AND METHOD. 612 /** 613 * Deletes the specified target pool. 614 * 615 * <p>Sample code: 616 * 617 * <pre>{@code 618 * // This snippet has been automatically generated and should be regarded as a code template only. 619 * // It will require modifications to work: 620 * // - It may require correct/in-range values for request initialization. 621 * // - It may require specifying regional endpoints when creating the service client as shown in 622 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 623 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 624 * String project = "project-309310695"; 625 * String region = "region-934795532"; 626 * String targetPool = "targetPool486493517"; 627 * Operation response = targetPoolsClient.deleteAsync(project, region, targetPool).get(); 628 * } 629 * }</pre> 630 * 631 * @param project Project ID for this request. 632 * @param region Name of the region scoping this request. 633 * @param targetPool Name of the TargetPool resource to delete. 634 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 635 */ deleteAsync( String project, String region, String targetPool)636 public final OperationFuture<Operation, Operation> deleteAsync( 637 String project, String region, String targetPool) { 638 DeleteTargetPoolRequest request = 639 DeleteTargetPoolRequest.newBuilder() 640 .setProject(project) 641 .setRegion(region) 642 .setTargetPool(targetPool) 643 .build(); 644 return deleteAsync(request); 645 } 646 647 // AUTO-GENERATED DOCUMENTATION AND METHOD. 648 /** 649 * Deletes the specified target pool. 650 * 651 * <p>Sample code: 652 * 653 * <pre>{@code 654 * // This snippet has been automatically generated and should be regarded as a code template only. 655 * // It will require modifications to work: 656 * // - It may require correct/in-range values for request initialization. 657 * // - It may require specifying regional endpoints when creating the service client as shown in 658 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 659 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 660 * DeleteTargetPoolRequest request = 661 * DeleteTargetPoolRequest.newBuilder() 662 * .setProject("project-309310695") 663 * .setRegion("region-934795532") 664 * .setRequestId("requestId693933066") 665 * .setTargetPool("targetPool486493517") 666 * .build(); 667 * Operation response = targetPoolsClient.deleteAsync(request).get(); 668 * } 669 * }</pre> 670 * 671 * @param request The request object containing all of the parameters for the API call. 672 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 673 */ 674 @BetaApi( 675 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync(DeleteTargetPoolRequest request)676 public final OperationFuture<Operation, Operation> deleteAsync(DeleteTargetPoolRequest request) { 677 return deleteOperationCallable().futureCall(request); 678 } 679 680 // AUTO-GENERATED DOCUMENTATION AND METHOD. 681 /** 682 * Deletes the specified target pool. 683 * 684 * <p>Sample code: 685 * 686 * <pre>{@code 687 * // This snippet has been automatically generated and should be regarded as a code template only. 688 * // It will require modifications to work: 689 * // - It may require correct/in-range values for request initialization. 690 * // - It may require specifying regional endpoints when creating the service client as shown in 691 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 692 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 693 * DeleteTargetPoolRequest request = 694 * DeleteTargetPoolRequest.newBuilder() 695 * .setProject("project-309310695") 696 * .setRegion("region-934795532") 697 * .setRequestId("requestId693933066") 698 * .setTargetPool("targetPool486493517") 699 * .build(); 700 * OperationFuture<Operation, Operation> future = 701 * targetPoolsClient.deleteOperationCallable().futureCall(request); 702 * // Do something. 703 * Operation response = future.get(); 704 * } 705 * }</pre> 706 */ 707 public final OperationCallable<DeleteTargetPoolRequest, Operation, Operation> deleteOperationCallable()708 deleteOperationCallable() { 709 return stub.deleteOperationCallable(); 710 } 711 712 // AUTO-GENERATED DOCUMENTATION AND METHOD. 713 /** 714 * Deletes the specified target pool. 715 * 716 * <p>Sample code: 717 * 718 * <pre>{@code 719 * // This snippet has been automatically generated and should be regarded as a code template only. 720 * // It will require modifications to work: 721 * // - It may require correct/in-range values for request initialization. 722 * // - It may require specifying regional endpoints when creating the service client as shown in 723 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 724 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 725 * DeleteTargetPoolRequest request = 726 * DeleteTargetPoolRequest.newBuilder() 727 * .setProject("project-309310695") 728 * .setRegion("region-934795532") 729 * .setRequestId("requestId693933066") 730 * .setTargetPool("targetPool486493517") 731 * .build(); 732 * ApiFuture<Operation> future = targetPoolsClient.deleteCallable().futureCall(request); 733 * // Do something. 734 * Operation response = future.get(); 735 * } 736 * }</pre> 737 */ deleteCallable()738 public final UnaryCallable<DeleteTargetPoolRequest, Operation> deleteCallable() { 739 return stub.deleteCallable(); 740 } 741 742 // AUTO-GENERATED DOCUMENTATION AND METHOD. 743 /** 744 * Returns the specified target pool. 745 * 746 * <p>Sample code: 747 * 748 * <pre>{@code 749 * // This snippet has been automatically generated and should be regarded as a code template only. 750 * // It will require modifications to work: 751 * // - It may require correct/in-range values for request initialization. 752 * // - It may require specifying regional endpoints when creating the service client as shown in 753 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 754 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 755 * String project = "project-309310695"; 756 * String region = "region-934795532"; 757 * String targetPool = "targetPool486493517"; 758 * TargetPool response = targetPoolsClient.get(project, region, targetPool); 759 * } 760 * }</pre> 761 * 762 * @param project Project ID for this request. 763 * @param region Name of the region scoping this request. 764 * @param targetPool Name of the TargetPool resource to return. 765 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 766 */ get(String project, String region, String targetPool)767 public final TargetPool get(String project, String region, String targetPool) { 768 GetTargetPoolRequest request = 769 GetTargetPoolRequest.newBuilder() 770 .setProject(project) 771 .setRegion(region) 772 .setTargetPool(targetPool) 773 .build(); 774 return get(request); 775 } 776 777 // AUTO-GENERATED DOCUMENTATION AND METHOD. 778 /** 779 * Returns the specified target pool. 780 * 781 * <p>Sample code: 782 * 783 * <pre>{@code 784 * // This snippet has been automatically generated and should be regarded as a code template only. 785 * // It will require modifications to work: 786 * // - It may require correct/in-range values for request initialization. 787 * // - It may require specifying regional endpoints when creating the service client as shown in 788 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 789 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 790 * GetTargetPoolRequest request = 791 * GetTargetPoolRequest.newBuilder() 792 * .setProject("project-309310695") 793 * .setRegion("region-934795532") 794 * .setTargetPool("targetPool486493517") 795 * .build(); 796 * TargetPool response = targetPoolsClient.get(request); 797 * } 798 * }</pre> 799 * 800 * @param request The request object containing all of the parameters for the API call. 801 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 802 */ get(GetTargetPoolRequest request)803 public final TargetPool get(GetTargetPoolRequest request) { 804 return getCallable().call(request); 805 } 806 807 // AUTO-GENERATED DOCUMENTATION AND METHOD. 808 /** 809 * Returns the specified target pool. 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 (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 820 * GetTargetPoolRequest request = 821 * GetTargetPoolRequest.newBuilder() 822 * .setProject("project-309310695") 823 * .setRegion("region-934795532") 824 * .setTargetPool("targetPool486493517") 825 * .build(); 826 * ApiFuture<TargetPool> future = targetPoolsClient.getCallable().futureCall(request); 827 * // Do something. 828 * TargetPool response = future.get(); 829 * } 830 * }</pre> 831 */ getCallable()832 public final UnaryCallable<GetTargetPoolRequest, TargetPool> getCallable() { 833 return stub.getCallable(); 834 } 835 836 // AUTO-GENERATED DOCUMENTATION AND METHOD. 837 /** 838 * Gets the most recent health check results for each IP for the instance that is referenced by 839 * the given target pool. 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 (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 850 * String project = "project-309310695"; 851 * String region = "region-934795532"; 852 * String targetPool = "targetPool486493517"; 853 * InstanceReference instanceReferenceResource = InstanceReference.newBuilder().build(); 854 * TargetPoolInstanceHealth response = 855 * targetPoolsClient.getHealth(project, region, targetPool, instanceReferenceResource); 856 * } 857 * }</pre> 858 * 859 * @param project Project ID for this request. 860 * @param region Name of the region scoping this request. 861 * @param targetPool Name of the TargetPool resource to which the queried instance belongs. 862 * @param instanceReferenceResource The body resource for this request 863 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 864 */ getHealth( String project, String region, String targetPool, InstanceReference instanceReferenceResource)865 public final TargetPoolInstanceHealth getHealth( 866 String project, 867 String region, 868 String targetPool, 869 InstanceReference instanceReferenceResource) { 870 GetHealthTargetPoolRequest request = 871 GetHealthTargetPoolRequest.newBuilder() 872 .setProject(project) 873 .setRegion(region) 874 .setTargetPool(targetPool) 875 .setInstanceReferenceResource(instanceReferenceResource) 876 .build(); 877 return getHealth(request); 878 } 879 880 // AUTO-GENERATED DOCUMENTATION AND METHOD. 881 /** 882 * Gets the most recent health check results for each IP for the instance that is referenced by 883 * the given target pool. 884 * 885 * <p>Sample code: 886 * 887 * <pre>{@code 888 * // This snippet has been automatically generated and should be regarded as a code template only. 889 * // It will require modifications to work: 890 * // - It may require correct/in-range values for request initialization. 891 * // - It may require specifying regional endpoints when creating the service client as shown in 892 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 893 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 894 * GetHealthTargetPoolRequest request = 895 * GetHealthTargetPoolRequest.newBuilder() 896 * .setInstanceReferenceResource(InstanceReference.newBuilder().build()) 897 * .setProject("project-309310695") 898 * .setRegion("region-934795532") 899 * .setTargetPool("targetPool486493517") 900 * .build(); 901 * TargetPoolInstanceHealth response = targetPoolsClient.getHealth(request); 902 * } 903 * }</pre> 904 * 905 * @param request The request object containing all of the parameters for the API call. 906 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 907 */ getHealth(GetHealthTargetPoolRequest request)908 public final TargetPoolInstanceHealth getHealth(GetHealthTargetPoolRequest request) { 909 return getHealthCallable().call(request); 910 } 911 912 // AUTO-GENERATED DOCUMENTATION AND METHOD. 913 /** 914 * Gets the most recent health check results for each IP for the instance that is referenced by 915 * the given target pool. 916 * 917 * <p>Sample code: 918 * 919 * <pre>{@code 920 * // This snippet has been automatically generated and should be regarded as a code template only. 921 * // It will require modifications to work: 922 * // - It may require correct/in-range values for request initialization. 923 * // - It may require specifying regional endpoints when creating the service client as shown in 924 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 925 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 926 * GetHealthTargetPoolRequest request = 927 * GetHealthTargetPoolRequest.newBuilder() 928 * .setInstanceReferenceResource(InstanceReference.newBuilder().build()) 929 * .setProject("project-309310695") 930 * .setRegion("region-934795532") 931 * .setTargetPool("targetPool486493517") 932 * .build(); 933 * ApiFuture<TargetPoolInstanceHealth> future = 934 * targetPoolsClient.getHealthCallable().futureCall(request); 935 * // Do something. 936 * TargetPoolInstanceHealth response = future.get(); 937 * } 938 * }</pre> 939 */ 940 public final UnaryCallable<GetHealthTargetPoolRequest, TargetPoolInstanceHealth> getHealthCallable()941 getHealthCallable() { 942 return stub.getHealthCallable(); 943 } 944 945 // AUTO-GENERATED DOCUMENTATION AND METHOD. 946 /** 947 * Creates a target pool in the specified project and region using the data included in the 948 * request. 949 * 950 * <p>Sample code: 951 * 952 * <pre>{@code 953 * // This snippet has been automatically generated and should be regarded as a code template only. 954 * // It will require modifications to work: 955 * // - It may require correct/in-range values for request initialization. 956 * // - It may require specifying regional endpoints when creating the service client as shown in 957 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 958 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 959 * String project = "project-309310695"; 960 * String region = "region-934795532"; 961 * TargetPool targetPoolResource = TargetPool.newBuilder().build(); 962 * Operation response = targetPoolsClient.insertAsync(project, region, targetPoolResource).get(); 963 * } 964 * }</pre> 965 * 966 * @param project Project ID for this request. 967 * @param region Name of the region scoping this request. 968 * @param targetPoolResource The body resource for this request 969 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 970 */ insertAsync( String project, String region, TargetPool targetPoolResource)971 public final OperationFuture<Operation, Operation> insertAsync( 972 String project, String region, TargetPool targetPoolResource) { 973 InsertTargetPoolRequest request = 974 InsertTargetPoolRequest.newBuilder() 975 .setProject(project) 976 .setRegion(region) 977 .setTargetPoolResource(targetPoolResource) 978 .build(); 979 return insertAsync(request); 980 } 981 982 // AUTO-GENERATED DOCUMENTATION AND METHOD. 983 /** 984 * Creates a target pool in the specified project and region using the data included in the 985 * request. 986 * 987 * <p>Sample code: 988 * 989 * <pre>{@code 990 * // This snippet has been automatically generated and should be regarded as a code template only. 991 * // It will require modifications to work: 992 * // - It may require correct/in-range values for request initialization. 993 * // - It may require specifying regional endpoints when creating the service client as shown in 994 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 995 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 996 * InsertTargetPoolRequest request = 997 * InsertTargetPoolRequest.newBuilder() 998 * .setProject("project-309310695") 999 * .setRegion("region-934795532") 1000 * .setRequestId("requestId693933066") 1001 * .setTargetPoolResource(TargetPool.newBuilder().build()) 1002 * .build(); 1003 * Operation response = targetPoolsClient.insertAsync(request).get(); 1004 * } 1005 * }</pre> 1006 * 1007 * @param request The request object containing all of the parameters for the API call. 1008 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1009 */ 1010 @BetaApi( 1011 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync(InsertTargetPoolRequest request)1012 public final OperationFuture<Operation, Operation> insertAsync(InsertTargetPoolRequest request) { 1013 return insertOperationCallable().futureCall(request); 1014 } 1015 1016 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1017 /** 1018 * Creates a target pool in the specified project and region using the data included in the 1019 * request. 1020 * 1021 * <p>Sample code: 1022 * 1023 * <pre>{@code 1024 * // This snippet has been automatically generated and should be regarded as a code template only. 1025 * // It will require modifications to work: 1026 * // - It may require correct/in-range values for request initialization. 1027 * // - It may require specifying regional endpoints when creating the service client as shown in 1028 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1029 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1030 * InsertTargetPoolRequest request = 1031 * InsertTargetPoolRequest.newBuilder() 1032 * .setProject("project-309310695") 1033 * .setRegion("region-934795532") 1034 * .setRequestId("requestId693933066") 1035 * .setTargetPoolResource(TargetPool.newBuilder().build()) 1036 * .build(); 1037 * OperationFuture<Operation, Operation> future = 1038 * targetPoolsClient.insertOperationCallable().futureCall(request); 1039 * // Do something. 1040 * Operation response = future.get(); 1041 * } 1042 * }</pre> 1043 */ 1044 public final OperationCallable<InsertTargetPoolRequest, Operation, Operation> insertOperationCallable()1045 insertOperationCallable() { 1046 return stub.insertOperationCallable(); 1047 } 1048 1049 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1050 /** 1051 * Creates a target pool in the specified project and region using the data included in the 1052 * request. 1053 * 1054 * <p>Sample code: 1055 * 1056 * <pre>{@code 1057 * // This snippet has been automatically generated and should be regarded as a code template only. 1058 * // It will require modifications to work: 1059 * // - It may require correct/in-range values for request initialization. 1060 * // - It may require specifying regional endpoints when creating the service client as shown in 1061 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1062 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1063 * InsertTargetPoolRequest request = 1064 * InsertTargetPoolRequest.newBuilder() 1065 * .setProject("project-309310695") 1066 * .setRegion("region-934795532") 1067 * .setRequestId("requestId693933066") 1068 * .setTargetPoolResource(TargetPool.newBuilder().build()) 1069 * .build(); 1070 * ApiFuture<Operation> future = targetPoolsClient.insertCallable().futureCall(request); 1071 * // Do something. 1072 * Operation response = future.get(); 1073 * } 1074 * }</pre> 1075 */ insertCallable()1076 public final UnaryCallable<InsertTargetPoolRequest, Operation> insertCallable() { 1077 return stub.insertCallable(); 1078 } 1079 1080 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1081 /** 1082 * Retrieves a list of target pools available to the specified project and region. 1083 * 1084 * <p>Sample code: 1085 * 1086 * <pre>{@code 1087 * // This snippet has been automatically generated and should be regarded as a code template only. 1088 * // It will require modifications to work: 1089 * // - It may require correct/in-range values for request initialization. 1090 * // - It may require specifying regional endpoints when creating the service client as shown in 1091 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1092 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1093 * String project = "project-309310695"; 1094 * String region = "region-934795532"; 1095 * for (TargetPool element : targetPoolsClient.list(project, region).iterateAll()) { 1096 * // doThingsWith(element); 1097 * } 1098 * } 1099 * }</pre> 1100 * 1101 * @param project Project ID for this request. 1102 * @param region Name of the region scoping this request. 1103 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1104 */ list(String project, String region)1105 public final ListPagedResponse list(String project, String region) { 1106 ListTargetPoolsRequest request = 1107 ListTargetPoolsRequest.newBuilder().setProject(project).setRegion(region).build(); 1108 return list(request); 1109 } 1110 1111 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1112 /** 1113 * Retrieves a list of target pools available to the specified project and region. 1114 * 1115 * <p>Sample code: 1116 * 1117 * <pre>{@code 1118 * // This snippet has been automatically generated and should be regarded as a code template only. 1119 * // It will require modifications to work: 1120 * // - It may require correct/in-range values for request initialization. 1121 * // - It may require specifying regional endpoints when creating the service client as shown in 1122 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1123 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1124 * ListTargetPoolsRequest request = 1125 * ListTargetPoolsRequest.newBuilder() 1126 * .setFilter("filter-1274492040") 1127 * .setMaxResults(1128457243) 1128 * .setOrderBy("orderBy-1207110587") 1129 * .setPageToken("pageToken873572522") 1130 * .setProject("project-309310695") 1131 * .setRegion("region-934795532") 1132 * .setReturnPartialSuccess(true) 1133 * .build(); 1134 * for (TargetPool element : targetPoolsClient.list(request).iterateAll()) { 1135 * // doThingsWith(element); 1136 * } 1137 * } 1138 * }</pre> 1139 * 1140 * @param request The request object containing all of the parameters for the API call. 1141 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1142 */ list(ListTargetPoolsRequest request)1143 public final ListPagedResponse list(ListTargetPoolsRequest request) { 1144 return listPagedCallable().call(request); 1145 } 1146 1147 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1148 /** 1149 * Retrieves a list of target pools available to the specified project and region. 1150 * 1151 * <p>Sample code: 1152 * 1153 * <pre>{@code 1154 * // This snippet has been automatically generated and should be regarded as a code template only. 1155 * // It will require modifications to work: 1156 * // - It may require correct/in-range values for request initialization. 1157 * // - It may require specifying regional endpoints when creating the service client as shown in 1158 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1159 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1160 * ListTargetPoolsRequest request = 1161 * ListTargetPoolsRequest.newBuilder() 1162 * .setFilter("filter-1274492040") 1163 * .setMaxResults(1128457243) 1164 * .setOrderBy("orderBy-1207110587") 1165 * .setPageToken("pageToken873572522") 1166 * .setProject("project-309310695") 1167 * .setRegion("region-934795532") 1168 * .setReturnPartialSuccess(true) 1169 * .build(); 1170 * ApiFuture<TargetPool> future = targetPoolsClient.listPagedCallable().futureCall(request); 1171 * // Do something. 1172 * for (TargetPool element : future.get().iterateAll()) { 1173 * // doThingsWith(element); 1174 * } 1175 * } 1176 * }</pre> 1177 */ listPagedCallable()1178 public final UnaryCallable<ListTargetPoolsRequest, ListPagedResponse> listPagedCallable() { 1179 return stub.listPagedCallable(); 1180 } 1181 1182 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1183 /** 1184 * Retrieves a list of target pools available to the specified project and region. 1185 * 1186 * <p>Sample code: 1187 * 1188 * <pre>{@code 1189 * // This snippet has been automatically generated and should be regarded as a code template only. 1190 * // It will require modifications to work: 1191 * // - It may require correct/in-range values for request initialization. 1192 * // - It may require specifying regional endpoints when creating the service client as shown in 1193 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1194 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1195 * ListTargetPoolsRequest request = 1196 * ListTargetPoolsRequest.newBuilder() 1197 * .setFilter("filter-1274492040") 1198 * .setMaxResults(1128457243) 1199 * .setOrderBy("orderBy-1207110587") 1200 * .setPageToken("pageToken873572522") 1201 * .setProject("project-309310695") 1202 * .setRegion("region-934795532") 1203 * .setReturnPartialSuccess(true) 1204 * .build(); 1205 * while (true) { 1206 * TargetPoolList response = targetPoolsClient.listCallable().call(request); 1207 * for (TargetPool element : response.getItemsList()) { 1208 * // doThingsWith(element); 1209 * } 1210 * String nextPageToken = response.getNextPageToken(); 1211 * if (!Strings.isNullOrEmpty(nextPageToken)) { 1212 * request = request.toBuilder().setPageToken(nextPageToken).build(); 1213 * } else { 1214 * break; 1215 * } 1216 * } 1217 * } 1218 * }</pre> 1219 */ listCallable()1220 public final UnaryCallable<ListTargetPoolsRequest, TargetPoolList> listCallable() { 1221 return stub.listCallable(); 1222 } 1223 1224 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1225 /** 1226 * Removes health check URL from a target pool. 1227 * 1228 * <p>Sample code: 1229 * 1230 * <pre>{@code 1231 * // This snippet has been automatically generated and should be regarded as a code template only. 1232 * // It will require modifications to work: 1233 * // - It may require correct/in-range values for request initialization. 1234 * // - It may require specifying regional endpoints when creating the service client as shown in 1235 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1236 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1237 * String project = "project-309310695"; 1238 * String region = "region-934795532"; 1239 * String targetPool = "targetPool486493517"; 1240 * TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource = 1241 * TargetPoolsRemoveHealthCheckRequest.newBuilder().build(); 1242 * Operation response = 1243 * targetPoolsClient 1244 * .removeHealthCheckAsync( 1245 * project, region, targetPool, targetPoolsRemoveHealthCheckRequestResource) 1246 * .get(); 1247 * } 1248 * }</pre> 1249 * 1250 * @param project Project ID for this request. 1251 * @param region Name of the region for this request. 1252 * @param targetPool Name of the target pool to remove health checks from. 1253 * @param targetPoolsRemoveHealthCheckRequestResource The body resource for this request 1254 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1255 */ removeHealthCheckAsync( String project, String region, String targetPool, TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource)1256 public final OperationFuture<Operation, Operation> removeHealthCheckAsync( 1257 String project, 1258 String region, 1259 String targetPool, 1260 TargetPoolsRemoveHealthCheckRequest targetPoolsRemoveHealthCheckRequestResource) { 1261 RemoveHealthCheckTargetPoolRequest request = 1262 RemoveHealthCheckTargetPoolRequest.newBuilder() 1263 .setProject(project) 1264 .setRegion(region) 1265 .setTargetPool(targetPool) 1266 .setTargetPoolsRemoveHealthCheckRequestResource( 1267 targetPoolsRemoveHealthCheckRequestResource) 1268 .build(); 1269 return removeHealthCheckAsync(request); 1270 } 1271 1272 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1273 /** 1274 * Removes health check URL from a target pool. 1275 * 1276 * <p>Sample code: 1277 * 1278 * <pre>{@code 1279 * // This snippet has been automatically generated and should be regarded as a code template only. 1280 * // It will require modifications to work: 1281 * // - It may require correct/in-range values for request initialization. 1282 * // - It may require specifying regional endpoints when creating the service client as shown in 1283 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1284 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1285 * RemoveHealthCheckTargetPoolRequest request = 1286 * RemoveHealthCheckTargetPoolRequest.newBuilder() 1287 * .setProject("project-309310695") 1288 * .setRegion("region-934795532") 1289 * .setRequestId("requestId693933066") 1290 * .setTargetPool("targetPool486493517") 1291 * .setTargetPoolsRemoveHealthCheckRequestResource( 1292 * TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) 1293 * .build(); 1294 * Operation response = targetPoolsClient.removeHealthCheckAsync(request).get(); 1295 * } 1296 * }</pre> 1297 * 1298 * @param request The request object containing all of the parameters for the API call. 1299 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1300 */ 1301 @BetaApi( 1302 "The surface for long-running operations is not stable yet and may change in the future.") removeHealthCheckAsync( RemoveHealthCheckTargetPoolRequest request)1303 public final OperationFuture<Operation, Operation> removeHealthCheckAsync( 1304 RemoveHealthCheckTargetPoolRequest request) { 1305 return removeHealthCheckOperationCallable().futureCall(request); 1306 } 1307 1308 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1309 /** 1310 * Removes health check URL from a target pool. 1311 * 1312 * <p>Sample code: 1313 * 1314 * <pre>{@code 1315 * // This snippet has been automatically generated and should be regarded as a code template only. 1316 * // It will require modifications to work: 1317 * // - It may require correct/in-range values for request initialization. 1318 * // - It may require specifying regional endpoints when creating the service client as shown in 1319 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1320 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1321 * RemoveHealthCheckTargetPoolRequest request = 1322 * RemoveHealthCheckTargetPoolRequest.newBuilder() 1323 * .setProject("project-309310695") 1324 * .setRegion("region-934795532") 1325 * .setRequestId("requestId693933066") 1326 * .setTargetPool("targetPool486493517") 1327 * .setTargetPoolsRemoveHealthCheckRequestResource( 1328 * TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) 1329 * .build(); 1330 * OperationFuture<Operation, Operation> future = 1331 * targetPoolsClient.removeHealthCheckOperationCallable().futureCall(request); 1332 * // Do something. 1333 * Operation response = future.get(); 1334 * } 1335 * }</pre> 1336 */ 1337 public final OperationCallable<RemoveHealthCheckTargetPoolRequest, Operation, Operation> removeHealthCheckOperationCallable()1338 removeHealthCheckOperationCallable() { 1339 return stub.removeHealthCheckOperationCallable(); 1340 } 1341 1342 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1343 /** 1344 * Removes health check URL from a target pool. 1345 * 1346 * <p>Sample code: 1347 * 1348 * <pre>{@code 1349 * // This snippet has been automatically generated and should be regarded as a code template only. 1350 * // It will require modifications to work: 1351 * // - It may require correct/in-range values for request initialization. 1352 * // - It may require specifying regional endpoints when creating the service client as shown in 1353 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1354 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1355 * RemoveHealthCheckTargetPoolRequest request = 1356 * RemoveHealthCheckTargetPoolRequest.newBuilder() 1357 * .setProject("project-309310695") 1358 * .setRegion("region-934795532") 1359 * .setRequestId("requestId693933066") 1360 * .setTargetPool("targetPool486493517") 1361 * .setTargetPoolsRemoveHealthCheckRequestResource( 1362 * TargetPoolsRemoveHealthCheckRequest.newBuilder().build()) 1363 * .build(); 1364 * ApiFuture<Operation> future = 1365 * targetPoolsClient.removeHealthCheckCallable().futureCall(request); 1366 * // Do something. 1367 * Operation response = future.get(); 1368 * } 1369 * }</pre> 1370 */ 1371 public final UnaryCallable<RemoveHealthCheckTargetPoolRequest, Operation> removeHealthCheckCallable()1372 removeHealthCheckCallable() { 1373 return stub.removeHealthCheckCallable(); 1374 } 1375 1376 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1377 /** 1378 * Removes instance URL from a target pool. 1379 * 1380 * <p>Sample code: 1381 * 1382 * <pre>{@code 1383 * // This snippet has been automatically generated and should be regarded as a code template only. 1384 * // It will require modifications to work: 1385 * // - It may require correct/in-range values for request initialization. 1386 * // - It may require specifying regional endpoints when creating the service client as shown in 1387 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1388 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1389 * String project = "project-309310695"; 1390 * String region = "region-934795532"; 1391 * String targetPool = "targetPool486493517"; 1392 * TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource = 1393 * TargetPoolsRemoveInstanceRequest.newBuilder().build(); 1394 * Operation response = 1395 * targetPoolsClient 1396 * .removeInstanceAsync( 1397 * project, region, targetPool, targetPoolsRemoveInstanceRequestResource) 1398 * .get(); 1399 * } 1400 * }</pre> 1401 * 1402 * @param project Project ID for this request. 1403 * @param region Name of the region scoping this request. 1404 * @param targetPool Name of the TargetPool resource to remove instances from. 1405 * @param targetPoolsRemoveInstanceRequestResource The body resource for this request 1406 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1407 */ removeInstanceAsync( String project, String region, String targetPool, TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource)1408 public final OperationFuture<Operation, Operation> removeInstanceAsync( 1409 String project, 1410 String region, 1411 String targetPool, 1412 TargetPoolsRemoveInstanceRequest targetPoolsRemoveInstanceRequestResource) { 1413 RemoveInstanceTargetPoolRequest request = 1414 RemoveInstanceTargetPoolRequest.newBuilder() 1415 .setProject(project) 1416 .setRegion(region) 1417 .setTargetPool(targetPool) 1418 .setTargetPoolsRemoveInstanceRequestResource(targetPoolsRemoveInstanceRequestResource) 1419 .build(); 1420 return removeInstanceAsync(request); 1421 } 1422 1423 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1424 /** 1425 * Removes instance URL from a target pool. 1426 * 1427 * <p>Sample code: 1428 * 1429 * <pre>{@code 1430 * // This snippet has been automatically generated and should be regarded as a code template only. 1431 * // It will require modifications to work: 1432 * // - It may require correct/in-range values for request initialization. 1433 * // - It may require specifying regional endpoints when creating the service client as shown in 1434 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1435 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1436 * RemoveInstanceTargetPoolRequest request = 1437 * RemoveInstanceTargetPoolRequest.newBuilder() 1438 * .setProject("project-309310695") 1439 * .setRegion("region-934795532") 1440 * .setRequestId("requestId693933066") 1441 * .setTargetPool("targetPool486493517") 1442 * .setTargetPoolsRemoveInstanceRequestResource( 1443 * TargetPoolsRemoveInstanceRequest.newBuilder().build()) 1444 * .build(); 1445 * Operation response = targetPoolsClient.removeInstanceAsync(request).get(); 1446 * } 1447 * }</pre> 1448 * 1449 * @param request The request object containing all of the parameters for the API call. 1450 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1451 */ 1452 @BetaApi( 1453 "The surface for long-running operations is not stable yet and may change in the future.") removeInstanceAsync( RemoveInstanceTargetPoolRequest request)1454 public final OperationFuture<Operation, Operation> removeInstanceAsync( 1455 RemoveInstanceTargetPoolRequest request) { 1456 return removeInstanceOperationCallable().futureCall(request); 1457 } 1458 1459 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1460 /** 1461 * Removes instance URL from a target pool. 1462 * 1463 * <p>Sample code: 1464 * 1465 * <pre>{@code 1466 * // This snippet has been automatically generated and should be regarded as a code template only. 1467 * // It will require modifications to work: 1468 * // - It may require correct/in-range values for request initialization. 1469 * // - It may require specifying regional endpoints when creating the service client as shown in 1470 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1471 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1472 * RemoveInstanceTargetPoolRequest request = 1473 * RemoveInstanceTargetPoolRequest.newBuilder() 1474 * .setProject("project-309310695") 1475 * .setRegion("region-934795532") 1476 * .setRequestId("requestId693933066") 1477 * .setTargetPool("targetPool486493517") 1478 * .setTargetPoolsRemoveInstanceRequestResource( 1479 * TargetPoolsRemoveInstanceRequest.newBuilder().build()) 1480 * .build(); 1481 * OperationFuture<Operation, Operation> future = 1482 * targetPoolsClient.removeInstanceOperationCallable().futureCall(request); 1483 * // Do something. 1484 * Operation response = future.get(); 1485 * } 1486 * }</pre> 1487 */ 1488 public final OperationCallable<RemoveInstanceTargetPoolRequest, Operation, Operation> removeInstanceOperationCallable()1489 removeInstanceOperationCallable() { 1490 return stub.removeInstanceOperationCallable(); 1491 } 1492 1493 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1494 /** 1495 * Removes instance URL from a target pool. 1496 * 1497 * <p>Sample code: 1498 * 1499 * <pre>{@code 1500 * // This snippet has been automatically generated and should be regarded as a code template only. 1501 * // It will require modifications to work: 1502 * // - It may require correct/in-range values for request initialization. 1503 * // - It may require specifying regional endpoints when creating the service client as shown in 1504 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1505 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1506 * RemoveInstanceTargetPoolRequest request = 1507 * RemoveInstanceTargetPoolRequest.newBuilder() 1508 * .setProject("project-309310695") 1509 * .setRegion("region-934795532") 1510 * .setRequestId("requestId693933066") 1511 * .setTargetPool("targetPool486493517") 1512 * .setTargetPoolsRemoveInstanceRequestResource( 1513 * TargetPoolsRemoveInstanceRequest.newBuilder().build()) 1514 * .build(); 1515 * ApiFuture<Operation> future = targetPoolsClient.removeInstanceCallable().futureCall(request); 1516 * // Do something. 1517 * Operation response = future.get(); 1518 * } 1519 * }</pre> 1520 */ removeInstanceCallable()1521 public final UnaryCallable<RemoveInstanceTargetPoolRequest, Operation> removeInstanceCallable() { 1522 return stub.removeInstanceCallable(); 1523 } 1524 1525 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1526 /** 1527 * Changes a backup target pool's configurations. 1528 * 1529 * <p>Sample code: 1530 * 1531 * <pre>{@code 1532 * // This snippet has been automatically generated and should be regarded as a code template only. 1533 * // It will require modifications to work: 1534 * // - It may require correct/in-range values for request initialization. 1535 * // - It may require specifying regional endpoints when creating the service client as shown in 1536 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1537 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1538 * String project = "project-309310695"; 1539 * String region = "region-934795532"; 1540 * String targetPool = "targetPool486493517"; 1541 * TargetReference targetReferenceResource = TargetReference.newBuilder().build(); 1542 * Operation response = 1543 * targetPoolsClient 1544 * .setBackupAsync(project, region, targetPool, targetReferenceResource) 1545 * .get(); 1546 * } 1547 * }</pre> 1548 * 1549 * @param project Project ID for this request. 1550 * @param region Name of the region scoping this request. 1551 * @param targetPool Name of the TargetPool resource to set a backup pool for. 1552 * @param targetReferenceResource The body resource for this request 1553 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1554 */ setBackupAsync( String project, String region, String targetPool, TargetReference targetReferenceResource)1555 public final OperationFuture<Operation, Operation> setBackupAsync( 1556 String project, String region, String targetPool, TargetReference targetReferenceResource) { 1557 SetBackupTargetPoolRequest request = 1558 SetBackupTargetPoolRequest.newBuilder() 1559 .setProject(project) 1560 .setRegion(region) 1561 .setTargetPool(targetPool) 1562 .setTargetReferenceResource(targetReferenceResource) 1563 .build(); 1564 return setBackupAsync(request); 1565 } 1566 1567 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1568 /** 1569 * Changes a backup target pool's configurations. 1570 * 1571 * <p>Sample code: 1572 * 1573 * <pre>{@code 1574 * // This snippet has been automatically generated and should be regarded as a code template only. 1575 * // It will require modifications to work: 1576 * // - It may require correct/in-range values for request initialization. 1577 * // - It may require specifying regional endpoints when creating the service client as shown in 1578 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1579 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1580 * SetBackupTargetPoolRequest request = 1581 * SetBackupTargetPoolRequest.newBuilder() 1582 * .setFailoverRatio(-861074818) 1583 * .setProject("project-309310695") 1584 * .setRegion("region-934795532") 1585 * .setRequestId("requestId693933066") 1586 * .setTargetPool("targetPool486493517") 1587 * .setTargetReferenceResource(TargetReference.newBuilder().build()) 1588 * .build(); 1589 * Operation response = targetPoolsClient.setBackupAsync(request).get(); 1590 * } 1591 * }</pre> 1592 * 1593 * @param request The request object containing all of the parameters for the API call. 1594 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1595 */ 1596 @BetaApi( 1597 "The surface for long-running operations is not stable yet and may change in the future.") setBackupAsync( SetBackupTargetPoolRequest request)1598 public final OperationFuture<Operation, Operation> setBackupAsync( 1599 SetBackupTargetPoolRequest request) { 1600 return setBackupOperationCallable().futureCall(request); 1601 } 1602 1603 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1604 /** 1605 * Changes a backup target pool's configurations. 1606 * 1607 * <p>Sample code: 1608 * 1609 * <pre>{@code 1610 * // This snippet has been automatically generated and should be regarded as a code template only. 1611 * // It will require modifications to work: 1612 * // - It may require correct/in-range values for request initialization. 1613 * // - It may require specifying regional endpoints when creating the service client as shown in 1614 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1615 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1616 * SetBackupTargetPoolRequest request = 1617 * SetBackupTargetPoolRequest.newBuilder() 1618 * .setFailoverRatio(-861074818) 1619 * .setProject("project-309310695") 1620 * .setRegion("region-934795532") 1621 * .setRequestId("requestId693933066") 1622 * .setTargetPool("targetPool486493517") 1623 * .setTargetReferenceResource(TargetReference.newBuilder().build()) 1624 * .build(); 1625 * OperationFuture<Operation, Operation> future = 1626 * targetPoolsClient.setBackupOperationCallable().futureCall(request); 1627 * // Do something. 1628 * Operation response = future.get(); 1629 * } 1630 * }</pre> 1631 */ 1632 public final OperationCallable<SetBackupTargetPoolRequest, Operation, Operation> setBackupOperationCallable()1633 setBackupOperationCallable() { 1634 return stub.setBackupOperationCallable(); 1635 } 1636 1637 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1638 /** 1639 * Changes a backup target pool's configurations. 1640 * 1641 * <p>Sample code: 1642 * 1643 * <pre>{@code 1644 * // This snippet has been automatically generated and should be regarded as a code template only. 1645 * // It will require modifications to work: 1646 * // - It may require correct/in-range values for request initialization. 1647 * // - It may require specifying regional endpoints when creating the service client as shown in 1648 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1649 * try (TargetPoolsClient targetPoolsClient = TargetPoolsClient.create()) { 1650 * SetBackupTargetPoolRequest request = 1651 * SetBackupTargetPoolRequest.newBuilder() 1652 * .setFailoverRatio(-861074818) 1653 * .setProject("project-309310695") 1654 * .setRegion("region-934795532") 1655 * .setRequestId("requestId693933066") 1656 * .setTargetPool("targetPool486493517") 1657 * .setTargetReferenceResource(TargetReference.newBuilder().build()) 1658 * .build(); 1659 * ApiFuture<Operation> future = targetPoolsClient.setBackupCallable().futureCall(request); 1660 * // Do something. 1661 * Operation response = future.get(); 1662 * } 1663 * }</pre> 1664 */ setBackupCallable()1665 public final UnaryCallable<SetBackupTargetPoolRequest, Operation> setBackupCallable() { 1666 return stub.setBackupCallable(); 1667 } 1668 1669 @Override close()1670 public final void close() { 1671 stub.close(); 1672 } 1673 1674 @Override shutdown()1675 public void shutdown() { 1676 stub.shutdown(); 1677 } 1678 1679 @Override isShutdown()1680 public boolean isShutdown() { 1681 return stub.isShutdown(); 1682 } 1683 1684 @Override isTerminated()1685 public boolean isTerminated() { 1686 return stub.isTerminated(); 1687 } 1688 1689 @Override shutdownNow()1690 public void shutdownNow() { 1691 stub.shutdownNow(); 1692 } 1693 1694 @Override awaitTermination(long duration, TimeUnit unit)1695 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1696 return stub.awaitTermination(duration, unit); 1697 } 1698 1699 public static class AggregatedListPagedResponse 1700 extends AbstractPagedListResponse< 1701 AggregatedListTargetPoolsRequest, 1702 TargetPoolAggregatedList, 1703 Map.Entry<String, TargetPoolsScopedList>, 1704 AggregatedListPage, 1705 AggregatedListFixedSizeCollection> { 1706 createAsync( PageContext< AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, Map.Entry<String, TargetPoolsScopedList>> context, ApiFuture<TargetPoolAggregatedList> futureResponse)1707 public static ApiFuture<AggregatedListPagedResponse> createAsync( 1708 PageContext< 1709 AggregatedListTargetPoolsRequest, 1710 TargetPoolAggregatedList, 1711 Map.Entry<String, TargetPoolsScopedList>> 1712 context, 1713 ApiFuture<TargetPoolAggregatedList> futureResponse) { 1714 ApiFuture<AggregatedListPage> futurePage = 1715 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 1716 return ApiFutures.transform( 1717 futurePage, 1718 input -> new AggregatedListPagedResponse(input), 1719 MoreExecutors.directExecutor()); 1720 } 1721 AggregatedListPagedResponse(AggregatedListPage page)1722 private AggregatedListPagedResponse(AggregatedListPage page) { 1723 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 1724 } 1725 } 1726 1727 public static class AggregatedListPage 1728 extends AbstractPage< 1729 AggregatedListTargetPoolsRequest, 1730 TargetPoolAggregatedList, 1731 Map.Entry<String, TargetPoolsScopedList>, 1732 AggregatedListPage> { 1733 AggregatedListPage( PageContext< AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, Map.Entry<String, TargetPoolsScopedList>> context, TargetPoolAggregatedList response)1734 private AggregatedListPage( 1735 PageContext< 1736 AggregatedListTargetPoolsRequest, 1737 TargetPoolAggregatedList, 1738 Map.Entry<String, TargetPoolsScopedList>> 1739 context, 1740 TargetPoolAggregatedList response) { 1741 super(context, response); 1742 } 1743 createEmptyPage()1744 private static AggregatedListPage createEmptyPage() { 1745 return new AggregatedListPage(null, null); 1746 } 1747 1748 @Override createPage( PageContext< AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, Map.Entry<String, TargetPoolsScopedList>> context, TargetPoolAggregatedList response)1749 protected AggregatedListPage createPage( 1750 PageContext< 1751 AggregatedListTargetPoolsRequest, 1752 TargetPoolAggregatedList, 1753 Map.Entry<String, TargetPoolsScopedList>> 1754 context, 1755 TargetPoolAggregatedList response) { 1756 return new AggregatedListPage(context, response); 1757 } 1758 1759 @Override createPageAsync( PageContext< AggregatedListTargetPoolsRequest, TargetPoolAggregatedList, Map.Entry<String, TargetPoolsScopedList>> context, ApiFuture<TargetPoolAggregatedList> futureResponse)1760 public ApiFuture<AggregatedListPage> createPageAsync( 1761 PageContext< 1762 AggregatedListTargetPoolsRequest, 1763 TargetPoolAggregatedList, 1764 Map.Entry<String, TargetPoolsScopedList>> 1765 context, 1766 ApiFuture<TargetPoolAggregatedList> futureResponse) { 1767 return super.createPageAsync(context, futureResponse); 1768 } 1769 } 1770 1771 public static class AggregatedListFixedSizeCollection 1772 extends AbstractFixedSizeCollection< 1773 AggregatedListTargetPoolsRequest, 1774 TargetPoolAggregatedList, 1775 Map.Entry<String, TargetPoolsScopedList>, 1776 AggregatedListPage, 1777 AggregatedListFixedSizeCollection> { 1778 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1779 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 1780 super(pages, collectionSize); 1781 } 1782 createEmptyCollection()1783 private static AggregatedListFixedSizeCollection createEmptyCollection() { 1784 return new AggregatedListFixedSizeCollection(null, 0); 1785 } 1786 1787 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)1788 protected AggregatedListFixedSizeCollection createCollection( 1789 List<AggregatedListPage> pages, int collectionSize) { 1790 return new AggregatedListFixedSizeCollection(pages, collectionSize); 1791 } 1792 } 1793 1794 public static class ListPagedResponse 1795 extends AbstractPagedListResponse< 1796 ListTargetPoolsRequest, TargetPoolList, TargetPool, ListPage, ListFixedSizeCollection> { 1797 createAsync( PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, ApiFuture<TargetPoolList> futureResponse)1798 public static ApiFuture<ListPagedResponse> createAsync( 1799 PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, 1800 ApiFuture<TargetPoolList> futureResponse) { 1801 ApiFuture<ListPage> futurePage = 1802 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 1803 return ApiFutures.transform( 1804 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 1805 } 1806 ListPagedResponse(ListPage page)1807 private ListPagedResponse(ListPage page) { 1808 super(page, ListFixedSizeCollection.createEmptyCollection()); 1809 } 1810 } 1811 1812 public static class ListPage 1813 extends AbstractPage<ListTargetPoolsRequest, TargetPoolList, TargetPool, ListPage> { 1814 ListPage( PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, TargetPoolList response)1815 private ListPage( 1816 PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, 1817 TargetPoolList response) { 1818 super(context, response); 1819 } 1820 createEmptyPage()1821 private static ListPage createEmptyPage() { 1822 return new ListPage(null, null); 1823 } 1824 1825 @Override createPage( PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, TargetPoolList response)1826 protected ListPage createPage( 1827 PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, 1828 TargetPoolList response) { 1829 return new ListPage(context, response); 1830 } 1831 1832 @Override createPageAsync( PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, ApiFuture<TargetPoolList> futureResponse)1833 public ApiFuture<ListPage> createPageAsync( 1834 PageContext<ListTargetPoolsRequest, TargetPoolList, TargetPool> context, 1835 ApiFuture<TargetPoolList> futureResponse) { 1836 return super.createPageAsync(context, futureResponse); 1837 } 1838 } 1839 1840 public static class ListFixedSizeCollection 1841 extends AbstractFixedSizeCollection< 1842 ListTargetPoolsRequest, TargetPoolList, TargetPool, ListPage, ListFixedSizeCollection> { 1843 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1844 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 1845 super(pages, collectionSize); 1846 } 1847 createEmptyCollection()1848 private static ListFixedSizeCollection createEmptyCollection() { 1849 return new ListFixedSizeCollection(null, 0); 1850 } 1851 1852 @Override createCollection(List<ListPage> pages, int collectionSize)1853 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 1854 return new ListFixedSizeCollection(pages, collectionSize); 1855 } 1856 } 1857 } 1858