Class InstanceGroupManagersClient (1.88.0)

GitHub RepositoryProduct Reference

Service Description: The InstanceGroupManagers 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 (InstanceGroupManagersClient instanceGroupManagersClient =
     InstanceGroupManagersClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instanceGroupManager = "instanceGroupManager-388242077";
   InstanceGroupManager response =
       instanceGroupManagersClient.get(project, zone, instanceGroupManager);
 }
 

Note: close() needs to be called on the InstanceGroupManagersClient 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

AbandonInstances

Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

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

  • abandonInstancesAsync(AbandonInstancesInstanceGroupManagerRequest request)

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

  • abandonInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)

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

  • abandonInstancesOperationCallable()

  • abandonInstancesCallable()

AggregatedList

Retrieves the list of managed instance groups and groups 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(AggregatedListInstanceGroupManagersRequest 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()

ApplyUpdatesToInstances

Applies changes to selected instances on the managed instance group. This method can be used to apply new overrides and/or new versions.

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

  • applyUpdatesToInstancesAsync(ApplyUpdatesToInstancesInstanceGroupManagerRequest request)

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

  • applyUpdatesToInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersApplyUpdatesRequest instanceGroupManagersApplyUpdatesRequestResource)

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

  • applyUpdatesToInstancesOperationCallable()

  • applyUpdatesToInstancesCallable()

CreateInstances

Creates instances with per-instance configurations in this managed instance group. Instances are created using the current instance template. The create instances operation is marked DONE if the createInstances request is successful. The underlying actions take additional time. You must separately verify the status of the creating or actions with the listmanagedinstances method.

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

  • createInstancesAsync(CreateInstancesInstanceGroupManagerRequest request)

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

  • createInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersCreateInstancesRequest instanceGroupManagersCreateInstancesRequestResource)

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

  • createInstancesOperationCallable()

  • createInstancesCallable()

Delete

Deletes the specified managed instance group and all of the instances in that group. Note that the 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(DeleteInstanceGroupManagerRequest 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 instanceGroupManager)

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()

DeleteInstances

Flags the specified instances in the managed instance group for immediate deletion. The instances are also removed from any target pools of which they were a member. This method reduces the targetSize of the managed instance group by the number of instances that you delete. This operation is marked as DONE when the action is scheduled even if the instances are still being deleted. You must separately verify the status of the deleting action with the listmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

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

  • deleteInstancesAsync(DeleteInstancesInstanceGroupManagerRequest request)

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

  • deleteInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersDeleteInstancesRequest instanceGroupManagersDeleteInstancesRequestResource)

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

  • deleteInstancesOperationCallable()

  • deleteInstancesCallable()

DeletePerInstanceConfigs

Deletes selected per-instance configurations for the managed instance group.

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

  • deletePerInstanceConfigsAsync(DeletePerInstanceConfigsInstanceGroupManagerRequest request)

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

  • deletePerInstanceConfigsAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersDeletePerInstanceConfigsReq instanceGroupManagersDeletePerInstanceConfigsReqResource)

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

  • deletePerInstanceConfigsOperationCallable()

  • deletePerInstanceConfigsCallable()

Get

