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