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