abandonInstances method

  1. @override
Future<Operation> abandonInstances(
  1. AbandonInstancesInstanceGroupManagerRequest request
)
override

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 thetargetSize of the managed instance group by the number of instances that you abandon. This operation is marked asDONE 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 thelistmanagedinstances 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.

Throws a http.ClientException if there were problems communicating with the API service. Throws a ServiceException if the API method failed for any reason.

Implementation

@override
Future<Operation> abandonInstances(
  AbandonInstancesInstanceGroupManagerRequest request,
) async {
  if (isClosed) throw StateError('Service is closed');

  if (_abandonInstances case final abandonInstances?) {
    return abandonInstances(request);
  }
  throw UnsupportedError('abandonInstances');
}