public function resumeAction($serverId)
{
$server = $this->getServer($serverId);
$this->checkPermissions($server, Acl::PERM_FARMS_SERVERS);
if ($server->status != Server::STATUS_SUSPENDED) {
throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_STATE, "Only Suspended Servers can be resumed.");
}
try {
$server->resume();
} catch (InstanceNotFound $e) {
throw new ApiErrorException(409, ErrorMessage::ERR_OBJECT_NOT_FOUND_ON_CLOUD, "The Server that you are trying to use does not exist on the cloud.");
} catch (Exception $e) {
throw new ApiErrorException(409, ErrorMessage::ERR_UNACCEPTABLE_OBJECT_CONFIGURATION, $e->getMessage());
}
$this->response->setStatus(200);
return $this->result($this->adapter('server')->toData($server));
}