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