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