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.PacketMirroringsStub; 31 import com.google.cloud.compute.v1.stub.PacketMirroringsStubSettings; 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 PacketMirrorings 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 (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 53 * String project = "project-309310695"; 54 * String region = "region-934795532"; 55 * String packetMirroring = "packetMirroring1405520923"; 56 * PacketMirroring response = packetMirroringsClient.get(project, region, packetMirroring); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the PacketMirroringsClient object to clean up resources 61 * such as threads. In the example above, try-with-resources is used, which automatically calls 62 * close(). 63 * 64 * <p>The surface of this class includes several types of Java methods for each of the API's 65 * methods: 66 * 67 * <ol> 68 * <li>A "flattened" method. With this type of method, the fields of the request type have been 69 * converted into function parameters. It may be the case that not all fields are available as 70 * parameters, and not every API method will have a flattened method entry point. 71 * <li>A "request object" method. This type of method only takes one parameter, a request object, 72 * which must be constructed before the call. Not every API method will have a request object 73 * method. 74 * <li>A "callable" method. This type of method takes no parameters and returns an immutable API 75 * callable object, which can be used to initiate calls to the service. 76 * </ol> 77 * 78 * <p>See the individual methods for example code. 79 * 80 * <p>Many parameters require resource names to be formatted in a particular way. To assist with 81 * these names, this class includes a format method for each type of name, and additionally a parse 82 * method to extract the individual identifiers contained within names that are returned. 83 * 84 * <p>This class can be customized by passing in a custom instance of PacketMirroringsSettings to 85 * create(). For example: 86 * 87 * <p>To customize credentials: 88 * 89 * <pre>{@code 90 * // This snippet has been automatically generated and should be regarded as a code template only. 91 * // It will require modifications to work: 92 * // - It may require correct/in-range values for request initialization. 93 * // - It may require specifying regional endpoints when creating the service client as shown in 94 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 95 * PacketMirroringsSettings packetMirroringsSettings = 96 * PacketMirroringsSettings.newBuilder() 97 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 98 * .build(); 99 * PacketMirroringsClient packetMirroringsClient = 100 * PacketMirroringsClient.create(packetMirroringsSettings); 101 * }</pre> 102 * 103 * <p>To customize the endpoint: 104 * 105 * <pre>{@code 106 * // This snippet has been automatically generated and should be regarded as a code template only. 107 * // It will require modifications to work: 108 * // - It may require correct/in-range values for request initialization. 109 * // - It may require specifying regional endpoints when creating the service client as shown in 110 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 111 * PacketMirroringsSettings packetMirroringsSettings = 112 * PacketMirroringsSettings.newBuilder().setEndpoint(myEndpoint).build(); 113 * PacketMirroringsClient packetMirroringsClient = 114 * PacketMirroringsClient.create(packetMirroringsSettings); 115 * }</pre> 116 * 117 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 118 */ 119 @Generated("by gapic-generator-java") 120 public class PacketMirroringsClient implements BackgroundResource { 121 private final PacketMirroringsSettings settings; 122 private final PacketMirroringsStub stub; 123 124 /** Constructs an instance of PacketMirroringsClient with default settings. */ create()125 public static final PacketMirroringsClient create() throws IOException { 126 return create(PacketMirroringsSettings.newBuilder().build()); 127 } 128 129 /** 130 * Constructs an instance of PacketMirroringsClient, using the given settings. The channels are 131 * created based on the settings passed in, or defaults for any settings that are not set. 132 */ create(PacketMirroringsSettings settings)133 public static final PacketMirroringsClient create(PacketMirroringsSettings settings) 134 throws IOException { 135 return new PacketMirroringsClient(settings); 136 } 137 138 /** 139 * Constructs an instance of PacketMirroringsClient, using the given stub for making calls. This 140 * is for advanced usage - prefer using create(PacketMirroringsSettings). 141 */ create(PacketMirroringsStub stub)142 public static final PacketMirroringsClient create(PacketMirroringsStub stub) { 143 return new PacketMirroringsClient(stub); 144 } 145 146 /** 147 * Constructs an instance of PacketMirroringsClient, using the given settings. This is protected 148 * so that it is easy to make a subclass, but otherwise, the static factory methods should be 149 * preferred. 150 */ PacketMirroringsClient(PacketMirroringsSettings settings)151 protected PacketMirroringsClient(PacketMirroringsSettings settings) throws IOException { 152 this.settings = settings; 153 this.stub = ((PacketMirroringsStubSettings) settings.getStubSettings()).createStub(); 154 } 155 PacketMirroringsClient(PacketMirroringsStub stub)156 protected PacketMirroringsClient(PacketMirroringsStub stub) { 157 this.settings = null; 158 this.stub = stub; 159 } 160 getSettings()161 public final PacketMirroringsSettings getSettings() { 162 return settings; 163 } 164 getStub()165 public PacketMirroringsStub getStub() { 166 return stub; 167 } 168 169 // AUTO-GENERATED DOCUMENTATION AND METHOD. 170 /** 171 * Retrieves an aggregated list of packetMirrorings. 172 * 173 * <p>Sample code: 174 * 175 * <pre>{@code 176 * // This snippet has been automatically generated and should be regarded as a code template only. 177 * // It will require modifications to work: 178 * // - It may require correct/in-range values for request initialization. 179 * // - It may require specifying regional endpoints when creating the service client as shown in 180 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 181 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 182 * String project = "project-309310695"; 183 * for (Map.Entry<String, PacketMirroringsScopedList> element : 184 * packetMirroringsClient.aggregatedList(project).iterateAll()) { 185 * // doThingsWith(element); 186 * } 187 * } 188 * }</pre> 189 * 190 * @param project Project ID for this request. 191 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 192 */ aggregatedList(String project)193 public final AggregatedListPagedResponse aggregatedList(String project) { 194 AggregatedListPacketMirroringsRequest request = 195 AggregatedListPacketMirroringsRequest.newBuilder().setProject(project).build(); 196 return aggregatedList(request); 197 } 198 199 // AUTO-GENERATED DOCUMENTATION AND METHOD. 200 /** 201 * Retrieves an aggregated list of packetMirrorings. 202 * 203 * <p>Sample code: 204 * 205 * <pre>{@code 206 * // This snippet has been automatically generated and should be regarded as a code template only. 207 * // It will require modifications to work: 208 * // - It may require correct/in-range values for request initialization. 209 * // - It may require specifying regional endpoints when creating the service client as shown in 210 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 211 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 212 * AggregatedListPacketMirroringsRequest request = 213 * AggregatedListPacketMirroringsRequest.newBuilder() 214 * .setFilter("filter-1274492040") 215 * .setIncludeAllScopes(true) 216 * .setMaxResults(1128457243) 217 * .setOrderBy("orderBy-1207110587") 218 * .setPageToken("pageToken873572522") 219 * .setProject("project-309310695") 220 * .setReturnPartialSuccess(true) 221 * .build(); 222 * for (Map.Entry<String, PacketMirroringsScopedList> element : 223 * packetMirroringsClient.aggregatedList(request).iterateAll()) { 224 * // doThingsWith(element); 225 * } 226 * } 227 * }</pre> 228 * 229 * @param request The request object containing all of the parameters for the API call. 230 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 231 */ aggregatedList( AggregatedListPacketMirroringsRequest request)232 public final AggregatedListPagedResponse aggregatedList( 233 AggregatedListPacketMirroringsRequest request) { 234 return aggregatedListPagedCallable().call(request); 235 } 236 237 // AUTO-GENERATED DOCUMENTATION AND METHOD. 238 /** 239 * Retrieves an aggregated list of packetMirrorings. 240 * 241 * <p>Sample code: 242 * 243 * <pre>{@code 244 * // This snippet has been automatically generated and should be regarded as a code template only. 245 * // It will require modifications to work: 246 * // - It may require correct/in-range values for request initialization. 247 * // - It may require specifying regional endpoints when creating the service client as shown in 248 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 249 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 250 * AggregatedListPacketMirroringsRequest request = 251 * AggregatedListPacketMirroringsRequest.newBuilder() 252 * .setFilter("filter-1274492040") 253 * .setIncludeAllScopes(true) 254 * .setMaxResults(1128457243) 255 * .setOrderBy("orderBy-1207110587") 256 * .setPageToken("pageToken873572522") 257 * .setProject("project-309310695") 258 * .setReturnPartialSuccess(true) 259 * .build(); 260 * ApiFuture<Map.Entry<String, PacketMirroringsScopedList>> future = 261 * packetMirroringsClient.aggregatedListPagedCallable().futureCall(request); 262 * // Do something. 263 * for (Map.Entry<String, PacketMirroringsScopedList> element : future.get().iterateAll()) { 264 * // doThingsWith(element); 265 * } 266 * } 267 * }</pre> 268 */ 269 public final UnaryCallable<AggregatedListPacketMirroringsRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()270 aggregatedListPagedCallable() { 271 return stub.aggregatedListPagedCallable(); 272 } 273 274 // AUTO-GENERATED DOCUMENTATION AND METHOD. 275 /** 276 * Retrieves an aggregated list of packetMirrorings. 277 * 278 * <p>Sample code: 279 * 280 * <pre>{@code 281 * // This snippet has been automatically generated and should be regarded as a code template only. 282 * // It will require modifications to work: 283 * // - It may require correct/in-range values for request initialization. 284 * // - It may require specifying regional endpoints when creating the service client as shown in 285 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 286 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 287 * AggregatedListPacketMirroringsRequest request = 288 * AggregatedListPacketMirroringsRequest.newBuilder() 289 * .setFilter("filter-1274492040") 290 * .setIncludeAllScopes(true) 291 * .setMaxResults(1128457243) 292 * .setOrderBy("orderBy-1207110587") 293 * .setPageToken("pageToken873572522") 294 * .setProject("project-309310695") 295 * .setReturnPartialSuccess(true) 296 * .build(); 297 * while (true) { 298 * PacketMirroringAggregatedList response = 299 * packetMirroringsClient.aggregatedListCallable().call(request); 300 * for (Map.Entry<String, PacketMirroringsScopedList> element : response.getItemsList()) { 301 * // doThingsWith(element); 302 * } 303 * String nextPageToken = response.getNextPageToken(); 304 * if (!Strings.isNullOrEmpty(nextPageToken)) { 305 * request = request.toBuilder().setPageToken(nextPageToken).build(); 306 * } else { 307 * break; 308 * } 309 * } 310 * } 311 * }</pre> 312 */ 313 public final UnaryCallable<AggregatedListPacketMirroringsRequest, PacketMirroringAggregatedList> aggregatedListCallable()314 aggregatedListCallable() { 315 return stub.aggregatedListCallable(); 316 } 317 318 // AUTO-GENERATED DOCUMENTATION AND METHOD. 319 /** 320 * Deletes the specified PacketMirroring resource. 321 * 322 * <p>Sample code: 323 * 324 * <pre>{@code 325 * // This snippet has been automatically generated and should be regarded as a code template only. 326 * // It will require modifications to work: 327 * // - It may require correct/in-range values for request initialization. 328 * // - It may require specifying regional endpoints when creating the service client as shown in 329 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 330 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 331 * String project = "project-309310695"; 332 * String region = "region-934795532"; 333 * String packetMirroring = "packetMirroring1405520923"; 334 * Operation response = 335 * packetMirroringsClient.deleteAsync(project, region, packetMirroring).get(); 336 * } 337 * }</pre> 338 * 339 * @param project Project ID for this request. 340 * @param region Name of the region for this request. 341 * @param packetMirroring Name of the PacketMirroring resource to delete. 342 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 343 */ deleteAsync( String project, String region, String packetMirroring)344 public final OperationFuture<Operation, Operation> deleteAsync( 345 String project, String region, String packetMirroring) { 346 DeletePacketMirroringRequest request = 347 DeletePacketMirroringRequest.newBuilder() 348 .setProject(project) 349 .setRegion(region) 350 .setPacketMirroring(packetMirroring) 351 .build(); 352 return deleteAsync(request); 353 } 354 355 // AUTO-GENERATED DOCUMENTATION AND METHOD. 356 /** 357 * Deletes the specified PacketMirroring resource. 358 * 359 * <p>Sample code: 360 * 361 * <pre>{@code 362 * // This snippet has been automatically generated and should be regarded as a code template only. 363 * // It will require modifications to work: 364 * // - It may require correct/in-range values for request initialization. 365 * // - It may require specifying regional endpoints when creating the service client as shown in 366 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 367 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 368 * DeletePacketMirroringRequest request = 369 * DeletePacketMirroringRequest.newBuilder() 370 * .setPacketMirroring("packetMirroring1405520923") 371 * .setProject("project-309310695") 372 * .setRegion("region-934795532") 373 * .setRequestId("requestId693933066") 374 * .build(); 375 * Operation response = packetMirroringsClient.deleteAsync(request).get(); 376 * } 377 * }</pre> 378 * 379 * @param request The request object containing all of the parameters for the API call. 380 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 381 */ 382 @BetaApi( 383 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync( DeletePacketMirroringRequest request)384 public final OperationFuture<Operation, Operation> deleteAsync( 385 DeletePacketMirroringRequest request) { 386 return deleteOperationCallable().futureCall(request); 387 } 388 389 // AUTO-GENERATED DOCUMENTATION AND METHOD. 390 /** 391 * Deletes the specified PacketMirroring resource. 392 * 393 * <p>Sample code: 394 * 395 * <pre>{@code 396 * // This snippet has been automatically generated and should be regarded as a code template only. 397 * // It will require modifications to work: 398 * // - It may require correct/in-range values for request initialization. 399 * // - It may require specifying regional endpoints when creating the service client as shown in 400 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 401 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 402 * DeletePacketMirroringRequest request = 403 * DeletePacketMirroringRequest.newBuilder() 404 * .setPacketMirroring("packetMirroring1405520923") 405 * .setProject("project-309310695") 406 * .setRegion("region-934795532") 407 * .setRequestId("requestId693933066") 408 * .build(); 409 * OperationFuture<Operation, Operation> future = 410 * packetMirroringsClient.deleteOperationCallable().futureCall(request); 411 * // Do something. 412 * Operation response = future.get(); 413 * } 414 * }</pre> 415 */ 416 public final OperationCallable<DeletePacketMirroringRequest, Operation, Operation> deleteOperationCallable()417 deleteOperationCallable() { 418 return stub.deleteOperationCallable(); 419 } 420 421 // AUTO-GENERATED DOCUMENTATION AND METHOD. 422 /** 423 * Deletes the specified PacketMirroring resource. 424 * 425 * <p>Sample code: 426 * 427 * <pre>{@code 428 * // This snippet has been automatically generated and should be regarded as a code template only. 429 * // It will require modifications to work: 430 * // - It may require correct/in-range values for request initialization. 431 * // - It may require specifying regional endpoints when creating the service client as shown in 432 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 433 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 434 * DeletePacketMirroringRequest request = 435 * DeletePacketMirroringRequest.newBuilder() 436 * .setPacketMirroring("packetMirroring1405520923") 437 * .setProject("project-309310695") 438 * .setRegion("region-934795532") 439 * .setRequestId("requestId693933066") 440 * .build(); 441 * ApiFuture<Operation> future = packetMirroringsClient.deleteCallable().futureCall(request); 442 * // Do something. 443 * Operation response = future.get(); 444 * } 445 * }</pre> 446 */ deleteCallable()447 public final UnaryCallable<DeletePacketMirroringRequest, Operation> deleteCallable() { 448 return stub.deleteCallable(); 449 } 450 451 // AUTO-GENERATED DOCUMENTATION AND METHOD. 452 /** 453 * Returns the specified PacketMirroring resource. 454 * 455 * <p>Sample code: 456 * 457 * <pre>{@code 458 * // This snippet has been automatically generated and should be regarded as a code template only. 459 * // It will require modifications to work: 460 * // - It may require correct/in-range values for request initialization. 461 * // - It may require specifying regional endpoints when creating the service client as shown in 462 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 463 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 464 * String project = "project-309310695"; 465 * String region = "region-934795532"; 466 * String packetMirroring = "packetMirroring1405520923"; 467 * PacketMirroring response = packetMirroringsClient.get(project, region, packetMirroring); 468 * } 469 * }</pre> 470 * 471 * @param project Project ID for this request. 472 * @param region Name of the region for this request. 473 * @param packetMirroring Name of the PacketMirroring resource to return. 474 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 475 */ get(String project, String region, String packetMirroring)476 public final PacketMirroring get(String project, String region, String packetMirroring) { 477 GetPacketMirroringRequest request = 478 GetPacketMirroringRequest.newBuilder() 479 .setProject(project) 480 .setRegion(region) 481 .setPacketMirroring(packetMirroring) 482 .build(); 483 return get(request); 484 } 485 486 // AUTO-GENERATED DOCUMENTATION AND METHOD. 487 /** 488 * Returns the specified PacketMirroring resource. 489 * 490 * <p>Sample code: 491 * 492 * <pre>{@code 493 * // This snippet has been automatically generated and should be regarded as a code template only. 494 * // It will require modifications to work: 495 * // - It may require correct/in-range values for request initialization. 496 * // - It may require specifying regional endpoints when creating the service client as shown in 497 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 498 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 499 * GetPacketMirroringRequest request = 500 * GetPacketMirroringRequest.newBuilder() 501 * .setPacketMirroring("packetMirroring1405520923") 502 * .setProject("project-309310695") 503 * .setRegion("region-934795532") 504 * .build(); 505 * PacketMirroring response = packetMirroringsClient.get(request); 506 * } 507 * }</pre> 508 * 509 * @param request The request object containing all of the parameters for the API call. 510 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 511 */ get(GetPacketMirroringRequest request)512 public final PacketMirroring get(GetPacketMirroringRequest request) { 513 return getCallable().call(request); 514 } 515 516 // AUTO-GENERATED DOCUMENTATION AND METHOD. 517 /** 518 * Returns the specified PacketMirroring resource. 519 * 520 * <p>Sample code: 521 * 522 * <pre>{@code 523 * // This snippet has been automatically generated and should be regarded as a code template only. 524 * // It will require modifications to work: 525 * // - It may require correct/in-range values for request initialization. 526 * // - It may require specifying regional endpoints when creating the service client as shown in 527 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 528 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 529 * GetPacketMirroringRequest request = 530 * GetPacketMirroringRequest.newBuilder() 531 * .setPacketMirroring("packetMirroring1405520923") 532 * .setProject("project-309310695") 533 * .setRegion("region-934795532") 534 * .build(); 535 * ApiFuture<PacketMirroring> future = packetMirroringsClient.getCallable().futureCall(request); 536 * // Do something. 537 * PacketMirroring response = future.get(); 538 * } 539 * }</pre> 540 */ getCallable()541 public final UnaryCallable<GetPacketMirroringRequest, PacketMirroring> getCallable() { 542 return stub.getCallable(); 543 } 544 545 // AUTO-GENERATED DOCUMENTATION AND METHOD. 546 /** 547 * Creates a PacketMirroring resource in the specified project and region using the data included 548 * in the request. 549 * 550 * <p>Sample code: 551 * 552 * <pre>{@code 553 * // This snippet has been automatically generated and should be regarded as a code template only. 554 * // It will require modifications to work: 555 * // - It may require correct/in-range values for request initialization. 556 * // - It may require specifying regional endpoints when creating the service client as shown in 557 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 558 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 559 * String project = "project-309310695"; 560 * String region = "region-934795532"; 561 * PacketMirroring packetMirroringResource = PacketMirroring.newBuilder().build(); 562 * Operation response = 563 * packetMirroringsClient.insertAsync(project, region, packetMirroringResource).get(); 564 * } 565 * }</pre> 566 * 567 * @param project Project ID for this request. 568 * @param region Name of the region for this request. 569 * @param packetMirroringResource The body resource for this request 570 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 571 */ insertAsync( String project, String region, PacketMirroring packetMirroringResource)572 public final OperationFuture<Operation, Operation> insertAsync( 573 String project, String region, PacketMirroring packetMirroringResource) { 574 InsertPacketMirroringRequest request = 575 InsertPacketMirroringRequest.newBuilder() 576 .setProject(project) 577 .setRegion(region) 578 .setPacketMirroringResource(packetMirroringResource) 579 .build(); 580 return insertAsync(request); 581 } 582 583 // AUTO-GENERATED DOCUMENTATION AND METHOD. 584 /** 585 * Creates a PacketMirroring resource in the specified project and region using the data included 586 * in the request. 587 * 588 * <p>Sample code: 589 * 590 * <pre>{@code 591 * // This snippet has been automatically generated and should be regarded as a code template only. 592 * // It will require modifications to work: 593 * // - It may require correct/in-range values for request initialization. 594 * // - It may require specifying regional endpoints when creating the service client as shown in 595 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 596 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 597 * InsertPacketMirroringRequest request = 598 * InsertPacketMirroringRequest.newBuilder() 599 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 600 * .setProject("project-309310695") 601 * .setRegion("region-934795532") 602 * .setRequestId("requestId693933066") 603 * .build(); 604 * Operation response = packetMirroringsClient.insertAsync(request).get(); 605 * } 606 * }</pre> 607 * 608 * @param request The request object containing all of the parameters for the API call. 609 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 610 */ 611 @BetaApi( 612 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync( InsertPacketMirroringRequest request)613 public final OperationFuture<Operation, Operation> insertAsync( 614 InsertPacketMirroringRequest request) { 615 return insertOperationCallable().futureCall(request); 616 } 617 618 // AUTO-GENERATED DOCUMENTATION AND METHOD. 619 /** 620 * Creates a PacketMirroring resource in the specified project and region using the data included 621 * in the request. 622 * 623 * <p>Sample code: 624 * 625 * <pre>{@code 626 * // This snippet has been automatically generated and should be regarded as a code template only. 627 * // It will require modifications to work: 628 * // - It may require correct/in-range values for request initialization. 629 * // - It may require specifying regional endpoints when creating the service client as shown in 630 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 631 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 632 * InsertPacketMirroringRequest request = 633 * InsertPacketMirroringRequest.newBuilder() 634 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 635 * .setProject("project-309310695") 636 * .setRegion("region-934795532") 637 * .setRequestId("requestId693933066") 638 * .build(); 639 * OperationFuture<Operation, Operation> future = 640 * packetMirroringsClient.insertOperationCallable().futureCall(request); 641 * // Do something. 642 * Operation response = future.get(); 643 * } 644 * }</pre> 645 */ 646 public final OperationCallable<InsertPacketMirroringRequest, Operation, Operation> insertOperationCallable()647 insertOperationCallable() { 648 return stub.insertOperationCallable(); 649 } 650 651 // AUTO-GENERATED DOCUMENTATION AND METHOD. 652 /** 653 * Creates a PacketMirroring resource in the specified project and region using the data included 654 * in the request. 655 * 656 * <p>Sample code: 657 * 658 * <pre>{@code 659 * // This snippet has been automatically generated and should be regarded as a code template only. 660 * // It will require modifications to work: 661 * // - It may require correct/in-range values for request initialization. 662 * // - It may require specifying regional endpoints when creating the service client as shown in 663 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 664 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 665 * InsertPacketMirroringRequest request = 666 * InsertPacketMirroringRequest.newBuilder() 667 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 668 * .setProject("project-309310695") 669 * .setRegion("region-934795532") 670 * .setRequestId("requestId693933066") 671 * .build(); 672 * ApiFuture<Operation> future = packetMirroringsClient.insertCallable().futureCall(request); 673 * // Do something. 674 * Operation response = future.get(); 675 * } 676 * }</pre> 677 */ insertCallable()678 public final UnaryCallable<InsertPacketMirroringRequest, Operation> insertCallable() { 679 return stub.insertCallable(); 680 } 681 682 // AUTO-GENERATED DOCUMENTATION AND METHOD. 683 /** 684 * Retrieves a list of PacketMirroring resources available to the specified project and region. 685 * 686 * <p>Sample code: 687 * 688 * <pre>{@code 689 * // This snippet has been automatically generated and should be regarded as a code template only. 690 * // It will require modifications to work: 691 * // - It may require correct/in-range values for request initialization. 692 * // - It may require specifying regional endpoints when creating the service client as shown in 693 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 694 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 695 * String project = "project-309310695"; 696 * String region = "region-934795532"; 697 * for (PacketMirroring element : packetMirroringsClient.list(project, region).iterateAll()) { 698 * // doThingsWith(element); 699 * } 700 * } 701 * }</pre> 702 * 703 * @param project Project ID for this request. 704 * @param region Name of the region for this request. 705 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 706 */ list(String project, String region)707 public final ListPagedResponse list(String project, String region) { 708 ListPacketMirroringsRequest request = 709 ListPacketMirroringsRequest.newBuilder().setProject(project).setRegion(region).build(); 710 return list(request); 711 } 712 713 // AUTO-GENERATED DOCUMENTATION AND METHOD. 714 /** 715 * Retrieves a list of PacketMirroring resources available to the specified project and region. 716 * 717 * <p>Sample code: 718 * 719 * <pre>{@code 720 * // This snippet has been automatically generated and should be regarded as a code template only. 721 * // It will require modifications to work: 722 * // - It may require correct/in-range values for request initialization. 723 * // - It may require specifying regional endpoints when creating the service client as shown in 724 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 725 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 726 * ListPacketMirroringsRequest request = 727 * ListPacketMirroringsRequest.newBuilder() 728 * .setFilter("filter-1274492040") 729 * .setMaxResults(1128457243) 730 * .setOrderBy("orderBy-1207110587") 731 * .setPageToken("pageToken873572522") 732 * .setProject("project-309310695") 733 * .setRegion("region-934795532") 734 * .setReturnPartialSuccess(true) 735 * .build(); 736 * for (PacketMirroring element : packetMirroringsClient.list(request).iterateAll()) { 737 * // doThingsWith(element); 738 * } 739 * } 740 * }</pre> 741 * 742 * @param request The request object containing all of the parameters for the API call. 743 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 744 */ list(ListPacketMirroringsRequest request)745 public final ListPagedResponse list(ListPacketMirroringsRequest request) { 746 return listPagedCallable().call(request); 747 } 748 749 // AUTO-GENERATED DOCUMENTATION AND METHOD. 750 /** 751 * Retrieves a list of PacketMirroring resources available to the specified project and region. 752 * 753 * <p>Sample code: 754 * 755 * <pre>{@code 756 * // This snippet has been automatically generated and should be regarded as a code template only. 757 * // It will require modifications to work: 758 * // - It may require correct/in-range values for request initialization. 759 * // - It may require specifying regional endpoints when creating the service client as shown in 760 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 761 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 762 * ListPacketMirroringsRequest request = 763 * ListPacketMirroringsRequest.newBuilder() 764 * .setFilter("filter-1274492040") 765 * .setMaxResults(1128457243) 766 * .setOrderBy("orderBy-1207110587") 767 * .setPageToken("pageToken873572522") 768 * .setProject("project-309310695") 769 * .setRegion("region-934795532") 770 * .setReturnPartialSuccess(true) 771 * .build(); 772 * ApiFuture<PacketMirroring> future = 773 * packetMirroringsClient.listPagedCallable().futureCall(request); 774 * // Do something. 775 * for (PacketMirroring element : future.get().iterateAll()) { 776 * // doThingsWith(element); 777 * } 778 * } 779 * }</pre> 780 */ listPagedCallable()781 public final UnaryCallable<ListPacketMirroringsRequest, ListPagedResponse> listPagedCallable() { 782 return stub.listPagedCallable(); 783 } 784 785 // AUTO-GENERATED DOCUMENTATION AND METHOD. 786 /** 787 * Retrieves a list of PacketMirroring resources available to the specified project and region. 788 * 789 * <p>Sample code: 790 * 791 * <pre>{@code 792 * // This snippet has been automatically generated and should be regarded as a code template only. 793 * // It will require modifications to work: 794 * // - It may require correct/in-range values for request initialization. 795 * // - It may require specifying regional endpoints when creating the service client as shown in 796 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 797 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 798 * ListPacketMirroringsRequest request = 799 * ListPacketMirroringsRequest.newBuilder() 800 * .setFilter("filter-1274492040") 801 * .setMaxResults(1128457243) 802 * .setOrderBy("orderBy-1207110587") 803 * .setPageToken("pageToken873572522") 804 * .setProject("project-309310695") 805 * .setRegion("region-934795532") 806 * .setReturnPartialSuccess(true) 807 * .build(); 808 * while (true) { 809 * PacketMirroringList response = packetMirroringsClient.listCallable().call(request); 810 * for (PacketMirroring element : response.getItemsList()) { 811 * // doThingsWith(element); 812 * } 813 * String nextPageToken = response.getNextPageToken(); 814 * if (!Strings.isNullOrEmpty(nextPageToken)) { 815 * request = request.toBuilder().setPageToken(nextPageToken).build(); 816 * } else { 817 * break; 818 * } 819 * } 820 * } 821 * }</pre> 822 */ listCallable()823 public final UnaryCallable<ListPacketMirroringsRequest, PacketMirroringList> listCallable() { 824 return stub.listCallable(); 825 } 826 827 // AUTO-GENERATED DOCUMENTATION AND METHOD. 828 /** 829 * Patches the specified PacketMirroring resource with the data included in the request. This 830 * method supports PATCH semantics and uses JSON merge patch format and processing rules. 831 * 832 * <p>Sample code: 833 * 834 * <pre>{@code 835 * // This snippet has been automatically generated and should be regarded as a code template only. 836 * // It will require modifications to work: 837 * // - It may require correct/in-range values for request initialization. 838 * // - It may require specifying regional endpoints when creating the service client as shown in 839 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 840 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 841 * String project = "project-309310695"; 842 * String region = "region-934795532"; 843 * String packetMirroring = "packetMirroring1405520923"; 844 * PacketMirroring packetMirroringResource = PacketMirroring.newBuilder().build(); 845 * Operation response = 846 * packetMirroringsClient 847 * .patchAsync(project, region, packetMirroring, packetMirroringResource) 848 * .get(); 849 * } 850 * }</pre> 851 * 852 * @param project Project ID for this request. 853 * @param region Name of the region for this request. 854 * @param packetMirroring Name of the PacketMirroring resource to patch. 855 * @param packetMirroringResource The body resource for this request 856 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 857 */ patchAsync( String project, String region, String packetMirroring, PacketMirroring packetMirroringResource)858 public final OperationFuture<Operation, Operation> patchAsync( 859 String project, 860 String region, 861 String packetMirroring, 862 PacketMirroring packetMirroringResource) { 863 PatchPacketMirroringRequest request = 864 PatchPacketMirroringRequest.newBuilder() 865 .setProject(project) 866 .setRegion(region) 867 .setPacketMirroring(packetMirroring) 868 .setPacketMirroringResource(packetMirroringResource) 869 .build(); 870 return patchAsync(request); 871 } 872 873 // AUTO-GENERATED DOCUMENTATION AND METHOD. 874 /** 875 * Patches the specified PacketMirroring resource with the data included in the request. This 876 * method supports PATCH semantics and uses JSON merge patch format and processing rules. 877 * 878 * <p>Sample code: 879 * 880 * <pre>{@code 881 * // This snippet has been automatically generated and should be regarded as a code template only. 882 * // It will require modifications to work: 883 * // - It may require correct/in-range values for request initialization. 884 * // - It may require specifying regional endpoints when creating the service client as shown in 885 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 886 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 887 * PatchPacketMirroringRequest request = 888 * PatchPacketMirroringRequest.newBuilder() 889 * .setPacketMirroring("packetMirroring1405520923") 890 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 891 * .setProject("project-309310695") 892 * .setRegion("region-934795532") 893 * .setRequestId("requestId693933066") 894 * .build(); 895 * Operation response = packetMirroringsClient.patchAsync(request).get(); 896 * } 897 * }</pre> 898 * 899 * @param request The request object containing all of the parameters for the API call. 900 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 901 */ 902 @BetaApi( 903 "The surface for long-running operations is not stable yet and may change in the future.") patchAsync( PatchPacketMirroringRequest request)904 public final OperationFuture<Operation, Operation> patchAsync( 905 PatchPacketMirroringRequest request) { 906 return patchOperationCallable().futureCall(request); 907 } 908 909 // AUTO-GENERATED DOCUMENTATION AND METHOD. 910 /** 911 * Patches the specified PacketMirroring resource with the data included in the request. This 912 * method supports PATCH semantics and uses JSON merge patch format and processing rules. 913 * 914 * <p>Sample code: 915 * 916 * <pre>{@code 917 * // This snippet has been automatically generated and should be regarded as a code template only. 918 * // It will require modifications to work: 919 * // - It may require correct/in-range values for request initialization. 920 * // - It may require specifying regional endpoints when creating the service client as shown in 921 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 922 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 923 * PatchPacketMirroringRequest request = 924 * PatchPacketMirroringRequest.newBuilder() 925 * .setPacketMirroring("packetMirroring1405520923") 926 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 927 * .setProject("project-309310695") 928 * .setRegion("region-934795532") 929 * .setRequestId("requestId693933066") 930 * .build(); 931 * OperationFuture<Operation, Operation> future = 932 * packetMirroringsClient.patchOperationCallable().futureCall(request); 933 * // Do something. 934 * Operation response = future.get(); 935 * } 936 * }</pre> 937 */ 938 public final OperationCallable<PatchPacketMirroringRequest, Operation, Operation> patchOperationCallable()939 patchOperationCallable() { 940 return stub.patchOperationCallable(); 941 } 942 943 // AUTO-GENERATED DOCUMENTATION AND METHOD. 944 /** 945 * Patches the specified PacketMirroring resource with the data included in the request. This 946 * method supports PATCH semantics and uses JSON merge patch format and processing rules. 947 * 948 * <p>Sample code: 949 * 950 * <pre>{@code 951 * // This snippet has been automatically generated and should be regarded as a code template only. 952 * // It will require modifications to work: 953 * // - It may require correct/in-range values for request initialization. 954 * // - It may require specifying regional endpoints when creating the service client as shown in 955 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 956 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 957 * PatchPacketMirroringRequest request = 958 * PatchPacketMirroringRequest.newBuilder() 959 * .setPacketMirroring("packetMirroring1405520923") 960 * .setPacketMirroringResource(PacketMirroring.newBuilder().build()) 961 * .setProject("project-309310695") 962 * .setRegion("region-934795532") 963 * .setRequestId("requestId693933066") 964 * .build(); 965 * ApiFuture<Operation> future = packetMirroringsClient.patchCallable().futureCall(request); 966 * // Do something. 967 * Operation response = future.get(); 968 * } 969 * }</pre> 970 */ patchCallable()971 public final UnaryCallable<PatchPacketMirroringRequest, Operation> patchCallable() { 972 return stub.patchCallable(); 973 } 974 975 // AUTO-GENERATED DOCUMENTATION AND METHOD. 976 /** 977 * Returns permissions that a caller has on the specified resource. 978 * 979 * <p>Sample code: 980 * 981 * <pre>{@code 982 * // This snippet has been automatically generated and should be regarded as a code template only. 983 * // It will require modifications to work: 984 * // - It may require correct/in-range values for request initialization. 985 * // - It may require specifying regional endpoints when creating the service client as shown in 986 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 987 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 988 * String project = "project-309310695"; 989 * String region = "region-934795532"; 990 * String resource = "resource-341064690"; 991 * TestPermissionsRequest testPermissionsRequestResource = 992 * TestPermissionsRequest.newBuilder().build(); 993 * TestPermissionsResponse response = 994 * packetMirroringsClient.testIamPermissions( 995 * project, region, resource, testPermissionsRequestResource); 996 * } 997 * }</pre> 998 * 999 * @param project Project ID for this request. 1000 * @param region The name of the region for this request. 1001 * @param resource Name or id of the resource for this request. 1002 * @param testPermissionsRequestResource The body resource for this request 1003 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1004 */ testIamPermissions( String project, String region, String resource, TestPermissionsRequest testPermissionsRequestResource)1005 public final TestPermissionsResponse testIamPermissions( 1006 String project, 1007 String region, 1008 String resource, 1009 TestPermissionsRequest testPermissionsRequestResource) { 1010 TestIamPermissionsPacketMirroringRequest request = 1011 TestIamPermissionsPacketMirroringRequest.newBuilder() 1012 .setProject(project) 1013 .setRegion(region) 1014 .setResource(resource) 1015 .setTestPermissionsRequestResource(testPermissionsRequestResource) 1016 .build(); 1017 return testIamPermissions(request); 1018 } 1019 1020 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1021 /** 1022 * Returns permissions that a caller has on the specified resource. 1023 * 1024 * <p>Sample code: 1025 * 1026 * <pre>{@code 1027 * // This snippet has been automatically generated and should be regarded as a code template only. 1028 * // It will require modifications to work: 1029 * // - It may require correct/in-range values for request initialization. 1030 * // - It may require specifying regional endpoints when creating the service client as shown in 1031 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1032 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 1033 * TestIamPermissionsPacketMirroringRequest request = 1034 * TestIamPermissionsPacketMirroringRequest.newBuilder() 1035 * .setProject("project-309310695") 1036 * .setRegion("region-934795532") 1037 * .setResource("resource-341064690") 1038 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 1039 * .build(); 1040 * TestPermissionsResponse response = packetMirroringsClient.testIamPermissions(request); 1041 * } 1042 * }</pre> 1043 * 1044 * @param request The request object containing all of the parameters for the API call. 1045 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1046 */ testIamPermissions( TestIamPermissionsPacketMirroringRequest request)1047 public final TestPermissionsResponse testIamPermissions( 1048 TestIamPermissionsPacketMirroringRequest request) { 1049 return testIamPermissionsCallable().call(request); 1050 } 1051 1052 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1053 /** 1054 * Returns permissions that a caller has on the specified resource. 1055 * 1056 * <p>Sample code: 1057 * 1058 * <pre>{@code 1059 * // This snippet has been automatically generated and should be regarded as a code template only. 1060 * // It will require modifications to work: 1061 * // - It may require correct/in-range values for request initialization. 1062 * // - It may require specifying regional endpoints when creating the service client as shown in 1063 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1064 * try (PacketMirroringsClient packetMirroringsClient = PacketMirroringsClient.create()) { 1065 * TestIamPermissionsPacketMirroringRequest request = 1066 * TestIamPermissionsPacketMirroringRequest.newBuilder() 1067 * .setProject("project-309310695") 1068 * .setRegion("region-934795532") 1069 * .setResource("resource-341064690") 1070 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 1071 * .build(); 1072 * ApiFuture<TestPermissionsResponse> future = 1073 * packetMirroringsClient.testIamPermissionsCallable().futureCall(request); 1074 * // Do something. 1075 * TestPermissionsResponse response = future.get(); 1076 * } 1077 * }</pre> 1078 */ 1079 public final UnaryCallable<TestIamPermissionsPacketMirroringRequest, TestPermissionsResponse> testIamPermissionsCallable()1080 testIamPermissionsCallable() { 1081 return stub.testIamPermissionsCallable(); 1082 } 1083 1084 @Override close()1085 public final void close() { 1086 stub.close(); 1087 } 1088 1089 @Override shutdown()1090 public void shutdown() { 1091 stub.shutdown(); 1092 } 1093 1094 @Override isShutdown()1095 public boolean isShutdown() { 1096 return stub.isShutdown(); 1097 } 1098 1099 @Override isTerminated()1100 public boolean isTerminated() { 1101 return stub.isTerminated(); 1102 } 1103 1104 @Override shutdownNow()1105 public void shutdownNow() { 1106 stub.shutdownNow(); 1107 } 1108 1109 @Override awaitTermination(long duration, TimeUnit unit)1110 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 1111 return stub.awaitTermination(duration, unit); 1112 } 1113 1114 public static class AggregatedListPagedResponse 1115 extends AbstractPagedListResponse< 1116 AggregatedListPacketMirroringsRequest, 1117 PacketMirroringAggregatedList, 1118 Map.Entry<String, PacketMirroringsScopedList>, 1119 AggregatedListPage, 1120 AggregatedListFixedSizeCollection> { 1121 createAsync( PageContext< AggregatedListPacketMirroringsRequest, PacketMirroringAggregatedList, Map.Entry<String, PacketMirroringsScopedList>> context, ApiFuture<PacketMirroringAggregatedList> futureResponse)1122 public static ApiFuture<AggregatedListPagedResponse> createAsync( 1123 PageContext< 1124 AggregatedListPacketMirroringsRequest, 1125 PacketMirroringAggregatedList, 1126 Map.Entry<String, PacketMirroringsScopedList>> 1127 context, 1128 ApiFuture<PacketMirroringAggregatedList> futureResponse) { 1129 ApiFuture<AggregatedListPage> futurePage = 1130 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 1131 return ApiFutures.transform( 1132 futurePage, 1133 input -> new AggregatedListPagedResponse(input), 1134 MoreExecutors.directExecutor()); 1135 } 1136 AggregatedListPagedResponse(AggregatedListPage page)1137 private AggregatedListPagedResponse(AggregatedListPage page) { 1138 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 1139 } 1140 } 1141 1142 public static class AggregatedListPage 1143 extends AbstractPage< 1144 AggregatedListPacketMirroringsRequest, 1145 PacketMirroringAggregatedList, 1146 Map.Entry<String, PacketMirroringsScopedList>, 1147 AggregatedListPage> { 1148 AggregatedListPage( PageContext< AggregatedListPacketMirroringsRequest, PacketMirroringAggregatedList, Map.Entry<String, PacketMirroringsScopedList>> context, PacketMirroringAggregatedList response)1149 private AggregatedListPage( 1150 PageContext< 1151 AggregatedListPacketMirroringsRequest, 1152 PacketMirroringAggregatedList, 1153 Map.Entry<String, PacketMirroringsScopedList>> 1154 context, 1155 PacketMirroringAggregatedList response) { 1156 super(context, response); 1157 } 1158 createEmptyPage()1159 private static AggregatedListPage createEmptyPage() { 1160 return new AggregatedListPage(null, null); 1161 } 1162 1163 @Override createPage( PageContext< AggregatedListPacketMirroringsRequest, PacketMirroringAggregatedList, Map.Entry<String, PacketMirroringsScopedList>> context, PacketMirroringAggregatedList response)1164 protected AggregatedListPage createPage( 1165 PageContext< 1166 AggregatedListPacketMirroringsRequest, 1167 PacketMirroringAggregatedList, 1168 Map.Entry<String, PacketMirroringsScopedList>> 1169 context, 1170 PacketMirroringAggregatedList response) { 1171 return new AggregatedListPage(context, response); 1172 } 1173 1174 @Override createPageAsync( PageContext< AggregatedListPacketMirroringsRequest, PacketMirroringAggregatedList, Map.Entry<String, PacketMirroringsScopedList>> context, ApiFuture<PacketMirroringAggregatedList> futureResponse)1175 public ApiFuture<AggregatedListPage> createPageAsync( 1176 PageContext< 1177 AggregatedListPacketMirroringsRequest, 1178 PacketMirroringAggregatedList, 1179 Map.Entry<String, PacketMirroringsScopedList>> 1180 context, 1181 ApiFuture<PacketMirroringAggregatedList> futureResponse) { 1182 return super.createPageAsync(context, futureResponse); 1183 } 1184 } 1185 1186 public static class AggregatedListFixedSizeCollection 1187 extends AbstractFixedSizeCollection< 1188 AggregatedListPacketMirroringsRequest, 1189 PacketMirroringAggregatedList, 1190 Map.Entry<String, PacketMirroringsScopedList>, 1191 AggregatedListPage, 1192 AggregatedListFixedSizeCollection> { 1193 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)1194 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 1195 super(pages, collectionSize); 1196 } 1197 createEmptyCollection()1198 private static AggregatedListFixedSizeCollection createEmptyCollection() { 1199 return new AggregatedListFixedSizeCollection(null, 0); 1200 } 1201 1202 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)1203 protected AggregatedListFixedSizeCollection createCollection( 1204 List<AggregatedListPage> pages, int collectionSize) { 1205 return new AggregatedListFixedSizeCollection(pages, collectionSize); 1206 } 1207 } 1208 1209 public static class ListPagedResponse 1210 extends AbstractPagedListResponse< 1211 ListPacketMirroringsRequest, 1212 PacketMirroringList, 1213 PacketMirroring, 1214 ListPage, 1215 ListFixedSizeCollection> { 1216 createAsync( PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, ApiFuture<PacketMirroringList> futureResponse)1217 public static ApiFuture<ListPagedResponse> createAsync( 1218 PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, 1219 ApiFuture<PacketMirroringList> futureResponse) { 1220 ApiFuture<ListPage> futurePage = 1221 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 1222 return ApiFutures.transform( 1223 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 1224 } 1225 ListPagedResponse(ListPage page)1226 private ListPagedResponse(ListPage page) { 1227 super(page, ListFixedSizeCollection.createEmptyCollection()); 1228 } 1229 } 1230 1231 public static class ListPage 1232 extends AbstractPage< 1233 ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring, ListPage> { 1234 ListPage( PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, PacketMirroringList response)1235 private ListPage( 1236 PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, 1237 PacketMirroringList response) { 1238 super(context, response); 1239 } 1240 createEmptyPage()1241 private static ListPage createEmptyPage() { 1242 return new ListPage(null, null); 1243 } 1244 1245 @Override createPage( PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, PacketMirroringList response)1246 protected ListPage createPage( 1247 PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, 1248 PacketMirroringList response) { 1249 return new ListPage(context, response); 1250 } 1251 1252 @Override createPageAsync( PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, ApiFuture<PacketMirroringList> futureResponse)1253 public ApiFuture<ListPage> createPageAsync( 1254 PageContext<ListPacketMirroringsRequest, PacketMirroringList, PacketMirroring> context, 1255 ApiFuture<PacketMirroringList> futureResponse) { 1256 return super.createPageAsync(context, futureResponse); 1257 } 1258 } 1259 1260 public static class ListFixedSizeCollection 1261 extends AbstractFixedSizeCollection< 1262 ListPacketMirroringsRequest, 1263 PacketMirroringList, 1264 PacketMirroring, 1265 ListPage, 1266 ListFixedSizeCollection> { 1267 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)1268 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 1269 super(pages, collectionSize); 1270 } 1271 createEmptyCollection()1272 private static ListFixedSizeCollection createEmptyCollection() { 1273 return new ListFixedSizeCollection(null, 0); 1274 } 1275 1276 @Override createCollection(List<ListPage> pages, int collectionSize)1277 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 1278 return new ListFixedSizeCollection(pages, collectionSize); 1279 } 1280 } 1281 } 1282