http://modulesgarden.com * CONTACT -> contact@modulesgarden.com * * * This software is furnished under a license and may be used and copied * only in accordance with the terms of such license and with the * inclusion of the above copyright notice. This software or any other * copies thereof may not be provided or otherwise made available to any * other person. No title to and ownership of the software is hereby * transferred. * * * ******************************************************************** */ namespace MGProvision\Proxmox\v2\models; /** * Description of ClusterResource * * @author Pawel Kopec * @version 1.0.0 */ class ClusterResource extends AbstractObject { protected $name; protected $vmid; protected $node; protected $template; protected $type; protected $status; public function getName() { return $this->name; } public function isCustom(){ return preg_match('/^custom[0-9]*/',$this->getName()); } public function matchName($serviceid){ return preg_match('/^custom'.$serviceid.'-*/',$this->getName()); } public function getVmid() { return $this->vmid; } public function getNode() { return $this->node; } public function getTemplate() { return $this->template; } public function setName($name) { $this->name = $name; return $this; } public function setVmid($vmid) { $this->vmid = $vmid; return $this; } public function setNode($node) { $this->node = $node; return $this; } public function setTemplate($template) { $this->template = $template; return $this; } public function getType() { return $this->type; } public function setType($type) { $this->type = $type; return $this; } public function getStatus() { return $this->status; } public function setStatus($status) { $this->status = $status; return $this; } public function getVm() { switch ($this->type) { case 'qemu' : return new Kvm($this->node, $this->vmid); break; case 'lxc': return new Lxc($this->node, $this->vmid); break; default : throw new \Exception(sprintf("Unkown virtualization %s type", $this->type)); } } }