Class InstancesClient (1.28.0)

public class InstancesClient implements BackgroundResource

Service Description: The Instances API.

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Instance response = instancesClient.get(project, zone, instance);
 }
 

Note: close() needs to be called on the InstancesClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns an immutable API callable object, which can be used to initiate calls to the service.

See the individual methods for example code.

Many parameters require resource names to be formatted in a particular way. To assist with these names, this class includes a format method for each type of name, and additionally a parse method to extract the individual identifiers contained within names that are returned.

This class can be customized by passing in a custom instance of InstancesSettings to create(). For example:

To customize credentials:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 InstancesSettings instancesSettings =
     InstancesSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 InstancesClient instancesClient = InstancesClient.create(instancesSettings);
 

To customize the endpoint:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 InstancesSettings instancesSettings =
     InstancesSettings.newBuilder().setEndpoint(myEndpoint).build();
 InstancesClient instancesClient = InstancesClient.create(instancesSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > InstancesClient

Implements

BackgroundResource

Static Methods

create()

public static final InstancesClient create()

Constructs an instance of InstancesClient with default settings.

Returns
TypeDescription
InstancesClient
Exceptions
TypeDescription
IOException

create(InstancesSettings settings)

public static final InstancesClient create(InstancesSettings settings)

Constructs an instance of InstancesClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsInstancesSettings
Returns
TypeDescription
InstancesClient
Exceptions
TypeDescription
IOException

create(InstancesStub stub)

public static final InstancesClient create(InstancesStub stub)

Constructs an instance of InstancesClient, using the given stub for making calls. This is for advanced usage - prefer using create(InstancesSettings).

Parameter
NameDescription
stubInstancesStub
Returns
TypeDescription
InstancesClient

Constructors

InstancesClient(InstancesSettings settings)

protected InstancesClient(InstancesSettings settings)

Constructs an instance of InstancesClient, using the given settings. This is protected so that it is easy to make a subclass, but otherwise, the static factory methods should be preferred.

Parameter
NameDescription
settingsInstancesSettings

InstancesClient(InstancesStub stub)

protected InstancesClient(InstancesStub stub)
Parameter
NameDescription
stubInstancesStub

Methods

addAccessConfigAsync(AddAccessConfigInstanceRequest request)

public final OperationFuture<Operation,Operation> addAccessConfigAsync(AddAccessConfigInstanceRequest request)

Adds an access config to an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddAccessConfigInstanceRequest request =
       AddAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.addAccessConfigAsync(request).get();
 }
 
Parameter
NameDescription
requestAddAccessConfigInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

addAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)

public final OperationFuture<Operation,Operation> addAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)

