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