Returns all of the details about the specified managed instance group.

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

  • get(GetInstanceGroupManagerRequest 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 instanceGroupManager)

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 a managed instance group using the information that you specify in the request. After the group is created, instances in the group are created using the specified instance template. This operation is marked as DONE when the group is created even if the instances in the group have not yet been created. You must separately verify the status of the individual instances with the listmanagedinstances method. A managed instance group can have up to 1000 VM instances per group. Please contact Cloud Support if you need an increase in this limit.

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

  • insertAsync(InsertInstanceGroupManagerRequest 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, InstanceGroupManager instanceGroupManagerResource)

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 a list of managed instance groups that are contained within the specified project and zone.

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

  • list(ListInstanceGroupManagersRequest 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()

ListErrors

Lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported.

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

  • listErrors(ListErrorsInstanceGroupManagersRequest request)

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

  • listErrors(String project, String zone, String instanceGroupManager)

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

  • listErrorsPagedCallable()

  • listErrorsCallable()

ListManagedInstances

Lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. The pageToken query parameter is supported only if the group's listManagedInstancesResults field is set to PAGINATED.

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

  • listManagedInstances(ListManagedInstancesInstanceGroupManagersRequest request)

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

  • listManagedInstances(String project, String zone, String instanceGroupManager)

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

  • listManagedInstancesPagedCallable()

  • listManagedInstancesCallable()

ListPerInstanceConfigs

Lists all of the per-instance configurations defined for the managed instance group. The orderBy query parameter is not supported.

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

  • listPerInstanceConfigs(ListPerInstanceConfigsInstanceGroupManagersRequest request)

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

  • listPerInstanceConfigs(String project, String zone, String instanceGroupManager)

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

  • listPerInstanceConfigsPagedCallable()

  • listPerInstanceConfigsCallable()

Patch

Updates a managed instance group using the information that you specify in the request. This operation is marked as DONE when the group is patched even if the instances in the group are still in the process of being patched. You must separately verify the status of the individual instances with the listManagedInstances method. This method supports PATCH semantics and uses the JSON merge patch format and processing rules. If you update your group to specify a new template or instance configuration, it's possible that your intended specification for each VM in the group is different from the current state of that VM. To learn how to apply an updated configuration to the VMs in a MIG, see Updating instances in a MIG.

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

  • patchAsync(PatchInstanceGroupManagerRequest request)

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

  • patchAsync(String project, String zone, String instanceGroupManager, InstanceGroupManager instanceGroupManagerResource)

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

  • patchOperationCallable()

  • patchCallable()

PatchPerInstanceConfigs

Inserts or patches per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.

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

  • patchPerInstanceConfigsAsync(PatchPerInstanceConfigsInstanceGroupManagerRequest request)

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

  • patchPerInstanceConfigsAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersPatchPerInstanceConfigsReq instanceGroupManagersPatchPerInstanceConfigsReqResource)

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

  • patchPerInstanceConfigsOperationCallable()

  • patchPerInstanceConfigsCallable()

RecreateInstances

Flags the specified VM instances in the managed instance group to be immediately recreated. Each instance is recreated using the group's current configuration. This operation is marked as DONE when the flag is set even if the instances have not yet been recreated. You must separately verify the status of each instance by checking its currentAction field; for more information, see Checking the status of managed 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

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

  • recreateInstancesAsync(RecreateInstancesInstanceGroupManagerRequest request)

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

  • recreateInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersRecreateInstancesRequest instanceGroupManagersRecreateInstancesRequestResource)

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

  • recreateInstancesOperationCallable()

  • recreateInstancesCallable()

Resize

Resizes the managed instance group. If you increase the size, the group creates new instances using the current instance template. If you decrease the size, the group deletes instances. The resize operation is marked DONE when the resize actions are scheduled even if the group has not yet added or deleted any instances. You must separately verify the status of the creating or deleting actions with the listmanagedinstances method. When resizing down, the instance group arbitrarily chooses the order in which VMs are deleted. The group takes into account some VM attributes when making the selection including: + The status of the VM instance. + The health of the VM instance. + The instance template version the VM is based on. + For regional managed instance groups, the location of the VM instance. This list is subject to change. 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 has elapsed 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.

  • resizeAsync(ResizeInstanceGroupManagerRequest request)

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

  • resizeAsync(String project, String zone, String instanceGroupManager, int size)

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

  • resizeOperationCallable()

  • resizeCallable()

ResumeInstances

Flags the specified instances in the managed instance group to be resumed. This method increases the targetSize and decreases the targetSuspendedSize of the managed instance group by the number of instances that you resume. The resumeInstances operation is marked DONE if the resumeInstances request is successful. The underlying actions take additional time. You must separately verify the status of the RESUMING action with the listmanagedinstances method. In this request, you can only specify instances that are suspended. For example, if an instance was previously suspended using the suspendInstances method, it can be resumed using the resumeInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are resumed. You can specify a maximum of 1000 instances with this method per request.

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

  • resumeInstancesAsync(ResumeInstancesInstanceGroupManagerRequest request)

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

  • resumeInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersResumeInstancesRequest instanceGroupManagersResumeInstancesRequestResource)

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

  • resumeInstancesOperationCallable()

  • resumeInstancesCallable()

SetInstanceTemplate

Specifies the instance template to use when creating new instances in this group. The templates for existing instances in the group do not change unless you run recreateInstances, run applyUpdatesToInstances, or set the group's updatePolicy.type to PROACTIVE.

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

  • setInstanceTemplateAsync(SetInstanceTemplateInstanceGroupManagerRequest request)

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

  • setInstanceTemplateAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersSetInstanceTemplateRequest instanceGroupManagersSetInstanceTemplateRequestResource)

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

  • setInstanceTemplateOperationCallable()

  • setInstanceTemplateCallable()

