added createServer and corrected certain minor bugs
This commit is contained in:
parent
f4e59ee82c
commit
c43e532f76
1 changed files with 25 additions and 18 deletions
|
@ -111,24 +111,7 @@ class compute
|
||||||
$this->app->setOutput("Images", $images);
|
$this->app->setOutput("Images", $images);
|
||||||
return;
|
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.
|
* Get server details.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -179,6 +162,27 @@ class compute
|
||||||
$this->app->setOutput("MyImage", $image);
|
$this->app->setOutput("MyImage", $image);
|
||||||
return;
|
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()
|
public function updateServer()
|
||||||
{
|
{
|
||||||
$serverId = $this->app->getPostParam("serverId");
|
$serverId = $this->app->getPostParam("serverId");
|
||||||
|
@ -204,6 +208,9 @@ class compute
|
||||||
$this->app->setOutput("Success", $serverId." has been updated successfully.");
|
$this->app->setOutput("Success", $serverId." has been updated successfully.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Delete a server
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function deleteServer()
|
public function deleteServer()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue