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