SetTargetPools

Modifies the target pools to which all instances in this managed instance group are assigned. The target pools automatically apply to all of the instances in the managed instance group. This operation is marked DONE when you make the request even if the instances have not yet been added to their target pools. The change might take some time to apply to all of the instances in the group depending on the size of the group.

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

  • setTargetPoolsAsync(SetTargetPoolsInstanceGroupManagerRequest request)

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

  • setTargetPoolsAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersSetTargetPoolsRequest instanceGroupManagersSetTargetPoolsRequestResource)

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

  • setTargetPoolsOperationCallable()

  • setTargetPoolsCallable()

StartInstances

Flags the specified instances in the managed instance group to be started. This method increases the targetSize and decreases the targetStoppedSize of the managed instance group by the number of instances that you start. The startInstances operation is marked DONE if the startInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STARTING action with the listmanagedinstances method. In this request, you can only specify instances that are stopped. For example, if an instance was previously stopped using the stopInstances method, it can be started using the startInstances method. If a health check is attached to the managed instance group, the specified instances will be verified as healthy after they are started. You can specify a maximum of 1000 instances with this method per request.

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

  • startInstancesAsync(StartInstancesInstanceGroupManagerRequest request)

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

  • startInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersStartInstancesRequest instanceGroupManagersStartInstancesRequestResource)

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

  • startInstancesOperationCallable()

  • startInstancesCallable()

StopInstances

Flags the specified instances in the managed instance group to be immediately stopped. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetStoppedSize of the managed instance group by the number of instances that you stop. The stopInstances operation is marked DONE if the stopInstances request is successful. The underlying actions take additional time. You must separately verify the status of the STOPPING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays stopping the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. 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 has elapsed before the VM instance is stopped. Stopped instances can be started using the startInstances method. You can specify a maximum of 1000 instances with this method per request.

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

  • stopInstancesAsync(StopInstancesInstanceGroupManagerRequest request)

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

  • stopInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersStopInstancesRequest instanceGroupManagersStopInstancesRequestResource)

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

  • stopInstancesOperationCallable()

  • stopInstancesCallable()

SuspendInstances

Flags the specified instances in the managed instance group to be immediately suspended. You can only specify instances that are running in this request. This method reduces the targetSize and increases the targetSuspendedSize of the managed instance group by the number of instances that you suspend. The suspendInstances operation is marked DONE if the suspendInstances request is successful. The underlying actions take additional time. You must separately verify the status of the SUSPENDING action with the listmanagedinstances method. If the standbyPolicy.initialDelaySec field is set, the group delays suspension of the instances until initialDelaySec have passed from instance.creationTimestamp (that is, when the instance was created). This delay gives your application time to set itself up and initialize on the instance. If more than initialDelaySec seconds have passed since instance.creationTimestamp when this method is called, there will be zero delay. 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 has elapsed before the VM instance is suspended. Suspended instances can be resumed using the resumeInstances method. You can specify a maximum of 1000 instances with this method per request.

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

  • suspendInstancesAsync(SuspendInstancesInstanceGroupManagerRequest request)

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

  • suspendInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersSuspendInstancesRequest instanceGroupManagersSuspendInstancesRequestResource)

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

  • suspendInstancesOperationCallable()

  • suspendInstancesCallable()

UpdatePerInstanceConfigs

Inserts or updates per-instance configurations for the managed instance group. perInstanceConfig.name serves as a key used to distinguish whether to perform insert or patch.

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

  • updatePerInstanceConfigsAsync(UpdatePerInstanceConfigsInstanceGroupManagerRequest request)

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

  • updatePerInstanceConfigsAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersUpdatePerInstanceConfigsReq instanceGroupManagersUpdatePerInstanceConfigsReqResource)

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

  • updatePerInstanceConfigsOperationCallable()

  • updatePerInstanceConfigsCallable()

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 InstanceGroupManagersSettings 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
 InstanceGroupManagersSettings instanceGroupManagersSettings =
     InstanceGroupManagersSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 InstanceGroupManagersClient instanceGroupManagersClient =
     InstanceGroupManagersClient.create(instanceGroupManagersSettings);
 

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
 InstanceGroupManagersSettings instanceGroupManagersSettings =
     InstanceGroupManagersSettings.newBuilder().setEndpoint(myEndpoint).build();
 InstanceGroupManagersClient instanceGroupManagersClient =
     InstanceGroupManagersClient.create(instanceGroupManagersSettings);
 

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

