Class InstancesClient

  • All Implemented Interfaces:
    com.google.api.gax.core.BackgroundResource, AutoCloseable

    @Generated("by gapic-generator-java")
    public class InstancesClient
    extends Object
    implements com.google.api.gax.core.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.

    • Constructor Detail

      • InstancesClient

        protected InstancesClient​(InstancesSettings settings)
                           throws IOException
        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.
        Throws:
        IOException
      • InstancesClient

        protected InstancesClient​(InstancesStub stub)
    • Method Detail

      • create

        public static final InstancesClient create​(InstancesSettings settings)
                                            throws IOException
        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.
        Throws:
        IOException
      • create

        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).
      • addAccessConfigAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        networkInterface - The name of the network interface to add to this instance.
        accessConfigResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addAccessConfigAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addAccessConfigOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • addAccessConfigCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • addResourcePoliciesAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        instancesAddResourcePoliciesRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addResourcePoliciesAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • addResourcePoliciesOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • addResourcePoliciesCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • aggregatedList

        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);
           }
         }
         
        Parameters:
        project - Project ID for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • aggregatedList

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • aggregatedListPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • aggregatedListCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • attachDiskAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        attachedDiskResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • attachDiskAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • attachDiskOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • attachDiskCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • bulkInsertAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        bulkInsertInstanceResourceResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • bulkInsertAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • bulkInsertOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • bulkInsertCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • deleteAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to delete.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • deleteCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • deleteAccessConfigAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        accessConfig - The name of the access config to delete.
        networkInterface - The name of the network interface.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAccessConfigAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • deleteAccessConfigOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • deleteAccessConfigCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • detachDiskAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Instance name for this request.
        deviceName - The device name of the disk to detach. Make a get() request on the instance to view currently attached disks and device names.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • detachDiskAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • detachDiskOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • detachDiskCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • get

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to return.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • get

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getEffectiveFirewalls

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        networkInterface - The name of the network interface to get the effective firewalls.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getEffectiveFirewalls

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getEffectiveFirewallsCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getGuestAttributes

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getGuestAttributes

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getGuestAttributesCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getIamPolicy

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        resource - Name or id of the resource for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicy

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getIamPolicyCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getScreenshot

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getScreenshot

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getScreenshotCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getSerialPortOutput

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getSerialPortOutput

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getSerialPortOutputCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • getShieldedInstanceIdentity

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name or id of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getShieldedInstanceIdentity

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • getShieldedInstanceIdentityCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • insertAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instanceResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • insertAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • insertOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • insertCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • list

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • list

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • listReferrers

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the target instance scoping this request, or '-' if the request should span over all instances in the container.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listReferrers

        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);
           }
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • listReferrersPagedCallable

        public final com.google.api.gax.rpc.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);
           }
         }
         
      • listReferrersCallable

        public final com.google.api.gax.rpc.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;
             }
           }
         }
         
      • removeResourcePoliciesAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        instancesRemoveResourcePoliciesRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeResourcePoliciesAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • removeResourcePoliciesOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • removeResourcePoliciesCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • resetAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • resetAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • resetOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • resetCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • resumeAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to resume.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • resumeAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • resumeOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • resumeCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • sendDiagnosticInterrupt

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • sendDiagnosticInterrupt

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • sendDiagnosticInterruptCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDeletionProtectionAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        resource - Name or id of the resource for this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDeletionProtectionAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDeletionProtectionOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDeletionProtectionCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDiskAutoDeleteAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        autoDelete - Whether to auto-delete the disk when the instance is deleted.
        deviceName - The device name of the disk to modify. Make a get() request on the instance to view currently attached disks and device names.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDiskAutoDeleteAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setDiskAutoDeleteOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setDiskAutoDeleteCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setIamPolicy

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        resource - Name or id of the resource for this request.
        zoneSetPolicyRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicy

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setIamPolicyCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setLabelsAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        instancesSetLabelsRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setLabelsAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setLabelsOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setLabelsCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMachineResourcesAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        instancesSetMachineResourcesRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMachineResourcesAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMachineResourcesOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMachineResourcesCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMachineTypeAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        instancesSetMachineTypeRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMachineTypeAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMachineTypeOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMachineTypeCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMetadataAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        metadataResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMetadataAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMetadataOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMetadataCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMinCpuPlatformAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        instancesSetMinCpuPlatformRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMinCpuPlatformAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setMinCpuPlatformOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setMinCpuPlatformCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setNameAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        instancesSetNameRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setNameAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setNameOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setNameCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setSchedulingAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Instance name for this request.
        schedulingResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setSchedulingAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setSchedulingOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setSchedulingCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setServiceAccountAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to start.
        instancesSetServiceAccountRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setServiceAccountAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setServiceAccountOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setServiceAccountCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setShieldedInstanceIntegrityPolicyAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name or id of the instance scoping this request.
        shieldedInstanceIntegrityPolicyResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setShieldedInstanceIntegrityPolicyAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setShieldedInstanceIntegrityPolicyOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setShieldedInstanceIntegrityPolicyCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setTagsAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        tagsResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setTagsAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • setTagsOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • setTagsCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • simulateMaintenanceEventAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • simulateMaintenanceEventAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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")
                   .setRequestId("requestId693933066")
                   .setZone("zone3744684")
                   .build();
           Operation response = instancesClient.simulateMaintenanceEventAsync(request).get();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • simulateMaintenanceEventOperationCallable

        public final com.google.api.gax.rpc.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")
                   .setRequestId("requestId693933066")
                   .setZone("zone3744684")
                   .build();
           OperationFuture<Operation, Operation> future =
               instancesClient.simulateMaintenanceEventOperationCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • simulateMaintenanceEventCallable

        public final com.google.api.gax.rpc.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")
                   .setRequestId("requestId693933066")
                   .setZone("zone3744684")
                   .build();
           ApiFuture<Operation> future =
               instancesClient.simulateMaintenanceEventCallable().futureCall(request);
           // Do something.
           Operation response = future.get();
         }
         
      • startAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to start.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • startAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • startOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • startCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • startWithEncryptionKeyAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to start.
        instancesStartWithEncryptionKeyRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • startWithEncryptionKeyAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • startWithEncryptionKeyOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • startWithEncryptionKeyCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • stopAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to stop.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • stopAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • stopOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • stopCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • suspendAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to suspend.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • suspendAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • suspendOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • suspendCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • testIamPermissions

        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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        resource - Name or id of the resource for this request.
        testPermissionsRequestResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissions

        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);
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • testIamPermissionsCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance resource to update.
        instanceResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateAccessConfigAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        networkInterface - The name of the network interface where the access config is attached.
        accessConfigResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAccessConfigAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateAccessConfigOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateAccessConfigCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateDisplayDeviceAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name of the instance scoping this request.
        displayDeviceResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateDisplayDeviceAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateDisplayDeviceOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateDisplayDeviceCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateNetworkInterfaceAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - The instance name for this request.
        networkInterface - The name of the network interface to update.
        networkInterfaceResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateNetworkInterfaceAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateNetworkInterfaceOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateNetworkInterfaceCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateShieldedInstanceConfigAsync

        public final com.google.api.gax.longrunning.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:
        project - Project ID for this request.
        zone - The name of the zone for this request.
        instance - Name or id of the instance scoping this request.
        shieldedInstanceConfigResource - The body resource for this request
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateShieldedInstanceConfigAsync

        @BetaApi("The surface for long-running operations is not stable yet and may change in the future.")
        public final com.google.api.gax.longrunning.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();
         }
         
        Parameters:
        request - The request object containing all of the parameters for the API call.
        Throws:
        com.google.api.gax.rpc.ApiException - if the remote call fails
      • updateShieldedInstanceConfigOperationCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • updateShieldedInstanceConfigCallable

        public final com.google.api.gax.rpc.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();
         }
         
      • shutdown

        public void shutdown()
        Specified by:
        shutdown in interface com.google.api.gax.core.BackgroundResource
      • isShutdown

        public boolean isShutdown()
        Specified by:
        isShutdown in interface com.google.api.gax.core.BackgroundResource
      • isTerminated

        public boolean isTerminated()
        Specified by:
        isTerminated in interface com.google.api.gax.core.BackgroundResource
      • shutdownNow

        public void shutdownNow()
        Specified by:
        shutdownNow in interface com.google.api.gax.core.BackgroundResource