Class InstanceGroupsClient (1.63.0)

GitHub RepositoryProduct Reference

Service Description: The InstanceGroups 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instanceGroup = "instanceGroup-1404696854";
   InstanceGroup response = instanceGroupsClient.get(project, zone, instanceGroup);
 }
 

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

Methods
Method Description Method Variants

AddInstances

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • addInstancesAsync(AddInstancesInstanceGroupRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • addInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • addInstancesOperationCallable()

  • addInstancesCallable()

AggregatedList

Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • aggregatedList(AggregatedListInstanceGroupsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • aggregatedList(String project)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • aggregatedListPagedCallable()

  • aggregatedListCallable()

Delete

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • deleteAsync(DeleteInstanceGroupRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • deleteAsync(String project, String zone, String instanceGroup)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • deleteOperationCallable()

  • deleteCallable()

Get

Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • get(GetInstanceGroupRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • get(String project, String zone, String instanceGroup)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • getCallable()

Insert

Creates an instance group in the specified project using the parameters that are included in the request.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • insertAsync(InsertInstanceGroupRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • insertAsync(String project, String zone, InstanceGroup instanceGroupResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • insertOperationCallable()

  • insertCallable()

List

Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • list(ListInstanceGroupsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • list(String project, String zone)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listPagedCallable()

  • listCallable()

ListInstances

Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • listInstances(ListInstancesInstanceGroupsRequest request)

"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.

  • listInstances(String project, String zone, String instanceGroup, InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • listInstancesPagedCallable()

  • listInstancesCallable()

RemoveInstances

Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • removeInstancesAsync(RemoveInstancesInstanceGroupRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • removeInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • removeInstancesOperationCallable()

  • removeInstancesCallable()

SetNamedPorts

Sets the named ports for the specified instance group.

Request object method variants only take one parameter, a request object, which must be constructed before the call.

  • setNamedPortsAsync(SetNamedPortsInstanceGroupRequest request)

Methods that return long-running operations have "Async" method variants that return OperationFuture, which is used to track polling of the service.

  • setNamedPortsAsync(String project, String zone, String instanceGroup, InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)

Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.

  • setNamedPortsOperationCallable()

  • setNamedPortsCallable()

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 InstanceGroupsSettings 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
 InstanceGroupsSettings instanceGroupsSettings =
     InstanceGroupsSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
 

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
 InstanceGroupsSettings instanceGroupsSettings =
     InstanceGroupsSettings.newBuilder().setEndpoint(myEndpoint).build();
 InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create(instanceGroupsSettings);
 

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

Inheritance

java.lang.Object > InstanceGroupsClient

Static Methods

create()

public static final InstanceGroupsClient create()

Constructs an instance of InstanceGroupsClient with default settings.

Returns
Type Description
InstanceGroupsClient
Exceptions
Type Description
IOException

create(InstanceGroupsSettings settings)

public static final InstanceGroupsClient create(InstanceGroupsSettings settings)

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

Parameter
Name Description
settings InstanceGroupsSettings
Returns
Type Description
InstanceGroupsClient
Exceptions
Type Description
IOException

create(InstanceGroupsStub stub)

public static final InstanceGroupsClient create(InstanceGroupsStub stub)

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

Parameter
Name Description
stub InstanceGroupsStub
Returns
Type Description
InstanceGroupsClient

Constructors

InstanceGroupsClient(InstanceGroupsSettings settings)

protected InstanceGroupsClient(InstanceGroupsSettings settings)

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

Parameter
Name Description
settings InstanceGroupsSettings

InstanceGroupsClient(InstanceGroupsStub stub)

protected InstanceGroupsClient(InstanceGroupsStub stub)
Parameter
Name Description
stub InstanceGroupsStub

Methods

addInstancesAsync(AddInstancesInstanceGroupRequest request)

public final OperationFuture<Operation,Operation> addInstancesAsync(AddInstancesInstanceGroupRequest request)

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   AddInstancesInstanceGroupRequest request =
       AddInstancesInstanceGroupRequest.newBuilder()
           .setInstanceGroup("instanceGroup-1404696854")
           .setInstanceGroupsAddInstancesRequestResource(
               InstanceGroupsAddInstancesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instanceGroupsClient.addInstancesAsync(request).get();
 }
 
Parameter
Name Description
request AddInstancesInstanceGroupRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

addInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)

public final OperationFuture<Operation,Operation> addInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource)

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group where you are adding instances.

instanceGroupsAddInstancesRequestResource InstanceGroupsAddInstancesRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

addInstancesCallable()

public final UnaryCallable<AddInstancesInstanceGroupRequest,Operation> addInstancesCallable()

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Sample code:


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

addInstancesOperationCallable()

public final OperationCallable<AddInstancesInstanceGroupRequest,Operation,Operation> addInstancesOperationCallable()

Adds a list of instances to the specified instance group. All of the instances in the instance group must be in the same network/subnetwork. Read Adding instances for more information.

Sample code:


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

aggregatedList(AggregatedListInstanceGroupsRequest request)

public final InstanceGroupsClient.AggregatedListPagedResponse aggregatedList(AggregatedListInstanceGroupsRequest request)

Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Sample code:


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

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

Returns
Type Description
InstanceGroupsClient.AggregatedListPagedResponse

aggregatedList(String project)

public final InstanceGroupsClient.AggregatedListPagedResponse aggregatedList(String project)

Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Sample code:


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

Project ID for this request.

Returns
Type Description
InstanceGroupsClient.AggregatedListPagedResponse

aggregatedListCallable()

public final UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupAggregatedList> aggregatedListCallable()

Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Sample code:


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

aggregatedListPagedCallable()

public final UnaryCallable<AggregatedListInstanceGroupsRequest,InstanceGroupsClient.AggregatedListPagedResponse> aggregatedListPagedCallable()

Retrieves the list of instance groups and sorts them by zone. To prevent failure, Google recommends that you set the returnPartialSuccess parameter to true.

Sample code:


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

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
Name Description
duration long
unit TimeUnit
Returns
Type Description
boolean
Exceptions
Type Description
InterruptedException

close()

public final void close()

deleteAsync(DeleteInstanceGroupRequest request)

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

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Sample code:


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

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

Returns
Type Description
OperationFuture<Operation,Operation>

deleteAsync(String project, String zone, String instanceGroup)

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

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group to delete.

Returns
Type Description
OperationFuture<Operation,Operation>

deleteCallable()

public final UnaryCallable<DeleteInstanceGroupRequest,Operation> deleteCallable()

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Sample code:


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

deleteOperationCallable()

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

Deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information.

Sample code:


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

get(GetInstanceGroupRequest request)

public final InstanceGroup get(GetInstanceGroupRequest request)

Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

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

Returns
Type Description
InstanceGroup

get(String project, String zone, String instanceGroup)

public final InstanceGroup get(String project, String zone, String instanceGroup)

Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group.

Returns
Type Description
InstanceGroup

getCallable()

public final UnaryCallable<GetInstanceGroupRequest,InstanceGroup> getCallable()

Returns the specified zonal instance group. Get a list of available zonal instance groups by making a list() request. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

getSettings()

public final InstanceGroupsSettings getSettings()
Returns
Type Description
InstanceGroupsSettings

getStub()

public InstanceGroupsStub getStub()
Returns
Type Description
InstanceGroupsStub

insertAsync(InsertInstanceGroupRequest request)

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

Creates an instance group in the specified project using the parameters that are 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   InsertInstanceGroupRequest request =
       InsertInstanceGroupRequest.newBuilder()
           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instanceGroupsClient.insertAsync(request).get();
 }
 
Parameter
Name Description
request InsertInstanceGroupRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

insertAsync(String project, String zone, InstanceGroup instanceGroupResource)

public final OperationFuture<Operation,Operation> insertAsync(String project, String zone, InstanceGroup instanceGroupResource)

Creates an instance group in the specified project using the parameters that are 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   InstanceGroup instanceGroupResource = InstanceGroup.newBuilder().build();
   Operation response =
       instanceGroupsClient.insertAsync(project, zone, instanceGroupResource).get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

zone String

The name of the zone where you want to create the instance group.

instanceGroupResource InstanceGroup

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

insertCallable()

public final UnaryCallable<InsertInstanceGroupRequest,Operation> insertCallable()

Creates an instance group in the specified project using the parameters that are 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   InsertInstanceGroupRequest request =
       InsertInstanceGroupRequest.newBuilder()
           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   ApiFuture<Operation> future = instanceGroupsClient.insertCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
UnaryCallable<InsertInstanceGroupRequest,Operation>

insertOperationCallable()

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

Creates an instance group in the specified project using the parameters that are 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 (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   InsertInstanceGroupRequest request =
       InsertInstanceGroupRequest.newBuilder()
           .setInstanceGroupResource(InstanceGroup.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   OperationFuture<Operation, Operation> future =
       instanceGroupsClient.insertOperationCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
Type Description
OperationCallable<InsertInstanceGroupRequest,Operation,Operation>

isShutdown()

public boolean isShutdown()
Returns
Type Description
boolean

isTerminated()

public boolean isTerminated()
Returns
Type Description
boolean

list(ListInstanceGroupsRequest request)

public final InstanceGroupsClient.ListPagedResponse list(ListInstanceGroupsRequest request)

Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

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

Returns
Type Description
InstanceGroupsClient.ListPagedResponse

list(String project, String zone)

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

Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

Returns
Type Description
InstanceGroupsClient.ListPagedResponse

listCallable()

public final UnaryCallable<ListInstanceGroupsRequest,InstanceGroupList> listCallable()

Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

listInstances(ListInstancesInstanceGroupsRequest request)

public final InstanceGroupsClient.ListInstancesPagedResponse listInstances(ListInstancesInstanceGroupsRequest request)

Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.

Sample code:


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

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

Returns
Type Description
InstanceGroupsClient.ListInstancesPagedResponse

listInstances(String project, String zone, String instanceGroup, InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)

public final InstanceGroupsClient.ListInstancesPagedResponse listInstances(String project, String zone, String instanceGroup, InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource)

Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instanceGroup = "instanceGroup-1404696854";
   InstanceGroupsListInstancesRequest instanceGroupsListInstancesRequestResource =
       InstanceGroupsListInstancesRequest.newBuilder().build();
   for (InstanceWithNamedPorts element :
       instanceGroupsClient
           .listInstances(
               project, zone, instanceGroup, instanceGroupsListInstancesRequestResource)
           .iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameters
Name Description
project String

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group from which you want to generate a list of included instances.

instanceGroupsListInstancesRequestResource InstanceGroupsListInstancesRequest

The body resource for this request

Returns
Type Description
InstanceGroupsClient.ListInstancesPagedResponse

listInstancesCallable()

public final UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsListInstances> listInstancesCallable()

Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.

Sample code:


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

listInstancesPagedCallable()

public final UnaryCallable<ListInstancesInstanceGroupsRequest,InstanceGroupsClient.ListInstancesPagedResponse> listInstancesPagedCallable()

Lists the instances in the specified instance group. The orderBy query parameter is not supported. The filter query parameter is supported, but only for expressions that use eq (equal) or ne (not equal) operators.

Sample code:


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

listPagedCallable()

public final UnaryCallable<ListInstanceGroupsRequest,InstanceGroupsClient.ListPagedResponse> listPagedCallable()

Retrieves the list of zonal instance group resources contained within the specified zone. For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead.

Sample code:


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

removeInstancesAsync(RemoveInstancesInstanceGroupRequest request)

public final OperationFuture<Operation,Operation> removeInstancesAsync(RemoveInstancesInstanceGroupRequest request)

Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   RemoveInstancesInstanceGroupRequest request =
       RemoveInstancesInstanceGroupRequest.newBuilder()
           .setInstanceGroup("instanceGroup-1404696854")
           .setInstanceGroupsRemoveInstancesRequestResource(
               InstanceGroupsRemoveInstancesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instanceGroupsClient.removeInstancesAsync(request).get();
 }
 
Parameter
Name Description
request RemoveInstancesInstanceGroupRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

removeInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)

public final OperationFuture<Operation,Operation> removeInstancesAsync(String project, String zone, String instanceGroup, InstanceGroupsRemoveInstancesRequest instanceGroupsRemoveInstancesRequestResource)

Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group where the specified instances will be removed.

instanceGroupsRemoveInstancesRequestResource InstanceGroupsRemoveInstancesRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

removeInstancesCallable()

public final UnaryCallable<RemoveInstancesInstanceGroupRequest,Operation> removeInstancesCallable()

Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.

Sample code:


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

removeInstancesOperationCallable()

public final OperationCallable<RemoveInstancesInstanceGroupRequest,Operation,Operation> removeInstancesOperationCallable()

Removes one or more instances from the specified instance group, but does not delete those instances. If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration before the VM instance is removed or deleted.

Sample code:


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

setNamedPortsAsync(SetNamedPortsInstanceGroupRequest request)

public final OperationFuture<Operation,Operation> setNamedPortsAsync(SetNamedPortsInstanceGroupRequest request)

Sets the named ports for the specified instance group.

Sample code:


 // This snippet has been automatically generated and should be regarded as a code template only.
 // It will require modifications to work:
 // - It may require correct/in-range values for request initialization.
 // - It may require specifying regional endpoints when creating the service client as shown in
 // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
 try (InstanceGroupsClient instanceGroupsClient = InstanceGroupsClient.create()) {
   SetNamedPortsInstanceGroupRequest request =
       SetNamedPortsInstanceGroupRequest.newBuilder()
           .setInstanceGroup("instanceGroup-1404696854")
           .setInstanceGroupsSetNamedPortsRequestResource(
               InstanceGroupsSetNamedPortsRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instanceGroupsClient.setNamedPortsAsync(request).get();
 }
 
Parameter
Name Description
request SetNamedPortsInstanceGroupRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

setNamedPortsAsync(String project, String zone, String instanceGroup, InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)

public final OperationFuture<Operation,Operation> setNamedPortsAsync(String project, String zone, String instanceGroup, InstanceGroupsSetNamedPortsRequest instanceGroupsSetNamedPortsRequestResource)

Sets the named ports for the specified instance group.

Sample code:


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

Project ID for this request.

zone String

The name of the zone where the instance group is located.

instanceGroup String

The name of the instance group where the named ports are updated.

instanceGroupsSetNamedPortsRequestResource InstanceGroupsSetNamedPortsRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

setNamedPortsCallable()

public final UnaryCallable<SetNamedPortsInstanceGroupRequest,Operation> setNamedPortsCallable()

Sets the named ports for the specified instance group.

Sample code:


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

setNamedPortsOperationCallable()

public final OperationCallable<SetNamedPortsInstanceGroupRequest,Operation,Operation> setNamedPortsOperationCallable()

Sets the named ports for the specified instance group.

Sample code:


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

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()