| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- <?php
- /* * ********************************************************************
- * ProxmoxVPS product developed. (2017-06-07)
- * *
- *
- * CREATED BY MODULESGARDEN -> 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 <pawelk@modulesgarden.com>
- * @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));
- }
- }
- }
|