suspend method
This method suspends a running instance, saving its state to persistent storage, and allows you to resume the instance at a later time. Suspended instances have no compute costs (cores or RAM), and incur only storage charges for the saved VM memory and localSSD data. Any charged resources the virtual machine was using, such as persistent disks and static IP addresses, will continue to be charged while the instance is suspended. For more information, see Suspending and resuming an instance.
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> suspend(SuspendInstanceRequest request) async {
final url = _endPoint.replace(
path:
'/compute/v1/projects/${request.project}/zones/${request.zone}/instances/${request.instance}/suspend',
queryParameters: {
if (request.discardLocalSsd case final $1?) 'discardLocalSsd': '${$1}',
'requestId': ?request.requestId,
},
);
final response = await _client.post(url);
return Operation.fromJson(response);
}