Inheritance

java.lang.Object > InstanceGroupManagersClient

Static Methods

create()

public static final InstanceGroupManagersClient create()

Constructs an instance of InstanceGroupManagersClient with default settings.

Returns
Type Description
InstanceGroupManagersClient
Exceptions
Type Description
IOException

create(InstanceGroupManagersSettings settings)

public static final InstanceGroupManagersClient create(InstanceGroupManagersSettings settings)

Constructs an instance of InstanceGroupManagersClient, 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 InstanceGroupManagersSettings
Returns
Type Description
InstanceGroupManagersClient
Exceptions
Type Description
IOException

create(InstanceGroupManagersStub stub)

public static final InstanceGroupManagersClient create(InstanceGroupManagersStub stub)

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

Parameter
Name Description
stub InstanceGroupManagersStub
Returns
Type Description
InstanceGroupManagersClient

Constructors

InstanceGroupManagersClient(InstanceGroupManagersSettings settings)

protected InstanceGroupManagersClient(InstanceGroupManagersSettings settings)

Constructs an instance of InstanceGroupManagersClient, 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 InstanceGroupManagersSettings

InstanceGroupManagersClient(InstanceGroupManagersStub stub)

protected InstanceGroupManagersClient(InstanceGroupManagersStub stub)
Parameter
Name Description
stub InstanceGroupManagersStub

Methods

abandonInstancesAsync(AbandonInstancesInstanceGroupManagerRequest request)

public final OperationFuture<Operation,Operation> abandonInstancesAsync(AbandonInstancesInstanceGroupManagerRequest request)

Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per 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 (InstanceGroupManagersClient instanceGroupManagersClient =
     InstanceGroupManagersClient.create()) {
   AbandonInstancesInstanceGroupManagerRequest request =
       AbandonInstancesInstanceGroupManagerRequest.newBuilder()
           .setInstanceGroupManager("instanceGroupManager-388242077")
           .setInstanceGroupManagersAbandonInstancesRequestResource(
               InstanceGroupManagersAbandonInstancesRequest.newBuilder().build())
           .setProject("project-309310695")
           .setRequestId("requestId693933066")
           .setZone("zone3744684")
           .build();
   Operation response = instanceGroupManagersClient.abandonInstancesAsync(request).get();
 }
 
Parameter
Name Description
request AbandonInstancesInstanceGroupManagerRequest

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

Returns
Type Description
OperationFuture<Operation,Operation>

abandonInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)

public final OperationFuture<Operation,Operation> abandonInstancesAsync(String project, String zone, String instanceGroupManager, InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource)

Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per 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 (InstanceGroupManagersClient instanceGroupManagersClient =
     InstanceGroupManagersClient.create()) {
   String project = "project-309310695";
   String zone = "zone3744684";
   String instanceGroupManager = "instanceGroupManager-388242077";
   InstanceGroupManagersAbandonInstancesRequest
       instanceGroupManagersAbandonInstancesRequestResource =
           InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
   Operation response =
       instanceGroupManagersClient
           .abandonInstancesAsync(
               project,
               zone,
               instanceGroupManager,
               instanceGroupManagersAbandonInstancesRequestResource)
           .get();
 }
 
Parameters
Name Description
project String

Project ID for this request.

zone String

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

instanceGroupManager String

The name of the managed instance group.

instanceGroupManagersAbandonInstancesRequestResource InstanceGroupManagersAbandonInstancesRequest

The body resource for this request

Returns
Type Description
OperationFuture<Operation,Operation>

abandonInstancesCallable()

public final UnaryCallable<AbandonInstancesInstanceGroupManagerRequest,Operation> abandonInstancesCallable()

Flags the specified instances to be removed from the managed instance group. Abandoning an instance does not delete the instance, but it does remove the instance from any target pools that are applied by the managed instance group. This method reduces the targetSize of the managed instance group by the number of instances that you abandon. This operation is marked as DONE when the action is scheduled even if the instances have not yet been removed from the group. You must separately verify the status of the abandoning action with the listmanagedinstances method. 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 has elapsed before the VM instance is removed or deleted. You can specify a maximum of 1000 instances with this method per request.

Sample code: