Vm.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. namespace ModulesGarden\ProxmoxAddon\App\Services;
  3. use MGProvision\Proxmox\v2\models\Kvm;
  4. use MGProvision\Proxmox\v2\models\Lxc;
  5. use ModulesGarden\ProxmoxAddon\App\Models\VmModel;
  6. class Vm
  7. {
  8. /**
  9. * @var Kvm|Lxc
  10. */
  11. protected $vm;
  12. /**
  13. * @var VmModel
  14. */
  15. protected $vmModel;
  16. /**
  17. * @return Kvm|Lxc
  18. */
  19. public function getVm()
  20. {
  21. return $this->vm;
  22. }
  23. /**
  24. * @param Kvm|Lxc $vm
  25. * @return Vm
  26. */
  27. public function setVm($vm)
  28. {
  29. $this->vm = $vm;
  30. return $this;
  31. }
  32. public function hasVm(){
  33. return $this->vm != null;
  34. }
  35. /**
  36. * @return VmModel
  37. */
  38. public function getVmModel()
  39. {
  40. if(is_null( $this->vmModel)){
  41. throw new \InvalidArgumentException('VmModel not set');
  42. }
  43. return $this->vmModel;
  44. }
  45. /**
  46. * @param VmModel $vmModel
  47. * @return $this
  48. */
  49. public function setVmModel(VmModel $vmModel)
  50. {
  51. $this->vmModel = $vmModel;
  52. return $this;
  53. }
  54. public function hasVmModel(){
  55. return $this->vmModel !=null;
  56. }
  57. }
  58. {
  59. }