suspend method

  1. @override
Future<Operation> suspend(
  1. SuspendInstanceRequest request
)
override

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

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

  if (_suspend case final suspend?) {
    return suspend(request);
  }
  throw UnsupportedError('suspend');
}