| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace MGProvision\Proxmox\v2\models;
- class CloudInitDrive extends AbstractObject {
- protected $path;
- protected $storage;
- protected $location;
- public function __construct($id, $config=null) {
- $this->id = $id;
- if ($config) {
- $config = self::asArray($config);
- $this->location = key($config);
- $ex = explode(":", $this->location );
- $config['storage'] = $ex[0];
- $this->setAttributes($config);
- }
- }
- /**
- * @return mixed
- */
- public function getPath()
- {
- return $this->path;
- }
- /**
- * @param mixed $path
- */
- public function setPath($path)
- {
- $this->path = $path;
- }
- /**
- * @return mixed
- */
- public function getStorage()
- {
- return $this->storage;
- }
- /**
- * @param mixed $storage
- */
- public function setStorage($storage)
- {
- $this->storage = $storage;
- }
- /**
- * @return mixed
- */
- public function getMedia()
- {
- return $this->media;
- }
- /**
- * @param mixed $media
- */
- public function setMedia($media)
- {
- $this->media = $media;
- }
- public function unmount(){
- return $this->api()->put($this->getPath(),[$this->id => 'none,media=cdrom' ]);
- }
- public function mount(){
- return $this->api()->put($this->getPath(),[$this->id => "{$this->storage}:cloudinit,format=raw" ]);
- }
- }
|