Adds an access config to an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String networkInterface = "networkInterface-341981525";
   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
   Operation response =
       instancesClient
           .addAccessConfigAsync(project, zone, instance, networkInterface, accessConfigResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

networkInterfaceString

The name of the network interface to add to this instance.

accessConfigResourceAccessConfig

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addAccessConfigCallable()

public final UnaryCallable<AddAccessConfigInstanceRequest,Operation> addAccessConfigCallable()

Adds an access config to an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddAccessConfigInstanceRequest request =
       AddAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.addAccessConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddAccessConfigInstanceRequest,Operation>

addAccessConfigOperationCallable()

public final OperationCallable<AddAccessConfigInstanceRequest,Operation,Operation> addAccessConfigOperationCallable()

Adds an access config to an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddAccessConfigInstanceRequest request =
       AddAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.addAccessConfigOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddAccessConfigInstanceRequest,Operation,Operation>

addResourcePoliciesAsync(AddResourcePoliciesInstanceRequest request)

public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(AddResourcePoliciesInstanceRequest request)

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddResourcePoliciesInstanceRequest request =
       AddResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesAddResourcePoliciesRequestResource(
               InstancesAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.addResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestAddResourcePoliciesInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesAsync(String project, String zone, String instance, InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> addResourcePoliciesAsync(String project, String zone, String instance, InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource)

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesAddResourcePoliciesRequest instancesAddResourcePoliciesRequestResource =
       InstancesAddResourcePoliciesRequest.newBuilder().build();
   Operation response =
       instancesClient
           .addResourcePoliciesAsync(
               project, zone, instance, instancesAddResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

instancesAddResourcePoliciesRequestResourceInstancesAddResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

addResourcePoliciesCallable()

public final UnaryCallable<AddResourcePoliciesInstanceRequest,Operation> addResourcePoliciesCallable()

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddResourcePoliciesInstanceRequest request =
       AddResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesAddResourcePoliciesRequestResource(
               InstancesAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.addResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AddResourcePoliciesInstanceRequest,Operation>

addResourcePoliciesOperationCallable()

public final OperationCallable<AddResourcePoliciesInstanceRequest,Operation,Operation> addResourcePoliciesOperationCallable()

Adds existing resource policies to an instance. You can only add one policy right now which will be applied to this instance for scheduling live migrations.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AddResourcePoliciesInstanceRequest request =
       AddResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesAddResourcePoliciesRequestResource(
               InstancesAddResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.addResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AddResourcePoliciesInstanceRequest,Operation,Operation>

aggregatedList(AggregatedListInstancesRequest request)

public final InstancesClient.AggregatedListPagedResponse aggregatedList(AggregatedListInstancesRequest request)

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AggregatedListInstancesRequest request =
       AggregatedListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   for (Map.Entry<String, InstancesScopedList> element :
       instancesClient.aggregatedList(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestAggregatedListInstancesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InstancesClient.AggregatedListPagedResponse

aggregatedList(String project)

public final InstancesClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   for (Map.Entry<String, InstancesScopedList> element :
       instancesClient.aggregatedList(project).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
projectString

Project ID for this request.

Returns
TypeDescription
InstancesClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListInstancesRequest,InstanceAggregatedList> aggregatedListCallable()

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AggregatedListInstancesRequest request =
       AggregatedListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   while (true) {
     InstanceAggregatedList response = instancesClient.aggregatedListCallable().call(request);
     for (Map.Entry<String, InstancesScopedList> element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListInstancesRequest,InstanceAggregatedList>

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListInstancesRequest,InstancesClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves an aggregated list of all of the instances in your project across all regions and zones. The performance of this method degrades when a filter is specified on a project that has a very large number of instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AggregatedListInstancesRequest request =
       AggregatedListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setIncludeAllScopes(true)
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .build();
   ApiFuture<Map.Entry<String, InstancesScopedList>> future =
       instancesClient.aggregatedListPagedCallable().futureCall(request);
   // Do something.
   for (Map.Entry<String, InstancesScopedList> element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<AggregatedListInstancesRequest,AggregatedListPagedResponse>

attachDiskAsync(AttachDiskInstanceRequest request)

public final OperationFuture<Operation,Operation> attachDiskAsync(AttachDiskInstanceRequest request)

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AttachDiskInstanceRequest request =
       AttachDiskInstanceRequest.newBuilder()
           .setAttachedDiskResource(AttachedDisk.newBuilder().build())
           .setForceAttach(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.attachDiskAsync(request).get();
 }
 
Parameter
NameDescription
requestAttachDiskInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

attachDiskAsync(String project, String zone, String instance, AttachedDisk attachedDiskResource)

public final OperationFuture<Operation,Operation> attachDiskAsync(String project, String zone, String instance, AttachedDisk attachedDiskResource)

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   AttachedDisk attachedDiskResource = AttachedDisk.newBuilder().build();
   Operation response =
       instancesClient.attachDiskAsync(project, zone, instance, attachedDiskResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

attachedDiskResourceAttachedDisk

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

attachDiskCallable()

public final UnaryCallable<AttachDiskInstanceRequest,Operation> attachDiskCallable()

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AttachDiskInstanceRequest request =
       AttachDiskInstanceRequest.newBuilder()
           .setAttachedDiskResource(AttachedDisk.newBuilder().build())
           .setForceAttach(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.attachDiskCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<AttachDiskInstanceRequest,Operation>

attachDiskOperationCallable()

public final OperationCallable<AttachDiskInstanceRequest,Operation,Operation> attachDiskOperationCallable()

Attaches an existing Disk resource to an instance. You must first create the disk before you can attach it. It is not possible to create and attach a disk at the same time. For more information, read Adding a persistent disk to your instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   AttachDiskInstanceRequest request =
       AttachDiskInstanceRequest.newBuilder()
           .setAttachedDiskResource(AttachedDisk.newBuilder().build())
           .setForceAttach(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.attachDiskOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<AttachDiskInstanceRequest,Operation,Operation>

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

bulkInsertAsync(BulkInsertInstanceRequest request)

public final OperationFuture<Operation,Operation> bulkInsertAsync(BulkInsertInstanceRequest request)

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   BulkInsertInstanceRequest request =
       BulkInsertInstanceRequest.newBuilder()
           .setBulkInsertInstanceResourceResource(
               BulkInsertInstanceResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.bulkInsertAsync(request).get();
 }
 
Parameter
NameDescription
requestBulkInsertInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

bulkInsertAsync(String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource)

public final OperationFuture<Operation,Operation> bulkInsertAsync(String project, String zone, BulkInsertInstanceResource bulkInsertInstanceResourceResource)

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   BulkInsertInstanceResource bulkInsertInstanceResourceResource =
       BulkInsertInstanceResource.newBuilder().build();
   Operation response =
       instancesClient.bulkInsertAsync(project, zone, bulkInsertInstanceResourceResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

bulkInsertInstanceResourceResourceBulkInsertInstanceResource

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

bulkInsertCallable()

public final UnaryCallable<BulkInsertInstanceRequest,Operation> bulkInsertCallable()

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   BulkInsertInstanceRequest request =
       BulkInsertInstanceRequest.newBuilder()
           .setBulkInsertInstanceResourceResource(
               BulkInsertInstanceResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.bulkInsertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<BulkInsertInstanceRequest,Operation>

bulkInsertOperationCallable()

public final OperationCallable<BulkInsertInstanceRequest,Operation,Operation> bulkInsertOperationCallable()

Creates multiple instances. Count specifies the number of instances to create. For more information, see About bulk creation of VMs.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   BulkInsertInstanceRequest request =
       BulkInsertInstanceRequest.newBuilder()
           .setBulkInsertInstanceResourceResource(
               BulkInsertInstanceResource.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.bulkInsertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<BulkInsertInstanceRequest,Operation,Operation>

close()

public final void close()

deleteAccessConfigAsync(DeleteAccessConfigInstanceRequest request)

public final OperationFuture<Operation,Operation> deleteAccessConfigAsync(DeleteAccessConfigInstanceRequest request)

Deletes an access config from an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteAccessConfigInstanceRequest request =
       DeleteAccessConfigInstanceRequest.newBuilder()
           .setAccessConfig("accessConfig1549765062")
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.deleteAccessConfigAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteAccessConfigInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAccessConfigAsync(String project, String zone, String instance, String accessConfig, String networkInterface)

public final OperationFuture<Operation,Operation> deleteAccessConfigAsync(String project, String zone, String instance, String accessConfig, String networkInterface)

Deletes an access config from an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String accessConfig = "accessConfig1549765062";
   String networkInterface = "networkInterface-341981525";
   Operation response =
       instancesClient
           .deleteAccessConfigAsync(project, zone, instance, accessConfig, networkInterface)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

accessConfigString

The name of the access config to delete.

networkInterfaceString

The name of the network interface.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAccessConfigCallable()

public final UnaryCallable<DeleteAccessConfigInstanceRequest,Operation> deleteAccessConfigCallable()

Deletes an access config from an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteAccessConfigInstanceRequest request =
       DeleteAccessConfigInstanceRequest.newBuilder()
           .setAccessConfig("accessConfig1549765062")
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.deleteAccessConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteAccessConfigInstanceRequest,Operation>

deleteAccessConfigOperationCallable()

public final OperationCallable<DeleteAccessConfigInstanceRequest,Operation,Operation> deleteAccessConfigOperationCallable()

Deletes an access config from an instance's network interface.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteAccessConfigInstanceRequest request =
       DeleteAccessConfigInstanceRequest.newBuilder()
           .setAccessConfig("accessConfig1549765062")
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.deleteAccessConfigOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteAccessConfigInstanceRequest,Operation,Operation>

deleteAsync(DeleteInstanceRequest request)

public final OperationFuture<Operation,Operation> deleteAsync(DeleteInstanceRequest request)

Deletes the specified Instance resource. For more information, see Deleting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.deleteAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> deleteAsync(String project, String zone, String instance)

Deletes the specified Instance resource. For more information, see Deleting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.deleteAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to delete.

Returns
TypeDescription
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteInstanceRequest,Operation> deleteCallable()

Deletes the specified Instance resource. For more information, see Deleting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.deleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteInstanceRequest,Operation>

deleteOperationCallable()

public final OperationCallable<DeleteInstanceRequest,Operation,Operation> deleteOperationCallable()

Deletes the specified Instance resource. For more information, see Deleting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DeleteInstanceRequest request =
       DeleteInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.deleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteInstanceRequest,Operation,Operation>

detachDiskAsync(DetachDiskInstanceRequest request)

public final OperationFuture<Operation,Operation> detachDiskAsync(DetachDiskInstanceRequest request)

Detaches a disk from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DetachDiskInstanceRequest request =
       DetachDiskInstanceRequest.newBuilder()
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.detachDiskAsync(request).get();
 }
 
Parameter
NameDescription
requestDetachDiskInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

detachDiskAsync(String project, String zone, String instance, String deviceName)

public final OperationFuture<Operation,Operation> detachDiskAsync(String project, String zone, String instance, String deviceName)

Detaches a disk from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String deviceName = "deviceName780988929";
   Operation response =
       instancesClient.detachDiskAsync(project, zone, instance, deviceName).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Instance name for this request.

deviceNameString

The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.

Returns
TypeDescription
OperationFuture<Operation,Operation>

detachDiskCallable()

public final UnaryCallable<DetachDiskInstanceRequest,Operation> detachDiskCallable()

Detaches a disk from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DetachDiskInstanceRequest request =
       DetachDiskInstanceRequest.newBuilder()
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.detachDiskCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DetachDiskInstanceRequest,Operation>

detachDiskOperationCallable()

public final OperationCallable<DetachDiskInstanceRequest,Operation,Operation> detachDiskOperationCallable()

Detaches a disk from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   DetachDiskInstanceRequest request =
       DetachDiskInstanceRequest.newBuilder()
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.detachDiskOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<DetachDiskInstanceRequest,Operation,Operation>

get(GetInstanceRequest request)

public final Instance get(GetInstanceRequest request)

Returns the specified Instance resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   Instance response = instancesClient.get(request);
 }
 
Parameter
NameDescription
requestGetInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Instance

get(String project, String zone, String instance)

public final Instance get(String project, String zone, String instance)

Returns the specified Instance resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Instance response = instancesClient.get(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to return.

Returns
TypeDescription
Instance

getCallable()

public final UnaryCallable<GetInstanceRequest,Instance> getCallable()

Returns the specified Instance resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetInstanceRequest request =
       GetInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<Instance> future = instancesClient.getCallable().futureCall(request);
   // Do something.
   Instance response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetInstanceRequest,Instance>

getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest request)

public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls(GetEffectiveFirewallsInstanceRequest request)

Returns effective firewalls applied to an interface of the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetEffectiveFirewallsInstanceRequest request =
       GetEffectiveFirewallsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   InstancesGetEffectiveFirewallsResponse response =
       instancesClient.getEffectiveFirewalls(request);
 }
 
Parameter
NameDescription
requestGetEffectiveFirewallsInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InstancesGetEffectiveFirewallsResponse

getEffectiveFirewalls(String project, String zone, String instance, String networkInterface)

public final InstancesGetEffectiveFirewallsResponse getEffectiveFirewalls(String project, String zone, String instance, String networkInterface)

Returns effective firewalls applied to an interface of the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String networkInterface = "networkInterface-341981525";
   InstancesGetEffectiveFirewallsResponse response =
       instancesClient.getEffectiveFirewalls(project, zone, instance, networkInterface);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

networkInterfaceString

The name of the network interface to get the effective firewalls.

Returns
TypeDescription
InstancesGetEffectiveFirewallsResponse

getEffectiveFirewallsCallable()

public final UnaryCallable<GetEffectiveFirewallsInstanceRequest,InstancesGetEffectiveFirewallsResponse> getEffectiveFirewallsCallable()

Returns effective firewalls applied to an interface of the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetEffectiveFirewallsInstanceRequest request =
       GetEffectiveFirewallsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<InstancesGetEffectiveFirewallsResponse> future =
       instancesClient.getEffectiveFirewallsCallable().futureCall(request);
   // Do something.
   InstancesGetEffectiveFirewallsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetEffectiveFirewallsInstanceRequest,InstancesGetEffectiveFirewallsResponse>

getGuestAttributes(GetGuestAttributesInstanceRequest request)

public final GuestAttributes getGuestAttributes(GetGuestAttributesInstanceRequest request)

Returns the specified guest attributes entry.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetGuestAttributesInstanceRequest request =
       GetGuestAttributesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setQueryPath("queryPath-1807004403")
           .setVariableKey("variableKey-1951698365")
           .setZone("zone3744684")
           .build();
   GuestAttributes response = instancesClient.getGuestAttributes(request);
 }
 
Parameter
NameDescription
requestGetGuestAttributesInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
GuestAttributes

getGuestAttributes(String project, String zone, String instance)

public final GuestAttributes getGuestAttributes(String project, String zone, String instance)

Returns the specified guest attributes entry.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   GuestAttributes response = instancesClient.getGuestAttributes(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

Returns
TypeDescription
GuestAttributes

getGuestAttributesCallable()

public final UnaryCallable<GetGuestAttributesInstanceRequest,GuestAttributes> getGuestAttributesCallable()

Returns the specified guest attributes entry.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetGuestAttributesInstanceRequest request =
       GetGuestAttributesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setQueryPath("queryPath-1807004403")
           .setVariableKey("variableKey-1951698365")
           .setZone("zone3744684")
           .build();
   ApiFuture<GuestAttributes> future =
       instancesClient.getGuestAttributesCallable().futureCall(request);
   // Do something.
   GuestAttributes response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetGuestAttributesInstanceRequest,GuestAttributes>

getIamPolicy(GetIamPolicyInstanceRequest request)

public final Policy getIamPolicy(GetIamPolicyInstanceRequest request)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetIamPolicyInstanceRequest request =
       GetIamPolicyInstanceRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   Policy response = instancesClient.getIamPolicy(request);
 }
 
Parameter
NameDescription
requestGetIamPolicyInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Policy

getIamPolicy(String project, String zone, String resource)

public final Policy getIamPolicy(String project, String zone, String resource)

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   Policy response = instancesClient.getIamPolicy(project, zone, resource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
Policy

getIamPolicyCallable()

public final UnaryCallable<GetIamPolicyInstanceRequest,Policy> getIamPolicyCallable()

Gets the access control policy for a resource. May be empty if no such policy or resource exists.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetIamPolicyInstanceRequest request =
       GetIamPolicyInstanceRequest.newBuilder()
           .setOptionsRequestedPolicyVersion(-574521795)
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   ApiFuture<Policy> future = instancesClient.getIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetIamPolicyInstanceRequest,Policy>

getScreenshot(GetScreenshotInstanceRequest request)

public final Screenshot getScreenshot(GetScreenshotInstanceRequest request)

Returns the screenshot from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetScreenshotInstanceRequest request =
       GetScreenshotInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   Screenshot response = instancesClient.getScreenshot(request);
 }
 
Parameter
NameDescription
requestGetScreenshotInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Screenshot

getScreenshot(String project, String zone, String instance)

public final Screenshot getScreenshot(String project, String zone, String instance)

Returns the screenshot from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Screenshot response = instancesClient.getScreenshot(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

Returns
TypeDescription
Screenshot

getScreenshotCallable()

public final UnaryCallable<GetScreenshotInstanceRequest,Screenshot> getScreenshotCallable()

Returns the screenshot from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetScreenshotInstanceRequest request =
       GetScreenshotInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<Screenshot> future = instancesClient.getScreenshotCallable().futureCall(request);
   // Do something.
   Screenshot response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetScreenshotInstanceRequest,Screenshot>

getSerialPortOutput(GetSerialPortOutputInstanceRequest request)

public final SerialPortOutput getSerialPortOutput(GetSerialPortOutputInstanceRequest request)

Returns the last 1 MB of serial port output from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetSerialPortOutputInstanceRequest request =
       GetSerialPortOutputInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setPort(3446913)
           .setProject("project-309310695")
           .setStart(109757538)
           .setZone("zone3744684")
           .build();
   SerialPortOutput response = instancesClient.getSerialPortOutput(request);
 }
 
Parameter
NameDescription
requestGetSerialPortOutputInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
SerialPortOutput

getSerialPortOutput(String project, String zone, String instance)

public final SerialPortOutput getSerialPortOutput(String project, String zone, String instance)

Returns the last 1 MB of serial port output from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   SerialPortOutput response = instancesClient.getSerialPortOutput(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance for this request.

Returns
TypeDescription
SerialPortOutput

getSerialPortOutputCallable()

public final UnaryCallable<GetSerialPortOutputInstanceRequest,SerialPortOutput> getSerialPortOutputCallable()

Returns the last 1 MB of serial port output from the specified instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetSerialPortOutputInstanceRequest request =
       GetSerialPortOutputInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setPort(3446913)
           .setProject("project-309310695")
           .setStart(109757538)
           .setZone("zone3744684")
           .build();
   ApiFuture<SerialPortOutput> future =
       instancesClient.getSerialPortOutputCallable().futureCall(request);
   // Do something.
   SerialPortOutput response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetSerialPortOutputInstanceRequest,SerialPortOutput>

getSettings()

public final InstancesSettings getSettings()
Returns
TypeDescription
InstancesSettings

getShieldedInstanceIdentity(GetShieldedInstanceIdentityInstanceRequest request)

public final ShieldedInstanceIdentity getShieldedInstanceIdentity(GetShieldedInstanceIdentityInstanceRequest request)

Returns the Shielded Instance Identity of an instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetShieldedInstanceIdentityInstanceRequest request =
       GetShieldedInstanceIdentityInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ShieldedInstanceIdentity response = instancesClient.getShieldedInstanceIdentity(request);
 }
 
Parameter
NameDescription
requestGetShieldedInstanceIdentityInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
ShieldedInstanceIdentity

getShieldedInstanceIdentity(String project, String zone, String instance)

public final ShieldedInstanceIdentity getShieldedInstanceIdentity(String project, String zone, String instance)

Returns the Shielded Instance Identity of an instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   ShieldedInstanceIdentity response =
       instancesClient.getShieldedInstanceIdentity(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name or id of the instance scoping this request.

Returns
TypeDescription
ShieldedInstanceIdentity

getShieldedInstanceIdentityCallable()

public final UnaryCallable<GetShieldedInstanceIdentityInstanceRequest,ShieldedInstanceIdentity> getShieldedInstanceIdentityCallable()

Returns the Shielded Instance Identity of an instance

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   GetShieldedInstanceIdentityInstanceRequest request =
       GetShieldedInstanceIdentityInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<ShieldedInstanceIdentity> future =
       instancesClient.getShieldedInstanceIdentityCallable().futureCall(request);
   // Do something.
   ShieldedInstanceIdentity response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetShieldedInstanceIdentityInstanceRequest,ShieldedInstanceIdentity>

getStub()

public InstancesStub getStub()
Returns
TypeDescription
InstancesStub

insertAsync(InsertInstanceRequest request)

public final OperationFuture<Operation,Operation> insertAsync(InsertInstanceRequest request)

Creates an instance resource in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   InsertInstanceRequest request =
       InsertInstanceRequest.newBuilder()
           .setInstanceResource(Instance.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceInstanceTemplate("sourceInstanceTemplate949712490")
           .setSourceMachineImage("sourceMachineImage1261073679")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.insertAsync(request).get();
 }
 
Parameter
NameDescription
requestInsertInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertAsync(String project, String zone, Instance instanceResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, String zone, Instance instanceResource)

Creates an instance resource in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   Instance instanceResource = Instance.newBuilder().build();
   Operation response = instancesClient.insertAsync(project, zone, instanceResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceResourceInstance

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertInstanceRequest,Operation> insertCallable()

Creates an instance resource in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   InsertInstanceRequest request =
       InsertInstanceRequest.newBuilder()
           .setInstanceResource(Instance.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceInstanceTemplate("sourceInstanceTemplate949712490")
           .setSourceMachineImage("sourceMachineImage1261073679")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<InsertInstanceRequest,Operation>

insertOperationCallable()

public final OperationCallable<InsertInstanceRequest,Operation,Operation> insertOperationCallable()

Creates an instance resource in the specified project using the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   InsertInstanceRequest request =
       InsertInstanceRequest.newBuilder()
           .setInstanceResource(Instance.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSourceInstanceTemplate("sourceInstanceTemplate949712490")
           .setSourceMachineImage("sourceMachineImage1261073679")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<InsertInstanceRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

list(ListInstancesRequest request)

public final InstancesClient.ListPagedResponse list(ListInstancesRequest request)

Retrieves the list of instances contained within the specified zone.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   for (Instance element : instancesClient.list(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListInstancesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InstancesClient.ListPagedResponse

list(String project, String zone)

public final InstancesClient.ListPagedResponse list(String project, String zone)

Retrieves the list of instances contained within the specified zone.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   for (Instance element : instancesClient.list(project, zone).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

Returns
TypeDescription
InstancesClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListInstancesRequest,InstanceList> listCallable()

Retrieves the list of instances contained within the specified zone.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   while (true) {
     InstanceList response = instancesClient.listCallable().call(request);
     for (Instance element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInstancesRequest,InstanceList>

listPagedCallable()

public final UnaryCallable<ListInstancesRequest,InstancesClient.ListPagedResponse> listPagedCallable()

Retrieves the list of instances contained within the specified zone.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListInstancesRequest request =
       ListInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   ApiFuture<Instance> future = instancesClient.listPagedCallable().futureCall(request);
   // Do something.
   for (Instance element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListInstancesRequest,ListPagedResponse>

listReferrers(ListReferrersInstancesRequest request)

public final InstancesClient.ListReferrersPagedResponse listReferrers(ListReferrersInstancesRequest request)

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListReferrersInstancesRequest request =
       ListReferrersInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setInstance("instance555127957")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   for (Reference element : instancesClient.listReferrers(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListReferrersInstancesRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
InstancesClient.ListReferrersPagedResponse

listReferrers(String project, String zone, String instance)

public final InstancesClient.ListReferrersPagedResponse listReferrers(String project, String zone, String instance)

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   for (Reference element :
       instancesClient.listReferrers(project, zone, instance).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the target instance scoping this request, or '-' if the request should span over all instances in the container.

Returns
TypeDescription
InstancesClient.ListReferrersPagedResponse

listReferrersCallable()

public final UnaryCallable<ListReferrersInstancesRequest,InstanceListReferrers> listReferrersCallable()

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListReferrersInstancesRequest request =
       ListReferrersInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setInstance("instance555127957")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   while (true) {
     InstanceListReferrers response = instancesClient.listReferrersCallable().call(request);
     for (Reference element : response.getItemsList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListReferrersInstancesRequest,InstanceListReferrers>

listReferrersPagedCallable()

public final UnaryCallable<ListReferrersInstancesRequest,InstancesClient.ListReferrersPagedResponse> listReferrersPagedCallable()

Retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ListReferrersInstancesRequest request =
       ListReferrersInstancesRequest.newBuilder()
           .setFilter("filter-1274492040")
           .setInstance("instance555127957")
           .setMaxResults(1128457243)
           .setOrderBy("orderBy-1207110587")
           .setPageToken("pageToken873572522")
           .setProject("project-309310695")
           .setReturnPartialSuccess(true)
           .setZone("zone3744684")
           .build();
   ApiFuture<Reference> future =
       instancesClient.listReferrersPagedCallable().futureCall(request);
   // Do something.
   for (Reference element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListReferrersInstancesRequest,ListReferrersPagedResponse>

removeResourcePoliciesAsync(RemoveResourcePoliciesInstanceRequest request)

public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(RemoveResourcePoliciesInstanceRequest request)

Removes resource policies from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   RemoveResourcePoliciesInstanceRequest request =
       RemoveResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesRemoveResourcePoliciesRequestResource(
               InstancesRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.removeResourcePoliciesAsync(request).get();
 }
 
Parameter
NameDescription
requestRemoveResourcePoliciesInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesAsync(String project, String zone, String instance, InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource)

public final OperationFuture<Operation,Operation> removeResourcePoliciesAsync(String project, String zone, String instance, InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource)

Removes resource policies from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesRemoveResourcePoliciesRequest instancesRemoveResourcePoliciesRequestResource =
       InstancesRemoveResourcePoliciesRequest.newBuilder().build();
   Operation response =
       instancesClient
           .removeResourcePoliciesAsync(
               project, zone, instance, instancesRemoveResourcePoliciesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

instancesRemoveResourcePoliciesRequestResourceInstancesRemoveResourcePoliciesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

removeResourcePoliciesCallable()

public final UnaryCallable<RemoveResourcePoliciesInstanceRequest,Operation> removeResourcePoliciesCallable()

Removes resource policies from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   RemoveResourcePoliciesInstanceRequest request =
       RemoveResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesRemoveResourcePoliciesRequestResource(
               InstancesRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.removeResourcePoliciesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<RemoveResourcePoliciesInstanceRequest,Operation>

removeResourcePoliciesOperationCallable()

public final OperationCallable<RemoveResourcePoliciesInstanceRequest,Operation,Operation> removeResourcePoliciesOperationCallable()

Removes resource policies from an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   RemoveResourcePoliciesInstanceRequest request =
       RemoveResourcePoliciesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesRemoveResourcePoliciesRequestResource(
               InstancesRemoveResourcePoliciesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.removeResourcePoliciesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<RemoveResourcePoliciesInstanceRequest,Operation,Operation>

resetAsync(ResetInstanceRequest request)

public final OperationFuture<Operation,Operation> resetAsync(ResetInstanceRequest request)

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.resetAsync(request).get();
 }
 
Parameter
NameDescription
requestResetInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

resetAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> resetAsync(String project, String zone, String instance)

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.resetAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

Returns
TypeDescription
OperationFuture<Operation,Operation>

resetCallable()

public final UnaryCallable<ResetInstanceRequest,Operation> resetCallable()

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.resetCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ResetInstanceRequest,Operation>

resetOperationCallable()

public final OperationCallable<ResetInstanceRequest,Operation,Operation> resetOperationCallable()

Performs a reset on the instance. This is a hard reset. The VM does not do a graceful shutdown. For more information, see Resetting an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResetInstanceRequest request =
       ResetInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.resetOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ResetInstanceRequest,Operation,Operation>

resumeAsync(ResumeInstanceRequest request)

public final OperationFuture<Operation,Operation> resumeAsync(ResumeInstanceRequest request)

Resumes an instance that was suspended using the instances().suspend method.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResumeInstanceRequest request =
       ResumeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.resumeAsync(request).get();
 }
 
Parameter
NameDescription
requestResumeInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

resumeAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> resumeAsync(String project, String zone, String instance)

Resumes an instance that was suspended using the instances().suspend method.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.resumeAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to resume.

Returns
TypeDescription
OperationFuture<Operation,Operation>

resumeCallable()

public final UnaryCallable<ResumeInstanceRequest,Operation> resumeCallable()

Resumes an instance that was suspended using the instances().suspend method.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResumeInstanceRequest request =
       ResumeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.resumeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<ResumeInstanceRequest,Operation>

resumeOperationCallable()

public final OperationCallable<ResumeInstanceRequest,Operation,Operation> resumeOperationCallable()

Resumes an instance that was suspended using the instances().suspend method.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   ResumeInstanceRequest request =
       ResumeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.resumeOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<ResumeInstanceRequest,Operation,Operation>

sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest request)

public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt(SendDiagnosticInterruptInstanceRequest request)

Sends diagnostic interrupt to the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SendDiagnosticInterruptInstanceRequest request =
       SendDiagnosticInterruptInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   SendDiagnosticInterruptInstanceResponse response =
       instancesClient.sendDiagnosticInterrupt(request);
 }
 
Parameter
NameDescription
requestSendDiagnosticInterruptInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
SendDiagnosticInterruptInstanceResponse

sendDiagnosticInterrupt(String project, String zone, String instance)

public final SendDiagnosticInterruptInstanceResponse sendDiagnosticInterrupt(String project, String zone, String instance)

Sends diagnostic interrupt to the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   SendDiagnosticInterruptInstanceResponse response =
       instancesClient.sendDiagnosticInterrupt(project, zone, instance);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

Returns
TypeDescription
SendDiagnosticInterruptInstanceResponse

sendDiagnosticInterruptCallable()

public final UnaryCallable<SendDiagnosticInterruptInstanceRequest,SendDiagnosticInterruptInstanceResponse> sendDiagnosticInterruptCallable()

Sends diagnostic interrupt to the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SendDiagnosticInterruptInstanceRequest request =
       SendDiagnosticInterruptInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<SendDiagnosticInterruptInstanceResponse> future =
       instancesClient.sendDiagnosticInterruptCallable().futureCall(request);
   // Do something.
   SendDiagnosticInterruptInstanceResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SendDiagnosticInterruptInstanceRequest,SendDiagnosticInterruptInstanceResponse>

setDeletionProtectionAsync(SetDeletionProtectionInstanceRequest request)

public final OperationFuture<Operation,Operation> setDeletionProtectionAsync(SetDeletionProtectionInstanceRequest request)

Sets deletion protection on the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDeletionProtectionInstanceRequest request =
       SetDeletionProtectionInstanceRequest.newBuilder()
           .setDeletionProtection(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setDeletionProtectionAsync(request).get();
 }
 
Parameter
NameDescription
requestSetDeletionProtectionInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDeletionProtectionAsync(String project, String zone, String resource)

public final OperationFuture<Operation,Operation> setDeletionProtectionAsync(String project, String zone, String resource)

Sets deletion protection on the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   Operation response =
       instancesClient.setDeletionProtectionAsync(project, zone, resource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDeletionProtectionCallable()

public final UnaryCallable<SetDeletionProtectionInstanceRequest,Operation> setDeletionProtectionCallable()

Sets deletion protection on the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDeletionProtectionInstanceRequest request =
       SetDeletionProtectionInstanceRequest.newBuilder()
           .setDeletionProtection(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.setDeletionProtectionCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetDeletionProtectionInstanceRequest,Operation>

setDeletionProtectionOperationCallable()

public final OperationCallable<SetDeletionProtectionInstanceRequest,Operation,Operation> setDeletionProtectionOperationCallable()

Sets deletion protection on the instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDeletionProtectionInstanceRequest request =
       SetDeletionProtectionInstanceRequest.newBuilder()
           .setDeletionProtection(true)
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setDeletionProtectionOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetDeletionProtectionInstanceRequest,Operation,Operation>

setDiskAutoDeleteAsync(SetDiskAutoDeleteInstanceRequest request)

public final OperationFuture<Operation,Operation> setDiskAutoDeleteAsync(SetDiskAutoDeleteInstanceRequest request)

Sets the auto-delete flag for a disk attached to an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDiskAutoDeleteInstanceRequest request =
       SetDiskAutoDeleteInstanceRequest.newBuilder()
           .setAutoDelete(true)
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setDiskAutoDeleteAsync(request).get();
 }
 
Parameter
NameDescription
requestSetDiskAutoDeleteInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDiskAutoDeleteAsync(String project, String zone, String instance, boolean autoDelete, String deviceName)

public final OperationFuture<Operation,Operation> setDiskAutoDeleteAsync(String project, String zone, String instance, boolean autoDelete, String deviceName)

Sets the auto-delete flag for a disk attached to an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   boolean autoDelete = true;
   String deviceName = "deviceName780988929";
   Operation response =
       instancesClient
           .setDiskAutoDeleteAsync(project, zone, instance, autoDelete, deviceName)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

autoDeleteboolean

Whether to auto-delete the disk when the instance is deleted.

deviceNameString

The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setDiskAutoDeleteCallable()

public final UnaryCallable<SetDiskAutoDeleteInstanceRequest,Operation> setDiskAutoDeleteCallable()

Sets the auto-delete flag for a disk attached to an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDiskAutoDeleteInstanceRequest request =
       SetDiskAutoDeleteInstanceRequest.newBuilder()
           .setAutoDelete(true)
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setDiskAutoDeleteCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetDiskAutoDeleteInstanceRequest,Operation>

setDiskAutoDeleteOperationCallable()

public final OperationCallable<SetDiskAutoDeleteInstanceRequest,Operation,Operation> setDiskAutoDeleteOperationCallable()

Sets the auto-delete flag for a disk attached to an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetDiskAutoDeleteInstanceRequest request =
       SetDiskAutoDeleteInstanceRequest.newBuilder()
           .setAutoDelete(true)
           .setDeviceName("deviceName780988929")
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setDiskAutoDeleteOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetDiskAutoDeleteInstanceRequest,Operation,Operation>

setIamPolicy(SetIamPolicyInstanceRequest request)

public final Policy setIamPolicy(SetIamPolicyInstanceRequest request)

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetIamPolicyInstanceRequest request =
       SetIamPolicyInstanceRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
           .build();
   Policy response = instancesClient.setIamPolicy(request);
 }
 
Parameter
NameDescription
requestSetIamPolicyInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
Policy

setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)

public final Policy setIamPolicy(String project, String zone, String resource, ZoneSetPolicyRequest zoneSetPolicyRequestResource)

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   ZoneSetPolicyRequest zoneSetPolicyRequestResource = ZoneSetPolicyRequest.newBuilder().build();
   Policy response =
       instancesClient.setIamPolicy(project, zone, resource, zoneSetPolicyRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

zoneSetPolicyRequestResourceZoneSetPolicyRequest

The body resource for this request

Returns
TypeDescription
Policy

setIamPolicyCallable()

public final UnaryCallable<SetIamPolicyInstanceRequest,Policy> setIamPolicyCallable()

Sets the access control policy on the specified resource. Replaces any existing policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetIamPolicyInstanceRequest request =
       SetIamPolicyInstanceRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setZone("zone3744684")
           .setZoneSetPolicyRequestResource(ZoneSetPolicyRequest.newBuilder().build())
           .build();
   ApiFuture<Policy> future = instancesClient.setIamPolicyCallable().futureCall(request);
   // Do something.
   Policy response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetIamPolicyInstanceRequest,Policy>

setLabelsAsync(SetLabelsInstanceRequest request)

public final OperationFuture<Operation,Operation> setLabelsAsync(SetLabelsInstanceRequest request)

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetLabelsInstanceRequest request =
       SetLabelsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setLabelsAsync(request).get();
 }
 
Parameter
NameDescription
requestSetLabelsInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsAsync(String project, String zone, String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)

public final OperationFuture<Operation,Operation> setLabelsAsync(String project, String zone, String instance, InstancesSetLabelsRequest instancesSetLabelsRequestResource)

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetLabelsRequest instancesSetLabelsRequestResource =
       InstancesSetLabelsRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setLabelsAsync(project, zone, instance, instancesSetLabelsRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

instancesSetLabelsRequestResourceInstancesSetLabelsRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setLabelsCallable()

public final UnaryCallable<SetLabelsInstanceRequest,Operation> setLabelsCallable()

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetLabelsInstanceRequest request =
       SetLabelsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setLabelsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetLabelsInstanceRequest,Operation>

setLabelsOperationCallable()

public final OperationCallable<SetLabelsInstanceRequest,Operation,Operation> setLabelsOperationCallable()

Sets labels on an instance. To learn more about labels, read the Labeling Resources documentation.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetLabelsInstanceRequest request =
       SetLabelsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetLabelsRequestResource(InstancesSetLabelsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setLabelsOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetLabelsInstanceRequest,Operation,Operation>

setMachineResourcesAsync(SetMachineResourcesInstanceRequest request)

public final OperationFuture<Operation,Operation> setMachineResourcesAsync(SetMachineResourcesInstanceRequest request)

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineResourcesInstanceRequest request =
       SetMachineResourcesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineResourcesRequestResource(
               InstancesSetMachineResourcesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setMachineResourcesAsync(request).get();
 }
 
Parameter
NameDescription
requestSetMachineResourcesInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMachineResourcesAsync(String project, String zone, String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)

public final OperationFuture<Operation,Operation> setMachineResourcesAsync(String project, String zone, String instance, InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource)

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetMachineResourcesRequest instancesSetMachineResourcesRequestResource =
       InstancesSetMachineResourcesRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setMachineResourcesAsync(
               project, zone, instance, instancesSetMachineResourcesRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

instancesSetMachineResourcesRequestResourceInstancesSetMachineResourcesRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMachineResourcesCallable()

public final UnaryCallable<SetMachineResourcesInstanceRequest,Operation> setMachineResourcesCallable()

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineResourcesInstanceRequest request =
       SetMachineResourcesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineResourcesRequestResource(
               InstancesSetMachineResourcesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.setMachineResourcesCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetMachineResourcesInstanceRequest,Operation>

setMachineResourcesOperationCallable()

public final OperationCallable<SetMachineResourcesInstanceRequest,Operation,Operation> setMachineResourcesOperationCallable()

Changes the number and/or type of accelerator for a stopped instance to the values specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineResourcesInstanceRequest request =
       SetMachineResourcesInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineResourcesRequestResource(
               InstancesSetMachineResourcesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setMachineResourcesOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetMachineResourcesInstanceRequest,Operation,Operation>

setMachineTypeAsync(SetMachineTypeInstanceRequest request)

public final OperationFuture<Operation,Operation> setMachineTypeAsync(SetMachineTypeInstanceRequest request)

Changes the machine type for a stopped instance to the machine type specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineTypeInstanceRequest request =
       SetMachineTypeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineTypeRequestResource(
               InstancesSetMachineTypeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setMachineTypeAsync(request).get();
 }
 
Parameter
NameDescription
requestSetMachineTypeInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMachineTypeAsync(String project, String zone, String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)

public final OperationFuture<Operation,Operation> setMachineTypeAsync(String project, String zone, String instance, InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource)

Changes the machine type for a stopped instance to the machine type specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetMachineTypeRequest instancesSetMachineTypeRequestResource =
       InstancesSetMachineTypeRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setMachineTypeAsync(project, zone, instance, instancesSetMachineTypeRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

instancesSetMachineTypeRequestResourceInstancesSetMachineTypeRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMachineTypeCallable()

public final UnaryCallable<SetMachineTypeInstanceRequest,Operation> setMachineTypeCallable()

Changes the machine type for a stopped instance to the machine type specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineTypeInstanceRequest request =
       SetMachineTypeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineTypeRequestResource(
               InstancesSetMachineTypeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setMachineTypeCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetMachineTypeInstanceRequest,Operation>

setMachineTypeOperationCallable()

public final OperationCallable<SetMachineTypeInstanceRequest,Operation,Operation> setMachineTypeOperationCallable()

Changes the machine type for a stopped instance to the machine type specified in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMachineTypeInstanceRequest request =
       SetMachineTypeInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMachineTypeRequestResource(
               InstancesSetMachineTypeRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setMachineTypeOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetMachineTypeInstanceRequest,Operation,Operation>

setMetadataAsync(SetMetadataInstanceRequest request)

public final OperationFuture<Operation,Operation> setMetadataAsync(SetMetadataInstanceRequest request)

Sets metadata for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMetadataInstanceRequest request =
       SetMetadataInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setMetadataAsync(request).get();
 }
 
Parameter
NameDescription
requestSetMetadataInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMetadataAsync(String project, String zone, String instance, Metadata metadataResource)

public final OperationFuture<Operation,Operation> setMetadataAsync(String project, String zone, String instance, Metadata metadataResource)

Sets metadata for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Metadata metadataResource = Metadata.newBuilder().build();
   Operation response =
       instancesClient.setMetadataAsync(project, zone, instance, metadataResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

metadataResourceMetadata

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMetadataCallable()

public final UnaryCallable<SetMetadataInstanceRequest,Operation> setMetadataCallable()

Sets metadata for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMetadataInstanceRequest request =
       SetMetadataInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setMetadataCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetMetadataInstanceRequest,Operation>

setMetadataOperationCallable()

public final OperationCallable<SetMetadataInstanceRequest,Operation,Operation> setMetadataOperationCallable()

Sets metadata for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMetadataInstanceRequest request =
       SetMetadataInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setMetadataResource(Metadata.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setMetadataOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetMetadataInstanceRequest,Operation,Operation>

setMinCpuPlatformAsync(SetMinCpuPlatformInstanceRequest request)

public final OperationFuture<Operation,Operation> setMinCpuPlatformAsync(SetMinCpuPlatformInstanceRequest request)

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMinCpuPlatformInstanceRequest request =
       SetMinCpuPlatformInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMinCpuPlatformRequestResource(
               InstancesSetMinCpuPlatformRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setMinCpuPlatformAsync(request).get();
 }
 
Parameter
NameDescription
requestSetMinCpuPlatformInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMinCpuPlatformAsync(String project, String zone, String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)

public final OperationFuture<Operation,Operation> setMinCpuPlatformAsync(String project, String zone, String instance, InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource)

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetMinCpuPlatformRequest instancesSetMinCpuPlatformRequestResource =
       InstancesSetMinCpuPlatformRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setMinCpuPlatformAsync(
               project, zone, instance, instancesSetMinCpuPlatformRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

instancesSetMinCpuPlatformRequestResourceInstancesSetMinCpuPlatformRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setMinCpuPlatformCallable()

public final UnaryCallable<SetMinCpuPlatformInstanceRequest,Operation> setMinCpuPlatformCallable()

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMinCpuPlatformInstanceRequest request =
       SetMinCpuPlatformInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMinCpuPlatformRequestResource(
               InstancesSetMinCpuPlatformRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setMinCpuPlatformCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetMinCpuPlatformInstanceRequest,Operation>

setMinCpuPlatformOperationCallable()

public final OperationCallable<SetMinCpuPlatformInstanceRequest,Operation,Operation> setMinCpuPlatformOperationCallable()

Changes the minimum CPU platform that this instance should use. This method can only be called on a stopped instance. For more information, read Specifying a Minimum CPU Platform.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetMinCpuPlatformInstanceRequest request =
       SetMinCpuPlatformInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetMinCpuPlatformRequestResource(
               InstancesSetMinCpuPlatformRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setMinCpuPlatformOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetMinCpuPlatformInstanceRequest,Operation,Operation>

setNameAsync(SetNameInstanceRequest request)

public final OperationFuture<Operation,Operation> setNameAsync(SetNameInstanceRequest request)

Sets name of an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetNameInstanceRequest request =
       SetNameInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setNameAsync(request).get();
 }
 
Parameter
NameDescription
requestSetNameInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setNameAsync(String project, String zone, String instance, InstancesSetNameRequest instancesSetNameRequestResource)

public final OperationFuture<Operation,Operation> setNameAsync(String project, String zone, String instance, InstancesSetNameRequest instancesSetNameRequestResource)

Sets name of an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetNameRequest instancesSetNameRequestResource =
       InstancesSetNameRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setNameAsync(project, zone, instance, instancesSetNameRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

instancesSetNameRequestResourceInstancesSetNameRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setNameCallable()

public final UnaryCallable<SetNameInstanceRequest,Operation> setNameCallable()

Sets name of an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetNameInstanceRequest request =
       SetNameInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setNameCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetNameInstanceRequest,Operation>

setNameOperationCallable()

public final OperationCallable<SetNameInstanceRequest,Operation,Operation> setNameOperationCallable()

Sets name of an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetNameInstanceRequest request =
       SetNameInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetNameRequestResource(InstancesSetNameRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setNameOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetNameInstanceRequest,Operation,Operation>

setSchedulingAsync(SetSchedulingInstanceRequest request)

public final OperationFuture<Operation,Operation> setSchedulingAsync(SetSchedulingInstanceRequest request)

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetSchedulingInstanceRequest request =
       SetSchedulingInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSchedulingResource(Scheduling.newBuilder().build())
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setSchedulingAsync(request).get();
 }
 
Parameter
NameDescription
requestSetSchedulingInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setSchedulingAsync(String project, String zone, String instance, Scheduling schedulingResource)

public final OperationFuture<Operation,Operation> setSchedulingAsync(String project, String zone, String instance, Scheduling schedulingResource)

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Scheduling schedulingResource = Scheduling.newBuilder().build();
   Operation response =
       instancesClient.setSchedulingAsync(project, zone, instance, schedulingResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Instance name for this request.

schedulingResourceScheduling

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setSchedulingCallable()

public final UnaryCallable<SetSchedulingInstanceRequest,Operation> setSchedulingCallable()

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetSchedulingInstanceRequest request =
       SetSchedulingInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSchedulingResource(Scheduling.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setSchedulingCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetSchedulingInstanceRequest,Operation>

setSchedulingOperationCallable()

public final OperationCallable<SetSchedulingInstanceRequest,Operation,Operation> setSchedulingOperationCallable()

Sets an instance's scheduling options. You can only call this method on a stopped instance, that is, a VM instance that is in a TERMINATED state. See Instance Life Cycle for more information on the possible instance states. For more information about setting scheduling options for a VM, see Set VM host maintenance policy.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetSchedulingInstanceRequest request =
       SetSchedulingInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setSchedulingResource(Scheduling.newBuilder().build())
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setSchedulingOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetSchedulingInstanceRequest,Operation,Operation>

setServiceAccountAsync(SetServiceAccountInstanceRequest request)

public final OperationFuture<Operation,Operation> setServiceAccountAsync(SetServiceAccountInstanceRequest request)

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetServiceAccountInstanceRequest request =
       SetServiceAccountInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetServiceAccountRequestResource(
               InstancesSetServiceAccountRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setServiceAccountAsync(request).get();
 }
 
Parameter
NameDescription
requestSetServiceAccountInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setServiceAccountAsync(String project, String zone, String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)

public final OperationFuture<Operation,Operation> setServiceAccountAsync(String project, String zone, String instance, InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource)

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesSetServiceAccountRequest instancesSetServiceAccountRequestResource =
       InstancesSetServiceAccountRequest.newBuilder().build();
   Operation response =
       instancesClient
           .setServiceAccountAsync(
               project, zone, instance, instancesSetServiceAccountRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to start.

instancesSetServiceAccountRequestResourceInstancesSetServiceAccountRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setServiceAccountCallable()

public final UnaryCallable<SetServiceAccountInstanceRequest,Operation> setServiceAccountCallable()

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetServiceAccountInstanceRequest request =
       SetServiceAccountInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetServiceAccountRequestResource(
               InstancesSetServiceAccountRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setServiceAccountCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetServiceAccountInstanceRequest,Operation>

setServiceAccountOperationCallable()

public final OperationCallable<SetServiceAccountInstanceRequest,Operation,Operation> setServiceAccountOperationCallable()

Sets the service account on the instance. For more information, read Changing the service account and access scopes for an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetServiceAccountInstanceRequest request =
       SetServiceAccountInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesSetServiceAccountRequestResource(
               InstancesSetServiceAccountRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setServiceAccountOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetServiceAccountInstanceRequest,Operation,Operation>

setShieldedInstanceIntegrityPolicyAsync(SetShieldedInstanceIntegrityPolicyInstanceRequest request)

public final OperationFuture<Operation,Operation> setShieldedInstanceIntegrityPolicyAsync(SetShieldedInstanceIntegrityPolicyInstanceRequest request)

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetShieldedInstanceIntegrityPolicyInstanceRequest request =
       SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceIntegrityPolicyResource(
               ShieldedInstanceIntegrityPolicy.newBuilder().build())
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setShieldedInstanceIntegrityPolicyAsync(request).get();
 }
 
Parameter
NameDescription
requestSetShieldedInstanceIntegrityPolicyInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setShieldedInstanceIntegrityPolicyAsync(String project, String zone, String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource)

public final OperationFuture<Operation,Operation> setShieldedInstanceIntegrityPolicyAsync(String project, String zone, String instance, ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource)

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   ShieldedInstanceIntegrityPolicy shieldedInstanceIntegrityPolicyResource =
       ShieldedInstanceIntegrityPolicy.newBuilder().build();
   Operation response =
       instancesClient
           .setShieldedInstanceIntegrityPolicyAsync(
               project, zone, instance, shieldedInstanceIntegrityPolicyResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name or id of the instance scoping this request.

shieldedInstanceIntegrityPolicyResourceShieldedInstanceIntegrityPolicy

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setShieldedInstanceIntegrityPolicyCallable()

public final UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation> setShieldedInstanceIntegrityPolicyCallable()

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetShieldedInstanceIntegrityPolicyInstanceRequest request =
       SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceIntegrityPolicyResource(
               ShieldedInstanceIntegrityPolicy.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.setShieldedInstanceIntegrityPolicyCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation>

setShieldedInstanceIntegrityPolicyOperationCallable()

public final OperationCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation,Operation> setShieldedInstanceIntegrityPolicyOperationCallable()

Sets the Shielded Instance integrity policy for an instance. You can only use this method on a running instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetShieldedInstanceIntegrityPolicyInstanceRequest request =
       SetShieldedInstanceIntegrityPolicyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceIntegrityPolicyResource(
               ShieldedInstanceIntegrityPolicy.newBuilder().build())
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setShieldedInstanceIntegrityPolicyOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetShieldedInstanceIntegrityPolicyInstanceRequest,Operation,Operation>

setTagsAsync(SetTagsInstanceRequest request)

public final OperationFuture<Operation,Operation> setTagsAsync(SetTagsInstanceRequest request)

Sets network tags for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetTagsInstanceRequest request =
       SetTagsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setTagsResource(Tags.newBuilder().build())
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.setTagsAsync(request).get();
 }
 
Parameter
NameDescription
requestSetTagsInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

setTagsAsync(String project, String zone, String instance, Tags tagsResource)

public final OperationFuture<Operation,Operation> setTagsAsync(String project, String zone, String instance, Tags tagsResource)

Sets network tags for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Tags tagsResource = Tags.newBuilder().build();
   Operation response =
       instancesClient.setTagsAsync(project, zone, instance, tagsResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

tagsResourceTags

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

setTagsCallable()

public final UnaryCallable<SetTagsInstanceRequest,Operation> setTagsCallable()

Sets network tags for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetTagsInstanceRequest request =
       SetTagsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setTagsResource(Tags.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.setTagsCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SetTagsInstanceRequest,Operation>

setTagsOperationCallable()

public final OperationCallable<SetTagsInstanceRequest,Operation,Operation> setTagsOperationCallable()

Sets network tags for the specified instance to the data included in the request.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SetTagsInstanceRequest request =
       SetTagsInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setTagsResource(Tags.newBuilder().build())
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.setTagsOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SetTagsInstanceRequest,Operation,Operation>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

simulateMaintenanceEventAsync(SimulateMaintenanceEventInstanceRequest request)

public final OperationFuture<Operation,Operation> simulateMaintenanceEventAsync(SimulateMaintenanceEventInstanceRequest request)

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SimulateMaintenanceEventInstanceRequest request =
       SimulateMaintenanceEventInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.simulateMaintenanceEventAsync(request).get();
 }
 
Parameter
NameDescription
requestSimulateMaintenanceEventInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

simulateMaintenanceEventAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> simulateMaintenanceEventAsync(String project, String zone, String instance)

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response =
       instancesClient.simulateMaintenanceEventAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

Returns
TypeDescription
OperationFuture<Operation,Operation>

simulateMaintenanceEventCallable()

public final UnaryCallable<SimulateMaintenanceEventInstanceRequest,Operation> simulateMaintenanceEventCallable()

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SimulateMaintenanceEventInstanceRequest request =
       SimulateMaintenanceEventInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.simulateMaintenanceEventCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SimulateMaintenanceEventInstanceRequest,Operation>

simulateMaintenanceEventOperationCallable()

public final OperationCallable<SimulateMaintenanceEventInstanceRequest,Operation,Operation> simulateMaintenanceEventOperationCallable()

Simulates a host maintenance event on a VM. For more information, see Simulate a host maintenance event.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SimulateMaintenanceEventInstanceRequest request =
       SimulateMaintenanceEventInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.simulateMaintenanceEventOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SimulateMaintenanceEventInstanceRequest,Operation,Operation>

startAsync(StartInstanceRequest request)

public final OperationFuture<Operation,Operation> startAsync(StartInstanceRequest request)

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.startAsync(request).get();
 }
 
Parameter
NameDescription
requestStartInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

startAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> startAsync(String project, String zone, String instance)

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.startAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to start.

Returns
TypeDescription
OperationFuture<Operation,Operation>

startCallable()

public final UnaryCallable<StartInstanceRequest,Operation> startCallable()

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.startCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StartInstanceRequest,Operation>

startOperationCallable()

public final OperationCallable<StartInstanceRequest,Operation,Operation> startOperationCallable()

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartInstanceRequest request =
       StartInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.startOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StartInstanceRequest,Operation,Operation>

startWithEncryptionKeyAsync(StartWithEncryptionKeyInstanceRequest request)

public final OperationFuture<Operation,Operation> startWithEncryptionKeyAsync(StartWithEncryptionKeyInstanceRequest request)

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartWithEncryptionKeyInstanceRequest request =
       StartWithEncryptionKeyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesStartWithEncryptionKeyRequestResource(
               InstancesStartWithEncryptionKeyRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.startWithEncryptionKeyAsync(request).get();
 }
 
Parameter
NameDescription
requestStartWithEncryptionKeyInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

startWithEncryptionKeyAsync(String project, String zone, String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)

public final OperationFuture<Operation,Operation> startWithEncryptionKeyAsync(String project, String zone, String instance, InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource)

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   InstancesStartWithEncryptionKeyRequest instancesStartWithEncryptionKeyRequestResource =
       InstancesStartWithEncryptionKeyRequest.newBuilder().build();
   Operation response =
       instancesClient
           .startWithEncryptionKeyAsync(
               project, zone, instance, instancesStartWithEncryptionKeyRequestResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to start.

instancesStartWithEncryptionKeyRequestResourceInstancesStartWithEncryptionKeyRequest

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

startWithEncryptionKeyCallable()

public final UnaryCallable<StartWithEncryptionKeyInstanceRequest,Operation> startWithEncryptionKeyCallable()

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartWithEncryptionKeyInstanceRequest request =
       StartWithEncryptionKeyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesStartWithEncryptionKeyRequestResource(
               InstancesStartWithEncryptionKeyRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.startWithEncryptionKeyCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StartWithEncryptionKeyInstanceRequest,Operation>

startWithEncryptionKeyOperationCallable()

public final OperationCallable<StartWithEncryptionKeyInstanceRequest,Operation,Operation> startWithEncryptionKeyOperationCallable()

Starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StartWithEncryptionKeyInstanceRequest request =
       StartWithEncryptionKeyInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstancesStartWithEncryptionKeyRequestResource(
               InstancesStartWithEncryptionKeyRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.startWithEncryptionKeyOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StartWithEncryptionKeyInstanceRequest,Operation,Operation>

stopAsync(StopInstanceRequest request)

public final OperationFuture<Operation,Operation> stopAsync(StopInstanceRequest request)

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StopInstanceRequest request =
       StopInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.stopAsync(request).get();
 }
 
Parameter
NameDescription
requestStopInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> stopAsync(String project, String zone, String instance)

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.stopAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to stop.

Returns
TypeDescription
OperationFuture<Operation,Operation>

stopCallable()

public final UnaryCallable<StopInstanceRequest,Operation> stopCallable()

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StopInstanceRequest request =
       StopInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.stopCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<StopInstanceRequest,Operation>

stopOperationCallable()

public final OperationCallable<StopInstanceRequest,Operation,Operation> stopOperationCallable()

Stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   StopInstanceRequest request =
       StopInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.stopOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<StopInstanceRequest,Operation,Operation>

suspendAsync(SuspendInstanceRequest request)

public final OperationFuture<Operation,Operation> suspendAsync(SuspendInstanceRequest request)

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SuspendInstanceRequest request =
       SuspendInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.suspendAsync(request).get();
 }
 
Parameter
NameDescription
requestSuspendInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

suspendAsync(String project, String zone, String instance)

public final OperationFuture<Operation,Operation> suspendAsync(String project, String zone, String instance)

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Operation response = instancesClient.suspendAsync(project, zone, instance).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to suspend.

Returns
TypeDescription
OperationFuture<Operation,Operation>

suspendCallable()

public final UnaryCallable<SuspendInstanceRequest,Operation> suspendCallable()

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SuspendInstanceRequest request =
       SuspendInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.suspendCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<SuspendInstanceRequest,Operation>

suspendOperationCallable()

public final OperationCallable<SuspendInstanceRequest,Operation,Operation> suspendOperationCallable()

This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   SuspendInstanceRequest request =
       SuspendInstanceRequest.newBuilder()
           .setDiscardLocalSsd(true)
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.suspendOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<SuspendInstanceRequest,Operation,Operation>

testIamPermissions(TestIamPermissionsInstanceRequest request)

public final TestPermissionsResponse testIamPermissions(TestIamPermissionsInstanceRequest request)

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   TestIamPermissionsInstanceRequest request =
       TestIamPermissionsInstanceRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .setZone("zone3744684")
           .build();
   TestPermissionsResponse response = instancesClient.testIamPermissions(request);
 }
 
Parameter
NameDescription
requestTestIamPermissionsInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
TestPermissionsResponse

testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)

public final TestPermissionsResponse testIamPermissions(String project, String zone, String resource, TestPermissionsRequest testPermissionsRequestResource)

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String resource = "resource-341064690";
   TestPermissionsRequest testPermissionsRequestResource =
       TestPermissionsRequest.newBuilder().build();
   TestPermissionsResponse response =
       instancesClient.testIamPermissions(
           project, zone, resource, testPermissionsRequestResource);
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

resourceString

Name or id of the resource for this request.

testPermissionsRequestResourceTestPermissionsRequest

The body resource for this request

Returns
TypeDescription
TestPermissionsResponse

testIamPermissionsCallable()

public final UnaryCallable<TestIamPermissionsInstanceRequest,TestPermissionsResponse> testIamPermissionsCallable()

Returns permissions that a caller has on the specified resource.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   TestIamPermissionsInstanceRequest request =
       TestIamPermissionsInstanceRequest.newBuilder()
           .setProject("project-309310695")
           .setResource("resource-341064690")
           .setTestPermissionsRequestResource(TestPermissionsRequest.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<TestPermissionsResponse> future =
       instancesClient.testIamPermissionsCallable().futureCall(request);
   // Do something.
   TestPermissionsResponse response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<TestIamPermissionsInstanceRequest,TestPermissionsResponse>

updateAccessConfigAsync(UpdateAccessConfigInstanceRequest request)

public final OperationFuture<Operation,Operation> updateAccessConfigAsync(UpdateAccessConfigInstanceRequest request)

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateAccessConfigInstanceRequest request =
       UpdateAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.updateAccessConfigAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateAccessConfigInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)

public final OperationFuture<Operation,Operation> updateAccessConfigAsync(String project, String zone, String instance, String networkInterface, AccessConfig accessConfigResource)

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String networkInterface = "networkInterface-341981525";
   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
   Operation response =
       instancesClient
           .updateAccessConfigAsync(
               project, zone, instance, networkInterface, accessConfigResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

networkInterfaceString

The name of the network interface where the access config is attached.

accessConfigResourceAccessConfig

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateAccessConfigCallable()

public final UnaryCallable<UpdateAccessConfigInstanceRequest,Operation> updateAccessConfigCallable()

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateAccessConfigInstanceRequest request =
       UpdateAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.updateAccessConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateAccessConfigInstanceRequest,Operation>

updateAccessConfigOperationCallable()

public final OperationCallable<UpdateAccessConfigInstanceRequest,Operation,Operation> updateAccessConfigOperationCallable()

Updates the specified access config from an instance's network interface with the data included in the request. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateAccessConfigInstanceRequest request =
       UpdateAccessConfigInstanceRequest.newBuilder()
           .setAccessConfigResource(AccessConfig.newBuilder().build())
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.updateAccessConfigOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateAccessConfigInstanceRequest,Operation,Operation>

updateAsync(UpdateInstanceRequest request)

public final OperationFuture<Operation,Operation> updateAsync(UpdateInstanceRequest request)

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstanceResource(Instance.newBuilder().build())
           .setMinimalAction("minimalAction624261943")
           .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.updateAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateAsync(String project, String zone, String instance, Instance instanceResource)

public final OperationFuture<Operation,Operation> updateAsync(String project, String zone, String instance, Instance instanceResource)

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   Instance instanceResource = Instance.newBuilder().build();
   Operation response =
       instancesClient.updateAsync(project, zone, instance, instanceResource).get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance resource to update.

instanceResourceInstance

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateCallable()

public final UnaryCallable<UpdateInstanceRequest,Operation> updateCallable()

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstanceResource(Instance.newBuilder().build())
           .setMinimalAction("minimalAction624261943")
           .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instancesClient.updateCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateInstanceRequest,Operation>

updateDisplayDeviceAsync(UpdateDisplayDeviceInstanceRequest request)

public final OperationFuture<Operation,Operation> updateDisplayDeviceAsync(UpdateDisplayDeviceInstanceRequest request)

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateDisplayDeviceInstanceRequest request =
       UpdateDisplayDeviceInstanceRequest.newBuilder()
           .setDisplayDeviceResource(DisplayDevice.newBuilder().build())
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.updateDisplayDeviceAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateDisplayDeviceInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateDisplayDeviceAsync(String project, String zone, String instance, DisplayDevice displayDeviceResource)

public final OperationFuture<Operation,Operation> updateDisplayDeviceAsync(String project, String zone, String instance, DisplayDevice displayDeviceResource)

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   DisplayDevice displayDeviceResource = DisplayDevice.newBuilder().build();
   Operation response =
       instancesClient
           .updateDisplayDeviceAsync(project, zone, instance, displayDeviceResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name of the instance scoping this request.

displayDeviceResourceDisplayDevice

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateDisplayDeviceCallable()

public final UnaryCallable<UpdateDisplayDeviceInstanceRequest,Operation> updateDisplayDeviceCallable()

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateDisplayDeviceInstanceRequest request =
       UpdateDisplayDeviceInstanceRequest.newBuilder()
           .setDisplayDeviceResource(DisplayDevice.newBuilder().build())
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.updateDisplayDeviceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateDisplayDeviceInstanceRequest,Operation>

updateDisplayDeviceOperationCallable()

public final OperationCallable<UpdateDisplayDeviceInstanceRequest,Operation,Operation> updateDisplayDeviceOperationCallable()

Updates the Display config for a VM instance. You can only use this method on a stopped VM instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateDisplayDeviceInstanceRequest request =
       UpdateDisplayDeviceInstanceRequest.newBuilder()
           .setDisplayDeviceResource(DisplayDevice.newBuilder().build())
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.updateDisplayDeviceOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateDisplayDeviceInstanceRequest,Operation,Operation>

updateNetworkInterfaceAsync(UpdateNetworkInterfaceInstanceRequest request)

public final OperationFuture<Operation,Operation> updateNetworkInterfaceAsync(UpdateNetworkInterfaceInstanceRequest request)

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateNetworkInterfaceInstanceRequest request =
       UpdateNetworkInterfaceInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.updateNetworkInterfaceAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateNetworkInterfaceInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateNetworkInterfaceAsync(String project, String zone, String instance, String networkInterface, NetworkInterface networkInterfaceResource)

public final OperationFuture<Operation,Operation> updateNetworkInterfaceAsync(String project, String zone, String instance, String networkInterface, NetworkInterface networkInterfaceResource)

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   String networkInterface = "networkInterface-341981525";
   NetworkInterface networkInterfaceResource = NetworkInterface.newBuilder().build();
   Operation response =
       instancesClient
           .updateNetworkInterfaceAsync(
               project, zone, instance, networkInterface, networkInterfaceResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

The instance name for this request.

networkInterfaceString

The name of the network interface to update.

networkInterfaceResourceNetworkInterface

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateNetworkInterfaceCallable()

public final UnaryCallable<UpdateNetworkInterfaceInstanceRequest,Operation> updateNetworkInterfaceCallable()

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateNetworkInterfaceInstanceRequest request =
       UpdateNetworkInterfaceInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.updateNetworkInterfaceCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateNetworkInterfaceInstanceRequest,Operation>

updateNetworkInterfaceOperationCallable()

public final OperationCallable<UpdateNetworkInterfaceInstanceRequest,Operation,Operation> updateNetworkInterfaceOperationCallable()

Updates an instance's network interface. This method can only update an interface's alias IP range and attached network. See Modifying alias IP ranges for an existing instance for instructions on changing alias IP ranges. See Migrating a VM between networks for instructions on migrating an interface. This method follows PATCH semantics.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateNetworkInterfaceInstanceRequest request =
       UpdateNetworkInterfaceInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setNetworkInterface("networkInterface-341981525")
           .setNetworkInterfaceResource(NetworkInterface.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.updateNetworkInterfaceOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateNetworkInterfaceInstanceRequest,Operation,Operation>

updateOperationCallable()

public final OperationCallable<UpdateInstanceRequest,Operation,Operation> updateOperationCallable()

Updates an instance only if the necessary resources are available. This method can update only a specific set of instance properties. See Updating a running instance for a list of updatable instance properties.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateInstanceRequest request =
       UpdateInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setInstanceResource(Instance.newBuilder().build())
           .setMinimalAction("minimalAction624261943")
           .setMostDisruptiveAllowedAction("mostDisruptiveAllowedAction-1597376488")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.updateOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateInstanceRequest,Operation,Operation>

updateShieldedInstanceConfigAsync(UpdateShieldedInstanceConfigInstanceRequest request)

public final OperationFuture<Operation,Operation> updateShieldedInstanceConfigAsync(UpdateShieldedInstanceConfigInstanceRequest request)

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateShieldedInstanceConfigInstanceRequest request =
       UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
           .setZone("zone3744684")
           .build();
   Operation response = instancesClient.updateShieldedInstanceConfigAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateShieldedInstanceConfigInstanceRequest

The request object containing all of the parameters for the API call.

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateShieldedInstanceConfigAsync(String project, String zone, String instance, ShieldedInstanceConfig shieldedInstanceConfigResource)

public final OperationFuture<Operation,Operation> updateShieldedInstanceConfigAsync(String project, String zone, String instance, ShieldedInstanceConfig shieldedInstanceConfigResource)

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instance = "instance555127957";
   ShieldedInstanceConfig shieldedInstanceConfigResource =
       ShieldedInstanceConfig.newBuilder().build();
   Operation response =
       instancesClient
           .updateShieldedInstanceConfigAsync(
               project, zone, instance, shieldedInstanceConfigResource)
           .get();
 }
 
Parameters
NameDescription
projectString

Project ID for this request.

zoneString

The name of the zone for this request.

instanceString

Name or id of the instance scoping this request.

shieldedInstanceConfigResourceShieldedInstanceConfig

The body resource for this request

Returns
TypeDescription
OperationFuture<Operation,Operation>

updateShieldedInstanceConfigCallable()

public final UnaryCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation> updateShieldedInstanceConfigCallable()

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateShieldedInstanceConfigInstanceRequest request =
       UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future =
       instancesClient.updateShieldedInstanceConfigCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation>

updateShieldedInstanceConfigOperationCallable()

public final OperationCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation,Operation> updateShieldedInstanceConfigOperationCallable()

Updates the Shielded Instance config for an instance. You can only use this method on a stopped instance. This method supports PATCH semantics and uses the JSON merge patch format and processing rules.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstancesClient instancesClient = InstancesClient.create()) {
   UpdateShieldedInstanceConfigInstanceRequest request =
       UpdateShieldedInstanceConfigInstanceRequest.newBuilder()
           .setInstance("instance555127957")
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setShieldedInstanceConfigResource(ShieldedInstanceConfig.newBuilder().build())
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instancesClient.updateShieldedInstanceConfigOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateShieldedInstanceConfigInstanceRequest,Operation,Operation>