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