End of comments
This commit is contained in:
parent
5263cf00a2
commit
1d42345e07
13 changed files with 491 additions and 264 deletions
|
@ -1,37 +1,62 @@
|
|||
<?php
|
||||
//namespace istic-openstack\Server\core;
|
||||
/**
|
||||
* File containing the compute Class.
|
||||
*
|
||||
* @version 1.0 Initialisation of this file
|
||||
* @since 1.0 Core application's file
|
||||
*
|
||||
* @author bhupi
|
||||
*
|
||||
*/
|
||||
|
||||
use OpenCloud\Common\Error;
|
||||
|
||||
class compute
|
||||
/**
|
||||
* Compute Class of the back-end application
|
||||
*
|
||||
* Management of Servers
|
||||
*
|
||||
*/
|
||||
class compute implements Core
|
||||
{
|
||||
/** @var App $app protected, contains the main app object */
|
||||
protected $app;
|
||||
|
||||
/** @var OpenStack\Identity $libClass protected, contains the library Compute object */
|
||||
/** @var OpenStack\Compute $libClass protected, contains the library Compute object */
|
||||
protected $libClass;
|
||||
|
||||
|
||||
/**
|
||||
* Compute constructor
|
||||
*
|
||||
* @param App $args the main app object
|
||||
*
|
||||
* @return compute Object
|
||||
*/
|
||||
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 NULL
|
||||
* @return void
|
||||
*/
|
||||
public function action($action){
|
||||
|
||||
$this->{$action.""}();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* List servers.
|
||||
* @return array
|
||||
*/
|
||||
* List servers.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function listServers()
|
||||
{
|
||||
try{
|
||||
|
@ -79,12 +104,13 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List flavors.
|
||||
* @return array
|
||||
*/
|
||||
* List flavors.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function listFlavors()
|
||||
{
|
||||
try{
|
||||
|
@ -117,12 +143,13 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List images.
|
||||
* @return array
|
||||
*/
|
||||
* List images.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function listImages()
|
||||
{
|
||||
try{
|
||||
|
@ -159,12 +186,13 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get server details.
|
||||
* @return array
|
||||
*/
|
||||
* Get server details.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getServer()
|
||||
{
|
||||
try{
|
||||
|
@ -193,12 +221,13 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get flavor details.
|
||||
* @return array
|
||||
*/
|
||||
* Get flavor details.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function getFlavor()
|
||||
{
|
||||
try{
|
||||
|
@ -227,12 +256,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get image details.
|
||||
* @return array
|
||||
*/
|
||||
* Get image details.
|
||||
* @return array
|
||||
*/
|
||||
public function getImage()
|
||||
{
|
||||
try{
|
||||
|
@ -261,12 +290,13 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create server.
|
||||
* @return array
|
||||
*/
|
||||
* Create server.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function createServer()
|
||||
{
|
||||
try{
|
||||
|
@ -295,12 +325,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* update a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateServer()
|
||||
{
|
||||
|
@ -342,11 +372,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function deleteServer()
|
||||
{
|
||||
|
@ -376,11 +407,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the password of a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function changePassword()
|
||||
{
|
||||
|
@ -411,11 +443,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reboot a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function reboot()
|
||||
{
|
||||
|
@ -445,11 +478,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rebuild a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function rebuild()
|
||||
{
|
||||
|
@ -490,13 +524,15 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resize a server
|
||||
*
|
||||
* A call to this method has to be followed by either confirmResize or revertResize
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function resize()
|
||||
{
|
||||
|
@ -526,11 +562,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm resize operation on a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function confirmResize()
|
||||
{
|
||||
|
@ -560,11 +597,12 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Revert resize operation on a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function revertResize()
|
||||
{
|
||||
|
@ -594,14 +632,14 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* List private and public addresses of a server
|
||||
* @return NULL
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
||||
public function listAddresses(array $options = [])
|
||||
public function listAddresses()
|
||||
{
|
||||
try{
|
||||
$serverId = $this->app->getPostParam("serverId");
|
||||
|
@ -629,7 +667,6 @@ class compute
|
|||
catch(Exception $e){
|
||||
$this->app->getErrorInstance()->OtherException($e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue