added createServer and corrected certain minor bugs

This commit is contained in:
stupidon 2016-03-05 14:05:52 +01:00
parent f4e59ee82c
commit c43e532f76

View file

@ -111,24 +111,7 @@ class compute
$this->app->setOutput("Images", $images);
return;
}
/**
* Create server.
* @return array
*/
public function createServer()
{
$name = $this->app->getPostParam("name");
$imageId = $this->app->getPostParam("imageId");
$flavorId = $this->app->getPostParam("flavorId");
if(!isset($name) || !isset($imageId) || !isset($flavorId)){
$this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID.");
return;
}
$opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId);
$server = $this->libClass->createServer($opt);
}
*/
/**
/**
* Get server details.
* @return array
*/
@ -179,6 +162,27 @@ class compute
$this->app->setOutput("MyImage", $image);
return;
}
/**
* Create server.
* @return array
*/
public function createServer()
{
$name = $this->app->getPostParam("name");
$imageId = $this->app->getPostParam("imageId");
$flavorId = $this->app->getPostParam("flavorId");
if(!isset($name) || !isset($imageId) || !isset($flavorId)){
$this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID.");
return;
}
$opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId);
$server = $this->libClass->createServer($opt);
}
/**
* update a server
* @return void
*/
public function updateServer()
{
$serverId = $this->app->getPostParam("serverId");
@ -204,6 +208,9 @@ class compute
$this->app->setOutput("Success", $serverId." has been updated successfully.");
return;
}
/**
* Delete a server
* @return void
*/
public function deleteServer()
{