merge
This commit is contained in:
parent
6349739a6c
commit
cfce59d6dc
47 changed files with 500 additions and 52 deletions
|
@ -1 +1,176 @@
|
|||
<?php
|
||||
//namespace istic-openstack\Server\core;
|
||||
// TODO introduce error-handling based on errors specific to the compute module
|
||||
use OpenStack\Common\Error;
|
||||
|
||||
class compute
|
||||
{
|
||||
/** @var App $app protected, contains the main app object */
|
||||
protected $app;
|
||||
|
||||
/** @var OpenStack\Identity $libClass protected, contains the library Compute object */
|
||||
protected $libClass;
|
||||
|
||||
|
||||
public function __construct($app)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->libClass = $app->getLibClass("Compute");
|
||||
}
|
||||
/**
|
||||
* Execute an action
|
||||
*
|
||||
* @param String $action name of another function of this class
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function action($action){
|
||||
|
||||
$this->{$action.""}();
|
||||
|
||||
}
|
||||
/**
|
||||
* List servers.
|
||||
* @return array
|
||||
*/
|
||||
public function listServers()
|
||||
{
|
||||
$servers = $this->libClass->listServers();
|
||||
$this->app->setOutput("Servers", $servers);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* List flavors.
|
||||
* @return array
|
||||
*/
|
||||
public function listFlavors()
|
||||
{
|
||||
$flavors = $this->libClass->listFlavors();
|
||||
$this->app->setOutput("Flavors", $flavors);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* List images.
|
||||
* @return array
|
||||
*/
|
||||
public function listImages()
|
||||
{
|
||||
$images = $this->libClass->listImages();
|
||||
$this->app->setOutput("Images", $images);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Create server.
|
||||
* @return array
|
||||
*
|
||||
public function createServer()
|
||||
{
|
||||
|
||||
$server = $this->libClass->createServer();
|
||||
}
|
||||
*/
|
||||
/**
|
||||
* Get server details.
|
||||
* @return array
|
||||
*/
|
||||
public function getServer()
|
||||
{
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
$opt = array('id' => $serverId);
|
||||
$server = $this->libClass->getServer($opt);
|
||||
$server->retrieve();
|
||||
$this->app->setOutput("MyServer", $server);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Get flavor details.
|
||||
* @return array
|
||||
*/
|
||||
public function getFlavor()
|
||||
{
|
||||
$flavorId = $this->app->getPostParam("flavorId");
|
||||
$opt = array('id' => $flavorId);
|
||||
$flavor = $this->libClass->getFlavor($opt);
|
||||
$flavor->retrieve();
|
||||
$this->app->setOutput("MyFlavor", $flavor);
|
||||
return;
|
||||
}
|
||||
/**
|
||||
* Get image details.
|
||||
* @return array
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
$imageId = $this->app->getPostParam("imageId");
|
||||
$opt = array('id' => $imageId);
|
||||
$image = $this->libClass->getImage($opt);
|
||||
$image->retrieve();
|
||||
$this->app->setOutput("MyImage", $image);
|
||||
return;
|
||||
}
|
||||
/* working on tests
|
||||
|
||||
public function update()
|
||||
{
|
||||
$image = $this->app->getServer(array $options = []);
|
||||
|
||||
}
|
||||
public function delete()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function changePassword($newPassword)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function reboot($type = Enum::REBOOT_SOFT)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function rebuild(array $options)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function resize($flavorId)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function confirmResize()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function revertResize()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function createImage(array $options)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function listAddresses(array $options = [])
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function getMetadata()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function resetMetadata(array $metadata)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function mergeMetadata(array $metadata)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function getMetadataItem($key)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function deleteMetadataItem($key)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue