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.VpnTunnelsStub; 31 import com.google.cloud.compute.v1.stub.VpnTunnelsStubSettings; 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 VpnTunnels 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 (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 53 * String project = "project-309310695"; 54 * String region = "region-934795532"; 55 * String vpnTunnel = "vpnTunnel452443772"; 56 * VpnTunnel response = vpnTunnelsClient.get(project, region, vpnTunnel); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the VpnTunnelsClient 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 VpnTunnelsSettings 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 * VpnTunnelsSettings vpnTunnelsSettings = 95 * VpnTunnelsSettings.newBuilder() 96 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 97 * .build(); 98 * VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create(vpnTunnelsSettings); 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 * VpnTunnelsSettings vpnTunnelsSettings = 110 * VpnTunnelsSettings.newBuilder().setEndpoint(myEndpoint).build(); 111 * VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create(vpnTunnelsSettings); 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 VpnTunnelsClient implements BackgroundResource { 118 private final VpnTunnelsSettings settings; 119 private final VpnTunnelsStub stub; 120 121 /** Constructs an instance of VpnTunnelsClient with default settings. */ create()122 public static final VpnTunnelsClient create() throws IOException { 123 return create(VpnTunnelsSettings.newBuilder().build()); 124 } 125 126 /** 127 * Constructs an instance of VpnTunnelsClient, 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(VpnTunnelsSettings settings)130 public static final VpnTunnelsClient create(VpnTunnelsSettings settings) throws IOException { 131 return new VpnTunnelsClient(settings); 132 } 133 134 /** 135 * Constructs an instance of VpnTunnelsClient, using the given stub for making calls. This is for 136 * advanced usage - prefer using create(VpnTunnelsSettings). 137 */ create(VpnTunnelsStub stub)138 public static final VpnTunnelsClient create(VpnTunnelsStub stub) { 139 return new VpnTunnelsClient(stub); 140 } 141 142 /** 143 * Constructs an instance of VpnTunnelsClient, using the given settings. This is protected so that 144 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 145 */ VpnTunnelsClient(VpnTunnelsSettings settings)146 protected VpnTunnelsClient(VpnTunnelsSettings settings) throws IOException { 147 this.settings = settings; 148 this.stub = ((VpnTunnelsStubSettings) settings.getStubSettings()).createStub(); 149 } 150 VpnTunnelsClient(VpnTunnelsStub stub)151 protected VpnTunnelsClient(VpnTunnelsStub stub) { 152 this.settings = null; 153 this.stub = stub; 154 } 155 getSettings()156 public final VpnTunnelsSettings getSettings() { 157 return settings; 158 } 159 getStub()160 public VpnTunnelsStub getStub() { 161 return stub; 162 } 163 164 // AUTO-GENERATED DOCUMENTATION AND METHOD. 165 /** 166 * Retrieves an aggregated list of VPN tunnels. 167 * 168 * <p>Sample code: 169 * 170 * <pre>{@code 171 * // This snippet has been automatically generated and should be regarded as a code template only. 172 * // It will require modifications to work: 173 * // - It may require correct/in-range values for request initialization. 174 * // - It may require specifying regional endpoints when creating the service client as shown in 175 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 176 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 177 * String project = "project-309310695"; 178 * for (Map.Entry<String, VpnTunnelsScopedList> element : 179 * vpnTunnelsClient.aggregatedList(project).iterateAll()) { 180 * // doThingsWith(element); 181 * } 182 * } 183 * }</pre> 184 * 185 * @param project Project ID for this request. 186 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 187 */ aggregatedList(String project)188 public final AggregatedListPagedResponse aggregatedList(String project) { 189 AggregatedListVpnTunnelsRequest request = 190 AggregatedListVpnTunnelsRequest.newBuilder().setProject(project).build(); 191 return aggregatedList(request); 192 } 193 194 // AUTO-GENERATED DOCUMENTATION AND METHOD. 195 /** 196 * Retrieves an aggregated list of VPN tunnels. 197 * 198 * <p>Sample code: 199 * 200 * <pre>{@code 201 * // This snippet has been automatically generated and should be regarded as a code template only. 202 * // It will require modifications to work: 203 * // - It may require correct/in-range values for request initialization. 204 * // - It may require specifying regional endpoints when creating the service client as shown in 205 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 206 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 207 * AggregatedListVpnTunnelsRequest request = 208 * AggregatedListVpnTunnelsRequest.newBuilder() 209 * .setFilter("filter-1274492040") 210 * .setIncludeAllScopes(true) 211 * .setMaxResults(1128457243) 212 * .setOrderBy("orderBy-1207110587") 213 * .setPageToken("pageToken873572522") 214 * .setProject("project-309310695") 215 * .setReturnPartialSuccess(true) 216 * .build(); 217 * for (Map.Entry<String, VpnTunnelsScopedList> element : 218 * vpnTunnelsClient.aggregatedList(request).iterateAll()) { 219 * // doThingsWith(element); 220 * } 221 * } 222 * }</pre> 223 * 224 * @param request The request object containing all of the parameters for the API call. 225 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 226 */ aggregatedList(AggregatedListVpnTunnelsRequest request)227 public final AggregatedListPagedResponse aggregatedList(AggregatedListVpnTunnelsRequest request) { 228 return aggregatedListPagedCallable().call(request); 229 } 230 231 // AUTO-GENERATED DOCUMENTATION AND METHOD. 232 /** 233 * Retrieves an aggregated list of VPN tunnels. 234 * 235 * <p>Sample code: 236 * 237 * <pre>{@code 238 * // This snippet has been automatically generated and should be regarded as a code template only. 239 * // It will require modifications to work: 240 * // - It may require correct/in-range values for request initialization. 241 * // - It may require specifying regional endpoints when creating the service client as shown in 242 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 243 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 244 * AggregatedListVpnTunnelsRequest request = 245 * AggregatedListVpnTunnelsRequest.newBuilder() 246 * .setFilter("filter-1274492040") 247 * .setIncludeAllScopes(true) 248 * .setMaxResults(1128457243) 249 * .setOrderBy("orderBy-1207110587") 250 * .setPageToken("pageToken873572522") 251 * .setProject("project-309310695") 252 * .setReturnPartialSuccess(true) 253 * .build(); 254 * ApiFuture<Map.Entry<String, VpnTunnelsScopedList>> future = 255 * vpnTunnelsClient.aggregatedListPagedCallable().futureCall(request); 256 * // Do something. 257 * for (Map.Entry<String, VpnTunnelsScopedList> element : future.get().iterateAll()) { 258 * // doThingsWith(element); 259 * } 260 * } 261 * }</pre> 262 */ 263 public final UnaryCallable<AggregatedListVpnTunnelsRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()264 aggregatedListPagedCallable() { 265 return stub.aggregatedListPagedCallable(); 266 } 267 268 // AUTO-GENERATED DOCUMENTATION AND METHOD. 269 /** 270 * Retrieves an aggregated list of VPN tunnels. 271 * 272 * <p>Sample code: 273 * 274 * <pre>{@code 275 * // This snippet has been automatically generated and should be regarded as a code template only. 276 * // It will require modifications to work: 277 * // - It may require correct/in-range values for request initialization. 278 * // - It may require specifying regional endpoints when creating the service client as shown in 279 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 280 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 281 * AggregatedListVpnTunnelsRequest request = 282 * AggregatedListVpnTunnelsRequest.newBuilder() 283 * .setFilter("filter-1274492040") 284 * .setIncludeAllScopes(true) 285 * .setMaxResults(1128457243) 286 * .setOrderBy("orderBy-1207110587") 287 * .setPageToken("pageToken873572522") 288 * .setProject("project-309310695") 289 * .setReturnPartialSuccess(true) 290 * .build(); 291 * while (true) { 292 * VpnTunnelAggregatedList response = vpnTunnelsClient.aggregatedListCallable().call(request); 293 * for (Map.Entry<String, VpnTunnelsScopedList> element : response.getItemsList()) { 294 * // doThingsWith(element); 295 * } 296 * String nextPageToken = response.getNextPageToken(); 297 * if (!Strings.isNullOrEmpty(nextPageToken)) { 298 * request = request.toBuilder().setPageToken(nextPageToken).build(); 299 * } else { 300 * break; 301 * } 302 * } 303 * } 304 * }</pre> 305 */ 306 public final UnaryCallable<AggregatedListVpnTunnelsRequest, VpnTunnelAggregatedList> aggregatedListCallable()307 aggregatedListCallable() { 308 return stub.aggregatedListCallable(); 309 } 310 311 // AUTO-GENERATED DOCUMENTATION AND METHOD. 312 /** 313 * Deletes the specified VpnTunnel resource. 314 * 315 * <p>Sample code: 316 * 317 * <pre>{@code 318 * // This snippet has been automatically generated and should be regarded as a code template only. 319 * // It will require modifications to work: 320 * // - It may require correct/in-range values for request initialization. 321 * // - It may require specifying regional endpoints when creating the service client as shown in 322 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 323 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 324 * String project = "project-309310695"; 325 * String region = "region-934795532"; 326 * String vpnTunnel = "vpnTunnel452443772"; 327 * Operation response = vpnTunnelsClient.deleteAsync(project, region, vpnTunnel).get(); 328 * } 329 * }</pre> 330 * 331 * @param project Project ID for this request. 332 * @param region Name of the region for this request. 333 * @param vpnTunnel Name of the VpnTunnel resource to delete. 334 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 335 */ deleteAsync( String project, String region, String vpnTunnel)336 public final OperationFuture<Operation, Operation> deleteAsync( 337 String project, String region, String vpnTunnel) { 338 DeleteVpnTunnelRequest request = 339 DeleteVpnTunnelRequest.newBuilder() 340 .setProject(project) 341 .setRegion(region) 342 .setVpnTunnel(vpnTunnel) 343 .build(); 344 return deleteAsync(request); 345 } 346 347 // AUTO-GENERATED DOCUMENTATION AND METHOD. 348 /** 349 * Deletes the specified VpnTunnel resource. 350 * 351 * <p>Sample code: 352 * 353 * <pre>{@code 354 * // This snippet has been automatically generated and should be regarded as a code template only. 355 * // It will require modifications to work: 356 * // - It may require correct/in-range values for request initialization. 357 * // - It may require specifying regional endpoints when creating the service client as shown in 358 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 359 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 360 * DeleteVpnTunnelRequest request = 361 * DeleteVpnTunnelRequest.newBuilder() 362 * .setProject("project-309310695") 363 * .setRegion("region-934795532") 364 * .setRequestId("requestId693933066") 365 * .setVpnTunnel("vpnTunnel452443772") 366 * .build(); 367 * Operation response = vpnTunnelsClient.deleteAsync(request).get(); 368 * } 369 * }</pre> 370 * 371 * @param request The request object containing all of the parameters for the API call. 372 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 373 */ 374 @BetaApi( 375 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync(DeleteVpnTunnelRequest request)376 public final OperationFuture<Operation, Operation> deleteAsync(DeleteVpnTunnelRequest request) { 377 return deleteOperationCallable().futureCall(request); 378 } 379 380 // AUTO-GENERATED DOCUMENTATION AND METHOD. 381 /** 382 * Deletes the specified VpnTunnel resource. 383 * 384 * <p>Sample code: 385 * 386 * <pre>{@code 387 * // This snippet has been automatically generated and should be regarded as a code template only. 388 * // It will require modifications to work: 389 * // - It may require correct/in-range values for request initialization. 390 * // - It may require specifying regional endpoints when creating the service client as shown in 391 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 392 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 393 * DeleteVpnTunnelRequest request = 394 * DeleteVpnTunnelRequest.newBuilder() 395 * .setProject("project-309310695") 396 * .setRegion("region-934795532") 397 * .setRequestId("requestId693933066") 398 * .setVpnTunnel("vpnTunnel452443772") 399 * .build(); 400 * OperationFuture<Operation, Operation> future = 401 * vpnTunnelsClient.deleteOperationCallable().futureCall(request); 402 * // Do something. 403 * Operation response = future.get(); 404 * } 405 * }</pre> 406 */ 407 public final OperationCallable<DeleteVpnTunnelRequest, Operation, Operation> deleteOperationCallable()408 deleteOperationCallable() { 409 return stub.deleteOperationCallable(); 410 } 411 412 // AUTO-GENERATED DOCUMENTATION AND METHOD. 413 /** 414 * Deletes the specified VpnTunnel resource. 415 * 416 * <p>Sample code: 417 * 418 * <pre>{@code 419 * // This snippet has been automatically generated and should be regarded as a code template only. 420 * // It will require modifications to work: 421 * // - It may require correct/in-range values for request initialization. 422 * // - It may require specifying regional endpoints when creating the service client as shown in 423 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 424 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 425 * DeleteVpnTunnelRequest request = 426 * DeleteVpnTunnelRequest.newBuilder() 427 * .setProject("project-309310695") 428 * .setRegion("region-934795532") 429 * .setRequestId("requestId693933066") 430 * .setVpnTunnel("vpnTunnel452443772") 431 * .build(); 432 * ApiFuture<Operation> future = vpnTunnelsClient.deleteCallable().futureCall(request); 433 * // Do something. 434 * Operation response = future.get(); 435 * } 436 * }</pre> 437 */ deleteCallable()438 public final UnaryCallable<DeleteVpnTunnelRequest, Operation> deleteCallable() { 439 return stub.deleteCallable(); 440 } 441 442 // AUTO-GENERATED DOCUMENTATION AND METHOD. 443 /** 444 * Returns the specified VpnTunnel resource. 445 * 446 * <p>Sample code: 447 * 448 * <pre>{@code 449 * // This snippet has been automatically generated and should be regarded as a code template only. 450 * // It will require modifications to work: 451 * // - It may require correct/in-range values for request initialization. 452 * // - It may require specifying regional endpoints when creating the service client as shown in 453 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 454 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 455 * String project = "project-309310695"; 456 * String region = "region-934795532"; 457 * String vpnTunnel = "vpnTunnel452443772"; 458 * VpnTunnel response = vpnTunnelsClient.get(project, region, vpnTunnel); 459 * } 460 * }</pre> 461 * 462 * @param project Project ID for this request. 463 * @param region Name of the region for this request. 464 * @param vpnTunnel Name of the VpnTunnel resource to return. 465 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 466 */ get(String project, String region, String vpnTunnel)467 public final VpnTunnel get(String project, String region, String vpnTunnel) { 468 GetVpnTunnelRequest request = 469 GetVpnTunnelRequest.newBuilder() 470 .setProject(project) 471 .setRegion(region) 472 .setVpnTunnel(vpnTunnel) 473 .build(); 474 return get(request); 475 } 476 477 // AUTO-GENERATED DOCUMENTATION AND METHOD. 478 /** 479 * Returns the specified VpnTunnel resource. 480 * 481 * <p>Sample code: 482 * 483 * <pre>{@code 484 * // This snippet has been automatically generated and should be regarded as a code template only. 485 * // It will require modifications to work: 486 * // - It may require correct/in-range values for request initialization. 487 * // - It may require specifying regional endpoints when creating the service client as shown in 488 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 489 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 490 * GetVpnTunnelRequest request = 491 * GetVpnTunnelRequest.newBuilder() 492 * .setProject("project-309310695") 493 * .setRegion("region-934795532") 494 * .setVpnTunnel("vpnTunnel452443772") 495 * .build(); 496 * VpnTunnel response = vpnTunnelsClient.get(request); 497 * } 498 * }</pre> 499 * 500 * @param request The request object containing all of the parameters for the API call. 501 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 502 */ get(GetVpnTunnelRequest request)503 public final VpnTunnel get(GetVpnTunnelRequest request) { 504 return getCallable().call(request); 505 } 506 507 // AUTO-GENERATED DOCUMENTATION AND METHOD. 508 /** 509 * Returns the specified VpnTunnel resource. 510 * 511 * <p>Sample code: 512 * 513 * <pre>{@code 514 * // This snippet has been automatically generated and should be regarded as a code template only. 515 * // It will require modifications to work: 516 * // - It may require correct/in-range values for request initialization. 517 * // - It may require specifying regional endpoints when creating the service client as shown in 518 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 519 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 520 * GetVpnTunnelRequest request = 521 * GetVpnTunnelRequest.newBuilder() 522 * .setProject("project-309310695") 523 * .setRegion("region-934795532") 524 * .setVpnTunnel("vpnTunnel452443772") 525 * .build(); 526 * ApiFuture<VpnTunnel> future = vpnTunnelsClient.getCallable().futureCall(request); 527 * // Do something. 528 * VpnTunnel response = future.get(); 529 * } 530 * }</pre> 531 */ getCallable()532 public final UnaryCallable<GetVpnTunnelRequest, VpnTunnel> getCallable() { 533 return stub.getCallable(); 534 } 535 536 // AUTO-GENERATED DOCUMENTATION AND METHOD. 537 /** 538 * Creates a VpnTunnel resource in the specified project and region using the data included in the 539 * request. 540 * 541 * <p>Sample code: 542 * 543 * <pre>{@code 544 * // This snippet has been automatically generated and should be regarded as a code template only. 545 * // It will require modifications to work: 546 * // - It may require correct/in-range values for request initialization. 547 * // - It may require specifying regional endpoints when creating the service client as shown in 548 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 549 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 550 * String project = "project-309310695"; 551 * String region = "region-934795532"; 552 * VpnTunnel vpnTunnelResource = VpnTunnel.newBuilder().build(); 553 * Operation response = vpnTunnelsClient.insertAsync(project, region, vpnTunnelResource).get(); 554 * } 555 * }</pre> 556 * 557 * @param project Project ID for this request. 558 * @param region Name of the region for this request. 559 * @param vpnTunnelResource The body resource for this request 560 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 561 */ insertAsync( String project, String region, VpnTunnel vpnTunnelResource)562 public final OperationFuture<Operation, Operation> insertAsync( 563 String project, String region, VpnTunnel vpnTunnelResource) { 564 InsertVpnTunnelRequest request = 565 InsertVpnTunnelRequest.newBuilder() 566 .setProject(project) 567 .setRegion(region) 568 .setVpnTunnelResource(vpnTunnelResource) 569 .build(); 570 return insertAsync(request); 571 } 572 573 // AUTO-GENERATED DOCUMENTATION AND METHOD. 574 /** 575 * Creates a VpnTunnel resource in the specified project and region using the data included in the 576 * request. 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 (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 587 * InsertVpnTunnelRequest request = 588 * InsertVpnTunnelRequest.newBuilder() 589 * .setProject("project-309310695") 590 * .setRegion("region-934795532") 591 * .setRequestId("requestId693933066") 592 * .setVpnTunnelResource(VpnTunnel.newBuilder().build()) 593 * .build(); 594 * Operation response = vpnTunnelsClient.insertAsync(request).get(); 595 * } 596 * }</pre> 597 * 598 * @param request The request object containing all of the parameters for the API call. 599 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 600 */ 601 @BetaApi( 602 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync(InsertVpnTunnelRequest request)603 public final OperationFuture<Operation, Operation> insertAsync(InsertVpnTunnelRequest request) { 604 return insertOperationCallable().futureCall(request); 605 } 606 607 // AUTO-GENERATED DOCUMENTATION AND METHOD. 608 /** 609 * Creates a VpnTunnel resource in the specified project and region using the data included in the 610 * request. 611 * 612 * <p>Sample code: 613 * 614 * <pre>{@code 615 * // This snippet has been automatically generated and should be regarded as a code template only. 616 * // It will require modifications to work: 617 * // - It may require correct/in-range values for request initialization. 618 * // - It may require specifying regional endpoints when creating the service client as shown in 619 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 620 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 621 * InsertVpnTunnelRequest request = 622 * InsertVpnTunnelRequest.newBuilder() 623 * .setProject("project-309310695") 624 * .setRegion("region-934795532") 625 * .setRequestId("requestId693933066") 626 * .setVpnTunnelResource(VpnTunnel.newBuilder().build()) 627 * .build(); 628 * OperationFuture<Operation, Operation> future = 629 * vpnTunnelsClient.insertOperationCallable().futureCall(request); 630 * // Do something. 631 * Operation response = future.get(); 632 * } 633 * }</pre> 634 */ 635 public final OperationCallable<InsertVpnTunnelRequest, Operation, Operation> insertOperationCallable()636 insertOperationCallable() { 637 return stub.insertOperationCallable(); 638 } 639 640 // AUTO-GENERATED DOCUMENTATION AND METHOD. 641 /** 642 * Creates a VpnTunnel resource in the specified project and region using the data included in the 643 * request. 644 * 645 * <p>Sample code: 646 * 647 * <pre>{@code 648 * // This snippet has been automatically generated and should be regarded as a code template only. 649 * // It will require modifications to work: 650 * // - It may require correct/in-range values for request initialization. 651 * // - It may require specifying regional endpoints when creating the service client as shown in 652 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 653 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 654 * InsertVpnTunnelRequest request = 655 * InsertVpnTunnelRequest.newBuilder() 656 * .setProject("project-309310695") 657 * .setRegion("region-934795532") 658 * .setRequestId("requestId693933066") 659 * .setVpnTunnelResource(VpnTunnel.newBuilder().build()) 660 * .build(); 661 * ApiFuture<Operation> future = vpnTunnelsClient.insertCallable().futureCall(request); 662 * // Do something. 663 * Operation response = future.get(); 664 * } 665 * }</pre> 666 */ insertCallable()667 public final UnaryCallable<InsertVpnTunnelRequest, Operation> insertCallable() { 668 return stub.insertCallable(); 669 } 670 671 // AUTO-GENERATED DOCUMENTATION AND METHOD. 672 /** 673 * Retrieves a list of VpnTunnel resources contained in the specified project and region. 674 * 675 * <p>Sample code: 676 * 677 * <pre>{@code 678 * // This snippet has been automatically generated and should be regarded as a code template only. 679 * // It will require modifications to work: 680 * // - It may require correct/in-range values for request initialization. 681 * // - It may require specifying regional endpoints when creating the service client as shown in 682 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 683 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 684 * String project = "project-309310695"; 685 * String region = "region-934795532"; 686 * for (VpnTunnel element : vpnTunnelsClient.list(project, region).iterateAll()) { 687 * // doThingsWith(element); 688 * } 689 * } 690 * }</pre> 691 * 692 * @param project Project ID for this request. 693 * @param region Name of the region for this request. 694 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 695 */ list(String project, String region)696 public final ListPagedResponse list(String project, String region) { 697 ListVpnTunnelsRequest request = 698 ListVpnTunnelsRequest.newBuilder().setProject(project).setRegion(region).build(); 699 return list(request); 700 } 701 702 // AUTO-GENERATED DOCUMENTATION AND METHOD. 703 /** 704 * Retrieves a list of VpnTunnel resources contained in the specified project and region. 705 * 706 * <p>Sample code: 707 * 708 * <pre>{@code 709 * // This snippet has been automatically generated and should be regarded as a code template only. 710 * // It will require modifications to work: 711 * // - It may require correct/in-range values for request initialization. 712 * // - It may require specifying regional endpoints when creating the service client as shown in 713 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 714 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 715 * ListVpnTunnelsRequest request = 716 * ListVpnTunnelsRequest.newBuilder() 717 * .setFilter("filter-1274492040") 718 * .setMaxResults(1128457243) 719 * .setOrderBy("orderBy-1207110587") 720 * .setPageToken("pageToken873572522") 721 * .setProject("project-309310695") 722 * .setRegion("region-934795532") 723 * .setReturnPartialSuccess(true) 724 * .build(); 725 * for (VpnTunnel element : vpnTunnelsClient.list(request).iterateAll()) { 726 * // doThingsWith(element); 727 * } 728 * } 729 * }</pre> 730 * 731 * @param request The request object containing all of the parameters for the API call. 732 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 733 */ list(ListVpnTunnelsRequest request)734 public final ListPagedResponse list(ListVpnTunnelsRequest request) { 735 return listPagedCallable().call(request); 736 } 737 738 // AUTO-GENERATED DOCUMENTATION AND METHOD. 739 /** 740 * Retrieves a list of VpnTunnel resources contained in the specified project and region. 741 * 742 * <p>Sample code: 743 * 744 * <pre>{@code 745 * // This snippet has been automatically generated and should be regarded as a code template only. 746 * // It will require modifications to work: 747 * // - It may require correct/in-range values for request initialization. 748 * // - It may require specifying regional endpoints when creating the service client as shown in 749 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 750 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 751 * ListVpnTunnelsRequest request = 752 * ListVpnTunnelsRequest.newBuilder() 753 * .setFilter("filter-1274492040") 754 * .setMaxResults(1128457243) 755 * .setOrderBy("orderBy-1207110587") 756 * .setPageToken("pageToken873572522") 757 * .setProject("project-309310695") 758 * .setRegion("region-934795532") 759 * .setReturnPartialSuccess(true) 760 * .build(); 761 * ApiFuture<VpnTunnel> future = vpnTunnelsClient.listPagedCallable().futureCall(request); 762 * // Do something. 763 * for (VpnTunnel element : future.get().iterateAll()) { 764 * // doThingsWith(element); 765 * } 766 * } 767 * }</pre> 768 */ listPagedCallable()769 public final UnaryCallable<ListVpnTunnelsRequest, ListPagedResponse> listPagedCallable() { 770 return stub.listPagedCallable(); 771 } 772 773 // AUTO-GENERATED DOCUMENTATION AND METHOD. 774 /** 775 * Retrieves a list of VpnTunnel resources contained in the specified project and region. 776 * 777 * <p>Sample code: 778 * 779 * <pre>{@code 780 * // This snippet has been automatically generated and should be regarded as a code template only. 781 * // It will require modifications to work: 782 * // - It may require correct/in-range values for request initialization. 783 * // - It may require specifying regional endpoints when creating the service client as shown in 784 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 785 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 786 * ListVpnTunnelsRequest request = 787 * ListVpnTunnelsRequest.newBuilder() 788 * .setFilter("filter-1274492040") 789 * .setMaxResults(1128457243) 790 * .setOrderBy("orderBy-1207110587") 791 * .setPageToken("pageToken873572522") 792 * .setProject("project-309310695") 793 * .setRegion("region-934795532") 794 * .setReturnPartialSuccess(true) 795 * .build(); 796 * while (true) { 797 * VpnTunnelList response = vpnTunnelsClient.listCallable().call(request); 798 * for (VpnTunnel element : response.getItemsList()) { 799 * // doThingsWith(element); 800 * } 801 * String nextPageToken = response.getNextPageToken(); 802 * if (!Strings.isNullOrEmpty(nextPageToken)) { 803 * request = request.toBuilder().setPageToken(nextPageToken).build(); 804 * } else { 805 * break; 806 * } 807 * } 808 * } 809 * }</pre> 810 */ listCallable()811 public final UnaryCallable<ListVpnTunnelsRequest, VpnTunnelList> listCallable() { 812 return stub.listCallable(); 813 } 814 815 // AUTO-GENERATED DOCUMENTATION AND METHOD. 816 /** 817 * Sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources 818 * documentation. 819 * 820 * <p>Sample code: 821 * 822 * <pre>{@code 823 * // This snippet has been automatically generated and should be regarded as a code template only. 824 * // It will require modifications to work: 825 * // - It may require correct/in-range values for request initialization. 826 * // - It may require specifying regional endpoints when creating the service client as shown in 827 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 828 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 829 * String project = "project-309310695"; 830 * String region = "region-934795532"; 831 * String resource = "resource-341064690"; 832 * RegionSetLabelsRequest regionSetLabelsRequestResource = 833 * RegionSetLabelsRequest.newBuilder().build(); 834 * Operation response = 835 * vpnTunnelsClient 836 * .setLabelsAsync(project, region, resource, regionSetLabelsRequestResource) 837 * .get(); 838 * } 839 * }</pre> 840 * 841 * @param project Project ID for this request. 842 * @param region The region for this request. 843 * @param resource Name or id of the resource for this request. 844 * @param regionSetLabelsRequestResource The body resource for this request 845 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 846 */ setLabelsAsync( String project, String region, String resource, RegionSetLabelsRequest regionSetLabelsRequestResource)847 public final OperationFuture<Operation, Operation> setLabelsAsync( 848 String project, 849 String region, 850 String resource, 851 RegionSetLabelsRequest regionSetLabelsRequestResource) { 852 SetLabelsVpnTunnelRequest request = 853 SetLabelsVpnTunnelRequest.newBuilder() 854 .setProject(project) 855 .setRegion(region) 856 .setResource(resource) 857 .setRegionSetLabelsRequestResource(regionSetLabelsRequestResource) 858 .build(); 859 return setLabelsAsync(request); 860 } 861 862 // AUTO-GENERATED DOCUMENTATION AND METHOD. 863 /** 864 * Sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources 865 * documentation. 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 (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 876 * SetLabelsVpnTunnelRequest request = 877 * SetLabelsVpnTunnelRequest.newBuilder() 878 * .setProject("project-309310695") 879 * .setRegion("region-934795532") 880 * .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build()) 881 * .setRequestId("requestId693933066") 882 * .setResource("resource-341064690") 883 * .build(); 884 * Operation response = vpnTunnelsClient.setLabelsAsync(request).get(); 885 * } 886 * }</pre> 887 * 888 * @param request The request object containing all of the parameters for the API call. 889 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 890 */ 891 @BetaApi( 892 "The surface for long-running operations is not stable yet and may change in the future.") setLabelsAsync( SetLabelsVpnTunnelRequest request)893 public final OperationFuture<Operation, Operation> setLabelsAsync( 894 SetLabelsVpnTunnelRequest request) { 895 return setLabelsOperationCallable().futureCall(request); 896 } 897 898 // AUTO-GENERATED DOCUMENTATION AND METHOD. 899 /** 900 * Sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources 901 * documentation. 902 * 903 * <p>Sample code: 904 * 905 * <pre>{@code 906 * // This snippet has been automatically generated and should be regarded as a code template only. 907 * // It will require modifications to work: 908 * // - It may require correct/in-range values for request initialization. 909 * // - It may require specifying regional endpoints when creating the service client as shown in 910 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 911 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 912 * SetLabelsVpnTunnelRequest request = 913 * SetLabelsVpnTunnelRequest.newBuilder() 914 * .setProject("project-309310695") 915 * .setRegion("region-934795532") 916 * .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build()) 917 * .setRequestId("requestId693933066") 918 * .setResource("resource-341064690") 919 * .build(); 920 * OperationFuture<Operation, Operation> future = 921 * vpnTunnelsClient.setLabelsOperationCallable().futureCall(request); 922 * // Do something. 923 * Operation response = future.get(); 924 * } 925 * }</pre> 926 */ 927 public final OperationCallable<SetLabelsVpnTunnelRequest, Operation, Operation> setLabelsOperationCallable()928 setLabelsOperationCallable() { 929 return stub.setLabelsOperationCallable(); 930 } 931 932 // AUTO-GENERATED DOCUMENTATION AND METHOD. 933 /** 934 * Sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources 935 * documentation. 936 * 937 * <p>Sample code: 938 * 939 * <pre>{@code 940 * // This snippet has been automatically generated and should be regarded as a code template only. 941 * // It will require modifications to work: 942 * // - It may require correct/in-range values for request initialization. 943 * // - It may require specifying regional endpoints when creating the service client as shown in 944 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 945 * try (VpnTunnelsClient vpnTunnelsClient = VpnTunnelsClient.create()) { 946 * SetLabelsVpnTunnelRequest request = 947 * SetLabelsVpnTunnelRequest.newBuilder() 948 * .setProject("project-309310695") 949 * .setRegion("region-934795532") 950 * .setRegionSetLabelsRequestResource(RegionSetLabelsRequest.newBuilder().build()) 951 * .setRequestId("requestId693933066") 952 * .setResource("resource-341064690") 953 * .build(); 954 * ApiFuture<Operation> future = vpnTunnelsClient.setLabelsCallable().futureCall(request); 955 * // Do something. 956 * Operation response = future.get(); 957 * } 958 * }</pre> 959 */ setLabelsCallable()960 public final UnaryCallable<SetLabelsVpnTunnelRequest, Operation> setLabelsCallable() { 961 return stub.setLabelsCallable(); 962 } 963 964 @Override close()965 public final void close() { 966 stub.close(); 967 } 968 969 @Override shutdown()970 public void shutdown() { 971 stub.shutdown(); 972 } 973 974 @Override isShutdown()975 public boolean isShutdown() { 976 return stub.isShutdown(); 977 } 978 979 @Override isTerminated()980 public boolean isTerminated() { 981 return stub.isTerminated(); 982 } 983 984 @Override shutdownNow()985 public void shutdownNow() { 986 stub.shutdownNow(); 987 } 988 989 @Override awaitTermination(long duration, TimeUnit unit)990 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 991 return stub.awaitTermination(duration, unit); 992 } 993 994 public static class AggregatedListPagedResponse 995 extends AbstractPagedListResponse< 996 AggregatedListVpnTunnelsRequest, 997 VpnTunnelAggregatedList, 998 Map.Entry<String, VpnTunnelsScopedList>, 999 AggregatedListPage, 1000 AggregatedListFixedSizeCollection> { 1001 createAsync( PageContext< AggregatedListVpnTunnelsRequest, VpnTunnelAggregatedList, Map.Entry<String, VpnTunnelsScopedList>> context, ApiFuture<VpnTunnelAggregatedList> futureResponse)1002 public static ApiFuture<AggregatedListPagedResponse> createAsync( 1003 PageContext< 1004 AggregatedListVpnTunnelsRequest, 1005 VpnTunnelAggregatedList, 1006 Map.Entry<String, VpnTunnelsScopedList>> 1007 context, 1008 ApiFuture<VpnTunnelAggregatedList> futureResponse) { 1009 ApiFuture<AggregatedListPage> futurePage = 1010 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 1011 return ApiFutures.transform( 1012 futurePage, 1013 input -> new AggregatedListPagedResponse(input), 1014 MoreExecutors.directExecutor()); 1015 } 1016 AggregatedListPagedResponse(AggregatedListPage page)1017 private AggregatedListPagedResponse(AggregatedListPage page) { 1018 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 1019 } 1020 } 1021 1022 public static class AggregatedListPage 1023 extends AbstractPage< 1024 AggregatedListVpnTunnelsRequest, 1025 VpnTunnelAggregatedList, 1026 Map.Entry<String, VpnTunnelsScopedList>, 1027 AggregatedListPage> { 1028 AggregatedListPage( PageContext< AggregatedListVpnTunnelsRequest, VpnTunnelAggregatedList, Map.Entry<String, VpnTunnelsScopedList>> context, VpnTunnelAggregatedList response)1029 private AggregatedListPage( 1030 PageContext< 1031 AggregatedListVpnTunnelsRequest, 1032 VpnTunnelAggregatedList, 1033 Map.Entry<String, VpnTunnelsScopedList>> 1034 context, 1035 VpnTunnelAggregatedList response) { 1036 super(context, response); 1037 } 1038 createEmptyPage()1039 private static AggregatedListPage createEmptyPage() { 1040 return new AggregatedListPage(null, null); 1041 } 1042 1043 @Override createPage( PageContext< AggregatedListVpnTunnelsRequest, VpnTunnelAggregatedList, Map.Entry<String, VpnTunnelsScopedList>> context, VpnTunnelAggregatedList response)1044 protected AggregatedListPage createPage( 1045 PageContext< 1046 AggregatedListVpnTunnelsRequest, 1047 VpnTunnelAggregatedList, 1048 Map.Entry<String, VpnTunnelsScopedList>> 1049 context, 1050 VpnTunnelAggregatedList response) { 1051 return new AggregatedListPage(context, response); 1052 } 1053 1054 @Override createPageAsync( PageContext< AggregatedListVpnTunnelsRequest, VpnTunnelAggregatedList, Map.Entry<String, VpnTunnelsScopedList>> context, ApiFuture<VpnTunnelAggregatedList> futureResponse)1055 public ApiFuture<AggregatedListPage> createPageAsync( 1056 PageContext< 1057 AggregatedListVpnTunnelsRequest, 1058 VpnTunnelAggregatedList, 1059 Map.Entry<String, VpnTunnelsScopedList>> 1060 context, 1061 ApiFuture<VpnTunnelAggregatedList> futureResponse) { 1062 return super.createPageAsync(context, futureResponse); 1063 } 1064 } 1065 1066 public static class AggregatedListFixedSizeCollection 1067 extends AbstractFixedSizeCollection< 1068 AggregatedListVpnTunnelsRequest, 1069 VpnTunnelAggregatedList, 1070 Map.Entry<String, VpnTunnelsScopedList>, 1071 AggregatedListPage, 1072 AggregatedListFixedSizeCollection> { 1073 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1074 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 1075 super(pages, collectionSize); 1076 } 1077 createEmptyCollection()1078 private static AggregatedListFixedSizeCollection createEmptyCollection() { 1079 return new AggregatedListFixedSizeCollection(null, 0); 1080 } 1081 1082 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)1083 protected AggregatedListFixedSizeCollection createCollection( 1084 List<AggregatedListPage> pages, int collectionSize) { 1085 return new AggregatedListFixedSizeCollection(pages, collectionSize); 1086 } 1087 } 1088 1089 public static class ListPagedResponse 1090 extends AbstractPagedListResponse< 1091 ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel, ListPage, ListFixedSizeCollection> { 1092 createAsync( PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, ApiFuture<VpnTunnelList> futureResponse)1093 public static ApiFuture<ListPagedResponse> createAsync( 1094 PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, 1095 ApiFuture<VpnTunnelList> futureResponse) { 1096 ApiFuture<ListPage> futurePage = 1097 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 1098 return ApiFutures.transform( 1099 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 1100 } 1101 ListPagedResponse(ListPage page)1102 private ListPagedResponse(ListPage page) { 1103 super(page, ListFixedSizeCollection.createEmptyCollection()); 1104 } 1105 } 1106 1107 public static class ListPage 1108 extends AbstractPage<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel, ListPage> { 1109 ListPage( PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, VpnTunnelList response)1110 private ListPage( 1111 PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, 1112 VpnTunnelList response) { 1113 super(context, response); 1114 } 1115 createEmptyPage()1116 private static ListPage createEmptyPage() { 1117 return new ListPage(null, null); 1118 } 1119 1120 @Override createPage( PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, VpnTunnelList response)1121 protected ListPage createPage( 1122 PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, 1123 VpnTunnelList response) { 1124 return new ListPage(context, response); 1125 } 1126 1127 @Override createPageAsync( PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, ApiFuture<VpnTunnelList> futureResponse)1128 public ApiFuture<ListPage> createPageAsync( 1129 PageContext<ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel> context, 1130 ApiFuture<VpnTunnelList> futureResponse) { 1131 return super.createPageAsync(context, futureResponse); 1132 } 1133 } 1134 1135 public static class ListFixedSizeCollection 1136 extends AbstractFixedSizeCollection< 1137 ListVpnTunnelsRequest, VpnTunnelList, VpnTunnel, ListPage, ListFixedSizeCollection> { 1138 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1139 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 1140 super(pages, collectionSize); 1141 } 1142 createEmptyCollection()1143 private static ListFixedSizeCollection createEmptyCollection() { 1144 return new ListFixedSizeCollection(null, 0); 1145 } 1146 1147 @Override createCollection(List<ListPage> pages, int collectionSize)1148 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 1149 return new ListFixedSizeCollection(pages, collectionSize); 1150 } 1151 } 1152 } 1153