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