recreateInstances method
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 itscurrentAction 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.
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
Future<Operation> recreateInstances(
RecreateInstancesInstanceGroupManagerRequest request,
) async {
final url = _endPoint.replace(
path:
'/compute/v1/projects/${request.project}/zones/${request.zone}/instanceGroupManagers/${request.instanceGroupManager}/recreateInstances',
queryParameters: {
if (request.noGracefulShutdown case final $1?)
'noGracefulShutdown': '${$1}',
'requestId': ?request.requestId,
},
);
final response = await _client.post(
url,
body: request.instanceGroupManagersRecreateInstancesRequestResource,
);
return Operation.fromJson(response);
}