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.InstancesStub; 31 import com.google.cloud.compute.v1.stub.InstancesStubSettings; 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 Instances 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 (InstancesClient instancesClient = InstancesClient.create()) { 53 * String project = "project-309310695"; 54 * String zone = "zone3744684"; 55 * String instance = "instance555127957"; 56 * Instance response = instancesClient.get(project, zone, instance); 57 * } 58 * }</pre> 59 * 60 * <p>Note: close() needs to be called on the InstancesClient object to clean up resources such as 61 * threads. In the example above, try-with-resources is used, which automatically calls 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 InstancesSettings to create(). 84 * 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 * InstancesSettings instancesSettings = 95 * InstancesSettings.newBuilder() 96 * .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) 97 * .build(); 98 * InstancesClient instancesClient = InstancesClient.create(instancesSettings); 99 * }</pre> 100 * 101 * <p>To customize the endpoint: 102 * 103 * <pre>{@code 104 * // This snippet has been automatically generated and should be regarded as a code template only. 105 * // It will require modifications to work: 106 * // - It may require correct/in-range values for request initialization. 107 * // - It may require specifying regional endpoints when creating the service client as shown in 108 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 109 * InstancesSettings instancesSettings = 110 * InstancesSettings.newBuilder().setEndpoint(myEndpoint).build(); 111 * InstancesClient instancesClient = InstancesClient.create(instancesSettings); 112 * }</pre> 113 * 114 * <p>Please refer to the GitHub repository's samples for more quickstart code snippets. 115 */ 116 @Generated("by gapic-generator-java") 117 public class InstancesClient implements BackgroundResource { 118 private final InstancesSettings settings; 119 private final InstancesStub stub; 120 121 /** Constructs an instance of InstancesClient with default settings. */ create()122 public static final InstancesClient create() throws IOException { 123 return create(InstancesSettings.newBuilder().build()); 124 } 125 126 /** 127 * Constructs an instance of InstancesClient, using the given settings. The channels are created 128 * based on the settings passed in, or defaults for any settings that are not set. 129 */ create(InstancesSettings settings)130 public static final InstancesClient create(InstancesSettings settings) throws IOException { 131 return new InstancesClient(settings); 132 } 133 134 /** 135 * Constructs an instance of InstancesClient, using the given stub for making calls. This is for 136 * advanced usage - prefer using create(InstancesSettings). 137 */ create(InstancesStub stub)138 public static final InstancesClient create(InstancesStub stub) { 139 return new InstancesClient(stub); 140 } 141 142 /** 143 * Constructs an instance of InstancesClient, using the given settings. This is protected so that 144 * it is easy to make a subclass, but otherwise, the static factory methods should be preferred. 145 */ InstancesClient(InstancesSettings settings)146 protected InstancesClient(InstancesSettings settings) throws IOException { 147 this.settings = settings; 148 this.stub = ((InstancesStubSettings) settings.getStubSettings()).createStub(); 149 } 150 InstancesClient(InstancesStub stub)151 protected InstancesClient(InstancesStub stub) { 152 this.settings = null; 153 this.stub = stub; 154 } 155 getSettings()156 public final InstancesSettings getSettings() { 157 return settings; 158 } 159 getStub()160 public InstancesStub getStub() { 161 return stub; 162 } 163 164 // AUTO-GENERATED DOCUMENTATION AND METHOD. 165 /** 166 * Adds an access config to an instance's network interface. 167 * 168 * <p>Sample code: 169 * 170 * <pre>{@code 171 * // This snippet has been automatically generated and should be regarded as a code template only. 172 * // It will require modifications to work: 173 * // - It may require correct/in-range values for request initialization. 174 * // - It may require specifying regional endpoints when creating the service client as shown in 175 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 176 * try (InstancesClient instancesClient = InstancesClient.create()) { 177 * String project = "project-309310695"; 178 * String zone = "zone3744684"; 179 * String instance = "instance555127957"; 180 * String networkInterface = "networkInterface-341981525"; 181 * AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); 182 * Operation response = 183 * instancesClient 184 * .addAccessConfigAsync(project, zone, instance, networkInterface, accessConfigResource) 185 * .get(); 186 * } 187 * }</pre> 188 * 189 * @param project Project ID for this request. 190 * @param zone The name of the zone for this request. 191 * @param instance The instance name for this request. 192 * @param networkInterface The name of the network interface to add to this instance. 193 * @param accessConfigResource The body resource for this request 194 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 195 */ addAccessConfigAsync( String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)196 public final OperationFuture<Operation, Operation> addAccessConfigAsync( 197 String project, 198 String zone, 199 String instance, 200 String networkInterface, 201 AccessConfig accessConfigResource) { 202 AddAccessConfigInstanceRequest request = 203 AddAccessConfigInstanceRequest.newBuilder() 204 .setProject(project) 205 .setZone(zone) 206 .setInstance(instance) 207 .setNetworkInterface(networkInterface) 208 .setAccessConfigResource(accessConfigResource) 209 .build(); 210 return addAccessConfigAsync(request); 211 } 212 213 // AUTO-GENERATED DOCUMENTATION AND METHOD. 214 /** 215 * Adds an access config to an instance's network interface. 216 * 217 * <p>Sample code: 218 * 219 * <pre>{@code 220 * // This snippet has been automatically generated and should be regarded as a code template only. 221 * // It will require modifications to work: 222 * // - It may require correct/in-range values for request initialization. 223 * // - It may require specifying regional endpoints when creating the service client as shown in 224 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 225 * try (InstancesClient instancesClient = InstancesClient.create()) { 226 * AddAccessConfigInstanceRequest request = 227 * AddAccessConfigInstanceRequest.newBuilder() 228 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 229 * .setInstance("instance555127957") 230 * .setNetworkInterface("networkInterface-341981525") 231 * .setProject("project-309310695") 232 * .setRequestId("requestId693933066") 233 * .setZone("zone3744684") 234 * .build(); 235 * Operation response = instancesClient.addAccessConfigAsync(request).get(); 236 * } 237 * }</pre> 238 * 239 * @param request The request object containing all of the parameters for the API call. 240 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 241 */ 242 @BetaApi( 243 "The surface for long-running operations is not stable yet and may change in the future.") addAccessConfigAsync( AddAccessConfigInstanceRequest request)244 public final OperationFuture<Operation, Operation> addAccessConfigAsync( 245 AddAccessConfigInstanceRequest request) { 246 return addAccessConfigOperationCallable().futureCall(request); 247 } 248 249 // AUTO-GENERATED DOCUMENTATION AND METHOD. 250 /** 251 * Adds an access config to an instance's network interface. 252 * 253 * <p>Sample code: 254 * 255 * <pre>{@code 256 * // This snippet has been automatically generated and should be regarded as a code template only. 257 * // It will require modifications to work: 258 * // - It may require correct/in-range values for request initialization. 259 * // - It may require specifying regional endpoints when creating the service client as shown in 260 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 261 * try (InstancesClient instancesClient = InstancesClient.create()) { 262 * AddAccessConfigInstanceRequest request = 263 * AddAccessConfigInstanceRequest.newBuilder() 264 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 265 * .setInstance("instance555127957") 266 * .setNetworkInterface("networkInterface-341981525") 267 * .setProject("project-309310695") 268 * .setRequestId("requestId693933066") 269 * .setZone("zone3744684") 270 * .build(); 271 * OperationFuture<Operation, Operation> future = 272 * instancesClient.addAccessConfigOperationCallable().futureCall(request); 273 * // Do something. 274 * Operation response = future.get(); 275 * } 276 * }</pre> 277 */ 278 public final OperationCallable<AddAccessConfigInstanceRequest, Operation, Operation> addAccessConfigOperationCallable()279 addAccessConfigOperationCallable() { 280 return stub.addAccessConfigOperationCallable(); 281 } 282 283 // AUTO-GENERATED DOCUMENTATION AND METHOD. 284 /** 285 * Adds an access config to an instance's network interface. 286 * 287 * <p>Sample code: 288 * 289 * <pre>{@code 290 * // This snippet has been automatically generated and should be regarded as a code template only. 291 * // It will require modifications to work: 292 * // - It may require correct/in-range values for request initialization. 293 * // - It may require specifying regional endpoints when creating the service client as shown in 294 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 295 * try (InstancesClient instancesClient = InstancesClient.create()) { 296 * AddAccessConfigInstanceRequest request = 297 * AddAccessConfigInstanceRequest.newBuilder() 298 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 299 * .setInstance("instance555127957") 300 * .setNetworkInterface("networkInterface-341981525") 301 * .setProject("project-309310695") 302 * .setRequestId("requestId693933066") 303 * .setZone("zone3744684") 304 * .build(); 305 * ApiFuture<Operation> future = instancesClient.addAccessConfigCallable().futureCall(request); 306 * // Do something. 307 * Operation response = future.get(); 308 * } 309 * }</pre> 310 */ addAccessConfigCallable()311 public final UnaryCallable<AddAccessConfigInstanceRequest, Operation> addAccessConfigCallable() { 312 return stub.addAccessConfigCallable(); 313 } 314 315 // AUTO-GENERATED DOCUMENTATION AND METHOD. 316 /** 317 * Adds existing resource policies to an instance. You can only add one policy right now which 318 * will be applied to this instance for scheduling live migrations. 319 * 320 * <p>Sample code: 321 * 322 * <pre>{@code 323 * // This snippet has been automatically generated and should be regarded as a code template only. 324 * // It will require modifications to work: 325 * // - It may require correct/in-range values for request initialization. 326 * // - It may require specifying regional endpoints when creating the service client as shown in 327 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 328 * try (InstancesClient instancesClient = InstancesClient.create()) { 329 * String project = "project-309310695"; 330 * String zone = "zone3744684"; 331 * String instance = "instance555127957"; 332 * InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource = 333 * InstancesAddResourcePoliciesRequest.newBuilder().build(); 334 * Operation response = 335 * instancesClient 336 * .addResourcePoliciesAsync( 337 * project, zone, instance, instancesAddResourcePoliciesRequestResource) 338 * .get(); 339 * } 340 * }</pre> 341 * 342 * @param project Project ID for this request. 343 * @param zone The name of the zone for this request. 344 * @param instance The instance name for this request. 345 * @param instancesAddResourcePoliciesRequestResource The body resource for this request 346 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 347 */ addResourcePoliciesAsync( String project, String zone, String instance, InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource)348 public final OperationFuture<Operation, Operation> addResourcePoliciesAsync( 349 String project, 350 String zone, 351 String instance, 352 InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource) { 353 AddResourcePoliciesInstanceRequest request = 354 AddResourcePoliciesInstanceRequest.newBuilder() 355 .setProject(project) 356 .setZone(zone) 357 .setInstance(instance) 358 .setInstancesAddResourcePoliciesRequestResource( 359 instancesAddResourcePoliciesRequestResource) 360 .build(); 361 return addResourcePoliciesAsync(request); 362 } 363 364 // AUTO-GENERATED DOCUMENTATION AND METHOD. 365 /** 366 * Adds existing resource policies to an instance. You can only add one policy right now which 367 * will be applied to this instance for scheduling live migrations. 368 * 369 * <p>Sample code: 370 * 371 * <pre>{@code 372 * // This snippet has been automatically generated and should be regarded as a code template only. 373 * // It will require modifications to work: 374 * // - It may require correct/in-range values for request initialization. 375 * // - It may require specifying regional endpoints when creating the service client as shown in 376 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 377 * try (InstancesClient instancesClient = InstancesClient.create()) { 378 * AddResourcePoliciesInstanceRequest request = 379 * AddResourcePoliciesInstanceRequest.newBuilder() 380 * .setInstance("instance555127957") 381 * .setInstancesAddResourcePoliciesRequestResource( 382 * InstancesAddResourcePoliciesRequest.newBuilder().build()) 383 * .setProject("project-309310695") 384 * .setRequestId("requestId693933066") 385 * .setZone("zone3744684") 386 * .build(); 387 * Operation response = instancesClient.addResourcePoliciesAsync(request).get(); 388 * } 389 * }</pre> 390 * 391 * @param request The request object containing all of the parameters for the API call. 392 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 393 */ 394 @BetaApi( 395 "The surface for long-running operations is not stable yet and may change in the future.") addResourcePoliciesAsync( AddResourcePoliciesInstanceRequest request)396 public final OperationFuture<Operation, Operation> addResourcePoliciesAsync( 397 AddResourcePoliciesInstanceRequest request) { 398 return addResourcePoliciesOperationCallable().futureCall(request); 399 } 400 401 // AUTO-GENERATED DOCUMENTATION AND METHOD. 402 /** 403 * Adds existing resource policies to an instance. You can only add one policy right now which 404 * will be applied to this instance for scheduling live migrations. 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 (InstancesClient instancesClient = InstancesClient.create()) { 415 * AddResourcePoliciesInstanceRequest request = 416 * AddResourcePoliciesInstanceRequest.newBuilder() 417 * .setInstance("instance555127957") 418 * .setInstancesAddResourcePoliciesRequestResource( 419 * InstancesAddResourcePoliciesRequest.newBuilder().build()) 420 * .setProject("project-309310695") 421 * .setRequestId("requestId693933066") 422 * .setZone("zone3744684") 423 * .build(); 424 * OperationFuture<Operation, Operation> future = 425 * instancesClient.addResourcePoliciesOperationCallable().futureCall(request); 426 * // Do something. 427 * Operation response = future.get(); 428 * } 429 * }</pre> 430 */ 431 public final OperationCallable<AddResourcePoliciesInstanceRequest, Operation, Operation> addResourcePoliciesOperationCallable()432 addResourcePoliciesOperationCallable() { 433 return stub.addResourcePoliciesOperationCallable(); 434 } 435 436 // AUTO-GENERATED DOCUMENTATION AND METHOD. 437 /** 438 * Adds existing resource policies to an instance. You can only add one policy right now which 439 * will be applied to this instance for scheduling live migrations. 440 * 441 * <p>Sample code: 442 * 443 * <pre>{@code 444 * // This snippet has been automatically generated and should be regarded as a code template only. 445 * // It will require modifications to work: 446 * // - It may require correct/in-range values for request initialization. 447 * // - It may require specifying regional endpoints when creating the service client as shown in 448 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 449 * try (InstancesClient instancesClient = InstancesClient.create()) { 450 * AddResourcePoliciesInstanceRequest request = 451 * AddResourcePoliciesInstanceRequest.newBuilder() 452 * .setInstance("instance555127957") 453 * .setInstancesAddResourcePoliciesRequestResource( 454 * InstancesAddResourcePoliciesRequest.newBuilder().build()) 455 * .setProject("project-309310695") 456 * .setRequestId("requestId693933066") 457 * .setZone("zone3744684") 458 * .build(); 459 * ApiFuture<Operation> future = 460 * instancesClient.addResourcePoliciesCallable().futureCall(request); 461 * // Do something. 462 * Operation response = future.get(); 463 * } 464 * }</pre> 465 */ 466 public final UnaryCallable<AddResourcePoliciesInstanceRequest, Operation> addResourcePoliciesCallable()467 addResourcePoliciesCallable() { 468 return stub.addResourcePoliciesCallable(); 469 } 470 471 // AUTO-GENERATED DOCUMENTATION AND METHOD. 472 /** 473 * Retrieves an aggregated list of all of the instances in your project across all regions and 474 * zones. The performance of this method degrades when a filter is specified on a project that has 475 * a very large number of instances. 476 * 477 * <p>Sample code: 478 * 479 * <pre>{@code 480 * // This snippet has been automatically generated and should be regarded as a code template only. 481 * // It will require modifications to work: 482 * // - It may require correct/in-range values for request initialization. 483 * // - It may require specifying regional endpoints when creating the service client as shown in 484 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 485 * try (InstancesClient instancesClient = InstancesClient.create()) { 486 * String project = "project-309310695"; 487 * for (Map.Entry<String, InstancesScopedList> element : 488 * instancesClient.aggregatedList(project).iterateAll()) { 489 * // doThingsWith(element); 490 * } 491 * } 492 * }</pre> 493 * 494 * @param project Project ID for this request. 495 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 496 */ aggregatedList(String project)497 public final AggregatedListPagedResponse aggregatedList(String project) { 498 AggregatedListInstancesRequest request = 499 AggregatedListInstancesRequest.newBuilder().setProject(project).build(); 500 return aggregatedList(request); 501 } 502 503 // AUTO-GENERATED DOCUMENTATION AND METHOD. 504 /** 505 * Retrieves an aggregated list of all of the instances in your project across all regions and 506 * zones. The performance of this method degrades when a filter is specified on a project that has 507 * a very large number of instances. 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 (InstancesClient instancesClient = InstancesClient.create()) { 518 * AggregatedListInstancesRequest request = 519 * AggregatedListInstancesRequest.newBuilder() 520 * .setFilter("filter-1274492040") 521 * .setIncludeAllScopes(true) 522 * .setMaxResults(1128457243) 523 * .setOrderBy("orderBy-1207110587") 524 * .setPageToken("pageToken873572522") 525 * .setProject("project-309310695") 526 * .setReturnPartialSuccess(true) 527 * .build(); 528 * for (Map.Entry<String, InstancesScopedList> element : 529 * instancesClient.aggregatedList(request).iterateAll()) { 530 * // doThingsWith(element); 531 * } 532 * } 533 * }</pre> 534 * 535 * @param request The request object containing all of the parameters for the API call. 536 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 537 */ aggregatedList(AggregatedListInstancesRequest request)538 public final AggregatedListPagedResponse aggregatedList(AggregatedListInstancesRequest request) { 539 return aggregatedListPagedCallable().call(request); 540 } 541 542 // AUTO-GENERATED DOCUMENTATION AND METHOD. 543 /** 544 * Retrieves an aggregated list of all of the instances in your project across all regions and 545 * zones. The performance of this method degrades when a filter is specified on a project that has 546 * a very large number of instances. 547 * 548 * <p>Sample code: 549 * 550 * <pre>{@code 551 * // This snippet has been automatically generated and should be regarded as a code template only. 552 * // It will require modifications to work: 553 * // - It may require correct/in-range values for request initialization. 554 * // - It may require specifying regional endpoints when creating the service client as shown in 555 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 556 * try (InstancesClient instancesClient = InstancesClient.create()) { 557 * AggregatedListInstancesRequest request = 558 * AggregatedListInstancesRequest.newBuilder() 559 * .setFilter("filter-1274492040") 560 * .setIncludeAllScopes(true) 561 * .setMaxResults(1128457243) 562 * .setOrderBy("orderBy-1207110587") 563 * .setPageToken("pageToken873572522") 564 * .setProject("project-309310695") 565 * .setReturnPartialSuccess(true) 566 * .build(); 567 * ApiFuture<Map.Entry<String, InstancesScopedList>> future = 568 * instancesClient.aggregatedListPagedCallable().futureCall(request); 569 * // Do something. 570 * for (Map.Entry<String, InstancesScopedList> element : future.get().iterateAll()) { 571 * // doThingsWith(element); 572 * } 573 * } 574 * }</pre> 575 */ 576 public final UnaryCallable<AggregatedListInstancesRequest, AggregatedListPagedResponse> aggregatedListPagedCallable()577 aggregatedListPagedCallable() { 578 return stub.aggregatedListPagedCallable(); 579 } 580 581 // AUTO-GENERATED DOCUMENTATION AND METHOD. 582 /** 583 * Retrieves an aggregated list of all of the instances in your project across all regions and 584 * zones. The performance of this method degrades when a filter is specified on a project that has 585 * a very large number of instances. 586 * 587 * <p>Sample code: 588 * 589 * <pre>{@code 590 * // This snippet has been automatically generated and should be regarded as a code template only. 591 * // It will require modifications to work: 592 * // - It may require correct/in-range values for request initialization. 593 * // - It may require specifying regional endpoints when creating the service client as shown in 594 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 595 * try (InstancesClient instancesClient = InstancesClient.create()) { 596 * AggregatedListInstancesRequest request = 597 * AggregatedListInstancesRequest.newBuilder() 598 * .setFilter("filter-1274492040") 599 * .setIncludeAllScopes(true) 600 * .setMaxResults(1128457243) 601 * .setOrderBy("orderBy-1207110587") 602 * .setPageToken("pageToken873572522") 603 * .setProject("project-309310695") 604 * .setReturnPartialSuccess(true) 605 * .build(); 606 * while (true) { 607 * InstanceAggregatedList response = instancesClient.aggregatedListCallable().call(request); 608 * for (Map.Entry<String, InstancesScopedList> element : response.getItemsList()) { 609 * // doThingsWith(element); 610 * } 611 * String nextPageToken = response.getNextPageToken(); 612 * if (!Strings.isNullOrEmpty(nextPageToken)) { 613 * request = request.toBuilder().setPageToken(nextPageToken).build(); 614 * } else { 615 * break; 616 * } 617 * } 618 * } 619 * }</pre> 620 */ 621 public final UnaryCallable<AggregatedListInstancesRequest, InstanceAggregatedList> aggregatedListCallable()622 aggregatedListCallable() { 623 return stub.aggregatedListCallable(); 624 } 625 626 // AUTO-GENERATED DOCUMENTATION AND METHOD. 627 /** 628 * Attaches an existing Disk resource to an instance. You must first create the disk before you 629 * can attach it. It is not possible to create and attach a disk at the same time. For more 630 * information, read Adding a persistent disk to your instance. 631 * 632 * <p>Sample code: 633 * 634 * <pre>{@code 635 * // This snippet has been automatically generated and should be regarded as a code template only. 636 * // It will require modifications to work: 637 * // - It may require correct/in-range values for request initialization. 638 * // - It may require specifying regional endpoints when creating the service client as shown in 639 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 640 * try (InstancesClient instancesClient = InstancesClient.create()) { 641 * String project = "project-309310695"; 642 * String zone = "zone3744684"; 643 * String instance = "instance555127957"; 644 * AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build(); 645 * Operation response = 646 * instancesClient.attachDiskAsync(project, zone, instance, attachedDiskResource).get(); 647 * } 648 * }</pre> 649 * 650 * @param project Project ID for this request. 651 * @param zone The name of the zone for this request. 652 * @param instance The instance name for this request. 653 * @param attachedDiskResource The body resource for this request 654 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 655 */ attachDiskAsync( String project, String zone, String instance, AttachedDisk attachedDiskResource)656 public final OperationFuture<Operation, Operation> attachDiskAsync( 657 String project, String zone, String instance, AttachedDisk attachedDiskResource) { 658 AttachDiskInstanceRequest request = 659 AttachDiskInstanceRequest.newBuilder() 660 .setProject(project) 661 .setZone(zone) 662 .setInstance(instance) 663 .setAttachedDiskResource(attachedDiskResource) 664 .build(); 665 return attachDiskAsync(request); 666 } 667 668 // AUTO-GENERATED DOCUMENTATION AND METHOD. 669 /** 670 * Attaches an existing Disk resource to an instance. You must first create the disk before you 671 * can attach it. It is not possible to create and attach a disk at the same time. For more 672 * information, read Adding a persistent disk to your instance. 673 * 674 * <p>Sample code: 675 * 676 * <pre>{@code 677 * // This snippet has been automatically generated and should be regarded as a code template only. 678 * // It will require modifications to work: 679 * // - It may require correct/in-range values for request initialization. 680 * // - It may require specifying regional endpoints when creating the service client as shown in 681 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 682 * try (InstancesClient instancesClient = InstancesClient.create()) { 683 * AttachDiskInstanceRequest request = 684 * AttachDiskInstanceRequest.newBuilder() 685 * .setAttachedDiskResource(AttachedDisk.newBuilder().build()) 686 * .setForceAttach(true) 687 * .setInstance("instance555127957") 688 * .setProject("project-309310695") 689 * .setRequestId("requestId693933066") 690 * .setZone("zone3744684") 691 * .build(); 692 * Operation response = instancesClient.attachDiskAsync(request).get(); 693 * } 694 * }</pre> 695 * 696 * @param request The request object containing all of the parameters for the API call. 697 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 698 */ 699 @BetaApi( 700 "The surface for long-running operations is not stable yet and may change in the future.") attachDiskAsync( AttachDiskInstanceRequest request)701 public final OperationFuture<Operation, Operation> attachDiskAsync( 702 AttachDiskInstanceRequest request) { 703 return attachDiskOperationCallable().futureCall(request); 704 } 705 706 // AUTO-GENERATED DOCUMENTATION AND METHOD. 707 /** 708 * Attaches an existing Disk resource to an instance. You must first create the disk before you 709 * can attach it. It is not possible to create and attach a disk at the same time. For more 710 * information, read Adding a persistent disk to your instance. 711 * 712 * <p>Sample code: 713 * 714 * <pre>{@code 715 * // This snippet has been automatically generated and should be regarded as a code template only. 716 * // It will require modifications to work: 717 * // - It may require correct/in-range values for request initialization. 718 * // - It may require specifying regional endpoints when creating the service client as shown in 719 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 720 * try (InstancesClient instancesClient = InstancesClient.create()) { 721 * AttachDiskInstanceRequest request = 722 * AttachDiskInstanceRequest.newBuilder() 723 * .setAttachedDiskResource(AttachedDisk.newBuilder().build()) 724 * .setForceAttach(true) 725 * .setInstance("instance555127957") 726 * .setProject("project-309310695") 727 * .setRequestId("requestId693933066") 728 * .setZone("zone3744684") 729 * .build(); 730 * OperationFuture<Operation, Operation> future = 731 * instancesClient.attachDiskOperationCallable().futureCall(request); 732 * // Do something. 733 * Operation response = future.get(); 734 * } 735 * }</pre> 736 */ 737 public final OperationCallable<AttachDiskInstanceRequest, Operation, Operation> attachDiskOperationCallable()738 attachDiskOperationCallable() { 739 return stub.attachDiskOperationCallable(); 740 } 741 742 // AUTO-GENERATED DOCUMENTATION AND METHOD. 743 /** 744 * Attaches an existing Disk resource to an instance. You must first create the disk before you 745 * can attach it. It is not possible to create and attach a disk at the same time. For more 746 * information, read Adding a persistent disk to your instance. 747 * 748 * <p>Sample code: 749 * 750 * <pre>{@code 751 * // This snippet has been automatically generated and should be regarded as a code template only. 752 * // It will require modifications to work: 753 * // - It may require correct/in-range values for request initialization. 754 * // - It may require specifying regional endpoints when creating the service client as shown in 755 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 756 * try (InstancesClient instancesClient = InstancesClient.create()) { 757 * AttachDiskInstanceRequest request = 758 * AttachDiskInstanceRequest.newBuilder() 759 * .setAttachedDiskResource(AttachedDisk.newBuilder().build()) 760 * .setForceAttach(true) 761 * .setInstance("instance555127957") 762 * .setProject("project-309310695") 763 * .setRequestId("requestId693933066") 764 * .setZone("zone3744684") 765 * .build(); 766 * ApiFuture<Operation> future = instancesClient.attachDiskCallable().futureCall(request); 767 * // Do something. 768 * Operation response = future.get(); 769 * } 770 * }</pre> 771 */ attachDiskCallable()772 public final UnaryCallable<AttachDiskInstanceRequest, Operation> attachDiskCallable() { 773 return stub.attachDiskCallable(); 774 } 775 776 // AUTO-GENERATED DOCUMENTATION AND METHOD. 777 /** 778 * Creates multiple instances. Count specifies the number of instances to create. For more 779 * information, see About bulk creation of VMs. 780 * 781 * <p>Sample code: 782 * 783 * <pre>{@code 784 * // This snippet has been automatically generated and should be regarded as a code template only. 785 * // It will require modifications to work: 786 * // - It may require correct/in-range values for request initialization. 787 * // - It may require specifying regional endpoints when creating the service client as shown in 788 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 789 * try (InstancesClient instancesClient = InstancesClient.create()) { 790 * String project = "project-309310695"; 791 * String zone = "zone3744684"; 792 * BulkInsertInstanceResource bulkInsertInstanceResourceResource = 793 * BulkInsertInstanceResource.newBuilder().build(); 794 * Operation response = 795 * instancesClient.bulkInsertAsync(project, zone, bulkInsertInstanceResourceResource).get(); 796 * } 797 * }</pre> 798 * 799 * @param project Project ID for this request. 800 * @param zone The name of the zone for this request. 801 * @param bulkInsertInstanceResourceResource The body resource for this request 802 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 803 */ bulkInsertAsync( String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource)804 public final OperationFuture<Operation, Operation> bulkInsertAsync( 805 String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource) { 806 BulkInsertInstanceRequest request = 807 BulkInsertInstanceRequest.newBuilder() 808 .setProject(project) 809 .setZone(zone) 810 .setBulkInsertInstanceResourceResource(bulkInsertInstanceResourceResource) 811 .build(); 812 return bulkInsertAsync(request); 813 } 814 815 // AUTO-GENERATED DOCUMENTATION AND METHOD. 816 /** 817 * Creates multiple instances. Count specifies the number of instances to create. For more 818 * information, see About bulk creation of VMs. 819 * 820 * <p>Sample code: 821 * 822 * <pre>{@code 823 * // This snippet has been automatically generated and should be regarded as a code template only. 824 * // It will require modifications to work: 825 * // - It may require correct/in-range values for request initialization. 826 * // - It may require specifying regional endpoints when creating the service client as shown in 827 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 828 * try (InstancesClient instancesClient = InstancesClient.create()) { 829 * BulkInsertInstanceRequest request = 830 * BulkInsertInstanceRequest.newBuilder() 831 * .setBulkInsertInstanceResourceResource( 832 * BulkInsertInstanceResource.newBuilder().build()) 833 * .setProject("project-309310695") 834 * .setRequestId("requestId693933066") 835 * .setZone("zone3744684") 836 * .build(); 837 * Operation response = instancesClient.bulkInsertAsync(request).get(); 838 * } 839 * }</pre> 840 * 841 * @param request The request object containing all of the parameters for the API call. 842 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 843 */ 844 @BetaApi( 845 "The surface for long-running operations is not stable yet and may change in the future.") bulkInsertAsync( BulkInsertInstanceRequest request)846 public final OperationFuture<Operation, Operation> bulkInsertAsync( 847 BulkInsertInstanceRequest request) { 848 return bulkInsertOperationCallable().futureCall(request); 849 } 850 851 // AUTO-GENERATED DOCUMENTATION AND METHOD. 852 /** 853 * Creates multiple instances. Count specifies the number of instances to create. For more 854 * information, see About bulk creation of VMs. 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 (InstancesClient instancesClient = InstancesClient.create()) { 865 * BulkInsertInstanceRequest request = 866 * BulkInsertInstanceRequest.newBuilder() 867 * .setBulkInsertInstanceResourceResource( 868 * BulkInsertInstanceResource.newBuilder().build()) 869 * .setProject("project-309310695") 870 * .setRequestId("requestId693933066") 871 * .setZone("zone3744684") 872 * .build(); 873 * OperationFuture<Operation, Operation> future = 874 * instancesClient.bulkInsertOperationCallable().futureCall(request); 875 * // Do something. 876 * Operation response = future.get(); 877 * } 878 * }</pre> 879 */ 880 public final OperationCallable<BulkInsertInstanceRequest, Operation, Operation> bulkInsertOperationCallable()881 bulkInsertOperationCallable() { 882 return stub.bulkInsertOperationCallable(); 883 } 884 885 // AUTO-GENERATED DOCUMENTATION AND METHOD. 886 /** 887 * Creates multiple instances. Count specifies the number of instances to create. For more 888 * information, see About bulk creation of VMs. 889 * 890 * <p>Sample code: 891 * 892 * <pre>{@code 893 * // This snippet has been automatically generated and should be regarded as a code template only. 894 * // It will require modifications to work: 895 * // - It may require correct/in-range values for request initialization. 896 * // - It may require specifying regional endpoints when creating the service client as shown in 897 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 898 * try (InstancesClient instancesClient = InstancesClient.create()) { 899 * BulkInsertInstanceRequest request = 900 * BulkInsertInstanceRequest.newBuilder() 901 * .setBulkInsertInstanceResourceResource( 902 * BulkInsertInstanceResource.newBuilder().build()) 903 * .setProject("project-309310695") 904 * .setRequestId("requestId693933066") 905 * .setZone("zone3744684") 906 * .build(); 907 * ApiFuture<Operation> future = instancesClient.bulkInsertCallable().futureCall(request); 908 * // Do something. 909 * Operation response = future.get(); 910 * } 911 * }</pre> 912 */ bulkInsertCallable()913 public final UnaryCallable<BulkInsertInstanceRequest, Operation> bulkInsertCallable() { 914 return stub.bulkInsertCallable(); 915 } 916 917 // AUTO-GENERATED DOCUMENTATION AND METHOD. 918 /** 919 * Deletes the specified Instance resource. For more information, see Deleting an instance. 920 * 921 * <p>Sample code: 922 * 923 * <pre>{@code 924 * // This snippet has been automatically generated and should be regarded as a code template only. 925 * // It will require modifications to work: 926 * // - It may require correct/in-range values for request initialization. 927 * // - It may require specifying regional endpoints when creating the service client as shown in 928 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 929 * try (InstancesClient instancesClient = InstancesClient.create()) { 930 * String project = "project-309310695"; 931 * String zone = "zone3744684"; 932 * String instance = "instance555127957"; 933 * Operation response = instancesClient.deleteAsync(project, zone, instance).get(); 934 * } 935 * }</pre> 936 * 937 * @param project Project ID for this request. 938 * @param zone The name of the zone for this request. 939 * @param instance Name of the instance resource to delete. 940 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 941 */ deleteAsync( String project, String zone, String instance)942 public final OperationFuture<Operation, Operation> deleteAsync( 943 String project, String zone, String instance) { 944 DeleteInstanceRequest request = 945 DeleteInstanceRequest.newBuilder() 946 .setProject(project) 947 .setZone(zone) 948 .setInstance(instance) 949 .build(); 950 return deleteAsync(request); 951 } 952 953 // AUTO-GENERATED DOCUMENTATION AND METHOD. 954 /** 955 * Deletes the specified Instance resource. For more information, see Deleting an instance. 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 (InstancesClient instancesClient = InstancesClient.create()) { 966 * DeleteInstanceRequest request = 967 * DeleteInstanceRequest.newBuilder() 968 * .setInstance("instance555127957") 969 * .setProject("project-309310695") 970 * .setRequestId("requestId693933066") 971 * .setZone("zone3744684") 972 * .build(); 973 * Operation response = instancesClient.deleteAsync(request).get(); 974 * } 975 * }</pre> 976 * 977 * @param request The request object containing all of the parameters for the API call. 978 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 979 */ 980 @BetaApi( 981 "The surface for long-running operations is not stable yet and may change in the future.") deleteAsync(DeleteInstanceRequest request)982 public final OperationFuture<Operation, Operation> deleteAsync(DeleteInstanceRequest request) { 983 return deleteOperationCallable().futureCall(request); 984 } 985 986 // AUTO-GENERATED DOCUMENTATION AND METHOD. 987 /** 988 * Deletes the specified Instance resource. For more information, see Deleting an instance. 989 * 990 * <p>Sample code: 991 * 992 * <pre>{@code 993 * // This snippet has been automatically generated and should be regarded as a code template only. 994 * // It will require modifications to work: 995 * // - It may require correct/in-range values for request initialization. 996 * // - It may require specifying regional endpoints when creating the service client as shown in 997 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 998 * try (InstancesClient instancesClient = InstancesClient.create()) { 999 * DeleteInstanceRequest request = 1000 * DeleteInstanceRequest.newBuilder() 1001 * .setInstance("instance555127957") 1002 * .setProject("project-309310695") 1003 * .setRequestId("requestId693933066") 1004 * .setZone("zone3744684") 1005 * .build(); 1006 * OperationFuture<Operation, Operation> future = 1007 * instancesClient.deleteOperationCallable().futureCall(request); 1008 * // Do something. 1009 * Operation response = future.get(); 1010 * } 1011 * }</pre> 1012 */ 1013 public final OperationCallable<DeleteInstanceRequest, Operation, Operation> deleteOperationCallable()1014 deleteOperationCallable() { 1015 return stub.deleteOperationCallable(); 1016 } 1017 1018 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1019 /** 1020 * Deletes the specified Instance resource. For more information, see Deleting an instance. 1021 * 1022 * <p>Sample code: 1023 * 1024 * <pre>{@code 1025 * // This snippet has been automatically generated and should be regarded as a code template only. 1026 * // It will require modifications to work: 1027 * // - It may require correct/in-range values for request initialization. 1028 * // - It may require specifying regional endpoints when creating the service client as shown in 1029 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1030 * try (InstancesClient instancesClient = InstancesClient.create()) { 1031 * DeleteInstanceRequest request = 1032 * DeleteInstanceRequest.newBuilder() 1033 * .setInstance("instance555127957") 1034 * .setProject("project-309310695") 1035 * .setRequestId("requestId693933066") 1036 * .setZone("zone3744684") 1037 * .build(); 1038 * ApiFuture<Operation> future = instancesClient.deleteCallable().futureCall(request); 1039 * // Do something. 1040 * Operation response = future.get(); 1041 * } 1042 * }</pre> 1043 */ deleteCallable()1044 public final UnaryCallable<DeleteInstanceRequest, Operation> deleteCallable() { 1045 return stub.deleteCallable(); 1046 } 1047 1048 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1049 /** 1050 * Deletes an access config from an instance's network interface. 1051 * 1052 * <p>Sample code: 1053 * 1054 * <pre>{@code 1055 * // This snippet has been automatically generated and should be regarded as a code template only. 1056 * // It will require modifications to work: 1057 * // - It may require correct/in-range values for request initialization. 1058 * // - It may require specifying regional endpoints when creating the service client as shown in 1059 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1060 * try (InstancesClient instancesClient = InstancesClient.create()) { 1061 * String project = "project-309310695"; 1062 * String zone = "zone3744684"; 1063 * String instance = "instance555127957"; 1064 * String accessConfig = "accessConfig1549765062"; 1065 * String networkInterface = "networkInterface-341981525"; 1066 * Operation response = 1067 * instancesClient 1068 * .deleteAccessConfigAsync(project, zone, instance, accessConfig, networkInterface) 1069 * .get(); 1070 * } 1071 * }</pre> 1072 * 1073 * @param project Project ID for this request. 1074 * @param zone The name of the zone for this request. 1075 * @param instance The instance name for this request. 1076 * @param accessConfig The name of the access config to delete. 1077 * @param networkInterface The name of the network interface. 1078 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1079 */ deleteAccessConfigAsync( String project, String zone, String instance, String accessConfig, String networkInterface)1080 public final OperationFuture<Operation, Operation> deleteAccessConfigAsync( 1081 String project, String zone, String instance, String accessConfig, String networkInterface) { 1082 DeleteAccessConfigInstanceRequest request = 1083 DeleteAccessConfigInstanceRequest.newBuilder() 1084 .setProject(project) 1085 .setZone(zone) 1086 .setInstance(instance) 1087 .setAccessConfig(accessConfig) 1088 .setNetworkInterface(networkInterface) 1089 .build(); 1090 return deleteAccessConfigAsync(request); 1091 } 1092 1093 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1094 /** 1095 * Deletes an access config from an instance's network interface. 1096 * 1097 * <p>Sample code: 1098 * 1099 * <pre>{@code 1100 * // This snippet has been automatically generated and should be regarded as a code template only. 1101 * // It will require modifications to work: 1102 * // - It may require correct/in-range values for request initialization. 1103 * // - It may require specifying regional endpoints when creating the service client as shown in 1104 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1105 * try (InstancesClient instancesClient = InstancesClient.create()) { 1106 * DeleteAccessConfigInstanceRequest request = 1107 * DeleteAccessConfigInstanceRequest.newBuilder() 1108 * .setAccessConfig("accessConfig1549765062") 1109 * .setInstance("instance555127957") 1110 * .setNetworkInterface("networkInterface-341981525") 1111 * .setProject("project-309310695") 1112 * .setRequestId("requestId693933066") 1113 * .setZone("zone3744684") 1114 * .build(); 1115 * Operation response = instancesClient.deleteAccessConfigAsync(request).get(); 1116 * } 1117 * }</pre> 1118 * 1119 * @param request The request object containing all of the parameters for the API call. 1120 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1121 */ 1122 @BetaApi( 1123 "The surface for long-running operations is not stable yet and may change in the future.") deleteAccessConfigAsync( DeleteAccessConfigInstanceRequest request)1124 public final OperationFuture<Operation, Operation> deleteAccessConfigAsync( 1125 DeleteAccessConfigInstanceRequest request) { 1126 return deleteAccessConfigOperationCallable().futureCall(request); 1127 } 1128 1129 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1130 /** 1131 * Deletes an access config from an instance's network interface. 1132 * 1133 * <p>Sample code: 1134 * 1135 * <pre>{@code 1136 * // This snippet has been automatically generated and should be regarded as a code template only. 1137 * // It will require modifications to work: 1138 * // - It may require correct/in-range values for request initialization. 1139 * // - It may require specifying regional endpoints when creating the service client as shown in 1140 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1141 * try (InstancesClient instancesClient = InstancesClient.create()) { 1142 * DeleteAccessConfigInstanceRequest request = 1143 * DeleteAccessConfigInstanceRequest.newBuilder() 1144 * .setAccessConfig("accessConfig1549765062") 1145 * .setInstance("instance555127957") 1146 * .setNetworkInterface("networkInterface-341981525") 1147 * .setProject("project-309310695") 1148 * .setRequestId("requestId693933066") 1149 * .setZone("zone3744684") 1150 * .build(); 1151 * OperationFuture<Operation, Operation> future = 1152 * instancesClient.deleteAccessConfigOperationCallable().futureCall(request); 1153 * // Do something. 1154 * Operation response = future.get(); 1155 * } 1156 * }</pre> 1157 */ 1158 public final OperationCallable<DeleteAccessConfigInstanceRequest, Operation, Operation> deleteAccessConfigOperationCallable()1159 deleteAccessConfigOperationCallable() { 1160 return stub.deleteAccessConfigOperationCallable(); 1161 } 1162 1163 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1164 /** 1165 * Deletes an access config from an instance's network interface. 1166 * 1167 * <p>Sample code: 1168 * 1169 * <pre>{@code 1170 * // This snippet has been automatically generated and should be regarded as a code template only. 1171 * // It will require modifications to work: 1172 * // - It may require correct/in-range values for request initialization. 1173 * // - It may require specifying regional endpoints when creating the service client as shown in 1174 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1175 * try (InstancesClient instancesClient = InstancesClient.create()) { 1176 * DeleteAccessConfigInstanceRequest request = 1177 * DeleteAccessConfigInstanceRequest.newBuilder() 1178 * .setAccessConfig("accessConfig1549765062") 1179 * .setInstance("instance555127957") 1180 * .setNetworkInterface("networkInterface-341981525") 1181 * .setProject("project-309310695") 1182 * .setRequestId("requestId693933066") 1183 * .setZone("zone3744684") 1184 * .build(); 1185 * ApiFuture<Operation> future = 1186 * instancesClient.deleteAccessConfigCallable().futureCall(request); 1187 * // Do something. 1188 * Operation response = future.get(); 1189 * } 1190 * }</pre> 1191 */ 1192 public final UnaryCallable<DeleteAccessConfigInstanceRequest, Operation> deleteAccessConfigCallable()1193 deleteAccessConfigCallable() { 1194 return stub.deleteAccessConfigCallable(); 1195 } 1196 1197 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1198 /** 1199 * Detaches a disk from an instance. 1200 * 1201 * <p>Sample code: 1202 * 1203 * <pre>{@code 1204 * // This snippet has been automatically generated and should be regarded as a code template only. 1205 * // It will require modifications to work: 1206 * // - It may require correct/in-range values for request initialization. 1207 * // - It may require specifying regional endpoints when creating the service client as shown in 1208 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1209 * try (InstancesClient instancesClient = InstancesClient.create()) { 1210 * String project = "project-309310695"; 1211 * String zone = "zone3744684"; 1212 * String instance = "instance555127957"; 1213 * String deviceName = "deviceName780988929"; 1214 * Operation response = 1215 * instancesClient.detachDiskAsync(project, zone, instance, deviceName).get(); 1216 * } 1217 * }</pre> 1218 * 1219 * @param project Project ID for this request. 1220 * @param zone The name of the zone for this request. 1221 * @param instance Instance name for this request. 1222 * @param deviceName The device name of the disk to detach. Make a get() request on the instance 1223 * to view currently attached disks and device names. 1224 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1225 */ detachDiskAsync( String project, String zone, String instance, String deviceName)1226 public final OperationFuture<Operation, Operation> detachDiskAsync( 1227 String project, String zone, String instance, String deviceName) { 1228 DetachDiskInstanceRequest request = 1229 DetachDiskInstanceRequest.newBuilder() 1230 .setProject(project) 1231 .setZone(zone) 1232 .setInstance(instance) 1233 .setDeviceName(deviceName) 1234 .build(); 1235 return detachDiskAsync(request); 1236 } 1237 1238 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1239 /** 1240 * Detaches a disk from an instance. 1241 * 1242 * <p>Sample code: 1243 * 1244 * <pre>{@code 1245 * // This snippet has been automatically generated and should be regarded as a code template only. 1246 * // It will require modifications to work: 1247 * // - It may require correct/in-range values for request initialization. 1248 * // - It may require specifying regional endpoints when creating the service client as shown in 1249 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1250 * try (InstancesClient instancesClient = InstancesClient.create()) { 1251 * DetachDiskInstanceRequest request = 1252 * DetachDiskInstanceRequest.newBuilder() 1253 * .setDeviceName("deviceName780988929") 1254 * .setInstance("instance555127957") 1255 * .setProject("project-309310695") 1256 * .setRequestId("requestId693933066") 1257 * .setZone("zone3744684") 1258 * .build(); 1259 * Operation response = instancesClient.detachDiskAsync(request).get(); 1260 * } 1261 * }</pre> 1262 * 1263 * @param request The request object containing all of the parameters for the API call. 1264 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1265 */ 1266 @BetaApi( 1267 "The surface for long-running operations is not stable yet and may change in the future.") detachDiskAsync( DetachDiskInstanceRequest request)1268 public final OperationFuture<Operation, Operation> detachDiskAsync( 1269 DetachDiskInstanceRequest request) { 1270 return detachDiskOperationCallable().futureCall(request); 1271 } 1272 1273 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1274 /** 1275 * Detaches a disk from an instance. 1276 * 1277 * <p>Sample code: 1278 * 1279 * <pre>{@code 1280 * // This snippet has been automatically generated and should be regarded as a code template only. 1281 * // It will require modifications to work: 1282 * // - It may require correct/in-range values for request initialization. 1283 * // - It may require specifying regional endpoints when creating the service client as shown in 1284 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1285 * try (InstancesClient instancesClient = InstancesClient.create()) { 1286 * DetachDiskInstanceRequest request = 1287 * DetachDiskInstanceRequest.newBuilder() 1288 * .setDeviceName("deviceName780988929") 1289 * .setInstance("instance555127957") 1290 * .setProject("project-309310695") 1291 * .setRequestId("requestId693933066") 1292 * .setZone("zone3744684") 1293 * .build(); 1294 * OperationFuture<Operation, Operation> future = 1295 * instancesClient.detachDiskOperationCallable().futureCall(request); 1296 * // Do something. 1297 * Operation response = future.get(); 1298 * } 1299 * }</pre> 1300 */ 1301 public final OperationCallable<DetachDiskInstanceRequest, Operation, Operation> detachDiskOperationCallable()1302 detachDiskOperationCallable() { 1303 return stub.detachDiskOperationCallable(); 1304 } 1305 1306 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1307 /** 1308 * Detaches a disk from an instance. 1309 * 1310 * <p>Sample code: 1311 * 1312 * <pre>{@code 1313 * // This snippet has been automatically generated and should be regarded as a code template only. 1314 * // It will require modifications to work: 1315 * // - It may require correct/in-range values for request initialization. 1316 * // - It may require specifying regional endpoints when creating the service client as shown in 1317 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1318 * try (InstancesClient instancesClient = InstancesClient.create()) { 1319 * DetachDiskInstanceRequest request = 1320 * DetachDiskInstanceRequest.newBuilder() 1321 * .setDeviceName("deviceName780988929") 1322 * .setInstance("instance555127957") 1323 * .setProject("project-309310695") 1324 * .setRequestId("requestId693933066") 1325 * .setZone("zone3744684") 1326 * .build(); 1327 * ApiFuture<Operation> future = instancesClient.detachDiskCallable().futureCall(request); 1328 * // Do something. 1329 * Operation response = future.get(); 1330 * } 1331 * }</pre> 1332 */ detachDiskCallable()1333 public final UnaryCallable<DetachDiskInstanceRequest, Operation> detachDiskCallable() { 1334 return stub.detachDiskCallable(); 1335 } 1336 1337 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1338 /** 1339 * Returns the specified Instance resource. 1340 * 1341 * <p>Sample code: 1342 * 1343 * <pre>{@code 1344 * // This snippet has been automatically generated and should be regarded as a code template only. 1345 * // It will require modifications to work: 1346 * // - It may require correct/in-range values for request initialization. 1347 * // - It may require specifying regional endpoints when creating the service client as shown in 1348 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1349 * try (InstancesClient instancesClient = InstancesClient.create()) { 1350 * String project = "project-309310695"; 1351 * String zone = "zone3744684"; 1352 * String instance = "instance555127957"; 1353 * Instance response = instancesClient.get(project, zone, instance); 1354 * } 1355 * }</pre> 1356 * 1357 * @param project Project ID for this request. 1358 * @param zone The name of the zone for this request. 1359 * @param instance Name of the instance resource to return. 1360 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1361 */ get(String project, String zone, String instance)1362 public final Instance get(String project, String zone, String instance) { 1363 GetInstanceRequest request = 1364 GetInstanceRequest.newBuilder() 1365 .setProject(project) 1366 .setZone(zone) 1367 .setInstance(instance) 1368 .build(); 1369 return get(request); 1370 } 1371 1372 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1373 /** 1374 * Returns the specified Instance resource. 1375 * 1376 * <p>Sample code: 1377 * 1378 * <pre>{@code 1379 * // This snippet has been automatically generated and should be regarded as a code template only. 1380 * // It will require modifications to work: 1381 * // - It may require correct/in-range values for request initialization. 1382 * // - It may require specifying regional endpoints when creating the service client as shown in 1383 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1384 * try (InstancesClient instancesClient = InstancesClient.create()) { 1385 * GetInstanceRequest request = 1386 * GetInstanceRequest.newBuilder() 1387 * .setInstance("instance555127957") 1388 * .setProject("project-309310695") 1389 * .setZone("zone3744684") 1390 * .build(); 1391 * Instance response = instancesClient.get(request); 1392 * } 1393 * }</pre> 1394 * 1395 * @param request The request object containing all of the parameters for the API call. 1396 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1397 */ get(GetInstanceRequest request)1398 public final Instance get(GetInstanceRequest request) { 1399 return getCallable().call(request); 1400 } 1401 1402 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1403 /** 1404 * Returns the specified Instance resource. 1405 * 1406 * <p>Sample code: 1407 * 1408 * <pre>{@code 1409 * // This snippet has been automatically generated and should be regarded as a code template only. 1410 * // It will require modifications to work: 1411 * // - It may require correct/in-range values for request initialization. 1412 * // - It may require specifying regional endpoints when creating the service client as shown in 1413 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1414 * try (InstancesClient instancesClient = InstancesClient.create()) { 1415 * GetInstanceRequest request = 1416 * GetInstanceRequest.newBuilder() 1417 * .setInstance("instance555127957") 1418 * .setProject("project-309310695") 1419 * .setZone("zone3744684") 1420 * .build(); 1421 * ApiFuture<Instance> future = instancesClient.getCallable().futureCall(request); 1422 * // Do something. 1423 * Instance response = future.get(); 1424 * } 1425 * }</pre> 1426 */ getCallable()1427 public final UnaryCallable<GetInstanceRequest, Instance> getCallable() { 1428 return stub.getCallable(); 1429 } 1430 1431 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1432 /** 1433 * Returns effective firewalls applied to an interface of the instance. 1434 * 1435 * <p>Sample code: 1436 * 1437 * <pre>{@code 1438 * // This snippet has been automatically generated and should be regarded as a code template only. 1439 * // It will require modifications to work: 1440 * // - It may require correct/in-range values for request initialization. 1441 * // - It may require specifying regional endpoints when creating the service client as shown in 1442 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1443 * try (InstancesClient instancesClient = InstancesClient.create()) { 1444 * String project = "project-309310695"; 1445 * String zone = "zone3744684"; 1446 * String instance = "instance555127957"; 1447 * String networkInterface = "networkInterface-341981525"; 1448 * InstancesGetEffectiveFirewallsResponse response = 1449 * instancesClient.getEffectiveFirewalls(project, zone, instance, networkInterface); 1450 * } 1451 * }</pre> 1452 * 1453 * @param project Project ID for this request. 1454 * @param zone The name of the zone for this request. 1455 * @param instance Name of the instance scoping this request. 1456 * @param networkInterface The name of the network interface to get the effective firewalls. 1457 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1458 */ getEffectiveFirewalls( String project, String zone, String instance, String networkInterface)1459 public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls( 1460 String project, String zone, String instance, String networkInterface) { 1461 GetEffectiveFirewallsInstanceRequest request = 1462 GetEffectiveFirewallsInstanceRequest.newBuilder() 1463 .setProject(project) 1464 .setZone(zone) 1465 .setInstance(instance) 1466 .setNetworkInterface(networkInterface) 1467 .build(); 1468 return getEffectiveFirewalls(request); 1469 } 1470 1471 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1472 /** 1473 * Returns effective firewalls applied to an interface of the instance. 1474 * 1475 * <p>Sample code: 1476 * 1477 * <pre>{@code 1478 * // This snippet has been automatically generated and should be regarded as a code template only. 1479 * // It will require modifications to work: 1480 * // - It may require correct/in-range values for request initialization. 1481 * // - It may require specifying regional endpoints when creating the service client as shown in 1482 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1483 * try (InstancesClient instancesClient = InstancesClient.create()) { 1484 * GetEffectiveFirewallsInstanceRequest request = 1485 * GetEffectiveFirewallsInstanceRequest.newBuilder() 1486 * .setInstance("instance555127957") 1487 * .setNetworkInterface("networkInterface-341981525") 1488 * .setProject("project-309310695") 1489 * .setZone("zone3744684") 1490 * .build(); 1491 * InstancesGetEffectiveFirewallsResponse response = 1492 * instancesClient.getEffectiveFirewalls(request); 1493 * } 1494 * }</pre> 1495 * 1496 * @param request The request object containing all of the parameters for the API call. 1497 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1498 */ getEffectiveFirewalls( GetEffectiveFirewallsInstanceRequest request)1499 public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls( 1500 GetEffectiveFirewallsInstanceRequest request) { 1501 return getEffectiveFirewallsCallable().call(request); 1502 } 1503 1504 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1505 /** 1506 * Returns effective firewalls applied to an interface of the instance. 1507 * 1508 * <p>Sample code: 1509 * 1510 * <pre>{@code 1511 * // This snippet has been automatically generated and should be regarded as a code template only. 1512 * // It will require modifications to work: 1513 * // - It may require correct/in-range values for request initialization. 1514 * // - It may require specifying regional endpoints when creating the service client as shown in 1515 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1516 * try (InstancesClient instancesClient = InstancesClient.create()) { 1517 * GetEffectiveFirewallsInstanceRequest request = 1518 * GetEffectiveFirewallsInstanceRequest.newBuilder() 1519 * .setInstance("instance555127957") 1520 * .setNetworkInterface("networkInterface-341981525") 1521 * .setProject("project-309310695") 1522 * .setZone("zone3744684") 1523 * .build(); 1524 * ApiFuture<InstancesGetEffectiveFirewallsResponse> future = 1525 * instancesClient.getEffectiveFirewallsCallable().futureCall(request); 1526 * // Do something. 1527 * InstancesGetEffectiveFirewallsResponse response = future.get(); 1528 * } 1529 * }</pre> 1530 */ 1531 public final UnaryCallable< 1532 GetEffectiveFirewallsInstanceRequest, InstancesGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()1533 getEffectiveFirewallsCallable() { 1534 return stub.getEffectiveFirewallsCallable(); 1535 } 1536 1537 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1538 /** 1539 * Returns the specified guest attributes entry. 1540 * 1541 * <p>Sample code: 1542 * 1543 * <pre>{@code 1544 * // This snippet has been automatically generated and should be regarded as a code template only. 1545 * // It will require modifications to work: 1546 * // - It may require correct/in-range values for request initialization. 1547 * // - It may require specifying regional endpoints when creating the service client as shown in 1548 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1549 * try (InstancesClient instancesClient = InstancesClient.create()) { 1550 * String project = "project-309310695"; 1551 * String zone = "zone3744684"; 1552 * String instance = "instance555127957"; 1553 * GuestAttributes response = instancesClient.getGuestAttributes(project, zone, instance); 1554 * } 1555 * }</pre> 1556 * 1557 * @param project Project ID for this request. 1558 * @param zone The name of the zone for this request. 1559 * @param instance Name of the instance scoping this request. 1560 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1561 */ getGuestAttributes(String project, String zone, String instance)1562 public final GuestAttributes getGuestAttributes(String project, String zone, String instance) { 1563 GetGuestAttributesInstanceRequest request = 1564 GetGuestAttributesInstanceRequest.newBuilder() 1565 .setProject(project) 1566 .setZone(zone) 1567 .setInstance(instance) 1568 .build(); 1569 return getGuestAttributes(request); 1570 } 1571 1572 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1573 /** 1574 * Returns the specified guest attributes entry. 1575 * 1576 * <p>Sample code: 1577 * 1578 * <pre>{@code 1579 * // This snippet has been automatically generated and should be regarded as a code template only. 1580 * // It will require modifications to work: 1581 * // - It may require correct/in-range values for request initialization. 1582 * // - It may require specifying regional endpoints when creating the service client as shown in 1583 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1584 * try (InstancesClient instancesClient = InstancesClient.create()) { 1585 * GetGuestAttributesInstanceRequest request = 1586 * GetGuestAttributesInstanceRequest.newBuilder() 1587 * .setInstance("instance555127957") 1588 * .setProject("project-309310695") 1589 * .setQueryPath("queryPath-1807004403") 1590 * .setVariableKey("variableKey-1951698365") 1591 * .setZone("zone3744684") 1592 * .build(); 1593 * GuestAttributes response = instancesClient.getGuestAttributes(request); 1594 * } 1595 * }</pre> 1596 * 1597 * @param request The request object containing all of the parameters for the API call. 1598 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1599 */ getGuestAttributes(GetGuestAttributesInstanceRequest request)1600 public final GuestAttributes getGuestAttributes(GetGuestAttributesInstanceRequest request) { 1601 return getGuestAttributesCallable().call(request); 1602 } 1603 1604 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1605 /** 1606 * Returns the specified guest attributes entry. 1607 * 1608 * <p>Sample code: 1609 * 1610 * <pre>{@code 1611 * // This snippet has been automatically generated and should be regarded as a code template only. 1612 * // It will require modifications to work: 1613 * // - It may require correct/in-range values for request initialization. 1614 * // - It may require specifying regional endpoints when creating the service client as shown in 1615 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1616 * try (InstancesClient instancesClient = InstancesClient.create()) { 1617 * GetGuestAttributesInstanceRequest request = 1618 * GetGuestAttributesInstanceRequest.newBuilder() 1619 * .setInstance("instance555127957") 1620 * .setProject("project-309310695") 1621 * .setQueryPath("queryPath-1807004403") 1622 * .setVariableKey("variableKey-1951698365") 1623 * .setZone("zone3744684") 1624 * .build(); 1625 * ApiFuture<GuestAttributes> future = 1626 * instancesClient.getGuestAttributesCallable().futureCall(request); 1627 * // Do something. 1628 * GuestAttributes response = future.get(); 1629 * } 1630 * }</pre> 1631 */ 1632 public final UnaryCallable<GetGuestAttributesInstanceRequest, GuestAttributes> getGuestAttributesCallable()1633 getGuestAttributesCallable() { 1634 return stub.getGuestAttributesCallable(); 1635 } 1636 1637 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1638 /** 1639 * Gets the access control policy for a resource. May be empty if no such policy or resource 1640 * exists. 1641 * 1642 * <p>Sample code: 1643 * 1644 * <pre>{@code 1645 * // This snippet has been automatically generated and should be regarded as a code template only. 1646 * // It will require modifications to work: 1647 * // - It may require correct/in-range values for request initialization. 1648 * // - It may require specifying regional endpoints when creating the service client as shown in 1649 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1650 * try (InstancesClient instancesClient = InstancesClient.create()) { 1651 * String project = "project-309310695"; 1652 * String zone = "zone3744684"; 1653 * String resource = "resource-341064690"; 1654 * Policy response = instancesClient.getIamPolicy(project, zone, resource); 1655 * } 1656 * }</pre> 1657 * 1658 * @param project Project ID for this request. 1659 * @param zone The name of the zone for this request. 1660 * @param resource Name or id of the resource for this request. 1661 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1662 */ getIamPolicy(String project, String zone, String resource)1663 public final Policy getIamPolicy(String project, String zone, String resource) { 1664 GetIamPolicyInstanceRequest request = 1665 GetIamPolicyInstanceRequest.newBuilder() 1666 .setProject(project) 1667 .setZone(zone) 1668 .setResource(resource) 1669 .build(); 1670 return getIamPolicy(request); 1671 } 1672 1673 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1674 /** 1675 * Gets the access control policy for a resource. May be empty if no such policy or resource 1676 * exists. 1677 * 1678 * <p>Sample code: 1679 * 1680 * <pre>{@code 1681 * // This snippet has been automatically generated and should be regarded as a code template only. 1682 * // It will require modifications to work: 1683 * // - It may require correct/in-range values for request initialization. 1684 * // - It may require specifying regional endpoints when creating the service client as shown in 1685 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1686 * try (InstancesClient instancesClient = InstancesClient.create()) { 1687 * GetIamPolicyInstanceRequest request = 1688 * GetIamPolicyInstanceRequest.newBuilder() 1689 * .setOptionsRequestedPolicyVersion(-574521795) 1690 * .setProject("project-309310695") 1691 * .setResource("resource-341064690") 1692 * .setZone("zone3744684") 1693 * .build(); 1694 * Policy response = instancesClient.getIamPolicy(request); 1695 * } 1696 * }</pre> 1697 * 1698 * @param request The request object containing all of the parameters for the API call. 1699 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1700 */ getIamPolicy(GetIamPolicyInstanceRequest request)1701 public final Policy getIamPolicy(GetIamPolicyInstanceRequest request) { 1702 return getIamPolicyCallable().call(request); 1703 } 1704 1705 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1706 /** 1707 * Gets the access control policy for a resource. May be empty if no such policy or resource 1708 * exists. 1709 * 1710 * <p>Sample code: 1711 * 1712 * <pre>{@code 1713 * // This snippet has been automatically generated and should be regarded as a code template only. 1714 * // It will require modifications to work: 1715 * // - It may require correct/in-range values for request initialization. 1716 * // - It may require specifying regional endpoints when creating the service client as shown in 1717 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1718 * try (InstancesClient instancesClient = InstancesClient.create()) { 1719 * GetIamPolicyInstanceRequest request = 1720 * GetIamPolicyInstanceRequest.newBuilder() 1721 * .setOptionsRequestedPolicyVersion(-574521795) 1722 * .setProject("project-309310695") 1723 * .setResource("resource-341064690") 1724 * .setZone("zone3744684") 1725 * .build(); 1726 * ApiFuture<Policy> future = instancesClient.getIamPolicyCallable().futureCall(request); 1727 * // Do something. 1728 * Policy response = future.get(); 1729 * } 1730 * }</pre> 1731 */ getIamPolicyCallable()1732 public final UnaryCallable<GetIamPolicyInstanceRequest, Policy> getIamPolicyCallable() { 1733 return stub.getIamPolicyCallable(); 1734 } 1735 1736 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1737 /** 1738 * Returns the screenshot from the specified instance. 1739 * 1740 * <p>Sample code: 1741 * 1742 * <pre>{@code 1743 * // This snippet has been automatically generated and should be regarded as a code template only. 1744 * // It will require modifications to work: 1745 * // - It may require correct/in-range values for request initialization. 1746 * // - It may require specifying regional endpoints when creating the service client as shown in 1747 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1748 * try (InstancesClient instancesClient = InstancesClient.create()) { 1749 * String project = "project-309310695"; 1750 * String zone = "zone3744684"; 1751 * String instance = "instance555127957"; 1752 * Screenshot response = instancesClient.getScreenshot(project, zone, instance); 1753 * } 1754 * }</pre> 1755 * 1756 * @param project Project ID for this request. 1757 * @param zone The name of the zone for this request. 1758 * @param instance Name of the instance scoping this request. 1759 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1760 */ getScreenshot(String project, String zone, String instance)1761 public final Screenshot getScreenshot(String project, String zone, String instance) { 1762 GetScreenshotInstanceRequest request = 1763 GetScreenshotInstanceRequest.newBuilder() 1764 .setProject(project) 1765 .setZone(zone) 1766 .setInstance(instance) 1767 .build(); 1768 return getScreenshot(request); 1769 } 1770 1771 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1772 /** 1773 * Returns the screenshot from the specified instance. 1774 * 1775 * <p>Sample code: 1776 * 1777 * <pre>{@code 1778 * // This snippet has been automatically generated and should be regarded as a code template only. 1779 * // It will require modifications to work: 1780 * // - It may require correct/in-range values for request initialization. 1781 * // - It may require specifying regional endpoints when creating the service client as shown in 1782 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1783 * try (InstancesClient instancesClient = InstancesClient.create()) { 1784 * GetScreenshotInstanceRequest request = 1785 * GetScreenshotInstanceRequest.newBuilder() 1786 * .setInstance("instance555127957") 1787 * .setProject("project-309310695") 1788 * .setZone("zone3744684") 1789 * .build(); 1790 * Screenshot response = instancesClient.getScreenshot(request); 1791 * } 1792 * }</pre> 1793 * 1794 * @param request The request object containing all of the parameters for the API call. 1795 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1796 */ getScreenshot(GetScreenshotInstanceRequest request)1797 public final Screenshot getScreenshot(GetScreenshotInstanceRequest request) { 1798 return getScreenshotCallable().call(request); 1799 } 1800 1801 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1802 /** 1803 * Returns the screenshot from the specified instance. 1804 * 1805 * <p>Sample code: 1806 * 1807 * <pre>{@code 1808 * // This snippet has been automatically generated and should be regarded as a code template only. 1809 * // It will require modifications to work: 1810 * // - It may require correct/in-range values for request initialization. 1811 * // - It may require specifying regional endpoints when creating the service client as shown in 1812 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1813 * try (InstancesClient instancesClient = InstancesClient.create()) { 1814 * GetScreenshotInstanceRequest request = 1815 * GetScreenshotInstanceRequest.newBuilder() 1816 * .setInstance("instance555127957") 1817 * .setProject("project-309310695") 1818 * .setZone("zone3744684") 1819 * .build(); 1820 * ApiFuture<Screenshot> future = instancesClient.getScreenshotCallable().futureCall(request); 1821 * // Do something. 1822 * Screenshot response = future.get(); 1823 * } 1824 * }</pre> 1825 */ getScreenshotCallable()1826 public final UnaryCallable<GetScreenshotInstanceRequest, Screenshot> getScreenshotCallable() { 1827 return stub.getScreenshotCallable(); 1828 } 1829 1830 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1831 /** 1832 * Returns the last 1 MB of serial port output from the specified instance. 1833 * 1834 * <p>Sample code: 1835 * 1836 * <pre>{@code 1837 * // This snippet has been automatically generated and should be regarded as a code template only. 1838 * // It will require modifications to work: 1839 * // - It may require correct/in-range values for request initialization. 1840 * // - It may require specifying regional endpoints when creating the service client as shown in 1841 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1842 * try (InstancesClient instancesClient = InstancesClient.create()) { 1843 * String project = "project-309310695"; 1844 * String zone = "zone3744684"; 1845 * String instance = "instance555127957"; 1846 * SerialPortOutput response = instancesClient.getSerialPortOutput(project, zone, instance); 1847 * } 1848 * }</pre> 1849 * 1850 * @param project Project ID for this request. 1851 * @param zone The name of the zone for this request. 1852 * @param instance Name of the instance for this request. 1853 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1854 */ getSerialPortOutput(String project, String zone, String instance)1855 public final SerialPortOutput getSerialPortOutput(String project, String zone, String instance) { 1856 GetSerialPortOutputInstanceRequest request = 1857 GetSerialPortOutputInstanceRequest.newBuilder() 1858 .setProject(project) 1859 .setZone(zone) 1860 .setInstance(instance) 1861 .build(); 1862 return getSerialPortOutput(request); 1863 } 1864 1865 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1866 /** 1867 * Returns the last 1 MB of serial port output from the specified instance. 1868 * 1869 * <p>Sample code: 1870 * 1871 * <pre>{@code 1872 * // This snippet has been automatically generated and should be regarded as a code template only. 1873 * // It will require modifications to work: 1874 * // - It may require correct/in-range values for request initialization. 1875 * // - It may require specifying regional endpoints when creating the service client as shown in 1876 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1877 * try (InstancesClient instancesClient = InstancesClient.create()) { 1878 * GetSerialPortOutputInstanceRequest request = 1879 * GetSerialPortOutputInstanceRequest.newBuilder() 1880 * .setInstance("instance555127957") 1881 * .setPort(3446913) 1882 * .setProject("project-309310695") 1883 * .setStart(109757538) 1884 * .setZone("zone3744684") 1885 * .build(); 1886 * SerialPortOutput response = instancesClient.getSerialPortOutput(request); 1887 * } 1888 * }</pre> 1889 * 1890 * @param request The request object containing all of the parameters for the API call. 1891 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1892 */ getSerialPortOutput(GetSerialPortOutputInstanceRequest request)1893 public final SerialPortOutput getSerialPortOutput(GetSerialPortOutputInstanceRequest request) { 1894 return getSerialPortOutputCallable().call(request); 1895 } 1896 1897 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1898 /** 1899 * Returns the last 1 MB of serial port output from the specified instance. 1900 * 1901 * <p>Sample code: 1902 * 1903 * <pre>{@code 1904 * // This snippet has been automatically generated and should be regarded as a code template only. 1905 * // It will require modifications to work: 1906 * // - It may require correct/in-range values for request initialization. 1907 * // - It may require specifying regional endpoints when creating the service client as shown in 1908 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1909 * try (InstancesClient instancesClient = InstancesClient.create()) { 1910 * GetSerialPortOutputInstanceRequest request = 1911 * GetSerialPortOutputInstanceRequest.newBuilder() 1912 * .setInstance("instance555127957") 1913 * .setPort(3446913) 1914 * .setProject("project-309310695") 1915 * .setStart(109757538) 1916 * .setZone("zone3744684") 1917 * .build(); 1918 * ApiFuture<SerialPortOutput> future = 1919 * instancesClient.getSerialPortOutputCallable().futureCall(request); 1920 * // Do something. 1921 * SerialPortOutput response = future.get(); 1922 * } 1923 * }</pre> 1924 */ 1925 public final UnaryCallable<GetSerialPortOutputInstanceRequest, SerialPortOutput> getSerialPortOutputCallable()1926 getSerialPortOutputCallable() { 1927 return stub.getSerialPortOutputCallable(); 1928 } 1929 1930 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1931 /** 1932 * Returns the Shielded Instance Identity of an instance 1933 * 1934 * <p>Sample code: 1935 * 1936 * <pre>{@code 1937 * // This snippet has been automatically generated and should be regarded as a code template only. 1938 * // It will require modifications to work: 1939 * // - It may require correct/in-range values for request initialization. 1940 * // - It may require specifying regional endpoints when creating the service client as shown in 1941 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1942 * try (InstancesClient instancesClient = InstancesClient.create()) { 1943 * String project = "project-309310695"; 1944 * String zone = "zone3744684"; 1945 * String instance = "instance555127957"; 1946 * ShieldedInstanceIdentity response = 1947 * instancesClient.getShieldedInstanceIdentity(project, zone, instance); 1948 * } 1949 * }</pre> 1950 * 1951 * @param project Project ID for this request. 1952 * @param zone The name of the zone for this request. 1953 * @param instance Name or id of the instance scoping this request. 1954 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1955 */ getShieldedInstanceIdentity( String project, String zone, String instance)1956 public final ShieldedInstanceIdentity getShieldedInstanceIdentity( 1957 String project, String zone, String instance) { 1958 GetShieldedInstanceIdentityInstanceRequest request = 1959 GetShieldedInstanceIdentityInstanceRequest.newBuilder() 1960 .setProject(project) 1961 .setZone(zone) 1962 .setInstance(instance) 1963 .build(); 1964 return getShieldedInstanceIdentity(request); 1965 } 1966 1967 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1968 /** 1969 * Returns the Shielded Instance Identity of an instance 1970 * 1971 * <p>Sample code: 1972 * 1973 * <pre>{@code 1974 * // This snippet has been automatically generated and should be regarded as a code template only. 1975 * // It will require modifications to work: 1976 * // - It may require correct/in-range values for request initialization. 1977 * // - It may require specifying regional endpoints when creating the service client as shown in 1978 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 1979 * try (InstancesClient instancesClient = InstancesClient.create()) { 1980 * GetShieldedInstanceIdentityInstanceRequest request = 1981 * GetShieldedInstanceIdentityInstanceRequest.newBuilder() 1982 * .setInstance("instance555127957") 1983 * .setProject("project-309310695") 1984 * .setZone("zone3744684") 1985 * .build(); 1986 * ShieldedInstanceIdentity response = instancesClient.getShieldedInstanceIdentity(request); 1987 * } 1988 * }</pre> 1989 * 1990 * @param request The request object containing all of the parameters for the API call. 1991 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 1992 */ getShieldedInstanceIdentity( GetShieldedInstanceIdentityInstanceRequest request)1993 public final ShieldedInstanceIdentity getShieldedInstanceIdentity( 1994 GetShieldedInstanceIdentityInstanceRequest request) { 1995 return getShieldedInstanceIdentityCallable().call(request); 1996 } 1997 1998 // AUTO-GENERATED DOCUMENTATION AND METHOD. 1999 /** 2000 * Returns the Shielded Instance Identity of an instance 2001 * 2002 * <p>Sample code: 2003 * 2004 * <pre>{@code 2005 * // This snippet has been automatically generated and should be regarded as a code template only. 2006 * // It will require modifications to work: 2007 * // - It may require correct/in-range values for request initialization. 2008 * // - It may require specifying regional endpoints when creating the service client as shown in 2009 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2010 * try (InstancesClient instancesClient = InstancesClient.create()) { 2011 * GetShieldedInstanceIdentityInstanceRequest request = 2012 * GetShieldedInstanceIdentityInstanceRequest.newBuilder() 2013 * .setInstance("instance555127957") 2014 * .setProject("project-309310695") 2015 * .setZone("zone3744684") 2016 * .build(); 2017 * ApiFuture<ShieldedInstanceIdentity> future = 2018 * instancesClient.getShieldedInstanceIdentityCallable().futureCall(request); 2019 * // Do something. 2020 * ShieldedInstanceIdentity response = future.get(); 2021 * } 2022 * }</pre> 2023 */ 2024 public final UnaryCallable<GetShieldedInstanceIdentityInstanceRequest, ShieldedInstanceIdentity> getShieldedInstanceIdentityCallable()2025 getShieldedInstanceIdentityCallable() { 2026 return stub.getShieldedInstanceIdentityCallable(); 2027 } 2028 2029 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2030 /** 2031 * Creates an instance resource in the specified project using the data included in the request. 2032 * 2033 * <p>Sample code: 2034 * 2035 * <pre>{@code 2036 * // This snippet has been automatically generated and should be regarded as a code template only. 2037 * // It will require modifications to work: 2038 * // - It may require correct/in-range values for request initialization. 2039 * // - It may require specifying regional endpoints when creating the service client as shown in 2040 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2041 * try (InstancesClient instancesClient = InstancesClient.create()) { 2042 * String project = "project-309310695"; 2043 * String zone = "zone3744684"; 2044 * Instance instanceResource = Instance.newBuilder().build(); 2045 * Operation response = instancesClient.insertAsync(project, zone, instanceResource).get(); 2046 * } 2047 * }</pre> 2048 * 2049 * @param project Project ID for this request. 2050 * @param zone The name of the zone for this request. 2051 * @param instanceResource The body resource for this request 2052 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2053 */ insertAsync( String project, String zone, Instance instanceResource)2054 public final OperationFuture<Operation, Operation> insertAsync( 2055 String project, String zone, Instance instanceResource) { 2056 InsertInstanceRequest request = 2057 InsertInstanceRequest.newBuilder() 2058 .setProject(project) 2059 .setZone(zone) 2060 .setInstanceResource(instanceResource) 2061 .build(); 2062 return insertAsync(request); 2063 } 2064 2065 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2066 /** 2067 * Creates an instance resource in the specified project using the data included in the request. 2068 * 2069 * <p>Sample code: 2070 * 2071 * <pre>{@code 2072 * // This snippet has been automatically generated and should be regarded as a code template only. 2073 * // It will require modifications to work: 2074 * // - It may require correct/in-range values for request initialization. 2075 * // - It may require specifying regional endpoints when creating the service client as shown in 2076 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2077 * try (InstancesClient instancesClient = InstancesClient.create()) { 2078 * InsertInstanceRequest request = 2079 * InsertInstanceRequest.newBuilder() 2080 * .setInstanceResource(Instance.newBuilder().build()) 2081 * .setProject("project-309310695") 2082 * .setRequestId("requestId693933066") 2083 * .setSourceInstanceTemplate("sourceInstanceTemplate949712490") 2084 * .setSourceMachineImage("sourceMachineImage1261073679") 2085 * .setZone("zone3744684") 2086 * .build(); 2087 * Operation response = instancesClient.insertAsync(request).get(); 2088 * } 2089 * }</pre> 2090 * 2091 * @param request The request object containing all of the parameters for the API call. 2092 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2093 */ 2094 @BetaApi( 2095 "The surface for long-running operations is not stable yet and may change in the future.") insertAsync(InsertInstanceRequest request)2096 public final OperationFuture<Operation, Operation> insertAsync(InsertInstanceRequest request) { 2097 return insertOperationCallable().futureCall(request); 2098 } 2099 2100 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2101 /** 2102 * Creates an instance resource in the specified project using the data included in the request. 2103 * 2104 * <p>Sample code: 2105 * 2106 * <pre>{@code 2107 * // This snippet has been automatically generated and should be regarded as a code template only. 2108 * // It will require modifications to work: 2109 * // - It may require correct/in-range values for request initialization. 2110 * // - It may require specifying regional endpoints when creating the service client as shown in 2111 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2112 * try (InstancesClient instancesClient = InstancesClient.create()) { 2113 * InsertInstanceRequest request = 2114 * InsertInstanceRequest.newBuilder() 2115 * .setInstanceResource(Instance.newBuilder().build()) 2116 * .setProject("project-309310695") 2117 * .setRequestId("requestId693933066") 2118 * .setSourceInstanceTemplate("sourceInstanceTemplate949712490") 2119 * .setSourceMachineImage("sourceMachineImage1261073679") 2120 * .setZone("zone3744684") 2121 * .build(); 2122 * OperationFuture<Operation, Operation> future = 2123 * instancesClient.insertOperationCallable().futureCall(request); 2124 * // Do something. 2125 * Operation response = future.get(); 2126 * } 2127 * }</pre> 2128 */ 2129 public final OperationCallable<InsertInstanceRequest, Operation, Operation> insertOperationCallable()2130 insertOperationCallable() { 2131 return stub.insertOperationCallable(); 2132 } 2133 2134 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2135 /** 2136 * Creates an instance resource in the specified project using the data included in the request. 2137 * 2138 * <p>Sample code: 2139 * 2140 * <pre>{@code 2141 * // This snippet has been automatically generated and should be regarded as a code template only. 2142 * // It will require modifications to work: 2143 * // - It may require correct/in-range values for request initialization. 2144 * // - It may require specifying regional endpoints when creating the service client as shown in 2145 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2146 * try (InstancesClient instancesClient = InstancesClient.create()) { 2147 * InsertInstanceRequest request = 2148 * InsertInstanceRequest.newBuilder() 2149 * .setInstanceResource(Instance.newBuilder().build()) 2150 * .setProject("project-309310695") 2151 * .setRequestId("requestId693933066") 2152 * .setSourceInstanceTemplate("sourceInstanceTemplate949712490") 2153 * .setSourceMachineImage("sourceMachineImage1261073679") 2154 * .setZone("zone3744684") 2155 * .build(); 2156 * ApiFuture<Operation> future = instancesClient.insertCallable().futureCall(request); 2157 * // Do something. 2158 * Operation response = future.get(); 2159 * } 2160 * }</pre> 2161 */ insertCallable()2162 public final UnaryCallable<InsertInstanceRequest, Operation> insertCallable() { 2163 return stub.insertCallable(); 2164 } 2165 2166 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2167 /** 2168 * Retrieves the list of instances contained within the specified zone. 2169 * 2170 * <p>Sample code: 2171 * 2172 * <pre>{@code 2173 * // This snippet has been automatically generated and should be regarded as a code template only. 2174 * // It will require modifications to work: 2175 * // - It may require correct/in-range values for request initialization. 2176 * // - It may require specifying regional endpoints when creating the service client as shown in 2177 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2178 * try (InstancesClient instancesClient = InstancesClient.create()) { 2179 * String project = "project-309310695"; 2180 * String zone = "zone3744684"; 2181 * for (Instance element : instancesClient.list(project, zone).iterateAll()) { 2182 * // doThingsWith(element); 2183 * } 2184 * } 2185 * }</pre> 2186 * 2187 * @param project Project ID for this request. 2188 * @param zone The name of the zone for this request. 2189 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2190 */ list(String project, String zone)2191 public final ListPagedResponse list(String project, String zone) { 2192 ListInstancesRequest request = 2193 ListInstancesRequest.newBuilder().setProject(project).setZone(zone).build(); 2194 return list(request); 2195 } 2196 2197 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2198 /** 2199 * Retrieves the list of instances contained within the specified zone. 2200 * 2201 * <p>Sample code: 2202 * 2203 * <pre>{@code 2204 * // This snippet has been automatically generated and should be regarded as a code template only. 2205 * // It will require modifications to work: 2206 * // - It may require correct/in-range values for request initialization. 2207 * // - It may require specifying regional endpoints when creating the service client as shown in 2208 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2209 * try (InstancesClient instancesClient = InstancesClient.create()) { 2210 * ListInstancesRequest request = 2211 * ListInstancesRequest.newBuilder() 2212 * .setFilter("filter-1274492040") 2213 * .setMaxResults(1128457243) 2214 * .setOrderBy("orderBy-1207110587") 2215 * .setPageToken("pageToken873572522") 2216 * .setProject("project-309310695") 2217 * .setReturnPartialSuccess(true) 2218 * .setZone("zone3744684") 2219 * .build(); 2220 * for (Instance element : instancesClient.list(request).iterateAll()) { 2221 * // doThingsWith(element); 2222 * } 2223 * } 2224 * }</pre> 2225 * 2226 * @param request The request object containing all of the parameters for the API call. 2227 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2228 */ list(ListInstancesRequest request)2229 public final ListPagedResponse list(ListInstancesRequest request) { 2230 return listPagedCallable().call(request); 2231 } 2232 2233 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2234 /** 2235 * Retrieves the list of instances contained within the specified zone. 2236 * 2237 * <p>Sample code: 2238 * 2239 * <pre>{@code 2240 * // This snippet has been automatically generated and should be regarded as a code template only. 2241 * // It will require modifications to work: 2242 * // - It may require correct/in-range values for request initialization. 2243 * // - It may require specifying regional endpoints when creating the service client as shown in 2244 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2245 * try (InstancesClient instancesClient = InstancesClient.create()) { 2246 * ListInstancesRequest request = 2247 * ListInstancesRequest.newBuilder() 2248 * .setFilter("filter-1274492040") 2249 * .setMaxResults(1128457243) 2250 * .setOrderBy("orderBy-1207110587") 2251 * .setPageToken("pageToken873572522") 2252 * .setProject("project-309310695") 2253 * .setReturnPartialSuccess(true) 2254 * .setZone("zone3744684") 2255 * .build(); 2256 * ApiFuture<Instance> future = instancesClient.listPagedCallable().futureCall(request); 2257 * // Do something. 2258 * for (Instance element : future.get().iterateAll()) { 2259 * // doThingsWith(element); 2260 * } 2261 * } 2262 * }</pre> 2263 */ listPagedCallable()2264 public final UnaryCallable<ListInstancesRequest, ListPagedResponse> listPagedCallable() { 2265 return stub.listPagedCallable(); 2266 } 2267 2268 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2269 /** 2270 * Retrieves the list of instances contained within the specified zone. 2271 * 2272 * <p>Sample code: 2273 * 2274 * <pre>{@code 2275 * // This snippet has been automatically generated and should be regarded as a code template only. 2276 * // It will require modifications to work: 2277 * // - It may require correct/in-range values for request initialization. 2278 * // - It may require specifying regional endpoints when creating the service client as shown in 2279 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2280 * try (InstancesClient instancesClient = InstancesClient.create()) { 2281 * ListInstancesRequest request = 2282 * ListInstancesRequest.newBuilder() 2283 * .setFilter("filter-1274492040") 2284 * .setMaxResults(1128457243) 2285 * .setOrderBy("orderBy-1207110587") 2286 * .setPageToken("pageToken873572522") 2287 * .setProject("project-309310695") 2288 * .setReturnPartialSuccess(true) 2289 * .setZone("zone3744684") 2290 * .build(); 2291 * while (true) { 2292 * InstanceList response = instancesClient.listCallable().call(request); 2293 * for (Instance element : response.getItemsList()) { 2294 * // doThingsWith(element); 2295 * } 2296 * String nextPageToken = response.getNextPageToken(); 2297 * if (!Strings.isNullOrEmpty(nextPageToken)) { 2298 * request = request.toBuilder().setPageToken(nextPageToken).build(); 2299 * } else { 2300 * break; 2301 * } 2302 * } 2303 * } 2304 * }</pre> 2305 */ listCallable()2306 public final UnaryCallable<ListInstancesRequest, InstanceList> listCallable() { 2307 return stub.listCallable(); 2308 } 2309 2310 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2311 /** 2312 * Retrieves a list of resources that refer to the VM instance specified in the request. For 2313 * example, if the VM instance is part of a managed or unmanaged instance group, the referrers 2314 * list includes the instance group. For more information, read Viewing referrers to VM instances. 2315 * 2316 * <p>Sample code: 2317 * 2318 * <pre>{@code 2319 * // This snippet has been automatically generated and should be regarded as a code template only. 2320 * // It will require modifications to work: 2321 * // - It may require correct/in-range values for request initialization. 2322 * // - It may require specifying regional endpoints when creating the service client as shown in 2323 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2324 * try (InstancesClient instancesClient = InstancesClient.create()) { 2325 * String project = "project-309310695"; 2326 * String zone = "zone3744684"; 2327 * String instance = "instance555127957"; 2328 * for (Reference element : 2329 * instancesClient.listReferrers(project, zone, instance).iterateAll()) { 2330 * // doThingsWith(element); 2331 * } 2332 * } 2333 * }</pre> 2334 * 2335 * @param project Project ID for this request. 2336 * @param zone The name of the zone for this request. 2337 * @param instance Name of the target instance scoping this request, or '-' if the request should 2338 * span over all instances in the container. 2339 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2340 */ listReferrers( String project, String zone, String instance)2341 public final ListReferrersPagedResponse listReferrers( 2342 String project, String zone, String instance) { 2343 ListReferrersInstancesRequest request = 2344 ListReferrersInstancesRequest.newBuilder() 2345 .setProject(project) 2346 .setZone(zone) 2347 .setInstance(instance) 2348 .build(); 2349 return listReferrers(request); 2350 } 2351 2352 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2353 /** 2354 * Retrieves a list of resources that refer to the VM instance specified in the request. For 2355 * example, if the VM instance is part of a managed or unmanaged instance group, the referrers 2356 * list includes the instance group. For more information, read Viewing referrers to VM instances. 2357 * 2358 * <p>Sample code: 2359 * 2360 * <pre>{@code 2361 * // This snippet has been automatically generated and should be regarded as a code template only. 2362 * // It will require modifications to work: 2363 * // - It may require correct/in-range values for request initialization. 2364 * // - It may require specifying regional endpoints when creating the service client as shown in 2365 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2366 * try (InstancesClient instancesClient = InstancesClient.create()) { 2367 * ListReferrersInstancesRequest request = 2368 * ListReferrersInstancesRequest.newBuilder() 2369 * .setFilter("filter-1274492040") 2370 * .setInstance("instance555127957") 2371 * .setMaxResults(1128457243) 2372 * .setOrderBy("orderBy-1207110587") 2373 * .setPageToken("pageToken873572522") 2374 * .setProject("project-309310695") 2375 * .setReturnPartialSuccess(true) 2376 * .setZone("zone3744684") 2377 * .build(); 2378 * for (Reference element : instancesClient.listReferrers(request).iterateAll()) { 2379 * // doThingsWith(element); 2380 * } 2381 * } 2382 * }</pre> 2383 * 2384 * @param request The request object containing all of the parameters for the API call. 2385 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2386 */ listReferrers(ListReferrersInstancesRequest request)2387 public final ListReferrersPagedResponse listReferrers(ListReferrersInstancesRequest request) { 2388 return listReferrersPagedCallable().call(request); 2389 } 2390 2391 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2392 /** 2393 * Retrieves a list of resources that refer to the VM instance specified in the request. For 2394 * example, if the VM instance is part of a managed or unmanaged instance group, the referrers 2395 * list includes the instance group. For more information, read Viewing referrers to VM instances. 2396 * 2397 * <p>Sample code: 2398 * 2399 * <pre>{@code 2400 * // This snippet has been automatically generated and should be regarded as a code template only. 2401 * // It will require modifications to work: 2402 * // - It may require correct/in-range values for request initialization. 2403 * // - It may require specifying regional endpoints when creating the service client as shown in 2404 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2405 * try (InstancesClient instancesClient = InstancesClient.create()) { 2406 * ListReferrersInstancesRequest request = 2407 * ListReferrersInstancesRequest.newBuilder() 2408 * .setFilter("filter-1274492040") 2409 * .setInstance("instance555127957") 2410 * .setMaxResults(1128457243) 2411 * .setOrderBy("orderBy-1207110587") 2412 * .setPageToken("pageToken873572522") 2413 * .setProject("project-309310695") 2414 * .setReturnPartialSuccess(true) 2415 * .setZone("zone3744684") 2416 * .build(); 2417 * ApiFuture<Reference> future = 2418 * instancesClient.listReferrersPagedCallable().futureCall(request); 2419 * // Do something. 2420 * for (Reference element : future.get().iterateAll()) { 2421 * // doThingsWith(element); 2422 * } 2423 * } 2424 * }</pre> 2425 */ 2426 public final UnaryCallable<ListReferrersInstancesRequest, ListReferrersPagedResponse> listReferrersPagedCallable()2427 listReferrersPagedCallable() { 2428 return stub.listReferrersPagedCallable(); 2429 } 2430 2431 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2432 /** 2433 * Retrieves a list of resources that refer to the VM instance specified in the request. For 2434 * example, if the VM instance is part of a managed or unmanaged instance group, the referrers 2435 * list includes the instance group. For more information, read Viewing referrers to VM instances. 2436 * 2437 * <p>Sample code: 2438 * 2439 * <pre>{@code 2440 * // This snippet has been automatically generated and should be regarded as a code template only. 2441 * // It will require modifications to work: 2442 * // - It may require correct/in-range values for request initialization. 2443 * // - It may require specifying regional endpoints when creating the service client as shown in 2444 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2445 * try (InstancesClient instancesClient = InstancesClient.create()) { 2446 * ListReferrersInstancesRequest request = 2447 * ListReferrersInstancesRequest.newBuilder() 2448 * .setFilter("filter-1274492040") 2449 * .setInstance("instance555127957") 2450 * .setMaxResults(1128457243) 2451 * .setOrderBy("orderBy-1207110587") 2452 * .setPageToken("pageToken873572522") 2453 * .setProject("project-309310695") 2454 * .setReturnPartialSuccess(true) 2455 * .setZone("zone3744684") 2456 * .build(); 2457 * while (true) { 2458 * InstanceListReferrers response = instancesClient.listReferrersCallable().call(request); 2459 * for (Reference element : response.getItemsList()) { 2460 * // doThingsWith(element); 2461 * } 2462 * String nextPageToken = response.getNextPageToken(); 2463 * if (!Strings.isNullOrEmpty(nextPageToken)) { 2464 * request = request.toBuilder().setPageToken(nextPageToken).build(); 2465 * } else { 2466 * break; 2467 * } 2468 * } 2469 * } 2470 * }</pre> 2471 */ 2472 public final UnaryCallable<ListReferrersInstancesRequest, InstanceListReferrers> listReferrersCallable()2473 listReferrersCallable() { 2474 return stub.listReferrersCallable(); 2475 } 2476 2477 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2478 /** 2479 * Removes resource policies from an instance. 2480 * 2481 * <p>Sample code: 2482 * 2483 * <pre>{@code 2484 * // This snippet has been automatically generated and should be regarded as a code template only. 2485 * // It will require modifications to work: 2486 * // - It may require correct/in-range values for request initialization. 2487 * // - It may require specifying regional endpoints when creating the service client as shown in 2488 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2489 * try (InstancesClient instancesClient = InstancesClient.create()) { 2490 * String project = "project-309310695"; 2491 * String zone = "zone3744684"; 2492 * String instance = "instance555127957"; 2493 * InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource = 2494 * InstancesRemoveResourcePoliciesRequest.newBuilder().build(); 2495 * Operation response = 2496 * instancesClient 2497 * .removeResourcePoliciesAsync( 2498 * project, zone, instance, instancesRemoveResourcePoliciesRequestResource) 2499 * .get(); 2500 * } 2501 * }</pre> 2502 * 2503 * @param project Project ID for this request. 2504 * @param zone The name of the zone for this request. 2505 * @param instance The instance name for this request. 2506 * @param instancesRemoveResourcePoliciesRequestResource The body resource for this request 2507 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2508 */ removeResourcePoliciesAsync( String project, String zone, String instance, InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource)2509 public final OperationFuture<Operation, Operation> removeResourcePoliciesAsync( 2510 String project, 2511 String zone, 2512 String instance, 2513 InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource) { 2514 RemoveResourcePoliciesInstanceRequest request = 2515 RemoveResourcePoliciesInstanceRequest.newBuilder() 2516 .setProject(project) 2517 .setZone(zone) 2518 .setInstance(instance) 2519 .setInstancesRemoveResourcePoliciesRequestResource( 2520 instancesRemoveResourcePoliciesRequestResource) 2521 .build(); 2522 return removeResourcePoliciesAsync(request); 2523 } 2524 2525 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2526 /** 2527 * Removes resource policies from an instance. 2528 * 2529 * <p>Sample code: 2530 * 2531 * <pre>{@code 2532 * // This snippet has been automatically generated and should be regarded as a code template only. 2533 * // It will require modifications to work: 2534 * // - It may require correct/in-range values for request initialization. 2535 * // - It may require specifying regional endpoints when creating the service client as shown in 2536 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2537 * try (InstancesClient instancesClient = InstancesClient.create()) { 2538 * RemoveResourcePoliciesInstanceRequest request = 2539 * RemoveResourcePoliciesInstanceRequest.newBuilder() 2540 * .setInstance("instance555127957") 2541 * .setInstancesRemoveResourcePoliciesRequestResource( 2542 * InstancesRemoveResourcePoliciesRequest.newBuilder().build()) 2543 * .setProject("project-309310695") 2544 * .setRequestId("requestId693933066") 2545 * .setZone("zone3744684") 2546 * .build(); 2547 * Operation response = instancesClient.removeResourcePoliciesAsync(request).get(); 2548 * } 2549 * }</pre> 2550 * 2551 * @param request The request object containing all of the parameters for the API call. 2552 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2553 */ 2554 @BetaApi( 2555 "The surface for long-running operations is not stable yet and may change in the future.") removeResourcePoliciesAsync( RemoveResourcePoliciesInstanceRequest request)2556 public final OperationFuture<Operation, Operation> removeResourcePoliciesAsync( 2557 RemoveResourcePoliciesInstanceRequest request) { 2558 return removeResourcePoliciesOperationCallable().futureCall(request); 2559 } 2560 2561 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2562 /** 2563 * Removes resource policies from an instance. 2564 * 2565 * <p>Sample code: 2566 * 2567 * <pre>{@code 2568 * // This snippet has been automatically generated and should be regarded as a code template only. 2569 * // It will require modifications to work: 2570 * // - It may require correct/in-range values for request initialization. 2571 * // - It may require specifying regional endpoints when creating the service client as shown in 2572 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2573 * try (InstancesClient instancesClient = InstancesClient.create()) { 2574 * RemoveResourcePoliciesInstanceRequest request = 2575 * RemoveResourcePoliciesInstanceRequest.newBuilder() 2576 * .setInstance("instance555127957") 2577 * .setInstancesRemoveResourcePoliciesRequestResource( 2578 * InstancesRemoveResourcePoliciesRequest.newBuilder().build()) 2579 * .setProject("project-309310695") 2580 * .setRequestId("requestId693933066") 2581 * .setZone("zone3744684") 2582 * .build(); 2583 * OperationFuture<Operation, Operation> future = 2584 * instancesClient.removeResourcePoliciesOperationCallable().futureCall(request); 2585 * // Do something. 2586 * Operation response = future.get(); 2587 * } 2588 * }</pre> 2589 */ 2590 public final OperationCallable<RemoveResourcePoliciesInstanceRequest, Operation, Operation> removeResourcePoliciesOperationCallable()2591 removeResourcePoliciesOperationCallable() { 2592 return stub.removeResourcePoliciesOperationCallable(); 2593 } 2594 2595 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2596 /** 2597 * Removes resource policies from an instance. 2598 * 2599 * <p>Sample code: 2600 * 2601 * <pre>{@code 2602 * // This snippet has been automatically generated and should be regarded as a code template only. 2603 * // It will require modifications to work: 2604 * // - It may require correct/in-range values for request initialization. 2605 * // - It may require specifying regional endpoints when creating the service client as shown in 2606 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2607 * try (InstancesClient instancesClient = InstancesClient.create()) { 2608 * RemoveResourcePoliciesInstanceRequest request = 2609 * RemoveResourcePoliciesInstanceRequest.newBuilder() 2610 * .setInstance("instance555127957") 2611 * .setInstancesRemoveResourcePoliciesRequestResource( 2612 * InstancesRemoveResourcePoliciesRequest.newBuilder().build()) 2613 * .setProject("project-309310695") 2614 * .setRequestId("requestId693933066") 2615 * .setZone("zone3744684") 2616 * .build(); 2617 * ApiFuture<Operation> future = 2618 * instancesClient.removeResourcePoliciesCallable().futureCall(request); 2619 * // Do something. 2620 * Operation response = future.get(); 2621 * } 2622 * }</pre> 2623 */ 2624 public final UnaryCallable<RemoveResourcePoliciesInstanceRequest, Operation> removeResourcePoliciesCallable()2625 removeResourcePoliciesCallable() { 2626 return stub.removeResourcePoliciesCallable(); 2627 } 2628 2629 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2630 /** 2631 * Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. 2632 * For more information, see Resetting an instance. 2633 * 2634 * <p>Sample code: 2635 * 2636 * <pre>{@code 2637 * // This snippet has been automatically generated and should be regarded as a code template only. 2638 * // It will require modifications to work: 2639 * // - It may require correct/in-range values for request initialization. 2640 * // - It may require specifying regional endpoints when creating the service client as shown in 2641 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2642 * try (InstancesClient instancesClient = InstancesClient.create()) { 2643 * String project = "project-309310695"; 2644 * String zone = "zone3744684"; 2645 * String instance = "instance555127957"; 2646 * Operation response = instancesClient.resetAsync(project, zone, instance).get(); 2647 * } 2648 * }</pre> 2649 * 2650 * @param project Project ID for this request. 2651 * @param zone The name of the zone for this request. 2652 * @param instance Name of the instance scoping this request. 2653 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2654 */ resetAsync( String project, String zone, String instance)2655 public final OperationFuture<Operation, Operation> resetAsync( 2656 String project, String zone, String instance) { 2657 ResetInstanceRequest request = 2658 ResetInstanceRequest.newBuilder() 2659 .setProject(project) 2660 .setZone(zone) 2661 .setInstance(instance) 2662 .build(); 2663 return resetAsync(request); 2664 } 2665 2666 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2667 /** 2668 * Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. 2669 * For more information, see Resetting an instance. 2670 * 2671 * <p>Sample code: 2672 * 2673 * <pre>{@code 2674 * // This snippet has been automatically generated and should be regarded as a code template only. 2675 * // It will require modifications to work: 2676 * // - It may require correct/in-range values for request initialization. 2677 * // - It may require specifying regional endpoints when creating the service client as shown in 2678 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2679 * try (InstancesClient instancesClient = InstancesClient.create()) { 2680 * ResetInstanceRequest request = 2681 * ResetInstanceRequest.newBuilder() 2682 * .setInstance("instance555127957") 2683 * .setProject("project-309310695") 2684 * .setRequestId("requestId693933066") 2685 * .setZone("zone3744684") 2686 * .build(); 2687 * Operation response = instancesClient.resetAsync(request).get(); 2688 * } 2689 * }</pre> 2690 * 2691 * @param request The request object containing all of the parameters for the API call. 2692 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2693 */ 2694 @BetaApi( 2695 "The surface for long-running operations is not stable yet and may change in the future.") resetAsync(ResetInstanceRequest request)2696 public final OperationFuture<Operation, Operation> resetAsync(ResetInstanceRequest request) { 2697 return resetOperationCallable().futureCall(request); 2698 } 2699 2700 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2701 /** 2702 * Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. 2703 * For more information, see Resetting an instance. 2704 * 2705 * <p>Sample code: 2706 * 2707 * <pre>{@code 2708 * // This snippet has been automatically generated and should be regarded as a code template only. 2709 * // It will require modifications to work: 2710 * // - It may require correct/in-range values for request initialization. 2711 * // - It may require specifying regional endpoints when creating the service client as shown in 2712 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2713 * try (InstancesClient instancesClient = InstancesClient.create()) { 2714 * ResetInstanceRequest request = 2715 * ResetInstanceRequest.newBuilder() 2716 * .setInstance("instance555127957") 2717 * .setProject("project-309310695") 2718 * .setRequestId("requestId693933066") 2719 * .setZone("zone3744684") 2720 * .build(); 2721 * OperationFuture<Operation, Operation> future = 2722 * instancesClient.resetOperationCallable().futureCall(request); 2723 * // Do something. 2724 * Operation response = future.get(); 2725 * } 2726 * }</pre> 2727 */ 2728 public final OperationCallable<ResetInstanceRequest, Operation, Operation> resetOperationCallable()2729 resetOperationCallable() { 2730 return stub.resetOperationCallable(); 2731 } 2732 2733 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2734 /** 2735 * Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. 2736 * For more information, see Resetting an instance. 2737 * 2738 * <p>Sample code: 2739 * 2740 * <pre>{@code 2741 * // This snippet has been automatically generated and should be regarded as a code template only. 2742 * // It will require modifications to work: 2743 * // - It may require correct/in-range values for request initialization. 2744 * // - It may require specifying regional endpoints when creating the service client as shown in 2745 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2746 * try (InstancesClient instancesClient = InstancesClient.create()) { 2747 * ResetInstanceRequest request = 2748 * ResetInstanceRequest.newBuilder() 2749 * .setInstance("instance555127957") 2750 * .setProject("project-309310695") 2751 * .setRequestId("requestId693933066") 2752 * .setZone("zone3744684") 2753 * .build(); 2754 * ApiFuture<Operation> future = instancesClient.resetCallable().futureCall(request); 2755 * // Do something. 2756 * Operation response = future.get(); 2757 * } 2758 * }</pre> 2759 */ resetCallable()2760 public final UnaryCallable<ResetInstanceRequest, Operation> resetCallable() { 2761 return stub.resetCallable(); 2762 } 2763 2764 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2765 /** 2766 * Resumes an instance that was suspended using the instances().suspend method. 2767 * 2768 * <p>Sample code: 2769 * 2770 * <pre>{@code 2771 * // This snippet has been automatically generated and should be regarded as a code template only. 2772 * // It will require modifications to work: 2773 * // - It may require correct/in-range values for request initialization. 2774 * // - It may require specifying regional endpoints when creating the service client as shown in 2775 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2776 * try (InstancesClient instancesClient = InstancesClient.create()) { 2777 * String project = "project-309310695"; 2778 * String zone = "zone3744684"; 2779 * String instance = "instance555127957"; 2780 * Operation response = instancesClient.resumeAsync(project, zone, instance).get(); 2781 * } 2782 * }</pre> 2783 * 2784 * @param project Project ID for this request. 2785 * @param zone The name of the zone for this request. 2786 * @param instance Name of the instance resource to resume. 2787 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2788 */ resumeAsync( String project, String zone, String instance)2789 public final OperationFuture<Operation, Operation> resumeAsync( 2790 String project, String zone, String instance) { 2791 ResumeInstanceRequest request = 2792 ResumeInstanceRequest.newBuilder() 2793 .setProject(project) 2794 .setZone(zone) 2795 .setInstance(instance) 2796 .build(); 2797 return resumeAsync(request); 2798 } 2799 2800 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2801 /** 2802 * Resumes an instance that was suspended using the instances().suspend method. 2803 * 2804 * <p>Sample code: 2805 * 2806 * <pre>{@code 2807 * // This snippet has been automatically generated and should be regarded as a code template only. 2808 * // It will require modifications to work: 2809 * // - It may require correct/in-range values for request initialization. 2810 * // - It may require specifying regional endpoints when creating the service client as shown in 2811 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2812 * try (InstancesClient instancesClient = InstancesClient.create()) { 2813 * ResumeInstanceRequest request = 2814 * ResumeInstanceRequest.newBuilder() 2815 * .setInstance("instance555127957") 2816 * .setProject("project-309310695") 2817 * .setRequestId("requestId693933066") 2818 * .setZone("zone3744684") 2819 * .build(); 2820 * Operation response = instancesClient.resumeAsync(request).get(); 2821 * } 2822 * }</pre> 2823 * 2824 * @param request The request object containing all of the parameters for the API call. 2825 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2826 */ 2827 @BetaApi( 2828 "The surface for long-running operations is not stable yet and may change in the future.") resumeAsync(ResumeInstanceRequest request)2829 public final OperationFuture<Operation, Operation> resumeAsync(ResumeInstanceRequest request) { 2830 return resumeOperationCallable().futureCall(request); 2831 } 2832 2833 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2834 /** 2835 * Resumes an instance that was suspended using the instances().suspend method. 2836 * 2837 * <p>Sample code: 2838 * 2839 * <pre>{@code 2840 * // This snippet has been automatically generated and should be regarded as a code template only. 2841 * // It will require modifications to work: 2842 * // - It may require correct/in-range values for request initialization. 2843 * // - It may require specifying regional endpoints when creating the service client as shown in 2844 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2845 * try (InstancesClient instancesClient = InstancesClient.create()) { 2846 * ResumeInstanceRequest request = 2847 * ResumeInstanceRequest.newBuilder() 2848 * .setInstance("instance555127957") 2849 * .setProject("project-309310695") 2850 * .setRequestId("requestId693933066") 2851 * .setZone("zone3744684") 2852 * .build(); 2853 * OperationFuture<Operation, Operation> future = 2854 * instancesClient.resumeOperationCallable().futureCall(request); 2855 * // Do something. 2856 * Operation response = future.get(); 2857 * } 2858 * }</pre> 2859 */ 2860 public final OperationCallable<ResumeInstanceRequest, Operation, Operation> resumeOperationCallable()2861 resumeOperationCallable() { 2862 return stub.resumeOperationCallable(); 2863 } 2864 2865 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2866 /** 2867 * Resumes an instance that was suspended using the instances().suspend method. 2868 * 2869 * <p>Sample code: 2870 * 2871 * <pre>{@code 2872 * // This snippet has been automatically generated and should be regarded as a code template only. 2873 * // It will require modifications to work: 2874 * // - It may require correct/in-range values for request initialization. 2875 * // - It may require specifying regional endpoints when creating the service client as shown in 2876 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2877 * try (InstancesClient instancesClient = InstancesClient.create()) { 2878 * ResumeInstanceRequest request = 2879 * ResumeInstanceRequest.newBuilder() 2880 * .setInstance("instance555127957") 2881 * .setProject("project-309310695") 2882 * .setRequestId("requestId693933066") 2883 * .setZone("zone3744684") 2884 * .build(); 2885 * ApiFuture<Operation> future = instancesClient.resumeCallable().futureCall(request); 2886 * // Do something. 2887 * Operation response = future.get(); 2888 * } 2889 * }</pre> 2890 */ resumeCallable()2891 public final UnaryCallable<ResumeInstanceRequest, Operation> resumeCallable() { 2892 return stub.resumeCallable(); 2893 } 2894 2895 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2896 /** 2897 * Sends diagnostic interrupt to the instance. 2898 * 2899 * <p>Sample code: 2900 * 2901 * <pre>{@code 2902 * // This snippet has been automatically generated and should be regarded as a code template only. 2903 * // It will require modifications to work: 2904 * // - It may require correct/in-range values for request initialization. 2905 * // - It may require specifying regional endpoints when creating the service client as shown in 2906 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2907 * try (InstancesClient instancesClient = InstancesClient.create()) { 2908 * String project = "project-309310695"; 2909 * String zone = "zone3744684"; 2910 * String instance = "instance555127957"; 2911 * SendDiagnosticInterruptInstanceResponse response = 2912 * instancesClient.sendDiagnosticInterrupt(project, zone, instance); 2913 * } 2914 * }</pre> 2915 * 2916 * @param project Project ID for this request. 2917 * @param zone The name of the zone for this request. 2918 * @param instance Name of the instance scoping this request. 2919 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2920 */ sendDiagnosticInterrupt( String project, String zone, String instance)2921 public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt( 2922 String project, String zone, String instance) { 2923 SendDiagnosticInterruptInstanceRequest request = 2924 SendDiagnosticInterruptInstanceRequest.newBuilder() 2925 .setProject(project) 2926 .setZone(zone) 2927 .setInstance(instance) 2928 .build(); 2929 return sendDiagnosticInterrupt(request); 2930 } 2931 2932 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2933 /** 2934 * Sends diagnostic interrupt to the instance. 2935 * 2936 * <p>Sample code: 2937 * 2938 * <pre>{@code 2939 * // This snippet has been automatically generated and should be regarded as a code template only. 2940 * // It will require modifications to work: 2941 * // - It may require correct/in-range values for request initialization. 2942 * // - It may require specifying regional endpoints when creating the service client as shown in 2943 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2944 * try (InstancesClient instancesClient = InstancesClient.create()) { 2945 * SendDiagnosticInterruptInstanceRequest request = 2946 * SendDiagnosticInterruptInstanceRequest.newBuilder() 2947 * .setInstance("instance555127957") 2948 * .setProject("project-309310695") 2949 * .setZone("zone3744684") 2950 * .build(); 2951 * SendDiagnosticInterruptInstanceResponse response = 2952 * instancesClient.sendDiagnosticInterrupt(request); 2953 * } 2954 * }</pre> 2955 * 2956 * @param request The request object containing all of the parameters for the API call. 2957 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 2958 */ sendDiagnosticInterrupt( SendDiagnosticInterruptInstanceRequest request)2959 public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt( 2960 SendDiagnosticInterruptInstanceRequest request) { 2961 return sendDiagnosticInterruptCallable().call(request); 2962 } 2963 2964 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2965 /** 2966 * Sends diagnostic interrupt to the instance. 2967 * 2968 * <p>Sample code: 2969 * 2970 * <pre>{@code 2971 * // This snippet has been automatically generated and should be regarded as a code template only. 2972 * // It will require modifications to work: 2973 * // - It may require correct/in-range values for request initialization. 2974 * // - It may require specifying regional endpoints when creating the service client as shown in 2975 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 2976 * try (InstancesClient instancesClient = InstancesClient.create()) { 2977 * SendDiagnosticInterruptInstanceRequest request = 2978 * SendDiagnosticInterruptInstanceRequest.newBuilder() 2979 * .setInstance("instance555127957") 2980 * .setProject("project-309310695") 2981 * .setZone("zone3744684") 2982 * .build(); 2983 * ApiFuture<SendDiagnosticInterruptInstanceResponse> future = 2984 * instancesClient.sendDiagnosticInterruptCallable().futureCall(request); 2985 * // Do something. 2986 * SendDiagnosticInterruptInstanceResponse response = future.get(); 2987 * } 2988 * }</pre> 2989 */ 2990 public final UnaryCallable< 2991 SendDiagnosticInterruptInstanceRequest, SendDiagnosticInterruptInstanceResponse> sendDiagnosticInterruptCallable()2992 sendDiagnosticInterruptCallable() { 2993 return stub.sendDiagnosticInterruptCallable(); 2994 } 2995 2996 // AUTO-GENERATED DOCUMENTATION AND METHOD. 2997 /** 2998 * Sets deletion protection on the instance. 2999 * 3000 * <p>Sample code: 3001 * 3002 * <pre>{@code 3003 * // This snippet has been automatically generated and should be regarded as a code template only. 3004 * // It will require modifications to work: 3005 * // - It may require correct/in-range values for request initialization. 3006 * // - It may require specifying regional endpoints when creating the service client as shown in 3007 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3008 * try (InstancesClient instancesClient = InstancesClient.create()) { 3009 * String project = "project-309310695"; 3010 * String zone = "zone3744684"; 3011 * String resource = "resource-341064690"; 3012 * Operation response = 3013 * instancesClient.setDeletionProtectionAsync(project, zone, resource).get(); 3014 * } 3015 * }</pre> 3016 * 3017 * @param project Project ID for this request. 3018 * @param zone The name of the zone for this request. 3019 * @param resource Name or id of the resource for this request. 3020 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3021 */ setDeletionProtectionAsync( String project, String zone, String resource)3022 public final OperationFuture<Operation, Operation> setDeletionProtectionAsync( 3023 String project, String zone, String resource) { 3024 SetDeletionProtectionInstanceRequest request = 3025 SetDeletionProtectionInstanceRequest.newBuilder() 3026 .setProject(project) 3027 .setZone(zone) 3028 .setResource(resource) 3029 .build(); 3030 return setDeletionProtectionAsync(request); 3031 } 3032 3033 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3034 /** 3035 * Sets deletion protection on the instance. 3036 * 3037 * <p>Sample code: 3038 * 3039 * <pre>{@code 3040 * // This snippet has been automatically generated and should be regarded as a code template only. 3041 * // It will require modifications to work: 3042 * // - It may require correct/in-range values for request initialization. 3043 * // - It may require specifying regional endpoints when creating the service client as shown in 3044 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3045 * try (InstancesClient instancesClient = InstancesClient.create()) { 3046 * SetDeletionProtectionInstanceRequest request = 3047 * SetDeletionProtectionInstanceRequest.newBuilder() 3048 * .setDeletionProtection(true) 3049 * .setProject("project-309310695") 3050 * .setRequestId("requestId693933066") 3051 * .setResource("resource-341064690") 3052 * .setZone("zone3744684") 3053 * .build(); 3054 * Operation response = instancesClient.setDeletionProtectionAsync(request).get(); 3055 * } 3056 * }</pre> 3057 * 3058 * @param request The request object containing all of the parameters for the API call. 3059 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3060 */ 3061 @BetaApi( 3062 "The surface for long-running operations is not stable yet and may change in the future.") setDeletionProtectionAsync( SetDeletionProtectionInstanceRequest request)3063 public final OperationFuture<Operation, Operation> setDeletionProtectionAsync( 3064 SetDeletionProtectionInstanceRequest request) { 3065 return setDeletionProtectionOperationCallable().futureCall(request); 3066 } 3067 3068 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3069 /** 3070 * Sets deletion protection on the instance. 3071 * 3072 * <p>Sample code: 3073 * 3074 * <pre>{@code 3075 * // This snippet has been automatically generated and should be regarded as a code template only. 3076 * // It will require modifications to work: 3077 * // - It may require correct/in-range values for request initialization. 3078 * // - It may require specifying regional endpoints when creating the service client as shown in 3079 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3080 * try (InstancesClient instancesClient = InstancesClient.create()) { 3081 * SetDeletionProtectionInstanceRequest request = 3082 * SetDeletionProtectionInstanceRequest.newBuilder() 3083 * .setDeletionProtection(true) 3084 * .setProject("project-309310695") 3085 * .setRequestId("requestId693933066") 3086 * .setResource("resource-341064690") 3087 * .setZone("zone3744684") 3088 * .build(); 3089 * OperationFuture<Operation, Operation> future = 3090 * instancesClient.setDeletionProtectionOperationCallable().futureCall(request); 3091 * // Do something. 3092 * Operation response = future.get(); 3093 * } 3094 * }</pre> 3095 */ 3096 public final OperationCallable<SetDeletionProtectionInstanceRequest, Operation, Operation> setDeletionProtectionOperationCallable()3097 setDeletionProtectionOperationCallable() { 3098 return stub.setDeletionProtectionOperationCallable(); 3099 } 3100 3101 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3102 /** 3103 * Sets deletion protection on the instance. 3104 * 3105 * <p>Sample code: 3106 * 3107 * <pre>{@code 3108 * // This snippet has been automatically generated and should be regarded as a code template only. 3109 * // It will require modifications to work: 3110 * // - It may require correct/in-range values for request initialization. 3111 * // - It may require specifying regional endpoints when creating the service client as shown in 3112 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3113 * try (InstancesClient instancesClient = InstancesClient.create()) { 3114 * SetDeletionProtectionInstanceRequest request = 3115 * SetDeletionProtectionInstanceRequest.newBuilder() 3116 * .setDeletionProtection(true) 3117 * .setProject("project-309310695") 3118 * .setRequestId("requestId693933066") 3119 * .setResource("resource-341064690") 3120 * .setZone("zone3744684") 3121 * .build(); 3122 * ApiFuture<Operation> future = 3123 * instancesClient.setDeletionProtectionCallable().futureCall(request); 3124 * // Do something. 3125 * Operation response = future.get(); 3126 * } 3127 * }</pre> 3128 */ 3129 public final UnaryCallable<SetDeletionProtectionInstanceRequest, Operation> setDeletionProtectionCallable()3130 setDeletionProtectionCallable() { 3131 return stub.setDeletionProtectionCallable(); 3132 } 3133 3134 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3135 /** 3136 * Sets the auto-delete flag for a disk attached to an instance. 3137 * 3138 * <p>Sample code: 3139 * 3140 * <pre>{@code 3141 * // This snippet has been automatically generated and should be regarded as a code template only. 3142 * // It will require modifications to work: 3143 * // - It may require correct/in-range values for request initialization. 3144 * // - It may require specifying regional endpoints when creating the service client as shown in 3145 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3146 * try (InstancesClient instancesClient = InstancesClient.create()) { 3147 * String project = "project-309310695"; 3148 * String zone = "zone3744684"; 3149 * String instance = "instance555127957"; 3150 * boolean autoDelete = true; 3151 * String deviceName = "deviceName780988929"; 3152 * Operation response = 3153 * instancesClient 3154 * .setDiskAutoDeleteAsync(project, zone, instance, autoDelete, deviceName) 3155 * .get(); 3156 * } 3157 * }</pre> 3158 * 3159 * @param project Project ID for this request. 3160 * @param zone The name of the zone for this request. 3161 * @param instance The instance name for this request. 3162 * @param autoDelete Whether to auto-delete the disk when the instance is deleted. 3163 * @param deviceName The device name of the disk to modify. Make a get() request on the instance 3164 * to view currently attached disks and device names. 3165 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3166 */ setDiskAutoDeleteAsync( String project, String zone, String instance, boolean autoDelete, String deviceName)3167 public final OperationFuture<Operation, Operation> setDiskAutoDeleteAsync( 3168 String project, String zone, String instance, boolean autoDelete, String deviceName) { 3169 SetDiskAutoDeleteInstanceRequest request = 3170 SetDiskAutoDeleteInstanceRequest.newBuilder() 3171 .setProject(project) 3172 .setZone(zone) 3173 .setInstance(instance) 3174 .setAutoDelete(autoDelete) 3175 .setDeviceName(deviceName) 3176 .build(); 3177 return setDiskAutoDeleteAsync(request); 3178 } 3179 3180 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3181 /** 3182 * Sets the auto-delete flag for a disk attached to an instance. 3183 * 3184 * <p>Sample code: 3185 * 3186 * <pre>{@code 3187 * // This snippet has been automatically generated and should be regarded as a code template only. 3188 * // It will require modifications to work: 3189 * // - It may require correct/in-range values for request initialization. 3190 * // - It may require specifying regional endpoints when creating the service client as shown in 3191 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3192 * try (InstancesClient instancesClient = InstancesClient.create()) { 3193 * SetDiskAutoDeleteInstanceRequest request = 3194 * SetDiskAutoDeleteInstanceRequest.newBuilder() 3195 * .setAutoDelete(true) 3196 * .setDeviceName("deviceName780988929") 3197 * .setInstance("instance555127957") 3198 * .setProject("project-309310695") 3199 * .setRequestId("requestId693933066") 3200 * .setZone("zone3744684") 3201 * .build(); 3202 * Operation response = instancesClient.setDiskAutoDeleteAsync(request).get(); 3203 * } 3204 * }</pre> 3205 * 3206 * @param request The request object containing all of the parameters for the API call. 3207 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3208 */ 3209 @BetaApi( 3210 "The surface for long-running operations is not stable yet and may change in the future.") setDiskAutoDeleteAsync( SetDiskAutoDeleteInstanceRequest request)3211 public final OperationFuture<Operation, Operation> setDiskAutoDeleteAsync( 3212 SetDiskAutoDeleteInstanceRequest request) { 3213 return setDiskAutoDeleteOperationCallable().futureCall(request); 3214 } 3215 3216 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3217 /** 3218 * Sets the auto-delete flag for a disk attached to an instance. 3219 * 3220 * <p>Sample code: 3221 * 3222 * <pre>{@code 3223 * // This snippet has been automatically generated and should be regarded as a code template only. 3224 * // It will require modifications to work: 3225 * // - It may require correct/in-range values for request initialization. 3226 * // - It may require specifying regional endpoints when creating the service client as shown in 3227 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3228 * try (InstancesClient instancesClient = InstancesClient.create()) { 3229 * SetDiskAutoDeleteInstanceRequest request = 3230 * SetDiskAutoDeleteInstanceRequest.newBuilder() 3231 * .setAutoDelete(true) 3232 * .setDeviceName("deviceName780988929") 3233 * .setInstance("instance555127957") 3234 * .setProject("project-309310695") 3235 * .setRequestId("requestId693933066") 3236 * .setZone("zone3744684") 3237 * .build(); 3238 * OperationFuture<Operation, Operation> future = 3239 * instancesClient.setDiskAutoDeleteOperationCallable().futureCall(request); 3240 * // Do something. 3241 * Operation response = future.get(); 3242 * } 3243 * }</pre> 3244 */ 3245 public final OperationCallable<SetDiskAutoDeleteInstanceRequest, Operation, Operation> setDiskAutoDeleteOperationCallable()3246 setDiskAutoDeleteOperationCallable() { 3247 return stub.setDiskAutoDeleteOperationCallable(); 3248 } 3249 3250 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3251 /** 3252 * Sets the auto-delete flag for a disk attached to an instance. 3253 * 3254 * <p>Sample code: 3255 * 3256 * <pre>{@code 3257 * // This snippet has been automatically generated and should be regarded as a code template only. 3258 * // It will require modifications to work: 3259 * // - It may require correct/in-range values for request initialization. 3260 * // - It may require specifying regional endpoints when creating the service client as shown in 3261 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3262 * try (InstancesClient instancesClient = InstancesClient.create()) { 3263 * SetDiskAutoDeleteInstanceRequest request = 3264 * SetDiskAutoDeleteInstanceRequest.newBuilder() 3265 * .setAutoDelete(true) 3266 * .setDeviceName("deviceName780988929") 3267 * .setInstance("instance555127957") 3268 * .setProject("project-309310695") 3269 * .setRequestId("requestId693933066") 3270 * .setZone("zone3744684") 3271 * .build(); 3272 * ApiFuture<Operation> future = instancesClient.setDiskAutoDeleteCallable().futureCall(request); 3273 * // Do something. 3274 * Operation response = future.get(); 3275 * } 3276 * }</pre> 3277 */ 3278 public final UnaryCallable<SetDiskAutoDeleteInstanceRequest, Operation> setDiskAutoDeleteCallable()3279 setDiskAutoDeleteCallable() { 3280 return stub.setDiskAutoDeleteCallable(); 3281 } 3282 3283 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3284 /** 3285 * Sets the access control policy on the specified resource. Replaces any existing policy. 3286 * 3287 * <p>Sample code: 3288 * 3289 * <pre>{@code 3290 * // This snippet has been automatically generated and should be regarded as a code template only. 3291 * // It will require modifications to work: 3292 * // - It may require correct/in-range values for request initialization. 3293 * // - It may require specifying regional endpoints when creating the service client as shown in 3294 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3295 * try (InstancesClient instancesClient = InstancesClient.create()) { 3296 * String project = "project-309310695"; 3297 * String zone = "zone3744684"; 3298 * String resource = "resource-341064690"; 3299 * ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build(); 3300 * Policy response = 3301 * instancesClient.setIamPolicy(project, zone, resource, zoneSetPolicyRequestResource); 3302 * } 3303 * }</pre> 3304 * 3305 * @param project Project ID for this request. 3306 * @param zone The name of the zone for this request. 3307 * @param resource Name or id of the resource for this request. 3308 * @param zoneSetPolicyRequestResource The body resource for this request 3309 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3310 */ setIamPolicy( String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)3311 public final Policy setIamPolicy( 3312 String project, 3313 String zone, 3314 String resource, 3315 ZoneSetPolicyRequest zoneSetPolicyRequestResource) { 3316 SetIamPolicyInstanceRequest request = 3317 SetIamPolicyInstanceRequest.newBuilder() 3318 .setProject(project) 3319 .setZone(zone) 3320 .setResource(resource) 3321 .setZoneSetPolicyRequestResource(zoneSetPolicyRequestResource) 3322 .build(); 3323 return setIamPolicy(request); 3324 } 3325 3326 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3327 /** 3328 * Sets the access control policy on the specified resource. Replaces any existing policy. 3329 * 3330 * <p>Sample code: 3331 * 3332 * <pre>{@code 3333 * // This snippet has been automatically generated and should be regarded as a code template only. 3334 * // It will require modifications to work: 3335 * // - It may require correct/in-range values for request initialization. 3336 * // - It may require specifying regional endpoints when creating the service client as shown in 3337 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3338 * try (InstancesClient instancesClient = InstancesClient.create()) { 3339 * SetIamPolicyInstanceRequest request = 3340 * SetIamPolicyInstanceRequest.newBuilder() 3341 * .setProject("project-309310695") 3342 * .setResource("resource-341064690") 3343 * .setZone("zone3744684") 3344 * .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build()) 3345 * .build(); 3346 * Policy response = instancesClient.setIamPolicy(request); 3347 * } 3348 * }</pre> 3349 * 3350 * @param request The request object containing all of the parameters for the API call. 3351 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3352 */ setIamPolicy(SetIamPolicyInstanceRequest request)3353 public final Policy setIamPolicy(SetIamPolicyInstanceRequest request) { 3354 return setIamPolicyCallable().call(request); 3355 } 3356 3357 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3358 /** 3359 * Sets the access control policy on the specified resource. Replaces any existing policy. 3360 * 3361 * <p>Sample code: 3362 * 3363 * <pre>{@code 3364 * // This snippet has been automatically generated and should be regarded as a code template only. 3365 * // It will require modifications to work: 3366 * // - It may require correct/in-range values for request initialization. 3367 * // - It may require specifying regional endpoints when creating the service client as shown in 3368 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3369 * try (InstancesClient instancesClient = InstancesClient.create()) { 3370 * SetIamPolicyInstanceRequest request = 3371 * SetIamPolicyInstanceRequest.newBuilder() 3372 * .setProject("project-309310695") 3373 * .setResource("resource-341064690") 3374 * .setZone("zone3744684") 3375 * .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build()) 3376 * .build(); 3377 * ApiFuture<Policy> future = instancesClient.setIamPolicyCallable().futureCall(request); 3378 * // Do something. 3379 * Policy response = future.get(); 3380 * } 3381 * }</pre> 3382 */ setIamPolicyCallable()3383 public final UnaryCallable<SetIamPolicyInstanceRequest, Policy> setIamPolicyCallable() { 3384 return stub.setIamPolicyCallable(); 3385 } 3386 3387 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3388 /** 3389 * Sets labels on an instance. To learn more about labels, read the Labeling Resources 3390 * documentation. 3391 * 3392 * <p>Sample code: 3393 * 3394 * <pre>{@code 3395 * // This snippet has been automatically generated and should be regarded as a code template only. 3396 * // It will require modifications to work: 3397 * // - It may require correct/in-range values for request initialization. 3398 * // - It may require specifying regional endpoints when creating the service client as shown in 3399 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3400 * try (InstancesClient instancesClient = InstancesClient.create()) { 3401 * String project = "project-309310695"; 3402 * String zone = "zone3744684"; 3403 * String instance = "instance555127957"; 3404 * InstancesSetLabelsRequest instancesSetLabelsRequestResource = 3405 * InstancesSetLabelsRequest.newBuilder().build(); 3406 * Operation response = 3407 * instancesClient 3408 * .setLabelsAsync(project, zone, instance, instancesSetLabelsRequestResource) 3409 * .get(); 3410 * } 3411 * }</pre> 3412 * 3413 * @param project Project ID for this request. 3414 * @param zone The name of the zone for this request. 3415 * @param instance Name of the instance scoping this request. 3416 * @param instancesSetLabelsRequestResource The body resource for this request 3417 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3418 */ setLabelsAsync( String project, String zone, String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)3419 public final OperationFuture<Operation, Operation> setLabelsAsync( 3420 String project, 3421 String zone, 3422 String instance, 3423 InstancesSetLabelsRequest instancesSetLabelsRequestResource) { 3424 SetLabelsInstanceRequest request = 3425 SetLabelsInstanceRequest.newBuilder() 3426 .setProject(project) 3427 .setZone(zone) 3428 .setInstance(instance) 3429 .setInstancesSetLabelsRequestResource(instancesSetLabelsRequestResource) 3430 .build(); 3431 return setLabelsAsync(request); 3432 } 3433 3434 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3435 /** 3436 * Sets labels on an instance. To learn more about labels, read the Labeling Resources 3437 * documentation. 3438 * 3439 * <p>Sample code: 3440 * 3441 * <pre>{@code 3442 * // This snippet has been automatically generated and should be regarded as a code template only. 3443 * // It will require modifications to work: 3444 * // - It may require correct/in-range values for request initialization. 3445 * // - It may require specifying regional endpoints when creating the service client as shown in 3446 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3447 * try (InstancesClient instancesClient = InstancesClient.create()) { 3448 * SetLabelsInstanceRequest request = 3449 * SetLabelsInstanceRequest.newBuilder() 3450 * .setInstance("instance555127957") 3451 * .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build()) 3452 * .setProject("project-309310695") 3453 * .setRequestId("requestId693933066") 3454 * .setZone("zone3744684") 3455 * .build(); 3456 * Operation response = instancesClient.setLabelsAsync(request).get(); 3457 * } 3458 * }</pre> 3459 * 3460 * @param request The request object containing all of the parameters for the API call. 3461 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3462 */ 3463 @BetaApi( 3464 "The surface for long-running operations is not stable yet and may change in the future.") setLabelsAsync( SetLabelsInstanceRequest request)3465 public final OperationFuture<Operation, Operation> setLabelsAsync( 3466 SetLabelsInstanceRequest request) { 3467 return setLabelsOperationCallable().futureCall(request); 3468 } 3469 3470 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3471 /** 3472 * Sets labels on an instance. To learn more about labels, read the Labeling Resources 3473 * documentation. 3474 * 3475 * <p>Sample code: 3476 * 3477 * <pre>{@code 3478 * // This snippet has been automatically generated and should be regarded as a code template only. 3479 * // It will require modifications to work: 3480 * // - It may require correct/in-range values for request initialization. 3481 * // - It may require specifying regional endpoints when creating the service client as shown in 3482 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3483 * try (InstancesClient instancesClient = InstancesClient.create()) { 3484 * SetLabelsInstanceRequest request = 3485 * SetLabelsInstanceRequest.newBuilder() 3486 * .setInstance("instance555127957") 3487 * .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build()) 3488 * .setProject("project-309310695") 3489 * .setRequestId("requestId693933066") 3490 * .setZone("zone3744684") 3491 * .build(); 3492 * OperationFuture<Operation, Operation> future = 3493 * instancesClient.setLabelsOperationCallable().futureCall(request); 3494 * // Do something. 3495 * Operation response = future.get(); 3496 * } 3497 * }</pre> 3498 */ 3499 public final OperationCallable<SetLabelsInstanceRequest, Operation, Operation> setLabelsOperationCallable()3500 setLabelsOperationCallable() { 3501 return stub.setLabelsOperationCallable(); 3502 } 3503 3504 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3505 /** 3506 * Sets labels on an instance. To learn more about labels, read the Labeling Resources 3507 * documentation. 3508 * 3509 * <p>Sample code: 3510 * 3511 * <pre>{@code 3512 * // This snippet has been automatically generated and should be regarded as a code template only. 3513 * // It will require modifications to work: 3514 * // - It may require correct/in-range values for request initialization. 3515 * // - It may require specifying regional endpoints when creating the service client as shown in 3516 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3517 * try (InstancesClient instancesClient = InstancesClient.create()) { 3518 * SetLabelsInstanceRequest request = 3519 * SetLabelsInstanceRequest.newBuilder() 3520 * .setInstance("instance555127957") 3521 * .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build()) 3522 * .setProject("project-309310695") 3523 * .setRequestId("requestId693933066") 3524 * .setZone("zone3744684") 3525 * .build(); 3526 * ApiFuture<Operation> future = instancesClient.setLabelsCallable().futureCall(request); 3527 * // Do something. 3528 * Operation response = future.get(); 3529 * } 3530 * }</pre> 3531 */ setLabelsCallable()3532 public final UnaryCallable<SetLabelsInstanceRequest, Operation> setLabelsCallable() { 3533 return stub.setLabelsCallable(); 3534 } 3535 3536 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3537 /** 3538 * Changes the number and/or type of accelerator for a stopped instance to the values specified in 3539 * the request. 3540 * 3541 * <p>Sample code: 3542 * 3543 * <pre>{@code 3544 * // This snippet has been automatically generated and should be regarded as a code template only. 3545 * // It will require modifications to work: 3546 * // - It may require correct/in-range values for request initialization. 3547 * // - It may require specifying regional endpoints when creating the service client as shown in 3548 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3549 * try (InstancesClient instancesClient = InstancesClient.create()) { 3550 * String project = "project-309310695"; 3551 * String zone = "zone3744684"; 3552 * String instance = "instance555127957"; 3553 * InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource = 3554 * InstancesSetMachineResourcesRequest.newBuilder().build(); 3555 * Operation response = 3556 * instancesClient 3557 * .setMachineResourcesAsync( 3558 * project, zone, instance, instancesSetMachineResourcesRequestResource) 3559 * .get(); 3560 * } 3561 * }</pre> 3562 * 3563 * @param project Project ID for this request. 3564 * @param zone The name of the zone for this request. 3565 * @param instance Name of the instance scoping this request. 3566 * @param instancesSetMachineResourcesRequestResource The body resource for this request 3567 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3568 */ setMachineResourcesAsync( String project, String zone, String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)3569 public final OperationFuture<Operation, Operation> setMachineResourcesAsync( 3570 String project, 3571 String zone, 3572 String instance, 3573 InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource) { 3574 SetMachineResourcesInstanceRequest request = 3575 SetMachineResourcesInstanceRequest.newBuilder() 3576 .setProject(project) 3577 .setZone(zone) 3578 .setInstance(instance) 3579 .setInstancesSetMachineResourcesRequestResource( 3580 instancesSetMachineResourcesRequestResource) 3581 .build(); 3582 return setMachineResourcesAsync(request); 3583 } 3584 3585 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3586 /** 3587 * Changes the number and/or type of accelerator for a stopped instance to the values specified in 3588 * the request. 3589 * 3590 * <p>Sample code: 3591 * 3592 * <pre>{@code 3593 * // This snippet has been automatically generated and should be regarded as a code template only. 3594 * // It will require modifications to work: 3595 * // - It may require correct/in-range values for request initialization. 3596 * // - It may require specifying regional endpoints when creating the service client as shown in 3597 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3598 * try (InstancesClient instancesClient = InstancesClient.create()) { 3599 * SetMachineResourcesInstanceRequest request = 3600 * SetMachineResourcesInstanceRequest.newBuilder() 3601 * .setInstance("instance555127957") 3602 * .setInstancesSetMachineResourcesRequestResource( 3603 * InstancesSetMachineResourcesRequest.newBuilder().build()) 3604 * .setProject("project-309310695") 3605 * .setRequestId("requestId693933066") 3606 * .setZone("zone3744684") 3607 * .build(); 3608 * Operation response = instancesClient.setMachineResourcesAsync(request).get(); 3609 * } 3610 * }</pre> 3611 * 3612 * @param request The request object containing all of the parameters for the API call. 3613 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3614 */ 3615 @BetaApi( 3616 "The surface for long-running operations is not stable yet and may change in the future.") setMachineResourcesAsync( SetMachineResourcesInstanceRequest request)3617 public final OperationFuture<Operation, Operation> setMachineResourcesAsync( 3618 SetMachineResourcesInstanceRequest request) { 3619 return setMachineResourcesOperationCallable().futureCall(request); 3620 } 3621 3622 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3623 /** 3624 * Changes the number and/or type of accelerator for a stopped instance to the values specified in 3625 * the request. 3626 * 3627 * <p>Sample code: 3628 * 3629 * <pre>{@code 3630 * // This snippet has been automatically generated and should be regarded as a code template only. 3631 * // It will require modifications to work: 3632 * // - It may require correct/in-range values for request initialization. 3633 * // - It may require specifying regional endpoints when creating the service client as shown in 3634 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3635 * try (InstancesClient instancesClient = InstancesClient.create()) { 3636 * SetMachineResourcesInstanceRequest request = 3637 * SetMachineResourcesInstanceRequest.newBuilder() 3638 * .setInstance("instance555127957") 3639 * .setInstancesSetMachineResourcesRequestResource( 3640 * InstancesSetMachineResourcesRequest.newBuilder().build()) 3641 * .setProject("project-309310695") 3642 * .setRequestId("requestId693933066") 3643 * .setZone("zone3744684") 3644 * .build(); 3645 * OperationFuture<Operation, Operation> future = 3646 * instancesClient.setMachineResourcesOperationCallable().futureCall(request); 3647 * // Do something. 3648 * Operation response = future.get(); 3649 * } 3650 * }</pre> 3651 */ 3652 public final OperationCallable<SetMachineResourcesInstanceRequest, Operation, Operation> setMachineResourcesOperationCallable()3653 setMachineResourcesOperationCallable() { 3654 return stub.setMachineResourcesOperationCallable(); 3655 } 3656 3657 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3658 /** 3659 * Changes the number and/or type of accelerator for a stopped instance to the values specified in 3660 * the request. 3661 * 3662 * <p>Sample code: 3663 * 3664 * <pre>{@code 3665 * // This snippet has been automatically generated and should be regarded as a code template only. 3666 * // It will require modifications to work: 3667 * // - It may require correct/in-range values for request initialization. 3668 * // - It may require specifying regional endpoints when creating the service client as shown in 3669 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3670 * try (InstancesClient instancesClient = InstancesClient.create()) { 3671 * SetMachineResourcesInstanceRequest request = 3672 * SetMachineResourcesInstanceRequest.newBuilder() 3673 * .setInstance("instance555127957") 3674 * .setInstancesSetMachineResourcesRequestResource( 3675 * InstancesSetMachineResourcesRequest.newBuilder().build()) 3676 * .setProject("project-309310695") 3677 * .setRequestId("requestId693933066") 3678 * .setZone("zone3744684") 3679 * .build(); 3680 * ApiFuture<Operation> future = 3681 * instancesClient.setMachineResourcesCallable().futureCall(request); 3682 * // Do something. 3683 * Operation response = future.get(); 3684 * } 3685 * }</pre> 3686 */ 3687 public final UnaryCallable<SetMachineResourcesInstanceRequest, Operation> setMachineResourcesCallable()3688 setMachineResourcesCallable() { 3689 return stub.setMachineResourcesCallable(); 3690 } 3691 3692 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3693 /** 3694 * Changes the machine type for a stopped instance to the machine type specified in the request. 3695 * 3696 * <p>Sample code: 3697 * 3698 * <pre>{@code 3699 * // This snippet has been automatically generated and should be regarded as a code template only. 3700 * // It will require modifications to work: 3701 * // - It may require correct/in-range values for request initialization. 3702 * // - It may require specifying regional endpoints when creating the service client as shown in 3703 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3704 * try (InstancesClient instancesClient = InstancesClient.create()) { 3705 * String project = "project-309310695"; 3706 * String zone = "zone3744684"; 3707 * String instance = "instance555127957"; 3708 * InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource = 3709 * InstancesSetMachineTypeRequest.newBuilder().build(); 3710 * Operation response = 3711 * instancesClient 3712 * .setMachineTypeAsync(project, zone, instance, instancesSetMachineTypeRequestResource) 3713 * .get(); 3714 * } 3715 * }</pre> 3716 * 3717 * @param project Project ID for this request. 3718 * @param zone The name of the zone for this request. 3719 * @param instance Name of the instance scoping this request. 3720 * @param instancesSetMachineTypeRequestResource The body resource for this request 3721 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3722 */ setMachineTypeAsync( String project, String zone, String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)3723 public final OperationFuture<Operation, Operation> setMachineTypeAsync( 3724 String project, 3725 String zone, 3726 String instance, 3727 InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource) { 3728 SetMachineTypeInstanceRequest request = 3729 SetMachineTypeInstanceRequest.newBuilder() 3730 .setProject(project) 3731 .setZone(zone) 3732 .setInstance(instance) 3733 .setInstancesSetMachineTypeRequestResource(instancesSetMachineTypeRequestResource) 3734 .build(); 3735 return setMachineTypeAsync(request); 3736 } 3737 3738 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3739 /** 3740 * Changes the machine type for a stopped instance to the machine type specified in the request. 3741 * 3742 * <p>Sample code: 3743 * 3744 * <pre>{@code 3745 * // This snippet has been automatically generated and should be regarded as a code template only. 3746 * // It will require modifications to work: 3747 * // - It may require correct/in-range values for request initialization. 3748 * // - It may require specifying regional endpoints when creating the service client as shown in 3749 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3750 * try (InstancesClient instancesClient = InstancesClient.create()) { 3751 * SetMachineTypeInstanceRequest request = 3752 * SetMachineTypeInstanceRequest.newBuilder() 3753 * .setInstance("instance555127957") 3754 * .setInstancesSetMachineTypeRequestResource( 3755 * InstancesSetMachineTypeRequest.newBuilder().build()) 3756 * .setProject("project-309310695") 3757 * .setRequestId("requestId693933066") 3758 * .setZone("zone3744684") 3759 * .build(); 3760 * Operation response = instancesClient.setMachineTypeAsync(request).get(); 3761 * } 3762 * }</pre> 3763 * 3764 * @param request The request object containing all of the parameters for the API call. 3765 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3766 */ 3767 @BetaApi( 3768 "The surface for long-running operations is not stable yet and may change in the future.") setMachineTypeAsync( SetMachineTypeInstanceRequest request)3769 public final OperationFuture<Operation, Operation> setMachineTypeAsync( 3770 SetMachineTypeInstanceRequest request) { 3771 return setMachineTypeOperationCallable().futureCall(request); 3772 } 3773 3774 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3775 /** 3776 * Changes the machine type for a stopped instance to the machine type specified in the request. 3777 * 3778 * <p>Sample code: 3779 * 3780 * <pre>{@code 3781 * // This snippet has been automatically generated and should be regarded as a code template only. 3782 * // It will require modifications to work: 3783 * // - It may require correct/in-range values for request initialization. 3784 * // - It may require specifying regional endpoints when creating the service client as shown in 3785 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3786 * try (InstancesClient instancesClient = InstancesClient.create()) { 3787 * SetMachineTypeInstanceRequest request = 3788 * SetMachineTypeInstanceRequest.newBuilder() 3789 * .setInstance("instance555127957") 3790 * .setInstancesSetMachineTypeRequestResource( 3791 * InstancesSetMachineTypeRequest.newBuilder().build()) 3792 * .setProject("project-309310695") 3793 * .setRequestId("requestId693933066") 3794 * .setZone("zone3744684") 3795 * .build(); 3796 * OperationFuture<Operation, Operation> future = 3797 * instancesClient.setMachineTypeOperationCallable().futureCall(request); 3798 * // Do something. 3799 * Operation response = future.get(); 3800 * } 3801 * }</pre> 3802 */ 3803 public final OperationCallable<SetMachineTypeInstanceRequest, Operation, Operation> setMachineTypeOperationCallable()3804 setMachineTypeOperationCallable() { 3805 return stub.setMachineTypeOperationCallable(); 3806 } 3807 3808 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3809 /** 3810 * Changes the machine type for a stopped instance to the machine type specified in the request. 3811 * 3812 * <p>Sample code: 3813 * 3814 * <pre>{@code 3815 * // This snippet has been automatically generated and should be regarded as a code template only. 3816 * // It will require modifications to work: 3817 * // - It may require correct/in-range values for request initialization. 3818 * // - It may require specifying regional endpoints when creating the service client as shown in 3819 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3820 * try (InstancesClient instancesClient = InstancesClient.create()) { 3821 * SetMachineTypeInstanceRequest request = 3822 * SetMachineTypeInstanceRequest.newBuilder() 3823 * .setInstance("instance555127957") 3824 * .setInstancesSetMachineTypeRequestResource( 3825 * InstancesSetMachineTypeRequest.newBuilder().build()) 3826 * .setProject("project-309310695") 3827 * .setRequestId("requestId693933066") 3828 * .setZone("zone3744684") 3829 * .build(); 3830 * ApiFuture<Operation> future = instancesClient.setMachineTypeCallable().futureCall(request); 3831 * // Do something. 3832 * Operation response = future.get(); 3833 * } 3834 * }</pre> 3835 */ setMachineTypeCallable()3836 public final UnaryCallable<SetMachineTypeInstanceRequest, Operation> setMachineTypeCallable() { 3837 return stub.setMachineTypeCallable(); 3838 } 3839 3840 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3841 /** 3842 * Sets metadata for the specified instance to the data included in the request. 3843 * 3844 * <p>Sample code: 3845 * 3846 * <pre>{@code 3847 * // This snippet has been automatically generated and should be regarded as a code template only. 3848 * // It will require modifications to work: 3849 * // - It may require correct/in-range values for request initialization. 3850 * // - It may require specifying regional endpoints when creating the service client as shown in 3851 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3852 * try (InstancesClient instancesClient = InstancesClient.create()) { 3853 * String project = "project-309310695"; 3854 * String zone = "zone3744684"; 3855 * String instance = "instance555127957"; 3856 * Metadata metadataResource = Metadata.newBuilder().build(); 3857 * Operation response = 3858 * instancesClient.setMetadataAsync(project, zone, instance, metadataResource).get(); 3859 * } 3860 * }</pre> 3861 * 3862 * @param project Project ID for this request. 3863 * @param zone The name of the zone for this request. 3864 * @param instance Name of the instance scoping this request. 3865 * @param metadataResource The body resource for this request 3866 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3867 */ setMetadataAsync( String project, String zone, String instance, Metadata metadataResource)3868 public final OperationFuture<Operation, Operation> setMetadataAsync( 3869 String project, String zone, String instance, Metadata metadataResource) { 3870 SetMetadataInstanceRequest request = 3871 SetMetadataInstanceRequest.newBuilder() 3872 .setProject(project) 3873 .setZone(zone) 3874 .setInstance(instance) 3875 .setMetadataResource(metadataResource) 3876 .build(); 3877 return setMetadataAsync(request); 3878 } 3879 3880 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3881 /** 3882 * Sets metadata for the specified instance to the data included in the request. 3883 * 3884 * <p>Sample code: 3885 * 3886 * <pre>{@code 3887 * // This snippet has been automatically generated and should be regarded as a code template only. 3888 * // It will require modifications to work: 3889 * // - It may require correct/in-range values for request initialization. 3890 * // - It may require specifying regional endpoints when creating the service client as shown in 3891 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3892 * try (InstancesClient instancesClient = InstancesClient.create()) { 3893 * SetMetadataInstanceRequest request = 3894 * SetMetadataInstanceRequest.newBuilder() 3895 * .setInstance("instance555127957") 3896 * .setMetadataResource(Metadata.newBuilder().build()) 3897 * .setProject("project-309310695") 3898 * .setRequestId("requestId693933066") 3899 * .setZone("zone3744684") 3900 * .build(); 3901 * Operation response = instancesClient.setMetadataAsync(request).get(); 3902 * } 3903 * }</pre> 3904 * 3905 * @param request The request object containing all of the parameters for the API call. 3906 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 3907 */ 3908 @BetaApi( 3909 "The surface for long-running operations is not stable yet and may change in the future.") setMetadataAsync( SetMetadataInstanceRequest request)3910 public final OperationFuture<Operation, Operation> setMetadataAsync( 3911 SetMetadataInstanceRequest request) { 3912 return setMetadataOperationCallable().futureCall(request); 3913 } 3914 3915 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3916 /** 3917 * Sets metadata for the specified instance to the data included in the request. 3918 * 3919 * <p>Sample code: 3920 * 3921 * <pre>{@code 3922 * // This snippet has been automatically generated and should be regarded as a code template only. 3923 * // It will require modifications to work: 3924 * // - It may require correct/in-range values for request initialization. 3925 * // - It may require specifying regional endpoints when creating the service client as shown in 3926 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3927 * try (InstancesClient instancesClient = InstancesClient.create()) { 3928 * SetMetadataInstanceRequest request = 3929 * SetMetadataInstanceRequest.newBuilder() 3930 * .setInstance("instance555127957") 3931 * .setMetadataResource(Metadata.newBuilder().build()) 3932 * .setProject("project-309310695") 3933 * .setRequestId("requestId693933066") 3934 * .setZone("zone3744684") 3935 * .build(); 3936 * OperationFuture<Operation, Operation> future = 3937 * instancesClient.setMetadataOperationCallable().futureCall(request); 3938 * // Do something. 3939 * Operation response = future.get(); 3940 * } 3941 * }</pre> 3942 */ 3943 public final OperationCallable<SetMetadataInstanceRequest, Operation, Operation> setMetadataOperationCallable()3944 setMetadataOperationCallable() { 3945 return stub.setMetadataOperationCallable(); 3946 } 3947 3948 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3949 /** 3950 * Sets metadata for the specified instance to the data included in the request. 3951 * 3952 * <p>Sample code: 3953 * 3954 * <pre>{@code 3955 * // This snippet has been automatically generated and should be regarded as a code template only. 3956 * // It will require modifications to work: 3957 * // - It may require correct/in-range values for request initialization. 3958 * // - It may require specifying regional endpoints when creating the service client as shown in 3959 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3960 * try (InstancesClient instancesClient = InstancesClient.create()) { 3961 * SetMetadataInstanceRequest request = 3962 * SetMetadataInstanceRequest.newBuilder() 3963 * .setInstance("instance555127957") 3964 * .setMetadataResource(Metadata.newBuilder().build()) 3965 * .setProject("project-309310695") 3966 * .setRequestId("requestId693933066") 3967 * .setZone("zone3744684") 3968 * .build(); 3969 * ApiFuture<Operation> future = instancesClient.setMetadataCallable().futureCall(request); 3970 * // Do something. 3971 * Operation response = future.get(); 3972 * } 3973 * }</pre> 3974 */ setMetadataCallable()3975 public final UnaryCallable<SetMetadataInstanceRequest, Operation> setMetadataCallable() { 3976 return stub.setMetadataCallable(); 3977 } 3978 3979 // AUTO-GENERATED DOCUMENTATION AND METHOD. 3980 /** 3981 * Changes the minimum CPU platform that this instance should use. This method can only be called 3982 * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. 3983 * 3984 * <p>Sample code: 3985 * 3986 * <pre>{@code 3987 * // This snippet has been automatically generated and should be regarded as a code template only. 3988 * // It will require modifications to work: 3989 * // - It may require correct/in-range values for request initialization. 3990 * // - It may require specifying regional endpoints when creating the service client as shown in 3991 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 3992 * try (InstancesClient instancesClient = InstancesClient.create()) { 3993 * String project = "project-309310695"; 3994 * String zone = "zone3744684"; 3995 * String instance = "instance555127957"; 3996 * InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource = 3997 * InstancesSetMinCpuPlatformRequest.newBuilder().build(); 3998 * Operation response = 3999 * instancesClient 4000 * .setMinCpuPlatformAsync( 4001 * project, zone, instance, instancesSetMinCpuPlatformRequestResource) 4002 * .get(); 4003 * } 4004 * }</pre> 4005 * 4006 * @param project Project ID for this request. 4007 * @param zone The name of the zone for this request. 4008 * @param instance Name of the instance scoping this request. 4009 * @param instancesSetMinCpuPlatformRequestResource The body resource for this request 4010 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4011 */ setMinCpuPlatformAsync( String project, String zone, String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)4012 public final OperationFuture<Operation, Operation> setMinCpuPlatformAsync( 4013 String project, 4014 String zone, 4015 String instance, 4016 InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource) { 4017 SetMinCpuPlatformInstanceRequest request = 4018 SetMinCpuPlatformInstanceRequest.newBuilder() 4019 .setProject(project) 4020 .setZone(zone) 4021 .setInstance(instance) 4022 .setInstancesSetMinCpuPlatformRequestResource(instancesSetMinCpuPlatformRequestResource) 4023 .build(); 4024 return setMinCpuPlatformAsync(request); 4025 } 4026 4027 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4028 /** 4029 * Changes the minimum CPU platform that this instance should use. This method can only be called 4030 * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. 4031 * 4032 * <p>Sample code: 4033 * 4034 * <pre>{@code 4035 * // This snippet has been automatically generated and should be regarded as a code template only. 4036 * // It will require modifications to work: 4037 * // - It may require correct/in-range values for request initialization. 4038 * // - It may require specifying regional endpoints when creating the service client as shown in 4039 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4040 * try (InstancesClient instancesClient = InstancesClient.create()) { 4041 * SetMinCpuPlatformInstanceRequest request = 4042 * SetMinCpuPlatformInstanceRequest.newBuilder() 4043 * .setInstance("instance555127957") 4044 * .setInstancesSetMinCpuPlatformRequestResource( 4045 * InstancesSetMinCpuPlatformRequest.newBuilder().build()) 4046 * .setProject("project-309310695") 4047 * .setRequestId("requestId693933066") 4048 * .setZone("zone3744684") 4049 * .build(); 4050 * Operation response = instancesClient.setMinCpuPlatformAsync(request).get(); 4051 * } 4052 * }</pre> 4053 * 4054 * @param request The request object containing all of the parameters for the API call. 4055 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4056 */ 4057 @BetaApi( 4058 "The surface for long-running operations is not stable yet and may change in the future.") setMinCpuPlatformAsync( SetMinCpuPlatformInstanceRequest request)4059 public final OperationFuture<Operation, Operation> setMinCpuPlatformAsync( 4060 SetMinCpuPlatformInstanceRequest request) { 4061 return setMinCpuPlatformOperationCallable().futureCall(request); 4062 } 4063 4064 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4065 /** 4066 * Changes the minimum CPU platform that this instance should use. This method can only be called 4067 * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. 4068 * 4069 * <p>Sample code: 4070 * 4071 * <pre>{@code 4072 * // This snippet has been automatically generated and should be regarded as a code template only. 4073 * // It will require modifications to work: 4074 * // - It may require correct/in-range values for request initialization. 4075 * // - It may require specifying regional endpoints when creating the service client as shown in 4076 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4077 * try (InstancesClient instancesClient = InstancesClient.create()) { 4078 * SetMinCpuPlatformInstanceRequest request = 4079 * SetMinCpuPlatformInstanceRequest.newBuilder() 4080 * .setInstance("instance555127957") 4081 * .setInstancesSetMinCpuPlatformRequestResource( 4082 * InstancesSetMinCpuPlatformRequest.newBuilder().build()) 4083 * .setProject("project-309310695") 4084 * .setRequestId("requestId693933066") 4085 * .setZone("zone3744684") 4086 * .build(); 4087 * OperationFuture<Operation, Operation> future = 4088 * instancesClient.setMinCpuPlatformOperationCallable().futureCall(request); 4089 * // Do something. 4090 * Operation response = future.get(); 4091 * } 4092 * }</pre> 4093 */ 4094 public final OperationCallable<SetMinCpuPlatformInstanceRequest, Operation, Operation> setMinCpuPlatformOperationCallable()4095 setMinCpuPlatformOperationCallable() { 4096 return stub.setMinCpuPlatformOperationCallable(); 4097 } 4098 4099 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4100 /** 4101 * Changes the minimum CPU platform that this instance should use. This method can only be called 4102 * on a stopped instance. For more information, read Specifying a Minimum CPU Platform. 4103 * 4104 * <p>Sample code: 4105 * 4106 * <pre>{@code 4107 * // This snippet has been automatically generated and should be regarded as a code template only. 4108 * // It will require modifications to work: 4109 * // - It may require correct/in-range values for request initialization. 4110 * // - It may require specifying regional endpoints when creating the service client as shown in 4111 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4112 * try (InstancesClient instancesClient = InstancesClient.create()) { 4113 * SetMinCpuPlatformInstanceRequest request = 4114 * SetMinCpuPlatformInstanceRequest.newBuilder() 4115 * .setInstance("instance555127957") 4116 * .setInstancesSetMinCpuPlatformRequestResource( 4117 * InstancesSetMinCpuPlatformRequest.newBuilder().build()) 4118 * .setProject("project-309310695") 4119 * .setRequestId("requestId693933066") 4120 * .setZone("zone3744684") 4121 * .build(); 4122 * ApiFuture<Operation> future = instancesClient.setMinCpuPlatformCallable().futureCall(request); 4123 * // Do something. 4124 * Operation response = future.get(); 4125 * } 4126 * }</pre> 4127 */ 4128 public final UnaryCallable<SetMinCpuPlatformInstanceRequest, Operation> setMinCpuPlatformCallable()4129 setMinCpuPlatformCallable() { 4130 return stub.setMinCpuPlatformCallable(); 4131 } 4132 4133 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4134 /** 4135 * Sets name of an instance. 4136 * 4137 * <p>Sample code: 4138 * 4139 * <pre>{@code 4140 * // This snippet has been automatically generated and should be regarded as a code template only. 4141 * // It will require modifications to work: 4142 * // - It may require correct/in-range values for request initialization. 4143 * // - It may require specifying regional endpoints when creating the service client as shown in 4144 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4145 * try (InstancesClient instancesClient = InstancesClient.create()) { 4146 * String project = "project-309310695"; 4147 * String zone = "zone3744684"; 4148 * String instance = "instance555127957"; 4149 * InstancesSetNameRequest instancesSetNameRequestResource = 4150 * InstancesSetNameRequest.newBuilder().build(); 4151 * Operation response = 4152 * instancesClient 4153 * .setNameAsync(project, zone, instance, instancesSetNameRequestResource) 4154 * .get(); 4155 * } 4156 * }</pre> 4157 * 4158 * @param project Project ID for this request. 4159 * @param zone The name of the zone for this request. 4160 * @param instance The instance name for this request. 4161 * @param instancesSetNameRequestResource The body resource for this request 4162 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4163 */ setNameAsync( String project, String zone, String instance, InstancesSetNameRequest instancesSetNameRequestResource)4164 public final OperationFuture<Operation, Operation> setNameAsync( 4165 String project, 4166 String zone, 4167 String instance, 4168 InstancesSetNameRequest instancesSetNameRequestResource) { 4169 SetNameInstanceRequest request = 4170 SetNameInstanceRequest.newBuilder() 4171 .setProject(project) 4172 .setZone(zone) 4173 .setInstance(instance) 4174 .setInstancesSetNameRequestResource(instancesSetNameRequestResource) 4175 .build(); 4176 return setNameAsync(request); 4177 } 4178 4179 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4180 /** 4181 * Sets name of an instance. 4182 * 4183 * <p>Sample code: 4184 * 4185 * <pre>{@code 4186 * // This snippet has been automatically generated and should be regarded as a code template only. 4187 * // It will require modifications to work: 4188 * // - It may require correct/in-range values for request initialization. 4189 * // - It may require specifying regional endpoints when creating the service client as shown in 4190 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4191 * try (InstancesClient instancesClient = InstancesClient.create()) { 4192 * SetNameInstanceRequest request = 4193 * SetNameInstanceRequest.newBuilder() 4194 * .setInstance("instance555127957") 4195 * .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build()) 4196 * .setProject("project-309310695") 4197 * .setRequestId("requestId693933066") 4198 * .setZone("zone3744684") 4199 * .build(); 4200 * Operation response = instancesClient.setNameAsync(request).get(); 4201 * } 4202 * }</pre> 4203 * 4204 * @param request The request object containing all of the parameters for the API call. 4205 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4206 */ 4207 @BetaApi( 4208 "The surface for long-running operations is not stable yet and may change in the future.") setNameAsync(SetNameInstanceRequest request)4209 public final OperationFuture<Operation, Operation> setNameAsync(SetNameInstanceRequest request) { 4210 return setNameOperationCallable().futureCall(request); 4211 } 4212 4213 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4214 /** 4215 * Sets name of an instance. 4216 * 4217 * <p>Sample code: 4218 * 4219 * <pre>{@code 4220 * // This snippet has been automatically generated and should be regarded as a code template only. 4221 * // It will require modifications to work: 4222 * // - It may require correct/in-range values for request initialization. 4223 * // - It may require specifying regional endpoints when creating the service client as shown in 4224 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4225 * try (InstancesClient instancesClient = InstancesClient.create()) { 4226 * SetNameInstanceRequest request = 4227 * SetNameInstanceRequest.newBuilder() 4228 * .setInstance("instance555127957") 4229 * .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build()) 4230 * .setProject("project-309310695") 4231 * .setRequestId("requestId693933066") 4232 * .setZone("zone3744684") 4233 * .build(); 4234 * OperationFuture<Operation, Operation> future = 4235 * instancesClient.setNameOperationCallable().futureCall(request); 4236 * // Do something. 4237 * Operation response = future.get(); 4238 * } 4239 * }</pre> 4240 */ 4241 public final OperationCallable<SetNameInstanceRequest, Operation, Operation> setNameOperationCallable()4242 setNameOperationCallable() { 4243 return stub.setNameOperationCallable(); 4244 } 4245 4246 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4247 /** 4248 * Sets name of an instance. 4249 * 4250 * <p>Sample code: 4251 * 4252 * <pre>{@code 4253 * // This snippet has been automatically generated and should be regarded as a code template only. 4254 * // It will require modifications to work: 4255 * // - It may require correct/in-range values for request initialization. 4256 * // - It may require specifying regional endpoints when creating the service client as shown in 4257 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4258 * try (InstancesClient instancesClient = InstancesClient.create()) { 4259 * SetNameInstanceRequest request = 4260 * SetNameInstanceRequest.newBuilder() 4261 * .setInstance("instance555127957") 4262 * .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build()) 4263 * .setProject("project-309310695") 4264 * .setRequestId("requestId693933066") 4265 * .setZone("zone3744684") 4266 * .build(); 4267 * ApiFuture<Operation> future = instancesClient.setNameCallable().futureCall(request); 4268 * // Do something. 4269 * Operation response = future.get(); 4270 * } 4271 * }</pre> 4272 */ setNameCallable()4273 public final UnaryCallable<SetNameInstanceRequest, Operation> setNameCallable() { 4274 return stub.setNameCallable(); 4275 } 4276 4277 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4278 /** 4279 * Sets an instance's scheduling options. You can only call this method on a stopped instance, 4280 * that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more 4281 * information on the possible instance states. For more information about setting scheduling 4282 * options for a VM, see Set VM host maintenance policy. 4283 * 4284 * <p>Sample code: 4285 * 4286 * <pre>{@code 4287 * // This snippet has been automatically generated and should be regarded as a code template only. 4288 * // It will require modifications to work: 4289 * // - It may require correct/in-range values for request initialization. 4290 * // - It may require specifying regional endpoints when creating the service client as shown in 4291 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4292 * try (InstancesClient instancesClient = InstancesClient.create()) { 4293 * String project = "project-309310695"; 4294 * String zone = "zone3744684"; 4295 * String instance = "instance555127957"; 4296 * Scheduling schedulingResource = Scheduling.newBuilder().build(); 4297 * Operation response = 4298 * instancesClient.setSchedulingAsync(project, zone, instance, schedulingResource).get(); 4299 * } 4300 * }</pre> 4301 * 4302 * @param project Project ID for this request. 4303 * @param zone The name of the zone for this request. 4304 * @param instance Instance name for this request. 4305 * @param schedulingResource The body resource for this request 4306 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4307 */ setSchedulingAsync( String project, String zone, String instance, Scheduling schedulingResource)4308 public final OperationFuture<Operation, Operation> setSchedulingAsync( 4309 String project, String zone, String instance, Scheduling schedulingResource) { 4310 SetSchedulingInstanceRequest request = 4311 SetSchedulingInstanceRequest.newBuilder() 4312 .setProject(project) 4313 .setZone(zone) 4314 .setInstance(instance) 4315 .setSchedulingResource(schedulingResource) 4316 .build(); 4317 return setSchedulingAsync(request); 4318 } 4319 4320 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4321 /** 4322 * Sets an instance's scheduling options. You can only call this method on a stopped instance, 4323 * that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more 4324 * information on the possible instance states. For more information about setting scheduling 4325 * options for a VM, see Set VM host maintenance policy. 4326 * 4327 * <p>Sample code: 4328 * 4329 * <pre>{@code 4330 * // This snippet has been automatically generated and should be regarded as a code template only. 4331 * // It will require modifications to work: 4332 * // - It may require correct/in-range values for request initialization. 4333 * // - It may require specifying regional endpoints when creating the service client as shown in 4334 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4335 * try (InstancesClient instancesClient = InstancesClient.create()) { 4336 * SetSchedulingInstanceRequest request = 4337 * SetSchedulingInstanceRequest.newBuilder() 4338 * .setInstance("instance555127957") 4339 * .setProject("project-309310695") 4340 * .setRequestId("requestId693933066") 4341 * .setSchedulingResource(Scheduling.newBuilder().build()) 4342 * .setZone("zone3744684") 4343 * .build(); 4344 * Operation response = instancesClient.setSchedulingAsync(request).get(); 4345 * } 4346 * }</pre> 4347 * 4348 * @param request The request object containing all of the parameters for the API call. 4349 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4350 */ 4351 @BetaApi( 4352 "The surface for long-running operations is not stable yet and may change in the future.") setSchedulingAsync( SetSchedulingInstanceRequest request)4353 public final OperationFuture<Operation, Operation> setSchedulingAsync( 4354 SetSchedulingInstanceRequest request) { 4355 return setSchedulingOperationCallable().futureCall(request); 4356 } 4357 4358 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4359 /** 4360 * Sets an instance's scheduling options. You can only call this method on a stopped instance, 4361 * that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more 4362 * information on the possible instance states. For more information about setting scheduling 4363 * options for a VM, see Set VM host maintenance policy. 4364 * 4365 * <p>Sample code: 4366 * 4367 * <pre>{@code 4368 * // This snippet has been automatically generated and should be regarded as a code template only. 4369 * // It will require modifications to work: 4370 * // - It may require correct/in-range values for request initialization. 4371 * // - It may require specifying regional endpoints when creating the service client as shown in 4372 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4373 * try (InstancesClient instancesClient = InstancesClient.create()) { 4374 * SetSchedulingInstanceRequest request = 4375 * SetSchedulingInstanceRequest.newBuilder() 4376 * .setInstance("instance555127957") 4377 * .setProject("project-309310695") 4378 * .setRequestId("requestId693933066") 4379 * .setSchedulingResource(Scheduling.newBuilder().build()) 4380 * .setZone("zone3744684") 4381 * .build(); 4382 * OperationFuture<Operation, Operation> future = 4383 * instancesClient.setSchedulingOperationCallable().futureCall(request); 4384 * // Do something. 4385 * Operation response = future.get(); 4386 * } 4387 * }</pre> 4388 */ 4389 public final OperationCallable<SetSchedulingInstanceRequest, Operation, Operation> setSchedulingOperationCallable()4390 setSchedulingOperationCallable() { 4391 return stub.setSchedulingOperationCallable(); 4392 } 4393 4394 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4395 /** 4396 * Sets an instance's scheduling options. You can only call this method on a stopped instance, 4397 * that is, a VM instance that is in a `TERMINATED` state. See Instance Life Cycle for more 4398 * information on the possible instance states. For more information about setting scheduling 4399 * options for a VM, see Set VM host maintenance policy. 4400 * 4401 * <p>Sample code: 4402 * 4403 * <pre>{@code 4404 * // This snippet has been automatically generated and should be regarded as a code template only. 4405 * // It will require modifications to work: 4406 * // - It may require correct/in-range values for request initialization. 4407 * // - It may require specifying regional endpoints when creating the service client as shown in 4408 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4409 * try (InstancesClient instancesClient = InstancesClient.create()) { 4410 * SetSchedulingInstanceRequest request = 4411 * SetSchedulingInstanceRequest.newBuilder() 4412 * .setInstance("instance555127957") 4413 * .setProject("project-309310695") 4414 * .setRequestId("requestId693933066") 4415 * .setSchedulingResource(Scheduling.newBuilder().build()) 4416 * .setZone("zone3744684") 4417 * .build(); 4418 * ApiFuture<Operation> future = instancesClient.setSchedulingCallable().futureCall(request); 4419 * // Do something. 4420 * Operation response = future.get(); 4421 * } 4422 * }</pre> 4423 */ setSchedulingCallable()4424 public final UnaryCallable<SetSchedulingInstanceRequest, Operation> setSchedulingCallable() { 4425 return stub.setSchedulingCallable(); 4426 } 4427 4428 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4429 /** 4430 * Sets the service account on the instance. For more information, read Changing the service 4431 * account and access scopes for an instance. 4432 * 4433 * <p>Sample code: 4434 * 4435 * <pre>{@code 4436 * // This snippet has been automatically generated and should be regarded as a code template only. 4437 * // It will require modifications to work: 4438 * // - It may require correct/in-range values for request initialization. 4439 * // - It may require specifying regional endpoints when creating the service client as shown in 4440 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4441 * try (InstancesClient instancesClient = InstancesClient.create()) { 4442 * String project = "project-309310695"; 4443 * String zone = "zone3744684"; 4444 * String instance = "instance555127957"; 4445 * InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource = 4446 * InstancesSetServiceAccountRequest.newBuilder().build(); 4447 * Operation response = 4448 * instancesClient 4449 * .setServiceAccountAsync( 4450 * project, zone, instance, instancesSetServiceAccountRequestResource) 4451 * .get(); 4452 * } 4453 * }</pre> 4454 * 4455 * @param project Project ID for this request. 4456 * @param zone The name of the zone for this request. 4457 * @param instance Name of the instance resource to start. 4458 * @param instancesSetServiceAccountRequestResource The body resource for this request 4459 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4460 */ setServiceAccountAsync( String project, String zone, String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)4461 public final OperationFuture<Operation, Operation> setServiceAccountAsync( 4462 String project, 4463 String zone, 4464 String instance, 4465 InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource) { 4466 SetServiceAccountInstanceRequest request = 4467 SetServiceAccountInstanceRequest.newBuilder() 4468 .setProject(project) 4469 .setZone(zone) 4470 .setInstance(instance) 4471 .setInstancesSetServiceAccountRequestResource(instancesSetServiceAccountRequestResource) 4472 .build(); 4473 return setServiceAccountAsync(request); 4474 } 4475 4476 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4477 /** 4478 * Sets the service account on the instance. For more information, read Changing the service 4479 * account and access scopes for an instance. 4480 * 4481 * <p>Sample code: 4482 * 4483 * <pre>{@code 4484 * // This snippet has been automatically generated and should be regarded as a code template only. 4485 * // It will require modifications to work: 4486 * // - It may require correct/in-range values for request initialization. 4487 * // - It may require specifying regional endpoints when creating the service client as shown in 4488 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4489 * try (InstancesClient instancesClient = InstancesClient.create()) { 4490 * SetServiceAccountInstanceRequest request = 4491 * SetServiceAccountInstanceRequest.newBuilder() 4492 * .setInstance("instance555127957") 4493 * .setInstancesSetServiceAccountRequestResource( 4494 * InstancesSetServiceAccountRequest.newBuilder().build()) 4495 * .setProject("project-309310695") 4496 * .setRequestId("requestId693933066") 4497 * .setZone("zone3744684") 4498 * .build(); 4499 * Operation response = instancesClient.setServiceAccountAsync(request).get(); 4500 * } 4501 * }</pre> 4502 * 4503 * @param request The request object containing all of the parameters for the API call. 4504 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4505 */ 4506 @BetaApi( 4507 "The surface for long-running operations is not stable yet and may change in the future.") setServiceAccountAsync( SetServiceAccountInstanceRequest request)4508 public final OperationFuture<Operation, Operation> setServiceAccountAsync( 4509 SetServiceAccountInstanceRequest request) { 4510 return setServiceAccountOperationCallable().futureCall(request); 4511 } 4512 4513 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4514 /** 4515 * Sets the service account on the instance. For more information, read Changing the service 4516 * account and access scopes for an instance. 4517 * 4518 * <p>Sample code: 4519 * 4520 * <pre>{@code 4521 * // This snippet has been automatically generated and should be regarded as a code template only. 4522 * // It will require modifications to work: 4523 * // - It may require correct/in-range values for request initialization. 4524 * // - It may require specifying regional endpoints when creating the service client as shown in 4525 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4526 * try (InstancesClient instancesClient = InstancesClient.create()) { 4527 * SetServiceAccountInstanceRequest request = 4528 * SetServiceAccountInstanceRequest.newBuilder() 4529 * .setInstance("instance555127957") 4530 * .setInstancesSetServiceAccountRequestResource( 4531 * InstancesSetServiceAccountRequest.newBuilder().build()) 4532 * .setProject("project-309310695") 4533 * .setRequestId("requestId693933066") 4534 * .setZone("zone3744684") 4535 * .build(); 4536 * OperationFuture<Operation, Operation> future = 4537 * instancesClient.setServiceAccountOperationCallable().futureCall(request); 4538 * // Do something. 4539 * Operation response = future.get(); 4540 * } 4541 * }</pre> 4542 */ 4543 public final OperationCallable<SetServiceAccountInstanceRequest, Operation, Operation> setServiceAccountOperationCallable()4544 setServiceAccountOperationCallable() { 4545 return stub.setServiceAccountOperationCallable(); 4546 } 4547 4548 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4549 /** 4550 * Sets the service account on the instance. For more information, read Changing the service 4551 * account and access scopes for an instance. 4552 * 4553 * <p>Sample code: 4554 * 4555 * <pre>{@code 4556 * // This snippet has been automatically generated and should be regarded as a code template only. 4557 * // It will require modifications to work: 4558 * // - It may require correct/in-range values for request initialization. 4559 * // - It may require specifying regional endpoints when creating the service client as shown in 4560 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4561 * try (InstancesClient instancesClient = InstancesClient.create()) { 4562 * SetServiceAccountInstanceRequest request = 4563 * SetServiceAccountInstanceRequest.newBuilder() 4564 * .setInstance("instance555127957") 4565 * .setInstancesSetServiceAccountRequestResource( 4566 * InstancesSetServiceAccountRequest.newBuilder().build()) 4567 * .setProject("project-309310695") 4568 * .setRequestId("requestId693933066") 4569 * .setZone("zone3744684") 4570 * .build(); 4571 * ApiFuture<Operation> future = instancesClient.setServiceAccountCallable().futureCall(request); 4572 * // Do something. 4573 * Operation response = future.get(); 4574 * } 4575 * }</pre> 4576 */ 4577 public final UnaryCallable<SetServiceAccountInstanceRequest, Operation> setServiceAccountCallable()4578 setServiceAccountCallable() { 4579 return stub.setServiceAccountCallable(); 4580 } 4581 4582 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4583 /** 4584 * Sets the Shielded Instance integrity policy for an instance. You can only use this method on a 4585 * running instance. This method supports PATCH semantics and uses the JSON merge patch format and 4586 * processing rules. 4587 * 4588 * <p>Sample code: 4589 * 4590 * <pre>{@code 4591 * // This snippet has been automatically generated and should be regarded as a code template only. 4592 * // It will require modifications to work: 4593 * // - It may require correct/in-range values for request initialization. 4594 * // - It may require specifying regional endpoints when creating the service client as shown in 4595 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4596 * try (InstancesClient instancesClient = InstancesClient.create()) { 4597 * String project = "project-309310695"; 4598 * String zone = "zone3744684"; 4599 * String instance = "instance555127957"; 4600 * ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource = 4601 * ShieldedInstanceIntegrityPolicy.newBuilder().build(); 4602 * Operation response = 4603 * instancesClient 4604 * .setShieldedInstanceIntegrityPolicyAsync( 4605 * project, zone, instance, shieldedInstanceIntegrityPolicyResource) 4606 * .get(); 4607 * } 4608 * }</pre> 4609 * 4610 * @param project Project ID for this request. 4611 * @param zone The name of the zone for this request. 4612 * @param instance Name or id of the instance scoping this request. 4613 * @param shieldedInstanceIntegrityPolicyResource The body resource for this request 4614 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4615 */ setShieldedInstanceIntegrityPolicyAsync( String project, String zone, String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource)4616 public final OperationFuture<Operation, Operation> setShieldedInstanceIntegrityPolicyAsync( 4617 String project, 4618 String zone, 4619 String instance, 4620 ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource) { 4621 SetShieldedInstanceIntegrityPolicyInstanceRequest request = 4622 SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder() 4623 .setProject(project) 4624 .setZone(zone) 4625 .setInstance(instance) 4626 .setShieldedInstanceIntegrityPolicyResource(shieldedInstanceIntegrityPolicyResource) 4627 .build(); 4628 return setShieldedInstanceIntegrityPolicyAsync(request); 4629 } 4630 4631 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4632 /** 4633 * Sets the Shielded Instance integrity policy for an instance. You can only use this method on a 4634 * running instance. This method supports PATCH semantics and uses the JSON merge patch format and 4635 * processing rules. 4636 * 4637 * <p>Sample code: 4638 * 4639 * <pre>{@code 4640 * // This snippet has been automatically generated and should be regarded as a code template only. 4641 * // It will require modifications to work: 4642 * // - It may require correct/in-range values for request initialization. 4643 * // - It may require specifying regional endpoints when creating the service client as shown in 4644 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4645 * try (InstancesClient instancesClient = InstancesClient.create()) { 4646 * SetShieldedInstanceIntegrityPolicyInstanceRequest request = 4647 * SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder() 4648 * .setInstance("instance555127957") 4649 * .setProject("project-309310695") 4650 * .setRequestId("requestId693933066") 4651 * .setShieldedInstanceIntegrityPolicyResource( 4652 * ShieldedInstanceIntegrityPolicy.newBuilder().build()) 4653 * .setZone("zone3744684") 4654 * .build(); 4655 * Operation response = instancesClient.setShieldedInstanceIntegrityPolicyAsync(request).get(); 4656 * } 4657 * }</pre> 4658 * 4659 * @param request The request object containing all of the parameters for the API call. 4660 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4661 */ 4662 @BetaApi( 4663 "The surface for long-running operations is not stable yet and may change in the future.") setShieldedInstanceIntegrityPolicyAsync( SetShieldedInstanceIntegrityPolicyInstanceRequest request)4664 public final OperationFuture<Operation, Operation> setShieldedInstanceIntegrityPolicyAsync( 4665 SetShieldedInstanceIntegrityPolicyInstanceRequest request) { 4666 return setShieldedInstanceIntegrityPolicyOperationCallable().futureCall(request); 4667 } 4668 4669 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4670 /** 4671 * Sets the Shielded Instance integrity policy for an instance. You can only use this method on a 4672 * running instance. This method supports PATCH semantics and uses the JSON merge patch format and 4673 * processing rules. 4674 * 4675 * <p>Sample code: 4676 * 4677 * <pre>{@code 4678 * // This snippet has been automatically generated and should be regarded as a code template only. 4679 * // It will require modifications to work: 4680 * // - It may require correct/in-range values for request initialization. 4681 * // - It may require specifying regional endpoints when creating the service client as shown in 4682 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4683 * try (InstancesClient instancesClient = InstancesClient.create()) { 4684 * SetShieldedInstanceIntegrityPolicyInstanceRequest request = 4685 * SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder() 4686 * .setInstance("instance555127957") 4687 * .setProject("project-309310695") 4688 * .setRequestId("requestId693933066") 4689 * .setShieldedInstanceIntegrityPolicyResource( 4690 * ShieldedInstanceIntegrityPolicy.newBuilder().build()) 4691 * .setZone("zone3744684") 4692 * .build(); 4693 * OperationFuture<Operation, Operation> future = 4694 * instancesClient.setShieldedInstanceIntegrityPolicyOperationCallable().futureCall(request); 4695 * // Do something. 4696 * Operation response = future.get(); 4697 * } 4698 * }</pre> 4699 */ 4700 public final OperationCallable< 4701 SetShieldedInstanceIntegrityPolicyInstanceRequest, Operation, Operation> setShieldedInstanceIntegrityPolicyOperationCallable()4702 setShieldedInstanceIntegrityPolicyOperationCallable() { 4703 return stub.setShieldedInstanceIntegrityPolicyOperationCallable(); 4704 } 4705 4706 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4707 /** 4708 * Sets the Shielded Instance integrity policy for an instance. You can only use this method on a 4709 * running instance. This method supports PATCH semantics and uses the JSON merge patch format and 4710 * processing rules. 4711 * 4712 * <p>Sample code: 4713 * 4714 * <pre>{@code 4715 * // This snippet has been automatically generated and should be regarded as a code template only. 4716 * // It will require modifications to work: 4717 * // - It may require correct/in-range values for request initialization. 4718 * // - It may require specifying regional endpoints when creating the service client as shown in 4719 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4720 * try (InstancesClient instancesClient = InstancesClient.create()) { 4721 * SetShieldedInstanceIntegrityPolicyInstanceRequest request = 4722 * SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder() 4723 * .setInstance("instance555127957") 4724 * .setProject("project-309310695") 4725 * .setRequestId("requestId693933066") 4726 * .setShieldedInstanceIntegrityPolicyResource( 4727 * ShieldedInstanceIntegrityPolicy.newBuilder().build()) 4728 * .setZone("zone3744684") 4729 * .build(); 4730 * ApiFuture<Operation> future = 4731 * instancesClient.setShieldedInstanceIntegrityPolicyCallable().futureCall(request); 4732 * // Do something. 4733 * Operation response = future.get(); 4734 * } 4735 * }</pre> 4736 */ 4737 public final UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest, Operation> setShieldedInstanceIntegrityPolicyCallable()4738 setShieldedInstanceIntegrityPolicyCallable() { 4739 return stub.setShieldedInstanceIntegrityPolicyCallable(); 4740 } 4741 4742 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4743 /** 4744 * Sets network tags for the specified instance to the data included in the request. 4745 * 4746 * <p>Sample code: 4747 * 4748 * <pre>{@code 4749 * // This snippet has been automatically generated and should be regarded as a code template only. 4750 * // It will require modifications to work: 4751 * // - It may require correct/in-range values for request initialization. 4752 * // - It may require specifying regional endpoints when creating the service client as shown in 4753 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4754 * try (InstancesClient instancesClient = InstancesClient.create()) { 4755 * String project = "project-309310695"; 4756 * String zone = "zone3744684"; 4757 * String instance = "instance555127957"; 4758 * Tags tagsResource = Tags.newBuilder().build(); 4759 * Operation response = 4760 * instancesClient.setTagsAsync(project, zone, instance, tagsResource).get(); 4761 * } 4762 * }</pre> 4763 * 4764 * @param project Project ID for this request. 4765 * @param zone The name of the zone for this request. 4766 * @param instance Name of the instance scoping this request. 4767 * @param tagsResource The body resource for this request 4768 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4769 */ setTagsAsync( String project, String zone, String instance, Tags tagsResource)4770 public final OperationFuture<Operation, Operation> setTagsAsync( 4771 String project, String zone, String instance, Tags tagsResource) { 4772 SetTagsInstanceRequest request = 4773 SetTagsInstanceRequest.newBuilder() 4774 .setProject(project) 4775 .setZone(zone) 4776 .setInstance(instance) 4777 .setTagsResource(tagsResource) 4778 .build(); 4779 return setTagsAsync(request); 4780 } 4781 4782 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4783 /** 4784 * Sets network tags for the specified instance to the data included in the request. 4785 * 4786 * <p>Sample code: 4787 * 4788 * <pre>{@code 4789 * // This snippet has been automatically generated and should be regarded as a code template only. 4790 * // It will require modifications to work: 4791 * // - It may require correct/in-range values for request initialization. 4792 * // - It may require specifying regional endpoints when creating the service client as shown in 4793 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4794 * try (InstancesClient instancesClient = InstancesClient.create()) { 4795 * SetTagsInstanceRequest request = 4796 * SetTagsInstanceRequest.newBuilder() 4797 * .setInstance("instance555127957") 4798 * .setProject("project-309310695") 4799 * .setRequestId("requestId693933066") 4800 * .setTagsResource(Tags.newBuilder().build()) 4801 * .setZone("zone3744684") 4802 * .build(); 4803 * Operation response = instancesClient.setTagsAsync(request).get(); 4804 * } 4805 * }</pre> 4806 * 4807 * @param request The request object containing all of the parameters for the API call. 4808 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4809 */ 4810 @BetaApi( 4811 "The surface for long-running operations is not stable yet and may change in the future.") setTagsAsync(SetTagsInstanceRequest request)4812 public final OperationFuture<Operation, Operation> setTagsAsync(SetTagsInstanceRequest request) { 4813 return setTagsOperationCallable().futureCall(request); 4814 } 4815 4816 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4817 /** 4818 * Sets network tags for the specified instance to the data included in the request. 4819 * 4820 * <p>Sample code: 4821 * 4822 * <pre>{@code 4823 * // This snippet has been automatically generated and should be regarded as a code template only. 4824 * // It will require modifications to work: 4825 * // - It may require correct/in-range values for request initialization. 4826 * // - It may require specifying regional endpoints when creating the service client as shown in 4827 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4828 * try (InstancesClient instancesClient = InstancesClient.create()) { 4829 * SetTagsInstanceRequest request = 4830 * SetTagsInstanceRequest.newBuilder() 4831 * .setInstance("instance555127957") 4832 * .setProject("project-309310695") 4833 * .setRequestId("requestId693933066") 4834 * .setTagsResource(Tags.newBuilder().build()) 4835 * .setZone("zone3744684") 4836 * .build(); 4837 * OperationFuture<Operation, Operation> future = 4838 * instancesClient.setTagsOperationCallable().futureCall(request); 4839 * // Do something. 4840 * Operation response = future.get(); 4841 * } 4842 * }</pre> 4843 */ 4844 public final OperationCallable<SetTagsInstanceRequest, Operation, Operation> setTagsOperationCallable()4845 setTagsOperationCallable() { 4846 return stub.setTagsOperationCallable(); 4847 } 4848 4849 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4850 /** 4851 * Sets network tags for the specified instance to the data included in the request. 4852 * 4853 * <p>Sample code: 4854 * 4855 * <pre>{@code 4856 * // This snippet has been automatically generated and should be regarded as a code template only. 4857 * // It will require modifications to work: 4858 * // - It may require correct/in-range values for request initialization. 4859 * // - It may require specifying regional endpoints when creating the service client as shown in 4860 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4861 * try (InstancesClient instancesClient = InstancesClient.create()) { 4862 * SetTagsInstanceRequest request = 4863 * SetTagsInstanceRequest.newBuilder() 4864 * .setInstance("instance555127957") 4865 * .setProject("project-309310695") 4866 * .setRequestId("requestId693933066") 4867 * .setTagsResource(Tags.newBuilder().build()) 4868 * .setZone("zone3744684") 4869 * .build(); 4870 * ApiFuture<Operation> future = instancesClient.setTagsCallable().futureCall(request); 4871 * // Do something. 4872 * Operation response = future.get(); 4873 * } 4874 * }</pre> 4875 */ setTagsCallable()4876 public final UnaryCallable<SetTagsInstanceRequest, Operation> setTagsCallable() { 4877 return stub.setTagsCallable(); 4878 } 4879 4880 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4881 /** 4882 * Simulates a host maintenance event on a VM. For more information, see Simulate a host 4883 * maintenance event. 4884 * 4885 * <p>Sample code: 4886 * 4887 * <pre>{@code 4888 * // This snippet has been automatically generated and should be regarded as a code template only. 4889 * // It will require modifications to work: 4890 * // - It may require correct/in-range values for request initialization. 4891 * // - It may require specifying regional endpoints when creating the service client as shown in 4892 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4893 * try (InstancesClient instancesClient = InstancesClient.create()) { 4894 * String project = "project-309310695"; 4895 * String zone = "zone3744684"; 4896 * String instance = "instance555127957"; 4897 * Operation response = 4898 * instancesClient.simulateMaintenanceEventAsync(project, zone, instance).get(); 4899 * } 4900 * }</pre> 4901 * 4902 * @param project Project ID for this request. 4903 * @param zone The name of the zone for this request. 4904 * @param instance Name of the instance scoping this request. 4905 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4906 */ simulateMaintenanceEventAsync( String project, String zone, String instance)4907 public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync( 4908 String project, String zone, String instance) { 4909 SimulateMaintenanceEventInstanceRequest request = 4910 SimulateMaintenanceEventInstanceRequest.newBuilder() 4911 .setProject(project) 4912 .setZone(zone) 4913 .setInstance(instance) 4914 .build(); 4915 return simulateMaintenanceEventAsync(request); 4916 } 4917 4918 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4919 /** 4920 * Simulates a host maintenance event on a VM. For more information, see Simulate a host 4921 * maintenance event. 4922 * 4923 * <p>Sample code: 4924 * 4925 * <pre>{@code 4926 * // This snippet has been automatically generated and should be regarded as a code template only. 4927 * // It will require modifications to work: 4928 * // - It may require correct/in-range values for request initialization. 4929 * // - It may require specifying regional endpoints when creating the service client as shown in 4930 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4931 * try (InstancesClient instancesClient = InstancesClient.create()) { 4932 * SimulateMaintenanceEventInstanceRequest request = 4933 * SimulateMaintenanceEventInstanceRequest.newBuilder() 4934 * .setInstance("instance555127957") 4935 * .setProject("project-309310695") 4936 * .setZone("zone3744684") 4937 * .build(); 4938 * Operation response = instancesClient.simulateMaintenanceEventAsync(request).get(); 4939 * } 4940 * }</pre> 4941 * 4942 * @param request The request object containing all of the parameters for the API call. 4943 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 4944 */ 4945 @BetaApi( 4946 "The surface for long-running operations is not stable yet and may change in the future.") simulateMaintenanceEventAsync( SimulateMaintenanceEventInstanceRequest request)4947 public final OperationFuture<Operation, Operation> simulateMaintenanceEventAsync( 4948 SimulateMaintenanceEventInstanceRequest request) { 4949 return simulateMaintenanceEventOperationCallable().futureCall(request); 4950 } 4951 4952 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4953 /** 4954 * Simulates a host maintenance event on a VM. For more information, see Simulate a host 4955 * maintenance event. 4956 * 4957 * <p>Sample code: 4958 * 4959 * <pre>{@code 4960 * // This snippet has been automatically generated and should be regarded as a code template only. 4961 * // It will require modifications to work: 4962 * // - It may require correct/in-range values for request initialization. 4963 * // - It may require specifying regional endpoints when creating the service client as shown in 4964 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4965 * try (InstancesClient instancesClient = InstancesClient.create()) { 4966 * SimulateMaintenanceEventInstanceRequest request = 4967 * SimulateMaintenanceEventInstanceRequest.newBuilder() 4968 * .setInstance("instance555127957") 4969 * .setProject("project-309310695") 4970 * .setZone("zone3744684") 4971 * .build(); 4972 * OperationFuture<Operation, Operation> future = 4973 * instancesClient.simulateMaintenanceEventOperationCallable().futureCall(request); 4974 * // Do something. 4975 * Operation response = future.get(); 4976 * } 4977 * }</pre> 4978 */ 4979 public final OperationCallable<SimulateMaintenanceEventInstanceRequest, Operation, Operation> simulateMaintenanceEventOperationCallable()4980 simulateMaintenanceEventOperationCallable() { 4981 return stub.simulateMaintenanceEventOperationCallable(); 4982 } 4983 4984 // AUTO-GENERATED DOCUMENTATION AND METHOD. 4985 /** 4986 * Simulates a host maintenance event on a VM. For more information, see Simulate a host 4987 * maintenance event. 4988 * 4989 * <p>Sample code: 4990 * 4991 * <pre>{@code 4992 * // This snippet has been automatically generated and should be regarded as a code template only. 4993 * // It will require modifications to work: 4994 * // - It may require correct/in-range values for request initialization. 4995 * // - It may require specifying regional endpoints when creating the service client as shown in 4996 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 4997 * try (InstancesClient instancesClient = InstancesClient.create()) { 4998 * SimulateMaintenanceEventInstanceRequest request = 4999 * SimulateMaintenanceEventInstanceRequest.newBuilder() 5000 * .setInstance("instance555127957") 5001 * .setProject("project-309310695") 5002 * .setZone("zone3744684") 5003 * .build(); 5004 * ApiFuture<Operation> future = 5005 * instancesClient.simulateMaintenanceEventCallable().futureCall(request); 5006 * // Do something. 5007 * Operation response = future.get(); 5008 * } 5009 * }</pre> 5010 */ 5011 public final UnaryCallable<SimulateMaintenanceEventInstanceRequest, Operation> simulateMaintenanceEventCallable()5012 simulateMaintenanceEventCallable() { 5013 return stub.simulateMaintenanceEventCallable(); 5014 } 5015 5016 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5017 /** 5018 * Starts an instance that was stopped using the instances().stop method. For more information, 5019 * see Restart an instance. 5020 * 5021 * <p>Sample code: 5022 * 5023 * <pre>{@code 5024 * // This snippet has been automatically generated and should be regarded as a code template only. 5025 * // It will require modifications to work: 5026 * // - It may require correct/in-range values for request initialization. 5027 * // - It may require specifying regional endpoints when creating the service client as shown in 5028 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5029 * try (InstancesClient instancesClient = InstancesClient.create()) { 5030 * String project = "project-309310695"; 5031 * String zone = "zone3744684"; 5032 * String instance = "instance555127957"; 5033 * Operation response = instancesClient.startAsync(project, zone, instance).get(); 5034 * } 5035 * }</pre> 5036 * 5037 * @param project Project ID for this request. 5038 * @param zone The name of the zone for this request. 5039 * @param instance Name of the instance resource to start. 5040 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5041 */ startAsync( String project, String zone, String instance)5042 public final OperationFuture<Operation, Operation> startAsync( 5043 String project, String zone, String instance) { 5044 StartInstanceRequest request = 5045 StartInstanceRequest.newBuilder() 5046 .setProject(project) 5047 .setZone(zone) 5048 .setInstance(instance) 5049 .build(); 5050 return startAsync(request); 5051 } 5052 5053 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5054 /** 5055 * Starts an instance that was stopped using the instances().stop method. For more information, 5056 * see Restart an instance. 5057 * 5058 * <p>Sample code: 5059 * 5060 * <pre>{@code 5061 * // This snippet has been automatically generated and should be regarded as a code template only. 5062 * // It will require modifications to work: 5063 * // - It may require correct/in-range values for request initialization. 5064 * // - It may require specifying regional endpoints when creating the service client as shown in 5065 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5066 * try (InstancesClient instancesClient = InstancesClient.create()) { 5067 * StartInstanceRequest request = 5068 * StartInstanceRequest.newBuilder() 5069 * .setInstance("instance555127957") 5070 * .setProject("project-309310695") 5071 * .setRequestId("requestId693933066") 5072 * .setZone("zone3744684") 5073 * .build(); 5074 * Operation response = instancesClient.startAsync(request).get(); 5075 * } 5076 * }</pre> 5077 * 5078 * @param request The request object containing all of the parameters for the API call. 5079 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5080 */ 5081 @BetaApi( 5082 "The surface for long-running operations is not stable yet and may change in the future.") startAsync(StartInstanceRequest request)5083 public final OperationFuture<Operation, Operation> startAsync(StartInstanceRequest request) { 5084 return startOperationCallable().futureCall(request); 5085 } 5086 5087 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5088 /** 5089 * Starts an instance that was stopped using the instances().stop method. For more information, 5090 * see Restart an instance. 5091 * 5092 * <p>Sample code: 5093 * 5094 * <pre>{@code 5095 * // This snippet has been automatically generated and should be regarded as a code template only. 5096 * // It will require modifications to work: 5097 * // - It may require correct/in-range values for request initialization. 5098 * // - It may require specifying regional endpoints when creating the service client as shown in 5099 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5100 * try (InstancesClient instancesClient = InstancesClient.create()) { 5101 * StartInstanceRequest request = 5102 * StartInstanceRequest.newBuilder() 5103 * .setInstance("instance555127957") 5104 * .setProject("project-309310695") 5105 * .setRequestId("requestId693933066") 5106 * .setZone("zone3744684") 5107 * .build(); 5108 * OperationFuture<Operation, Operation> future = 5109 * instancesClient.startOperationCallable().futureCall(request); 5110 * // Do something. 5111 * Operation response = future.get(); 5112 * } 5113 * }</pre> 5114 */ 5115 public final OperationCallable<StartInstanceRequest, Operation, Operation> startOperationCallable()5116 startOperationCallable() { 5117 return stub.startOperationCallable(); 5118 } 5119 5120 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5121 /** 5122 * Starts an instance that was stopped using the instances().stop method. For more information, 5123 * see Restart an instance. 5124 * 5125 * <p>Sample code: 5126 * 5127 * <pre>{@code 5128 * // This snippet has been automatically generated and should be regarded as a code template only. 5129 * // It will require modifications to work: 5130 * // - It may require correct/in-range values for request initialization. 5131 * // - It may require specifying regional endpoints when creating the service client as shown in 5132 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5133 * try (InstancesClient instancesClient = InstancesClient.create()) { 5134 * StartInstanceRequest request = 5135 * StartInstanceRequest.newBuilder() 5136 * .setInstance("instance555127957") 5137 * .setProject("project-309310695") 5138 * .setRequestId("requestId693933066") 5139 * .setZone("zone3744684") 5140 * .build(); 5141 * ApiFuture<Operation> future = instancesClient.startCallable().futureCall(request); 5142 * // Do something. 5143 * Operation response = future.get(); 5144 * } 5145 * }</pre> 5146 */ startCallable()5147 public final UnaryCallable<StartInstanceRequest, Operation> startCallable() { 5148 return stub.startCallable(); 5149 } 5150 5151 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5152 /** 5153 * Starts an instance that was stopped using the instances().stop method. For more information, 5154 * see Restart an instance. 5155 * 5156 * <p>Sample code: 5157 * 5158 * <pre>{@code 5159 * // This snippet has been automatically generated and should be regarded as a code template only. 5160 * // It will require modifications to work: 5161 * // - It may require correct/in-range values for request initialization. 5162 * // - It may require specifying regional endpoints when creating the service client as shown in 5163 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5164 * try (InstancesClient instancesClient = InstancesClient.create()) { 5165 * String project = "project-309310695"; 5166 * String zone = "zone3744684"; 5167 * String instance = "instance555127957"; 5168 * InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource = 5169 * InstancesStartWithEncryptionKeyRequest.newBuilder().build(); 5170 * Operation response = 5171 * instancesClient 5172 * .startWithEncryptionKeyAsync( 5173 * project, zone, instance, instancesStartWithEncryptionKeyRequestResource) 5174 * .get(); 5175 * } 5176 * }</pre> 5177 * 5178 * @param project Project ID for this request. 5179 * @param zone The name of the zone for this request. 5180 * @param instance Name of the instance resource to start. 5181 * @param instancesStartWithEncryptionKeyRequestResource The body resource for this request 5182 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5183 */ startWithEncryptionKeyAsync( String project, String zone, String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)5184 public final OperationFuture<Operation, Operation> startWithEncryptionKeyAsync( 5185 String project, 5186 String zone, 5187 String instance, 5188 InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource) { 5189 StartWithEncryptionKeyInstanceRequest request = 5190 StartWithEncryptionKeyInstanceRequest.newBuilder() 5191 .setProject(project) 5192 .setZone(zone) 5193 .setInstance(instance) 5194 .setInstancesStartWithEncryptionKeyRequestResource( 5195 instancesStartWithEncryptionKeyRequestResource) 5196 .build(); 5197 return startWithEncryptionKeyAsync(request); 5198 } 5199 5200 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5201 /** 5202 * Starts an instance that was stopped using the instances().stop method. For more information, 5203 * see Restart an instance. 5204 * 5205 * <p>Sample code: 5206 * 5207 * <pre>{@code 5208 * // This snippet has been automatically generated and should be regarded as a code template only. 5209 * // It will require modifications to work: 5210 * // - It may require correct/in-range values for request initialization. 5211 * // - It may require specifying regional endpoints when creating the service client as shown in 5212 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5213 * try (InstancesClient instancesClient = InstancesClient.create()) { 5214 * StartWithEncryptionKeyInstanceRequest request = 5215 * StartWithEncryptionKeyInstanceRequest.newBuilder() 5216 * .setInstance("instance555127957") 5217 * .setInstancesStartWithEncryptionKeyRequestResource( 5218 * InstancesStartWithEncryptionKeyRequest.newBuilder().build()) 5219 * .setProject("project-309310695") 5220 * .setRequestId("requestId693933066") 5221 * .setZone("zone3744684") 5222 * .build(); 5223 * Operation response = instancesClient.startWithEncryptionKeyAsync(request).get(); 5224 * } 5225 * }</pre> 5226 * 5227 * @param request The request object containing all of the parameters for the API call. 5228 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5229 */ 5230 @BetaApi( 5231 "The surface for long-running operations is not stable yet and may change in the future.") startWithEncryptionKeyAsync( StartWithEncryptionKeyInstanceRequest request)5232 public final OperationFuture<Operation, Operation> startWithEncryptionKeyAsync( 5233 StartWithEncryptionKeyInstanceRequest request) { 5234 return startWithEncryptionKeyOperationCallable().futureCall(request); 5235 } 5236 5237 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5238 /** 5239 * Starts an instance that was stopped using the instances().stop method. For more information, 5240 * see Restart an instance. 5241 * 5242 * <p>Sample code: 5243 * 5244 * <pre>{@code 5245 * // This snippet has been automatically generated and should be regarded as a code template only. 5246 * // It will require modifications to work: 5247 * // - It may require correct/in-range values for request initialization. 5248 * // - It may require specifying regional endpoints when creating the service client as shown in 5249 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5250 * try (InstancesClient instancesClient = InstancesClient.create()) { 5251 * StartWithEncryptionKeyInstanceRequest request = 5252 * StartWithEncryptionKeyInstanceRequest.newBuilder() 5253 * .setInstance("instance555127957") 5254 * .setInstancesStartWithEncryptionKeyRequestResource( 5255 * InstancesStartWithEncryptionKeyRequest.newBuilder().build()) 5256 * .setProject("project-309310695") 5257 * .setRequestId("requestId693933066") 5258 * .setZone("zone3744684") 5259 * .build(); 5260 * OperationFuture<Operation, Operation> future = 5261 * instancesClient.startWithEncryptionKeyOperationCallable().futureCall(request); 5262 * // Do something. 5263 * Operation response = future.get(); 5264 * } 5265 * }</pre> 5266 */ 5267 public final OperationCallable<StartWithEncryptionKeyInstanceRequest, Operation, Operation> startWithEncryptionKeyOperationCallable()5268 startWithEncryptionKeyOperationCallable() { 5269 return stub.startWithEncryptionKeyOperationCallable(); 5270 } 5271 5272 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5273 /** 5274 * Starts an instance that was stopped using the instances().stop method. For more information, 5275 * see Restart an instance. 5276 * 5277 * <p>Sample code: 5278 * 5279 * <pre>{@code 5280 * // This snippet has been automatically generated and should be regarded as a code template only. 5281 * // It will require modifications to work: 5282 * // - It may require correct/in-range values for request initialization. 5283 * // - It may require specifying regional endpoints when creating the service client as shown in 5284 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5285 * try (InstancesClient instancesClient = InstancesClient.create()) { 5286 * StartWithEncryptionKeyInstanceRequest request = 5287 * StartWithEncryptionKeyInstanceRequest.newBuilder() 5288 * .setInstance("instance555127957") 5289 * .setInstancesStartWithEncryptionKeyRequestResource( 5290 * InstancesStartWithEncryptionKeyRequest.newBuilder().build()) 5291 * .setProject("project-309310695") 5292 * .setRequestId("requestId693933066") 5293 * .setZone("zone3744684") 5294 * .build(); 5295 * ApiFuture<Operation> future = 5296 * instancesClient.startWithEncryptionKeyCallable().futureCall(request); 5297 * // Do something. 5298 * Operation response = future.get(); 5299 * } 5300 * }</pre> 5301 */ 5302 public final UnaryCallable<StartWithEncryptionKeyInstanceRequest, Operation> startWithEncryptionKeyCallable()5303 startWithEncryptionKeyCallable() { 5304 return stub.startWithEncryptionKeyCallable(); 5305 } 5306 5307 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5308 /** 5309 * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a 5310 * later time. Stopped instances do not incur VM usage charges while they are stopped. However, 5311 * resources that the VM is using, such as persistent disks and static IP addresses, will continue 5312 * to be charged until they are deleted. For more information, see Stopping an instance. 5313 * 5314 * <p>Sample code: 5315 * 5316 * <pre>{@code 5317 * // This snippet has been automatically generated and should be regarded as a code template only. 5318 * // It will require modifications to work: 5319 * // - It may require correct/in-range values for request initialization. 5320 * // - It may require specifying regional endpoints when creating the service client as shown in 5321 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5322 * try (InstancesClient instancesClient = InstancesClient.create()) { 5323 * String project = "project-309310695"; 5324 * String zone = "zone3744684"; 5325 * String instance = "instance555127957"; 5326 * Operation response = instancesClient.stopAsync(project, zone, instance).get(); 5327 * } 5328 * }</pre> 5329 * 5330 * @param project Project ID for this request. 5331 * @param zone The name of the zone for this request. 5332 * @param instance Name of the instance resource to stop. 5333 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5334 */ stopAsync( String project, String zone, String instance)5335 public final OperationFuture<Operation, Operation> stopAsync( 5336 String project, String zone, String instance) { 5337 StopInstanceRequest request = 5338 StopInstanceRequest.newBuilder() 5339 .setProject(project) 5340 .setZone(zone) 5341 .setInstance(instance) 5342 .build(); 5343 return stopAsync(request); 5344 } 5345 5346 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5347 /** 5348 * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a 5349 * later time. Stopped instances do not incur VM usage charges while they are stopped. However, 5350 * resources that the VM is using, such as persistent disks and static IP addresses, will continue 5351 * to be charged until they are deleted. For more information, see Stopping an instance. 5352 * 5353 * <p>Sample code: 5354 * 5355 * <pre>{@code 5356 * // This snippet has been automatically generated and should be regarded as a code template only. 5357 * // It will require modifications to work: 5358 * // - It may require correct/in-range values for request initialization. 5359 * // - It may require specifying regional endpoints when creating the service client as shown in 5360 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5361 * try (InstancesClient instancesClient = InstancesClient.create()) { 5362 * StopInstanceRequest request = 5363 * StopInstanceRequest.newBuilder() 5364 * .setDiscardLocalSsd(true) 5365 * .setInstance("instance555127957") 5366 * .setProject("project-309310695") 5367 * .setRequestId("requestId693933066") 5368 * .setZone("zone3744684") 5369 * .build(); 5370 * Operation response = instancesClient.stopAsync(request).get(); 5371 * } 5372 * }</pre> 5373 * 5374 * @param request The request object containing all of the parameters for the API call. 5375 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5376 */ 5377 @BetaApi( 5378 "The surface for long-running operations is not stable yet and may change in the future.") stopAsync(StopInstanceRequest request)5379 public final OperationFuture<Operation, Operation> stopAsync(StopInstanceRequest request) { 5380 return stopOperationCallable().futureCall(request); 5381 } 5382 5383 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5384 /** 5385 * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a 5386 * later time. Stopped instances do not incur VM usage charges while they are stopped. However, 5387 * resources that the VM is using, such as persistent disks and static IP addresses, will continue 5388 * to be charged until they are deleted. For more information, see Stopping an instance. 5389 * 5390 * <p>Sample code: 5391 * 5392 * <pre>{@code 5393 * // This snippet has been automatically generated and should be regarded as a code template only. 5394 * // It will require modifications to work: 5395 * // - It may require correct/in-range values for request initialization. 5396 * // - It may require specifying regional endpoints when creating the service client as shown in 5397 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5398 * try (InstancesClient instancesClient = InstancesClient.create()) { 5399 * StopInstanceRequest request = 5400 * StopInstanceRequest.newBuilder() 5401 * .setDiscardLocalSsd(true) 5402 * .setInstance("instance555127957") 5403 * .setProject("project-309310695") 5404 * .setRequestId("requestId693933066") 5405 * .setZone("zone3744684") 5406 * .build(); 5407 * OperationFuture<Operation, Operation> future = 5408 * instancesClient.stopOperationCallable().futureCall(request); 5409 * // Do something. 5410 * Operation response = future.get(); 5411 * } 5412 * }</pre> 5413 */ 5414 public final OperationCallable<StopInstanceRequest, Operation, Operation> stopOperationCallable()5415 stopOperationCallable() { 5416 return stub.stopOperationCallable(); 5417 } 5418 5419 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5420 /** 5421 * Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a 5422 * later time. Stopped instances do not incur VM usage charges while they are stopped. However, 5423 * resources that the VM is using, such as persistent disks and static IP addresses, will continue 5424 * to be charged until they are deleted. For more information, see Stopping an instance. 5425 * 5426 * <p>Sample code: 5427 * 5428 * <pre>{@code 5429 * // This snippet has been automatically generated and should be regarded as a code template only. 5430 * // It will require modifications to work: 5431 * // - It may require correct/in-range values for request initialization. 5432 * // - It may require specifying regional endpoints when creating the service client as shown in 5433 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5434 * try (InstancesClient instancesClient = InstancesClient.create()) { 5435 * StopInstanceRequest request = 5436 * StopInstanceRequest.newBuilder() 5437 * .setDiscardLocalSsd(true) 5438 * .setInstance("instance555127957") 5439 * .setProject("project-309310695") 5440 * .setRequestId("requestId693933066") 5441 * .setZone("zone3744684") 5442 * .build(); 5443 * ApiFuture<Operation> future = instancesClient.stopCallable().futureCall(request); 5444 * // Do something. 5445 * Operation response = future.get(); 5446 * } 5447 * }</pre> 5448 */ stopCallable()5449 public final UnaryCallable<StopInstanceRequest, Operation> stopCallable() { 5450 return stub.stopCallable(); 5451 } 5452 5453 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5454 /** 5455 * This method suspends a running instance, saving its state to persistent storage, and allows you 5456 * to resume the instance at a later time. Suspended instances have no compute costs (cores or 5457 * RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged 5458 * resources the virtual machine was using, such as persistent disks and static IP addresses, will 5459 * continue to be charged while the instance is suspended. For more information, see Suspending 5460 * and resuming an instance. 5461 * 5462 * <p>Sample code: 5463 * 5464 * <pre>{@code 5465 * // This snippet has been automatically generated and should be regarded as a code template only. 5466 * // It will require modifications to work: 5467 * // - It may require correct/in-range values for request initialization. 5468 * // - It may require specifying regional endpoints when creating the service client as shown in 5469 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5470 * try (InstancesClient instancesClient = InstancesClient.create()) { 5471 * String project = "project-309310695"; 5472 * String zone = "zone3744684"; 5473 * String instance = "instance555127957"; 5474 * Operation response = instancesClient.suspendAsync(project, zone, instance).get(); 5475 * } 5476 * }</pre> 5477 * 5478 * @param project Project ID for this request. 5479 * @param zone The name of the zone for this request. 5480 * @param instance Name of the instance resource to suspend. 5481 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5482 */ suspendAsync( String project, String zone, String instance)5483 public final OperationFuture<Operation, Operation> suspendAsync( 5484 String project, String zone, String instance) { 5485 SuspendInstanceRequest request = 5486 SuspendInstanceRequest.newBuilder() 5487 .setProject(project) 5488 .setZone(zone) 5489 .setInstance(instance) 5490 .build(); 5491 return suspendAsync(request); 5492 } 5493 5494 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5495 /** 5496 * This method suspends a running instance, saving its state to persistent storage, and allows you 5497 * to resume the instance at a later time. Suspended instances have no compute costs (cores or 5498 * RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged 5499 * resources the virtual machine was using, such as persistent disks and static IP addresses, will 5500 * continue to be charged while the instance is suspended. For more information, see Suspending 5501 * and resuming an instance. 5502 * 5503 * <p>Sample code: 5504 * 5505 * <pre>{@code 5506 * // This snippet has been automatically generated and should be regarded as a code template only. 5507 * // It will require modifications to work: 5508 * // - It may require correct/in-range values for request initialization. 5509 * // - It may require specifying regional endpoints when creating the service client as shown in 5510 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5511 * try (InstancesClient instancesClient = InstancesClient.create()) { 5512 * SuspendInstanceRequest request = 5513 * SuspendInstanceRequest.newBuilder() 5514 * .setDiscardLocalSsd(true) 5515 * .setInstance("instance555127957") 5516 * .setProject("project-309310695") 5517 * .setRequestId("requestId693933066") 5518 * .setZone("zone3744684") 5519 * .build(); 5520 * Operation response = instancesClient.suspendAsync(request).get(); 5521 * } 5522 * }</pre> 5523 * 5524 * @param request The request object containing all of the parameters for the API call. 5525 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5526 */ 5527 @BetaApi( 5528 "The surface for long-running operations is not stable yet and may change in the future.") suspendAsync(SuspendInstanceRequest request)5529 public final OperationFuture<Operation, Operation> suspendAsync(SuspendInstanceRequest request) { 5530 return suspendOperationCallable().futureCall(request); 5531 } 5532 5533 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5534 /** 5535 * This method suspends a running instance, saving its state to persistent storage, and allows you 5536 * to resume the instance at a later time. Suspended instances have no compute costs (cores or 5537 * RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged 5538 * resources the virtual machine was using, such as persistent disks and static IP addresses, will 5539 * continue to be charged while the instance is suspended. For more information, see Suspending 5540 * and resuming an instance. 5541 * 5542 * <p>Sample code: 5543 * 5544 * <pre>{@code 5545 * // This snippet has been automatically generated and should be regarded as a code template only. 5546 * // It will require modifications to work: 5547 * // - It may require correct/in-range values for request initialization. 5548 * // - It may require specifying regional endpoints when creating the service client as shown in 5549 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5550 * try (InstancesClient instancesClient = InstancesClient.create()) { 5551 * SuspendInstanceRequest request = 5552 * SuspendInstanceRequest.newBuilder() 5553 * .setDiscardLocalSsd(true) 5554 * .setInstance("instance555127957") 5555 * .setProject("project-309310695") 5556 * .setRequestId("requestId693933066") 5557 * .setZone("zone3744684") 5558 * .build(); 5559 * OperationFuture<Operation, Operation> future = 5560 * instancesClient.suspendOperationCallable().futureCall(request); 5561 * // Do something. 5562 * Operation response = future.get(); 5563 * } 5564 * }</pre> 5565 */ 5566 public final OperationCallable<SuspendInstanceRequest, Operation, Operation> suspendOperationCallable()5567 suspendOperationCallable() { 5568 return stub.suspendOperationCallable(); 5569 } 5570 5571 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5572 /** 5573 * This method suspends a running instance, saving its state to persistent storage, and allows you 5574 * to resume the instance at a later time. Suspended instances have no compute costs (cores or 5575 * RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged 5576 * resources the virtual machine was using, such as persistent disks and static IP addresses, will 5577 * continue to be charged while the instance is suspended. For more information, see Suspending 5578 * and resuming an instance. 5579 * 5580 * <p>Sample code: 5581 * 5582 * <pre>{@code 5583 * // This snippet has been automatically generated and should be regarded as a code template only. 5584 * // It will require modifications to work: 5585 * // - It may require correct/in-range values for request initialization. 5586 * // - It may require specifying regional endpoints when creating the service client as shown in 5587 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5588 * try (InstancesClient instancesClient = InstancesClient.create()) { 5589 * SuspendInstanceRequest request = 5590 * SuspendInstanceRequest.newBuilder() 5591 * .setDiscardLocalSsd(true) 5592 * .setInstance("instance555127957") 5593 * .setProject("project-309310695") 5594 * .setRequestId("requestId693933066") 5595 * .setZone("zone3744684") 5596 * .build(); 5597 * ApiFuture<Operation> future = instancesClient.suspendCallable().futureCall(request); 5598 * // Do something. 5599 * Operation response = future.get(); 5600 * } 5601 * }</pre> 5602 */ suspendCallable()5603 public final UnaryCallable<SuspendInstanceRequest, Operation> suspendCallable() { 5604 return stub.suspendCallable(); 5605 } 5606 5607 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5608 /** 5609 * Returns permissions that a caller has on the specified resource. 5610 * 5611 * <p>Sample code: 5612 * 5613 * <pre>{@code 5614 * // This snippet has been automatically generated and should be regarded as a code template only. 5615 * // It will require modifications to work: 5616 * // - It may require correct/in-range values for request initialization. 5617 * // - It may require specifying regional endpoints when creating the service client as shown in 5618 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5619 * try (InstancesClient instancesClient = InstancesClient.create()) { 5620 * String project = "project-309310695"; 5621 * String zone = "zone3744684"; 5622 * String resource = "resource-341064690"; 5623 * TestPermissionsRequest testPermissionsRequestResource = 5624 * TestPermissionsRequest.newBuilder().build(); 5625 * TestPermissionsResponse response = 5626 * instancesClient.testIamPermissions( 5627 * project, zone, resource, testPermissionsRequestResource); 5628 * } 5629 * }</pre> 5630 * 5631 * @param project Project ID for this request. 5632 * @param zone The name of the zone for this request. 5633 * @param resource Name or id of the resource for this request. 5634 * @param testPermissionsRequestResource The body resource for this request 5635 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5636 */ testIamPermissions( String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)5637 public final TestPermissionsResponse testIamPermissions( 5638 String project, 5639 String zone, 5640 String resource, 5641 TestPermissionsRequest testPermissionsRequestResource) { 5642 TestIamPermissionsInstanceRequest request = 5643 TestIamPermissionsInstanceRequest.newBuilder() 5644 .setProject(project) 5645 .setZone(zone) 5646 .setResource(resource) 5647 .setTestPermissionsRequestResource(testPermissionsRequestResource) 5648 .build(); 5649 return testIamPermissions(request); 5650 } 5651 5652 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5653 /** 5654 * Returns permissions that a caller has on the specified resource. 5655 * 5656 * <p>Sample code: 5657 * 5658 * <pre>{@code 5659 * // This snippet has been automatically generated and should be regarded as a code template only. 5660 * // It will require modifications to work: 5661 * // - It may require correct/in-range values for request initialization. 5662 * // - It may require specifying regional endpoints when creating the service client as shown in 5663 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5664 * try (InstancesClient instancesClient = InstancesClient.create()) { 5665 * TestIamPermissionsInstanceRequest request = 5666 * TestIamPermissionsInstanceRequest.newBuilder() 5667 * .setProject("project-309310695") 5668 * .setResource("resource-341064690") 5669 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 5670 * .setZone("zone3744684") 5671 * .build(); 5672 * TestPermissionsResponse response = instancesClient.testIamPermissions(request); 5673 * } 5674 * }</pre> 5675 * 5676 * @param request The request object containing all of the parameters for the API call. 5677 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5678 */ testIamPermissions( TestIamPermissionsInstanceRequest request)5679 public final TestPermissionsResponse testIamPermissions( 5680 TestIamPermissionsInstanceRequest request) { 5681 return testIamPermissionsCallable().call(request); 5682 } 5683 5684 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5685 /** 5686 * Returns permissions that a caller has on the specified resource. 5687 * 5688 * <p>Sample code: 5689 * 5690 * <pre>{@code 5691 * // This snippet has been automatically generated and should be regarded as a code template only. 5692 * // It will require modifications to work: 5693 * // - It may require correct/in-range values for request initialization. 5694 * // - It may require specifying regional endpoints when creating the service client as shown in 5695 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5696 * try (InstancesClient instancesClient = InstancesClient.create()) { 5697 * TestIamPermissionsInstanceRequest request = 5698 * TestIamPermissionsInstanceRequest.newBuilder() 5699 * .setProject("project-309310695") 5700 * .setResource("resource-341064690") 5701 * .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build()) 5702 * .setZone("zone3744684") 5703 * .build(); 5704 * ApiFuture<TestPermissionsResponse> future = 5705 * instancesClient.testIamPermissionsCallable().futureCall(request); 5706 * // Do something. 5707 * TestPermissionsResponse response = future.get(); 5708 * } 5709 * }</pre> 5710 */ 5711 public final UnaryCallable<TestIamPermissionsInstanceRequest, TestPermissionsResponse> testIamPermissionsCallable()5712 testIamPermissionsCallable() { 5713 return stub.testIamPermissionsCallable(); 5714 } 5715 5716 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5717 /** 5718 * Updates an instance only if the necessary resources are available. This method can update only 5719 * a specific set of instance properties. See Updating a running instance for a list of updatable 5720 * instance properties. 5721 * 5722 * <p>Sample code: 5723 * 5724 * <pre>{@code 5725 * // This snippet has been automatically generated and should be regarded as a code template only. 5726 * // It will require modifications to work: 5727 * // - It may require correct/in-range values for request initialization. 5728 * // - It may require specifying regional endpoints when creating the service client as shown in 5729 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5730 * try (InstancesClient instancesClient = InstancesClient.create()) { 5731 * String project = "project-309310695"; 5732 * String zone = "zone3744684"; 5733 * String instance = "instance555127957"; 5734 * Instance instanceResource = Instance.newBuilder().build(); 5735 * Operation response = 5736 * instancesClient.updateAsync(project, zone, instance, instanceResource).get(); 5737 * } 5738 * }</pre> 5739 * 5740 * @param project Project ID for this request. 5741 * @param zone The name of the zone for this request. 5742 * @param instance Name of the instance resource to update. 5743 * @param instanceResource The body resource for this request 5744 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5745 */ updateAsync( String project, String zone, String instance, Instance instanceResource)5746 public final OperationFuture<Operation, Operation> updateAsync( 5747 String project, String zone, String instance, Instance instanceResource) { 5748 UpdateInstanceRequest request = 5749 UpdateInstanceRequest.newBuilder() 5750 .setProject(project) 5751 .setZone(zone) 5752 .setInstance(instance) 5753 .setInstanceResource(instanceResource) 5754 .build(); 5755 return updateAsync(request); 5756 } 5757 5758 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5759 /** 5760 * Updates an instance only if the necessary resources are available. This method can update only 5761 * a specific set of instance properties. See Updating a running instance for a list of updatable 5762 * instance properties. 5763 * 5764 * <p>Sample code: 5765 * 5766 * <pre>{@code 5767 * // This snippet has been automatically generated and should be regarded as a code template only. 5768 * // It will require modifications to work: 5769 * // - It may require correct/in-range values for request initialization. 5770 * // - It may require specifying regional endpoints when creating the service client as shown in 5771 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5772 * try (InstancesClient instancesClient = InstancesClient.create()) { 5773 * UpdateInstanceRequest request = 5774 * UpdateInstanceRequest.newBuilder() 5775 * .setInstance("instance555127957") 5776 * .setInstanceResource(Instance.newBuilder().build()) 5777 * .setMinimalAction("minimalAction624261943") 5778 * .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488") 5779 * .setProject("project-309310695") 5780 * .setRequestId("requestId693933066") 5781 * .setZone("zone3744684") 5782 * .build(); 5783 * Operation response = instancesClient.updateAsync(request).get(); 5784 * } 5785 * }</pre> 5786 * 5787 * @param request The request object containing all of the parameters for the API call. 5788 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5789 */ 5790 @BetaApi( 5791 "The surface for long-running operations is not stable yet and may change in the future.") updateAsync(UpdateInstanceRequest request)5792 public final OperationFuture<Operation, Operation> updateAsync(UpdateInstanceRequest request) { 5793 return updateOperationCallable().futureCall(request); 5794 } 5795 5796 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5797 /** 5798 * Updates an instance only if the necessary resources are available. This method can update only 5799 * a specific set of instance properties. See Updating a running instance for a list of updatable 5800 * instance properties. 5801 * 5802 * <p>Sample code: 5803 * 5804 * <pre>{@code 5805 * // This snippet has been automatically generated and should be regarded as a code template only. 5806 * // It will require modifications to work: 5807 * // - It may require correct/in-range values for request initialization. 5808 * // - It may require specifying regional endpoints when creating the service client as shown in 5809 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5810 * try (InstancesClient instancesClient = InstancesClient.create()) { 5811 * UpdateInstanceRequest request = 5812 * UpdateInstanceRequest.newBuilder() 5813 * .setInstance("instance555127957") 5814 * .setInstanceResource(Instance.newBuilder().build()) 5815 * .setMinimalAction("minimalAction624261943") 5816 * .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488") 5817 * .setProject("project-309310695") 5818 * .setRequestId("requestId693933066") 5819 * .setZone("zone3744684") 5820 * .build(); 5821 * OperationFuture<Operation, Operation> future = 5822 * instancesClient.updateOperationCallable().futureCall(request); 5823 * // Do something. 5824 * Operation response = future.get(); 5825 * } 5826 * }</pre> 5827 */ 5828 public final OperationCallable<UpdateInstanceRequest, Operation, Operation> updateOperationCallable()5829 updateOperationCallable() { 5830 return stub.updateOperationCallable(); 5831 } 5832 5833 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5834 /** 5835 * Updates an instance only if the necessary resources are available. This method can update only 5836 * a specific set of instance properties. See Updating a running instance for a list of updatable 5837 * instance properties. 5838 * 5839 * <p>Sample code: 5840 * 5841 * <pre>{@code 5842 * // This snippet has been automatically generated and should be regarded as a code template only. 5843 * // It will require modifications to work: 5844 * // - It may require correct/in-range values for request initialization. 5845 * // - It may require specifying regional endpoints when creating the service client as shown in 5846 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5847 * try (InstancesClient instancesClient = InstancesClient.create()) { 5848 * UpdateInstanceRequest request = 5849 * UpdateInstanceRequest.newBuilder() 5850 * .setInstance("instance555127957") 5851 * .setInstanceResource(Instance.newBuilder().build()) 5852 * .setMinimalAction("minimalAction624261943") 5853 * .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488") 5854 * .setProject("project-309310695") 5855 * .setRequestId("requestId693933066") 5856 * .setZone("zone3744684") 5857 * .build(); 5858 * ApiFuture<Operation> future = instancesClient.updateCallable().futureCall(request); 5859 * // Do something. 5860 * Operation response = future.get(); 5861 * } 5862 * }</pre> 5863 */ updateCallable()5864 public final UnaryCallable<UpdateInstanceRequest, Operation> updateCallable() { 5865 return stub.updateCallable(); 5866 } 5867 5868 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5869 /** 5870 * Updates the specified access config from an instance's network interface with the data included 5871 * in the request. This method supports PATCH semantics and uses the JSON merge patch format and 5872 * processing rules. 5873 * 5874 * <p>Sample code: 5875 * 5876 * <pre>{@code 5877 * // This snippet has been automatically generated and should be regarded as a code template only. 5878 * // It will require modifications to work: 5879 * // - It may require correct/in-range values for request initialization. 5880 * // - It may require specifying regional endpoints when creating the service client as shown in 5881 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5882 * try (InstancesClient instancesClient = InstancesClient.create()) { 5883 * String project = "project-309310695"; 5884 * String zone = "zone3744684"; 5885 * String instance = "instance555127957"; 5886 * String networkInterface = "networkInterface-341981525"; 5887 * AccessConfig accessConfigResource = AccessConfig.newBuilder().build(); 5888 * Operation response = 5889 * instancesClient 5890 * .updateAccessConfigAsync( 5891 * project, zone, instance, networkInterface, accessConfigResource) 5892 * .get(); 5893 * } 5894 * }</pre> 5895 * 5896 * @param project Project ID for this request. 5897 * @param zone The name of the zone for this request. 5898 * @param instance The instance name for this request. 5899 * @param networkInterface The name of the network interface where the access config is attached. 5900 * @param accessConfigResource The body resource for this request 5901 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5902 */ updateAccessConfigAsync( String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)5903 public final OperationFuture<Operation, Operation> updateAccessConfigAsync( 5904 String project, 5905 String zone, 5906 String instance, 5907 String networkInterface, 5908 AccessConfig accessConfigResource) { 5909 UpdateAccessConfigInstanceRequest request = 5910 UpdateAccessConfigInstanceRequest.newBuilder() 5911 .setProject(project) 5912 .setZone(zone) 5913 .setInstance(instance) 5914 .setNetworkInterface(networkInterface) 5915 .setAccessConfigResource(accessConfigResource) 5916 .build(); 5917 return updateAccessConfigAsync(request); 5918 } 5919 5920 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5921 /** 5922 * Updates the specified access config from an instance's network interface with the data included 5923 * in the request. This method supports PATCH semantics and uses the JSON merge patch format and 5924 * processing rules. 5925 * 5926 * <p>Sample code: 5927 * 5928 * <pre>{@code 5929 * // This snippet has been automatically generated and should be regarded as a code template only. 5930 * // It will require modifications to work: 5931 * // - It may require correct/in-range values for request initialization. 5932 * // - It may require specifying regional endpoints when creating the service client as shown in 5933 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5934 * try (InstancesClient instancesClient = InstancesClient.create()) { 5935 * UpdateAccessConfigInstanceRequest request = 5936 * UpdateAccessConfigInstanceRequest.newBuilder() 5937 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 5938 * .setInstance("instance555127957") 5939 * .setNetworkInterface("networkInterface-341981525") 5940 * .setProject("project-309310695") 5941 * .setRequestId("requestId693933066") 5942 * .setZone("zone3744684") 5943 * .build(); 5944 * Operation response = instancesClient.updateAccessConfigAsync(request).get(); 5945 * } 5946 * }</pre> 5947 * 5948 * @param request The request object containing all of the parameters for the API call. 5949 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 5950 */ 5951 @BetaApi( 5952 "The surface for long-running operations is not stable yet and may change in the future.") updateAccessConfigAsync( UpdateAccessConfigInstanceRequest request)5953 public final OperationFuture<Operation, Operation> updateAccessConfigAsync( 5954 UpdateAccessConfigInstanceRequest request) { 5955 return updateAccessConfigOperationCallable().futureCall(request); 5956 } 5957 5958 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5959 /** 5960 * Updates the specified access config from an instance's network interface with the data included 5961 * in the request. This method supports PATCH semantics and uses the JSON merge patch format and 5962 * processing rules. 5963 * 5964 * <p>Sample code: 5965 * 5966 * <pre>{@code 5967 * // This snippet has been automatically generated and should be regarded as a code template only. 5968 * // It will require modifications to work: 5969 * // - It may require correct/in-range values for request initialization. 5970 * // - It may require specifying regional endpoints when creating the service client as shown in 5971 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 5972 * try (InstancesClient instancesClient = InstancesClient.create()) { 5973 * UpdateAccessConfigInstanceRequest request = 5974 * UpdateAccessConfigInstanceRequest.newBuilder() 5975 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 5976 * .setInstance("instance555127957") 5977 * .setNetworkInterface("networkInterface-341981525") 5978 * .setProject("project-309310695") 5979 * .setRequestId("requestId693933066") 5980 * .setZone("zone3744684") 5981 * .build(); 5982 * OperationFuture<Operation, Operation> future = 5983 * instancesClient.updateAccessConfigOperationCallable().futureCall(request); 5984 * // Do something. 5985 * Operation response = future.get(); 5986 * } 5987 * }</pre> 5988 */ 5989 public final OperationCallable<UpdateAccessConfigInstanceRequest, Operation, Operation> updateAccessConfigOperationCallable()5990 updateAccessConfigOperationCallable() { 5991 return stub.updateAccessConfigOperationCallable(); 5992 } 5993 5994 // AUTO-GENERATED DOCUMENTATION AND METHOD. 5995 /** 5996 * Updates the specified access config from an instance's network interface with the data included 5997 * in the request. This method supports PATCH semantics and uses the JSON merge patch format and 5998 * processing rules. 5999 * 6000 * <p>Sample code: 6001 * 6002 * <pre>{@code 6003 * // This snippet has been automatically generated and should be regarded as a code template only. 6004 * // It will require modifications to work: 6005 * // - It may require correct/in-range values for request initialization. 6006 * // - It may require specifying regional endpoints when creating the service client as shown in 6007 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6008 * try (InstancesClient instancesClient = InstancesClient.create()) { 6009 * UpdateAccessConfigInstanceRequest request = 6010 * UpdateAccessConfigInstanceRequest.newBuilder() 6011 * .setAccessConfigResource(AccessConfig.newBuilder().build()) 6012 * .setInstance("instance555127957") 6013 * .setNetworkInterface("networkInterface-341981525") 6014 * .setProject("project-309310695") 6015 * .setRequestId("requestId693933066") 6016 * .setZone("zone3744684") 6017 * .build(); 6018 * ApiFuture<Operation> future = 6019 * instancesClient.updateAccessConfigCallable().futureCall(request); 6020 * // Do something. 6021 * Operation response = future.get(); 6022 * } 6023 * }</pre> 6024 */ 6025 public final UnaryCallable<UpdateAccessConfigInstanceRequest, Operation> updateAccessConfigCallable()6026 updateAccessConfigCallable() { 6027 return stub.updateAccessConfigCallable(); 6028 } 6029 6030 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6031 /** 6032 * Updates the Display config for a VM instance. You can only use this method on a stopped VM 6033 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6034 * processing rules. 6035 * 6036 * <p>Sample code: 6037 * 6038 * <pre>{@code 6039 * // This snippet has been automatically generated and should be regarded as a code template only. 6040 * // It will require modifications to work: 6041 * // - It may require correct/in-range values for request initialization. 6042 * // - It may require specifying regional endpoints when creating the service client as shown in 6043 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6044 * try (InstancesClient instancesClient = InstancesClient.create()) { 6045 * String project = "project-309310695"; 6046 * String zone = "zone3744684"; 6047 * String instance = "instance555127957"; 6048 * DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build(); 6049 * Operation response = 6050 * instancesClient 6051 * .updateDisplayDeviceAsync(project, zone, instance, displayDeviceResource) 6052 * .get(); 6053 * } 6054 * }</pre> 6055 * 6056 * @param project Project ID for this request. 6057 * @param zone The name of the zone for this request. 6058 * @param instance Name of the instance scoping this request. 6059 * @param displayDeviceResource The body resource for this request 6060 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6061 */ updateDisplayDeviceAsync( String project, String zone, String instance, DisplayDevice displayDeviceResource)6062 public final OperationFuture<Operation, Operation> updateDisplayDeviceAsync( 6063 String project, String zone, String instance, DisplayDevice displayDeviceResource) { 6064 UpdateDisplayDeviceInstanceRequest request = 6065 UpdateDisplayDeviceInstanceRequest.newBuilder() 6066 .setProject(project) 6067 .setZone(zone) 6068 .setInstance(instance) 6069 .setDisplayDeviceResource(displayDeviceResource) 6070 .build(); 6071 return updateDisplayDeviceAsync(request); 6072 } 6073 6074 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6075 /** 6076 * Updates the Display config for a VM instance. You can only use this method on a stopped VM 6077 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6078 * processing rules. 6079 * 6080 * <p>Sample code: 6081 * 6082 * <pre>{@code 6083 * // This snippet has been automatically generated and should be regarded as a code template only. 6084 * // It will require modifications to work: 6085 * // - It may require correct/in-range values for request initialization. 6086 * // - It may require specifying regional endpoints when creating the service client as shown in 6087 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6088 * try (InstancesClient instancesClient = InstancesClient.create()) { 6089 * UpdateDisplayDeviceInstanceRequest request = 6090 * UpdateDisplayDeviceInstanceRequest.newBuilder() 6091 * .setDisplayDeviceResource(DisplayDevice.newBuilder().build()) 6092 * .setInstance("instance555127957") 6093 * .setProject("project-309310695") 6094 * .setRequestId("requestId693933066") 6095 * .setZone("zone3744684") 6096 * .build(); 6097 * Operation response = instancesClient.updateDisplayDeviceAsync(request).get(); 6098 * } 6099 * }</pre> 6100 * 6101 * @param request The request object containing all of the parameters for the API call. 6102 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6103 */ 6104 @BetaApi( 6105 "The surface for long-running operations is not stable yet and may change in the future.") updateDisplayDeviceAsync( UpdateDisplayDeviceInstanceRequest request)6106 public final OperationFuture<Operation, Operation> updateDisplayDeviceAsync( 6107 UpdateDisplayDeviceInstanceRequest request) { 6108 return updateDisplayDeviceOperationCallable().futureCall(request); 6109 } 6110 6111 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6112 /** 6113 * Updates the Display config for a VM instance. You can only use this method on a stopped VM 6114 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6115 * processing rules. 6116 * 6117 * <p>Sample code: 6118 * 6119 * <pre>{@code 6120 * // This snippet has been automatically generated and should be regarded as a code template only. 6121 * // It will require modifications to work: 6122 * // - It may require correct/in-range values for request initialization. 6123 * // - It may require specifying regional endpoints when creating the service client as shown in 6124 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6125 * try (InstancesClient instancesClient = InstancesClient.create()) { 6126 * UpdateDisplayDeviceInstanceRequest request = 6127 * UpdateDisplayDeviceInstanceRequest.newBuilder() 6128 * .setDisplayDeviceResource(DisplayDevice.newBuilder().build()) 6129 * .setInstance("instance555127957") 6130 * .setProject("project-309310695") 6131 * .setRequestId("requestId693933066") 6132 * .setZone("zone3744684") 6133 * .build(); 6134 * OperationFuture<Operation, Operation> future = 6135 * instancesClient.updateDisplayDeviceOperationCallable().futureCall(request); 6136 * // Do something. 6137 * Operation response = future.get(); 6138 * } 6139 * }</pre> 6140 */ 6141 public final OperationCallable<UpdateDisplayDeviceInstanceRequest, Operation, Operation> updateDisplayDeviceOperationCallable()6142 updateDisplayDeviceOperationCallable() { 6143 return stub.updateDisplayDeviceOperationCallable(); 6144 } 6145 6146 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6147 /** 6148 * Updates the Display config for a VM instance. You can only use this method on a stopped VM 6149 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6150 * processing rules. 6151 * 6152 * <p>Sample code: 6153 * 6154 * <pre>{@code 6155 * // This snippet has been automatically generated and should be regarded as a code template only. 6156 * // It will require modifications to work: 6157 * // - It may require correct/in-range values for request initialization. 6158 * // - It may require specifying regional endpoints when creating the service client as shown in 6159 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6160 * try (InstancesClient instancesClient = InstancesClient.create()) { 6161 * UpdateDisplayDeviceInstanceRequest request = 6162 * UpdateDisplayDeviceInstanceRequest.newBuilder() 6163 * .setDisplayDeviceResource(DisplayDevice.newBuilder().build()) 6164 * .setInstance("instance555127957") 6165 * .setProject("project-309310695") 6166 * .setRequestId("requestId693933066") 6167 * .setZone("zone3744684") 6168 * .build(); 6169 * ApiFuture<Operation> future = 6170 * instancesClient.updateDisplayDeviceCallable().futureCall(request); 6171 * // Do something. 6172 * Operation response = future.get(); 6173 * } 6174 * }</pre> 6175 */ 6176 public final UnaryCallable<UpdateDisplayDeviceInstanceRequest, Operation> updateDisplayDeviceCallable()6177 updateDisplayDeviceCallable() { 6178 return stub.updateDisplayDeviceCallable(); 6179 } 6180 6181 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6182 /** 6183 * Updates an instance's network interface. This method can only update an interface's alias IP 6184 * range and attached network. See Modifying alias IP ranges for an existing instance for 6185 * instructions on changing alias IP ranges. See Migrating a VM between networks for instructions 6186 * on migrating an interface. This method follows PATCH semantics. 6187 * 6188 * <p>Sample code: 6189 * 6190 * <pre>{@code 6191 * // This snippet has been automatically generated and should be regarded as a code template only. 6192 * // It will require modifications to work: 6193 * // - It may require correct/in-range values for request initialization. 6194 * // - It may require specifying regional endpoints when creating the service client as shown in 6195 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6196 * try (InstancesClient instancesClient = InstancesClient.create()) { 6197 * String project = "project-309310695"; 6198 * String zone = "zone3744684"; 6199 * String instance = "instance555127957"; 6200 * String networkInterface = "networkInterface-341981525"; 6201 * NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build(); 6202 * Operation response = 6203 * instancesClient 6204 * .updateNetworkInterfaceAsync( 6205 * project, zone, instance, networkInterface, networkInterfaceResource) 6206 * .get(); 6207 * } 6208 * }</pre> 6209 * 6210 * @param project Project ID for this request. 6211 * @param zone The name of the zone for this request. 6212 * @param instance The instance name for this request. 6213 * @param networkInterface The name of the network interface to update. 6214 * @param networkInterfaceResource The body resource for this request 6215 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6216 */ updateNetworkInterfaceAsync( String project, String zone, String instance, String networkInterface, NetworkInterface networkInterfaceResource)6217 public final OperationFuture<Operation, Operation> updateNetworkInterfaceAsync( 6218 String project, 6219 String zone, 6220 String instance, 6221 String networkInterface, 6222 NetworkInterface networkInterfaceResource) { 6223 UpdateNetworkInterfaceInstanceRequest request = 6224 UpdateNetworkInterfaceInstanceRequest.newBuilder() 6225 .setProject(project) 6226 .setZone(zone) 6227 .setInstance(instance) 6228 .setNetworkInterface(networkInterface) 6229 .setNetworkInterfaceResource(networkInterfaceResource) 6230 .build(); 6231 return updateNetworkInterfaceAsync(request); 6232 } 6233 6234 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6235 /** 6236 * Updates an instance's network interface. This method can only update an interface's alias IP 6237 * range and attached network. See Modifying alias IP ranges for an existing instance for 6238 * instructions on changing alias IP ranges. See Migrating a VM between networks for instructions 6239 * on migrating an interface. This method follows PATCH semantics. 6240 * 6241 * <p>Sample code: 6242 * 6243 * <pre>{@code 6244 * // This snippet has been automatically generated and should be regarded as a code template only. 6245 * // It will require modifications to work: 6246 * // - It may require correct/in-range values for request initialization. 6247 * // - It may require specifying regional endpoints when creating the service client as shown in 6248 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6249 * try (InstancesClient instancesClient = InstancesClient.create()) { 6250 * UpdateNetworkInterfaceInstanceRequest request = 6251 * UpdateNetworkInterfaceInstanceRequest.newBuilder() 6252 * .setInstance("instance555127957") 6253 * .setNetworkInterface("networkInterface-341981525") 6254 * .setNetworkInterfaceResource(NetworkInterface.newBuilder().build()) 6255 * .setProject("project-309310695") 6256 * .setRequestId("requestId693933066") 6257 * .setZone("zone3744684") 6258 * .build(); 6259 * Operation response = instancesClient.updateNetworkInterfaceAsync(request).get(); 6260 * } 6261 * }</pre> 6262 * 6263 * @param request The request object containing all of the parameters for the API call. 6264 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6265 */ 6266 @BetaApi( 6267 "The surface for long-running operations is not stable yet and may change in the future.") updateNetworkInterfaceAsync( UpdateNetworkInterfaceInstanceRequest request)6268 public final OperationFuture<Operation, Operation> updateNetworkInterfaceAsync( 6269 UpdateNetworkInterfaceInstanceRequest request) { 6270 return updateNetworkInterfaceOperationCallable().futureCall(request); 6271 } 6272 6273 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6274 /** 6275 * Updates an instance's network interface. This method can only update an interface's alias IP 6276 * range and attached network. See Modifying alias IP ranges for an existing instance for 6277 * instructions on changing alias IP ranges. See Migrating a VM between networks for instructions 6278 * on migrating an interface. This method follows PATCH semantics. 6279 * 6280 * <p>Sample code: 6281 * 6282 * <pre>{@code 6283 * // This snippet has been automatically generated and should be regarded as a code template only. 6284 * // It will require modifications to work: 6285 * // - It may require correct/in-range values for request initialization. 6286 * // - It may require specifying regional endpoints when creating the service client as shown in 6287 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6288 * try (InstancesClient instancesClient = InstancesClient.create()) { 6289 * UpdateNetworkInterfaceInstanceRequest request = 6290 * UpdateNetworkInterfaceInstanceRequest.newBuilder() 6291 * .setInstance("instance555127957") 6292 * .setNetworkInterface("networkInterface-341981525") 6293 * .setNetworkInterfaceResource(NetworkInterface.newBuilder().build()) 6294 * .setProject("project-309310695") 6295 * .setRequestId("requestId693933066") 6296 * .setZone("zone3744684") 6297 * .build(); 6298 * OperationFuture<Operation, Operation> future = 6299 * instancesClient.updateNetworkInterfaceOperationCallable().futureCall(request); 6300 * // Do something. 6301 * Operation response = future.get(); 6302 * } 6303 * }</pre> 6304 */ 6305 public final OperationCallable<UpdateNetworkInterfaceInstanceRequest, Operation, Operation> updateNetworkInterfaceOperationCallable()6306 updateNetworkInterfaceOperationCallable() { 6307 return stub.updateNetworkInterfaceOperationCallable(); 6308 } 6309 6310 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6311 /** 6312 * Updates an instance's network interface. This method can only update an interface's alias IP 6313 * range and attached network. See Modifying alias IP ranges for an existing instance for 6314 * instructions on changing alias IP ranges. See Migrating a VM between networks for instructions 6315 * on migrating an interface. This method follows PATCH semantics. 6316 * 6317 * <p>Sample code: 6318 * 6319 * <pre>{@code 6320 * // This snippet has been automatically generated and should be regarded as a code template only. 6321 * // It will require modifications to work: 6322 * // - It may require correct/in-range values for request initialization. 6323 * // - It may require specifying regional endpoints when creating the service client as shown in 6324 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6325 * try (InstancesClient instancesClient = InstancesClient.create()) { 6326 * UpdateNetworkInterfaceInstanceRequest request = 6327 * UpdateNetworkInterfaceInstanceRequest.newBuilder() 6328 * .setInstance("instance555127957") 6329 * .setNetworkInterface("networkInterface-341981525") 6330 * .setNetworkInterfaceResource(NetworkInterface.newBuilder().build()) 6331 * .setProject("project-309310695") 6332 * .setRequestId("requestId693933066") 6333 * .setZone("zone3744684") 6334 * .build(); 6335 * ApiFuture<Operation> future = 6336 * instancesClient.updateNetworkInterfaceCallable().futureCall(request); 6337 * // Do something. 6338 * Operation response = future.get(); 6339 * } 6340 * }</pre> 6341 */ 6342 public final UnaryCallable<UpdateNetworkInterfaceInstanceRequest, Operation> updateNetworkInterfaceCallable()6343 updateNetworkInterfaceCallable() { 6344 return stub.updateNetworkInterfaceCallable(); 6345 } 6346 6347 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6348 /** 6349 * Updates the Shielded Instance config for an instance. You can only use this method on a stopped 6350 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6351 * processing rules. 6352 * 6353 * <p>Sample code: 6354 * 6355 * <pre>{@code 6356 * // This snippet has been automatically generated and should be regarded as a code template only. 6357 * // It will require modifications to work: 6358 * // - It may require correct/in-range values for request initialization. 6359 * // - It may require specifying regional endpoints when creating the service client as shown in 6360 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6361 * try (InstancesClient instancesClient = InstancesClient.create()) { 6362 * String project = "project-309310695"; 6363 * String zone = "zone3744684"; 6364 * String instance = "instance555127957"; 6365 * ShieldedInstanceConfig shieldedInstanceConfigResource = 6366 * ShieldedInstanceConfig.newBuilder().build(); 6367 * Operation response = 6368 * instancesClient 6369 * .updateShieldedInstanceConfigAsync( 6370 * project, zone, instance, shieldedInstanceConfigResource) 6371 * .get(); 6372 * } 6373 * }</pre> 6374 * 6375 * @param project Project ID for this request. 6376 * @param zone The name of the zone for this request. 6377 * @param instance Name or id of the instance scoping this request. 6378 * @param shieldedInstanceConfigResource The body resource for this request 6379 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6380 */ updateShieldedInstanceConfigAsync( String project, String zone, String instance, ShieldedInstanceConfig shieldedInstanceConfigResource)6381 public final OperationFuture<Operation, Operation> updateShieldedInstanceConfigAsync( 6382 String project, 6383 String zone, 6384 String instance, 6385 ShieldedInstanceConfig shieldedInstanceConfigResource) { 6386 UpdateShieldedInstanceConfigInstanceRequest request = 6387 UpdateShieldedInstanceConfigInstanceRequest.newBuilder() 6388 .setProject(project) 6389 .setZone(zone) 6390 .setInstance(instance) 6391 .setShieldedInstanceConfigResource(shieldedInstanceConfigResource) 6392 .build(); 6393 return updateShieldedInstanceConfigAsync(request); 6394 } 6395 6396 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6397 /** 6398 * Updates the Shielded Instance config for an instance. You can only use this method on a stopped 6399 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6400 * processing rules. 6401 * 6402 * <p>Sample code: 6403 * 6404 * <pre>{@code 6405 * // This snippet has been automatically generated and should be regarded as a code template only. 6406 * // It will require modifications to work: 6407 * // - It may require correct/in-range values for request initialization. 6408 * // - It may require specifying regional endpoints when creating the service client as shown in 6409 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6410 * try (InstancesClient instancesClient = InstancesClient.create()) { 6411 * UpdateShieldedInstanceConfigInstanceRequest request = 6412 * UpdateShieldedInstanceConfigInstanceRequest.newBuilder() 6413 * .setInstance("instance555127957") 6414 * .setProject("project-309310695") 6415 * .setRequestId("requestId693933066") 6416 * .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build()) 6417 * .setZone("zone3744684") 6418 * .build(); 6419 * Operation response = instancesClient.updateShieldedInstanceConfigAsync(request).get(); 6420 * } 6421 * }</pre> 6422 * 6423 * @param request The request object containing all of the parameters for the API call. 6424 * @throws com.google.api.gax.rpc.ApiException if the remote call fails 6425 */ 6426 @BetaApi( 6427 "The surface for long-running operations is not stable yet and may change in the future.") updateShieldedInstanceConfigAsync( UpdateShieldedInstanceConfigInstanceRequest request)6428 public final OperationFuture<Operation, Operation> updateShieldedInstanceConfigAsync( 6429 UpdateShieldedInstanceConfigInstanceRequest request) { 6430 return updateShieldedInstanceConfigOperationCallable().futureCall(request); 6431 } 6432 6433 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6434 /** 6435 * Updates the Shielded Instance config for an instance. You can only use this method on a stopped 6436 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6437 * processing rules. 6438 * 6439 * <p>Sample code: 6440 * 6441 * <pre>{@code 6442 * // This snippet has been automatically generated and should be regarded as a code template only. 6443 * // It will require modifications to work: 6444 * // - It may require correct/in-range values for request initialization. 6445 * // - It may require specifying regional endpoints when creating the service client as shown in 6446 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6447 * try (InstancesClient instancesClient = InstancesClient.create()) { 6448 * UpdateShieldedInstanceConfigInstanceRequest request = 6449 * UpdateShieldedInstanceConfigInstanceRequest.newBuilder() 6450 * .setInstance("instance555127957") 6451 * .setProject("project-309310695") 6452 * .setRequestId("requestId693933066") 6453 * .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build()) 6454 * .setZone("zone3744684") 6455 * .build(); 6456 * OperationFuture<Operation, Operation> future = 6457 * instancesClient.updateShieldedInstanceConfigOperationCallable().futureCall(request); 6458 * // Do something. 6459 * Operation response = future.get(); 6460 * } 6461 * }</pre> 6462 */ 6463 public final OperationCallable<UpdateShieldedInstanceConfigInstanceRequest, Operation, Operation> updateShieldedInstanceConfigOperationCallable()6464 updateShieldedInstanceConfigOperationCallable() { 6465 return stub.updateShieldedInstanceConfigOperationCallable(); 6466 } 6467 6468 // AUTO-GENERATED DOCUMENTATION AND METHOD. 6469 /** 6470 * Updates the Shielded Instance config for an instance. You can only use this method on a stopped 6471 * instance. This method supports PATCH semantics and uses the JSON merge patch format and 6472 * processing rules. 6473 * 6474 * <p>Sample code: 6475 * 6476 * <pre>{@code 6477 * // This snippet has been automatically generated and should be regarded as a code template only. 6478 * // It will require modifications to work: 6479 * // - It may require correct/in-range values for request initialization. 6480 * // - It may require specifying regional endpoints when creating the service client as shown in 6481 * // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library 6482 * try (InstancesClient instancesClient = InstancesClient.create()) { 6483 * UpdateShieldedInstanceConfigInstanceRequest request = 6484 * UpdateShieldedInstanceConfigInstanceRequest.newBuilder() 6485 * .setInstance("instance555127957") 6486 * .setProject("project-309310695") 6487 * .setRequestId("requestId693933066") 6488 * .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build()) 6489 * .setZone("zone3744684") 6490 * .build(); 6491 * ApiFuture<Operation> future = 6492 * instancesClient.updateShieldedInstanceConfigCallable().futureCall(request); 6493 * // Do something. 6494 * Operation response = future.get(); 6495 * } 6496 * }</pre> 6497 */ 6498 public final UnaryCallable<UpdateShieldedInstanceConfigInstanceRequest, Operation> updateShieldedInstanceConfigCallable()6499 updateShieldedInstanceConfigCallable() { 6500 return stub.updateShieldedInstanceConfigCallable(); 6501 } 6502 6503 @Override close()6504 public final void close() { 6505 stub.close(); 6506 } 6507 6508 @Override shutdown()6509 public void shutdown() { 6510 stub.shutdown(); 6511 } 6512 6513 @Override isShutdown()6514 public boolean isShutdown() { 6515 return stub.isShutdown(); 6516 } 6517 6518 @Override isTerminated()6519 public boolean isTerminated() { 6520 return stub.isTerminated(); 6521 } 6522 6523 @Override shutdownNow()6524 public void shutdownNow() { 6525 stub.shutdownNow(); 6526 } 6527 6528 @Override awaitTermination(long duration, TimeUnit unit)6529 public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { 6530 return stub.awaitTermination(duration, unit); 6531 } 6532 6533 public static class AggregatedListPagedResponse 6534 extends AbstractPagedListResponse< 6535 AggregatedListInstancesRequest, 6536 InstanceAggregatedList, 6537 Map.Entry<String, InstancesScopedList>, 6538 AggregatedListPage, 6539 AggregatedListFixedSizeCollection> { 6540 createAsync( PageContext< AggregatedListInstancesRequest, InstanceAggregatedList, Map.Entry<String, InstancesScopedList>> context, ApiFuture<InstanceAggregatedList> futureResponse)6541 public static ApiFuture<AggregatedListPagedResponse> createAsync( 6542 PageContext< 6543 AggregatedListInstancesRequest, 6544 InstanceAggregatedList, 6545 Map.Entry<String, InstancesScopedList>> 6546 context, 6547 ApiFuture<InstanceAggregatedList> futureResponse) { 6548 ApiFuture<AggregatedListPage> futurePage = 6549 AggregatedListPage.createEmptyPage().createPageAsync(context, futureResponse); 6550 return ApiFutures.transform( 6551 futurePage, 6552 input -> new AggregatedListPagedResponse(input), 6553 MoreExecutors.directExecutor()); 6554 } 6555 AggregatedListPagedResponse(AggregatedListPage page)6556 private AggregatedListPagedResponse(AggregatedListPage page) { 6557 super(page, AggregatedListFixedSizeCollection.createEmptyCollection()); 6558 } 6559 } 6560 6561 public static class AggregatedListPage 6562 extends AbstractPage< 6563 AggregatedListInstancesRequest, 6564 InstanceAggregatedList, 6565 Map.Entry<String, InstancesScopedList>, 6566 AggregatedListPage> { 6567 AggregatedListPage( PageContext< AggregatedListInstancesRequest, InstanceAggregatedList, Map.Entry<String, InstancesScopedList>> context, InstanceAggregatedList response)6568 private AggregatedListPage( 6569 PageContext< 6570 AggregatedListInstancesRequest, 6571 InstanceAggregatedList, 6572 Map.Entry<String, InstancesScopedList>> 6573 context, 6574 InstanceAggregatedList response) { 6575 super(context, response); 6576 } 6577 createEmptyPage()6578 private static AggregatedListPage createEmptyPage() { 6579 return new AggregatedListPage(null, null); 6580 } 6581 6582 @Override createPage( PageContext< AggregatedListInstancesRequest, InstanceAggregatedList, Map.Entry<String, InstancesScopedList>> context, InstanceAggregatedList response)6583 protected AggregatedListPage createPage( 6584 PageContext< 6585 AggregatedListInstancesRequest, 6586 InstanceAggregatedList, 6587 Map.Entry<String, InstancesScopedList>> 6588 context, 6589 InstanceAggregatedList response) { 6590 return new AggregatedListPage(context, response); 6591 } 6592 6593 @Override createPageAsync( PageContext< AggregatedListInstancesRequest, InstanceAggregatedList, Map.Entry<String, InstancesScopedList>> context, ApiFuture<InstanceAggregatedList> futureResponse)6594 public ApiFuture<AggregatedListPage> createPageAsync( 6595 PageContext< 6596 AggregatedListInstancesRequest, 6597 InstanceAggregatedList, 6598 Map.Entry<String, InstancesScopedList>> 6599 context, 6600 ApiFuture<InstanceAggregatedList> futureResponse) { 6601 return super.createPageAsync(context, futureResponse); 6602 } 6603 } 6604 6605 public static class AggregatedListFixedSizeCollection 6606 extends AbstractFixedSizeCollection< 6607 AggregatedListInstancesRequest, 6608 InstanceAggregatedList, 6609 Map.Entry<String, InstancesScopedList>, 6610 AggregatedListPage, 6611 AggregatedListFixedSizeCollection> { 6612 AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize)6613 private AggregatedListFixedSizeCollection(List<AggregatedListPage> pages, int collectionSize) { 6614 super(pages, collectionSize); 6615 } 6616 createEmptyCollection()6617 private static AggregatedListFixedSizeCollection createEmptyCollection() { 6618 return new AggregatedListFixedSizeCollection(null, 0); 6619 } 6620 6621 @Override createCollection( List<AggregatedListPage> pages, int collectionSize)6622 protected AggregatedListFixedSizeCollection createCollection( 6623 List<AggregatedListPage> pages, int collectionSize) { 6624 return new AggregatedListFixedSizeCollection(pages, collectionSize); 6625 } 6626 } 6627 6628 public static class ListPagedResponse 6629 extends AbstractPagedListResponse< 6630 ListInstancesRequest, InstanceList, Instance, ListPage, ListFixedSizeCollection> { 6631 createAsync( PageContext<ListInstancesRequest, InstanceList, Instance> context, ApiFuture<InstanceList> futureResponse)6632 public static ApiFuture<ListPagedResponse> createAsync( 6633 PageContext<ListInstancesRequest, InstanceList, Instance> context, 6634 ApiFuture<InstanceList> futureResponse) { 6635 ApiFuture<ListPage> futurePage = 6636 ListPage.createEmptyPage().createPageAsync(context, futureResponse); 6637 return ApiFutures.transform( 6638 futurePage, input -> new ListPagedResponse(input), MoreExecutors.directExecutor()); 6639 } 6640 ListPagedResponse(ListPage page)6641 private ListPagedResponse(ListPage page) { 6642 super(page, ListFixedSizeCollection.createEmptyCollection()); 6643 } 6644 } 6645 6646 public static class ListPage 6647 extends AbstractPage<ListInstancesRequest, InstanceList, Instance, ListPage> { 6648 ListPage( PageContext<ListInstancesRequest, InstanceList, Instance> context, InstanceList response)6649 private ListPage( 6650 PageContext<ListInstancesRequest, InstanceList, Instance> context, InstanceList response) { 6651 super(context, response); 6652 } 6653 createEmptyPage()6654 private static ListPage createEmptyPage() { 6655 return new ListPage(null, null); 6656 } 6657 6658 @Override createPage( PageContext<ListInstancesRequest, InstanceList, Instance> context, InstanceList response)6659 protected ListPage createPage( 6660 PageContext<ListInstancesRequest, InstanceList, Instance> context, InstanceList response) { 6661 return new ListPage(context, response); 6662 } 6663 6664 @Override createPageAsync( PageContext<ListInstancesRequest, InstanceList, Instance> context, ApiFuture<InstanceList> futureResponse)6665 public ApiFuture<ListPage> createPageAsync( 6666 PageContext<ListInstancesRequest, InstanceList, Instance> context, 6667 ApiFuture<InstanceList> futureResponse) { 6668 return super.createPageAsync(context, futureResponse); 6669 } 6670 } 6671 6672 public static class ListFixedSizeCollection 6673 extends AbstractFixedSizeCollection< 6674 ListInstancesRequest, InstanceList, Instance, ListPage, ListFixedSizeCollection> { 6675 ListFixedSizeCollection(List<ListPage> pages, int collectionSize)6676 private ListFixedSizeCollection(List<ListPage> pages, int collectionSize) { 6677 super(pages, collectionSize); 6678 } 6679 createEmptyCollection()6680 private static ListFixedSizeCollection createEmptyCollection() { 6681 return new ListFixedSizeCollection(null, 0); 6682 } 6683 6684 @Override createCollection(List<ListPage> pages, int collectionSize)6685 protected ListFixedSizeCollection createCollection(List<ListPage> pages, int collectionSize) { 6686 return new ListFixedSizeCollection(pages, collectionSize); 6687 } 6688 } 6689 6690 public static class ListReferrersPagedResponse 6691 extends AbstractPagedListResponse< 6692 ListReferrersInstancesRequest, 6693 InstanceListReferrers, 6694 Reference, 6695 ListReferrersPage, 6696 ListReferrersFixedSizeCollection> { 6697 createAsync( PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, ApiFuture<InstanceListReferrers> futureResponse)6698 public static ApiFuture<ListReferrersPagedResponse> createAsync( 6699 PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, 6700 ApiFuture<InstanceListReferrers> futureResponse) { 6701 ApiFuture<ListReferrersPage> futurePage = 6702 ListReferrersPage.createEmptyPage().createPageAsync(context, futureResponse); 6703 return ApiFutures.transform( 6704 futurePage, 6705 input -> new ListReferrersPagedResponse(input), 6706 MoreExecutors.directExecutor()); 6707 } 6708 ListReferrersPagedResponse(ListReferrersPage page)6709 private ListReferrersPagedResponse(ListReferrersPage page) { 6710 super(page, ListReferrersFixedSizeCollection.createEmptyCollection()); 6711 } 6712 } 6713 6714 public static class ListReferrersPage 6715 extends AbstractPage< 6716 ListReferrersInstancesRequest, InstanceListReferrers, Reference, ListReferrersPage> { 6717 ListReferrersPage( PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, InstanceListReferrers response)6718 private ListReferrersPage( 6719 PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, 6720 InstanceListReferrers response) { 6721 super(context, response); 6722 } 6723 createEmptyPage()6724 private static ListReferrersPage createEmptyPage() { 6725 return new ListReferrersPage(null, null); 6726 } 6727 6728 @Override createPage( PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, InstanceListReferrers response)6729 protected ListReferrersPage createPage( 6730 PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, 6731 InstanceListReferrers response) { 6732 return new ListReferrersPage(context, response); 6733 } 6734 6735 @Override createPageAsync( PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, ApiFuture<InstanceListReferrers> futureResponse)6736 public ApiFuture<ListReferrersPage> createPageAsync( 6737 PageContext<ListReferrersInstancesRequest, InstanceListReferrers, Reference> context, 6738 ApiFuture<InstanceListReferrers> futureResponse) { 6739 return super.createPageAsync(context, futureResponse); 6740 } 6741 } 6742 6743 public static class ListReferrersFixedSizeCollection 6744 extends AbstractFixedSizeCollection< 6745 ListReferrersInstancesRequest, 6746 InstanceListReferrers, 6747 Reference, 6748 ListReferrersPage, 6749 ListReferrersFixedSizeCollection> { 6750 ListReferrersFixedSizeCollection(List<ListReferrersPage> pages, int collectionSize)6751 private ListReferrersFixedSizeCollection(List<ListReferrersPage> pages, int collectionSize) { 6752 super(pages, collectionSize); 6753 } 6754 createEmptyCollection()6755 private static ListReferrersFixedSizeCollection createEmptyCollection() { 6756 return new ListReferrersFixedSizeCollection(null, 0); 6757 } 6758 6759 @Override createCollection( List<ListReferrersPage> pages, int collectionSize)6760 protected ListReferrersFixedSizeCollection createCollection( 6761 List<ListReferrersPage> pages, int collectionSize) { 6762 return new ListReferrersFixedSizeCollection(pages, collectionSize); 6763 } 6764 } 6765 } 6766