summaryrefslogtreecommitdiff
path: root/server/core/Compute.php
diff options
context:
space:
mode:
Diffstat (limited to 'server/core/Compute.php')
-rwxr-xr-xserver/core/Compute.php141
1 files changed, 89 insertions, 52 deletions
diff --git a/server/core/Compute.php b/server/core/Compute.php
index e466b52..7e27d00 100755
--- a/server/core/Compute.php
+++ b/server/core/Compute.php
@@ -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;
}
}