diff options
Diffstat (limited to 'server/core')
| -rwxr-xr-x | server/core/App.php | 164 | ||||
| -rwxr-xr-x | server/core/Automating.php | 9 | ||||
| -rwxr-xr-x | server/core/Compute.php | 550 | ||||
| -rwxr-xr-x | server/core/CoreInterface.php | 10 | ||||
| -rwxr-xr-x | server/core/ErrorManagement.php | 66 | ||||
| -rwxr-xr-x | server/core/Identity.php | 1413 | ||||
| -rwxr-xr-x | server/core/Image.php | 222 | ||||
| -rwxr-xr-x | server/core/LibOverride/genTokenOptions.php | 104 | ||||
| -rwxr-xr-x | server/core/Network.php | 318 | ||||
| -rwxr-xr-x | server/core/NetworkLayer3.php | 156 |
10 files changed, 1384 insertions, 1628 deletions
diff --git a/server/core/App.php b/server/core/App.php index 114d945..3a027d7 100755 --- a/server/core/App.php +++ b/server/core/App.php @@ -1,21 +1,53 @@ <?php
+/**
+* File containing the identity Class.
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Eole 'eoledev at outlook . fr'
+*
+*/
+
+//Library token management override
include_once("core/LibOverride/genTokenOptions.php");
include_once("core/ErrorManagement.php");
+//Library loading
use OpenCloud\Common\Error\BadResponseError;
use OpenCloud\Common\Error\BaseError;
use OpenCloud\Common\Error\NotImplementedError;
use OpenCloud\Common\Error\UserInputError;
+/**
+* App Class of the back-end application
+*
+* This class allow the communication between the front-end application and
+* the library which allow to send requests to an Openstack instance.
+*
+*/
class App{
+ /** @var Openstack $openstack protected, contains the main library object */
protected $openstack;
+ /** @var Array $postParams protected, contains the post parameters */
protected $postParams;
+ /** @var genTokenOptions $tokenClass protected, contains the class object for the authentication override of the library */
protected $tokenClass;
+ /** @var String $tokenPost protected, contains the token given in parameter */
protected $tokenPost;
+ /** @var errorManagement $errorClass protected, contains the errorManagement object */
protected $errorClass;
+ /** @var Array $output protected, contains the result for the API call */
protected $output;
+ /**
+ * App constructor
+ *
+ * @param Array $args Args for the OpenStack Library
+ *
+ * @return App object
+ */
public function __construct($args){
$this->tokenPost = NULL;
@@ -27,6 +59,13 @@ class App{ }
+ /**
+ * Set the class var $tokenPost and load the token
+ * into the genTokenOptions Class
+ *
+ * @param String $token token to be set
+ *
+ */
public function setToken($token){
$this->tokenPost = $token;
@@ -34,42 +73,59 @@ class App{ }
+ /**
+ * Check the expiration of the token
+ *
+ * @return Boolean if the token is not expired
+ */
public function checkToken(){
return $this->tokenClass->checkToken();
}
+ /**
+ * Get the service Class given the name in parameter
+ *
+ * @param String $service Name of the service
+ *
+ * @return Core object
+ */
public function getLibClass($service){
switch($service){
- case "Identity":
- if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->identityV3($opt);
- break;
- case "Image":
- if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->imagesV2($opt);
- break;
- case "Network":
- if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->networkingV2($opt);
- break;
- case "Compute":
- if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->computeV2($opt);
- break;
- case "NetworkLayer3":
- if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
- $opt = $this->tokenClass->getOptions('Network');
- return $this->openstack->networkingV2ExtLayer3($opt);
- break;
+ case "Identity":
+ if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->identityV3($opt);
+ break;
+ case "Image":
+ if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->imagesV2($opt);
+ break;
+ case "Network":
+ if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->networkingV2($opt);
+ break;
+ case "Compute":
+ if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->computeV2($opt);
+ break;
+ case "NetworkLayer3":
+ if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+ $opt = $this->tokenClass->getOptions('Network');
+ return $this->openstack->networkingV2ExtLayer3($opt);
+ break;
}
}
+ /**
+ * Generate the token for the different services in OpenStack
+ *
+ * @return NULL
+ */
public function authenticate(){
try{
@@ -81,16 +137,21 @@ class App{ $this->setOutput("token", $this->tokenClass->getBackup());
}catch(BadResponseError $e){
$this->errorClass->BadResponseHandler($e);
- }catch(UserInputError $e){
+ }catch(UserInputError $e){
$this->errorClass->UserInputHandler($e);
- }catch(BaseError $e){
+ }catch(BaseError $e){
$this->errorClass->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
+ }catch(NotImplementedError $e){
$this->errorClass->NotImplementedHandler($e);
- }
+ }
}
+ /**
+ * Revoke the openstack services' token
+ *
+ * @return NULL
+ */
public function deauthenticate(){
try{
@@ -103,16 +164,23 @@ class App{ $this->setOutput("deauthenticate", "Ok");
}catch(BadResponseError $e){
$this->errorClass->BadResponseHandler($e);
- }catch(UserInputError $e){
+ }catch(UserInputError $e){
$this->errorClass->UserInputHandler($e);
- }catch(BaseError $e){
+ }catch(BaseError $e){
$this->errorClass->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
+ }catch(NotImplementedError $e){
$this->errorClass->NotImplementedHandler($e);
- }
+ }
}
+ /**
+ * Retrieve a post parameter given its name
+ *
+ * @param String $name Expected post parameter's name
+ *
+ * @return Object Post value
+ */
public function getPostParam($name){
if(isset($this->postParams[$name])){
@@ -123,28 +191,52 @@ class App{ }
-
+ /**
+ * Set a post parameter for automating task
+ *
+ * @param String $param Name for the Post entry
+ * @param Object $value Value for the Post entry
+ *
+ * @return NULL
+ */
public function setPostParam($param, $value){
$this->postParams[$param] = $value;
-
+
}
+ /**
+ * Set a new output message
+ *
+ * @param String $key Array key for the message
+ * @param Array $out Message's value
+ *
+ * @return NULL
+ */
public function setOutput($key, $out){
$this->output[$key] = $out;
}
+ /**
+ * Retrieve the errorManagement instance Object
+ *
+ * @return errorManagement object
+ */
public function getErrorInstance(){
return $this->errorClass;
}
+ /**
+ * Output the messages to be send to the client
+ *
+ * @return NULl
+ */
public function show(){
echo json_encode($this->output);
- //error_log(var_dump(json_encode($this->output), true), 0);
}
}
diff --git a/server/core/Automating.php b/server/core/Automating.php index fb42702..2d8db00 100755 --- a/server/core/Automating.php +++ b/server/core/Automating.php @@ -5,9 +5,8 @@ * @version 1.0 Initialisation of this file * @since 1.0 Core application's file * -* @author Evan Pisani 'yogg at epsina . com' et bhupi +* @author Evan Pisani 'yogg at epsina . com', bhupi * -* @todo Complete the functions with errors detection and finish the descriptions */ include("Image.php"); @@ -44,10 +43,10 @@ class automating{ * * @param String $action name of another function of this class * - * @return void + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } /** @@ -58,7 +57,7 @@ class automating{ * @param String $serverName name ofthe new server * @param String $flavor kind of server * - * @return void + * @return NULL */ private function createPublicServer() { diff --git a/server/core/Compute.php b/server/core/Compute.php index 4a7fe6c..e466b52 100755 --- a/server/core/Compute.php +++ b/server/core/Compute.php @@ -4,170 +4,170 @@ use OpenCloud\Common\Error; class compute { - /** @var App $app protected, contains the main app object */ - protected $app; + /** @var App $app protected, contains the main app object */ + protected $app; - /** @var OpenStack\Identity $libClass protected, contains the library Compute object */ - protected $libClass; + /** @var OpenStack\Identity $libClass protected, contains the library Compute object */ + protected $libClass; - public function __construct($app) - { - $this->app = $app; - $this->libClass = $app->getLibClass("Compute"); - } + 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 + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } - /** - * List servers. - * @return array - */ - public function listServers() - { + /** + * List servers. + * @return array + */ + public function listServers() + { try{ $serverList = $this->libClass->listServers(true); $servers = Array(); foreach($serverList as $server){ - $servers[$server->id] = Array(); - $server->flavor->retrieve(); - $server->image->retrieve(); - $server->retrieve(); - $servers[$server->id]["id"] = $server->id; - $servers[$server->id]["name"] = $server->name; - $servers[$server->id]["image"] = $server->image; - $servers[$server->id]["ram"] = $server->flavor->ram; - $servers[$server->id]["disk"] = $server->flavor->disk; - $servers[$server->id]["flavor"] = $server->flavor; - $servers[$server->id]["status"] = $server->status; - $servers[$server->id]["created"] = $server->created; - $servers[$server->id]["updated"] = $server->updated; - $servers[$server->id]["ipv4"] = $server->ipv4; - $servers[$server->id]["ipv6"] = $server->ipv6; - $servers[$server->id]["progress"] = $server->progress; - $servers[$server->id]["hostId"] = $server->hostId; - $servers[$server->id]["tenantId"] = $server->tenantId; - $servers[$server->id]["userId"] = $server->userId; - $servers[$server->id]["taskState"] = $server->taskState; - $servers[$server->id]["addresses"] = $server->addresses; - $servers[$server->id]["links"] = $server->links; - $servers[$server->id]["metadata"] = $server->metadata; + $servers[$server->id] = Array(); + $server->flavor->retrieve(); + $server->image->retrieve(); + $server->retrieve(); + $servers[$server->id]["id"] = $server->id; + $servers[$server->id]["name"] = $server->name; + $servers[$server->id]["image"] = $server->image; + $servers[$server->id]["ram"] = $server->flavor->ram; + $servers[$server->id]["disk"] = $server->flavor->disk; + $servers[$server->id]["flavor"] = $server->flavor; + $servers[$server->id]["status"] = $server->status; + $servers[$server->id]["created"] = $server->created; + $servers[$server->id]["updated"] = $server->updated; + $servers[$server->id]["ipv4"] = $server->ipv4; + $servers[$server->id]["ipv6"] = $server->ipv6; + $servers[$server->id]["progress"] = $server->progress; + $servers[$server->id]["hostId"] = $server->hostId; + $servers[$server->id]["tenantId"] = $server->tenantId; + $servers[$server->id]["userId"] = $server->userId; + $servers[$server->id]["taskState"] = $server->taskState; + $servers[$server->id]["addresses"] = $server->addresses; + $servers[$server->id]["links"] = $server->links; + $servers[$server->id]["metadata"] = $server->metadata; } $this->app->setOutput("Servers", $servers); } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * List flavors. - * @return array - */ - public function listFlavors() - { + } + return; + } + /** + * List flavors. + * @return array + */ + public function listFlavors() + { try{ $flavorList = $this->libClass->listFlavors(); $flavors = Array(); foreach($flavorList as $flavor){ - $flavors[$flavor->id] = Array(); - $flavor->retrieve(); - $flavors[$flavor->id]["id"] = $flavor->id; - $flavors[$flavor->id]["name"] = $flavor->name; - $flavors[$flavor->id]["ram"] = $flavor->ram; - $flavors[$flavor->id]["disk"] = $flavor->disk; - $flavors[$flavor->id]["vcpus"] = $flavor->vcpus; - $flavors[$flavor->id]["links"] = $flavor->links; - } - $this->app->setOutput("Flavors", $flavors); + $flavors[$flavor->id] = Array(); + $flavor->retrieve(); + $flavors[$flavor->id]["id"] = $flavor->id; + $flavors[$flavor->id]["name"] = $flavor->name; + $flavors[$flavor->id]["ram"] = $flavor->ram; + $flavors[$flavor->id]["disk"] = $flavor->disk; + $flavors[$flavor->id]["vcpus"] = $flavor->vcpus; + $flavors[$flavor->id]["links"] = $flavor->links; + } + $this->app->setOutput("Flavors", $flavors); } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * List images. - * @return array - */ - public function listImages() - { - try{ + } + return; + } + /** + * List images. + * @return array + */ + public function listImages() + { + try{ $imageList = $this->libClass->listImages(); $images = Array(); foreach($imageList as $image){ - $images[$image->id] = Array(); - $image->retrieve(); - $images[$image->id]["id"] = $image->id; - $images[$image->id]["name"] = $image->name; - $images[$image->id]["status"] = $image->status; - $images[$image->id]["created"] = $image->created; - $images[$image->id]["updated"] = $image->updated; - $images[$image->id]["minDisk"] = $image->minDisk; - $images[$image->id]["minRam"] = $image->minRam; - $images[$image->id]["progress"] = $image->progress; - $images[$image->id]["links"] = $image->links; - $images[$image->id]["metadata"] = $image->metadata; - } - $this->app->setOutput("Images", $images); + $images[$image->id] = Array(); + $image->retrieve(); + $images[$image->id]["id"] = $image->id; + $images[$image->id]["name"] = $image->name; + $images[$image->id]["status"] = $image->status; + $images[$image->id]["created"] = $image->created; + $images[$image->id]["updated"] = $image->updated; + $images[$image->id]["minDisk"] = $image->minDisk; + $images[$image->id]["minRam"] = $image->minRam; + $images[$image->id]["progress"] = $image->progress; + $images[$image->id]["links"] = $image->links; + $images[$image->id]["metadata"] = $image->metadata; + } + $this->app->setOutput("Images", $images); } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * Get server details. - * @return array - */ - public function getServer() - { - try{ + } + return; + } + /** + * Get server details. + * @return array + */ + public function getServer() + { + try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ $this->app->setOutput("Error", "Server ID is missing!"); @@ -180,27 +180,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * Get flavor details. - * @return array - */ - public function getFlavor() - { + } + return; + } + /** + * Get flavor details. + * @return array + */ + public function getFlavor() + { try{ $flavorId = $this->app->getPostParam("flavorId"); if(!isset($serverId)){ @@ -214,27 +214,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * Get image details. - * @return array - */ - public function getImage() - { + } + return; + } + /** + * Get image details. + * @return array + */ + public function getImage() + { try{ $imageId = $this->app->getPostParam("imageId"); if(!isset($serverId)){ @@ -248,27 +248,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** - * Create server. - * @return array - */ - public function createServer() - { + } + return; + } + /** + * Create server. + * @return array + */ + public function createServer() + { try{ $name = $this->app->getPostParam("name"); $imageId = $this->app->getPostParam("imageId"); @@ -282,28 +282,28 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } + } return; - } - + } + /** * update a server - * @return void + * @return NULL */ - public function updateServer() - { + public function updateServer() + { try{ $serverId = $this->app->getPostParam("serverId"); $newName = $this->app->getPostParam("newName"); @@ -329,27 +329,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } + } + return; + } /** * Delete a server - * @return void + * @return NULL */ - public function deleteServer() - { + public function deleteServer() + { try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ @@ -363,27 +363,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } + } + return; + } /** * Change the password of a server - * @return void + * @return NULL */ - public function changePassword() - { + public function changePassword() + { try{ $serverId = $this->app->getPostParam("serverId"); $password = $this->app->getPostParam("newPassword"); @@ -398,27 +398,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } + } return; - } - /** + } + /** * Reboot a server - * @return void + * @return NULL */ - public function reboot() - { + public function reboot() + { try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ @@ -432,74 +432,74 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** + } + return; + } + /** * Rebuild a server - * @return void + * @return NULL */ - public function rebuild() - { - $serverId = $this->app->getPostParam("serverId"); - $imageId = $this->app->getPostParam("imageId"); - $newName = $this->app->getPostParam("newName"); - $adminPass = $this->app->getPostParam("adminPass"); + public function rebuild() + { + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)) { $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); return; - try{ - $serverId = $this->app->getPostParam("serverId"); - $imageId = $this->app->getPostParam("imageId"); - $newName = $this->app->getPostParam("newName"); - $adminPass = $this->app->getPostParam("adminPass"); - if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)){ - $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); - return; + try{ + $serverId = $this->app->getPostParam("serverId"); + $imageId = $this->app->getPostParam("imageId"); + $newName = $this->app->getPostParam("newName"); + $adminPass = $this->app->getPostParam("adminPass"); + if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)){ + $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!"); + return; + } + $opt = array('id' => $serverId); + $server = $this->libClass->getServer($opt); + $attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass); + $server->rebuild($attr); + $this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image."); } - $opt = array('id' => $serverId); - $server = $this->libClass->getServer($opt); - $attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass); - $server->rebuild($attr); - $this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image."); + catch(BadResponseError $e){ + $this->app->getErrorInstance()->BadResponseHandler($e); + } + catch(UserInputError $e){ + $this->app->getErrorInstance()->UserInputHandler($e); + } + catch(BaseError $e){ + $this->app->getErrorInstance()->BaseErrorHandler($e); + } + catch(NotImplementedError $e){ + $this->app->getErrorInstance()->NotImplementedHandler($e); + } + catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + return; } - catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - } - catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - } - catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - } - catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - } - 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 void + * @return NULL */ - public function resize() - { + public function resize() + { try{ $serverId = $this->app->getPostParam("serverId"); $newFlavorId = $this->app->getPostParam("newFlavorId"); @@ -513,27 +513,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** + } + return; + } + /** * Confirm resize operation on a server - * @return void + * @return NULL */ - public function confirmResize() - { + public function confirmResize() + { try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ @@ -547,27 +547,27 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } - /** + } + return; + } + /** * Revert resize operation on a server - * @return void + * @return NULL */ - public function revertResize() - { + public function revertResize() + { try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ @@ -581,28 +581,28 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } + } + return; + } /** * List private and public addresses of a server - * @return void + * @return NULL */ - - public function listAddresses(array $options = []) - { + + public function listAddresses(array $options = []) + { try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ @@ -616,20 +616,20 @@ class compute } catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - } + } catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - } + } catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - } + } catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - } + } catch(Exception $e){ $this->app->getErrorInstance()->OtherException($e); - } - return; - } + } + return; + } } - + diff --git a/server/core/CoreInterface.php b/server/core/CoreInterface.php index ed0d959..6c2313b 100755 --- a/server/core/CoreInterface.php +++ b/server/core/CoreInterface.php @@ -1,5 +1,13 @@ <?php
-
+/**
+* File containing Core Interface
+*
+* @version 1.0 Initialisation of this file
+* @since 1.0 Core application's file
+*
+* @author Eole 'eoledev at outlook . fr'
+*
+*/
interface Core{
public function action($action);
diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php index be7080b..0e315a7 100755 --- a/server/core/ErrorManagement.php +++ b/server/core/ErrorManagement.php @@ -22,9 +22,9 @@ Class errorManagement{ /**
* ErrorManagemement constructor
*
- * @param App $app the main app object
+ * @param App $args the main app object
*
- * @return ErrorManagement
+ * @return ErrorManagement Object
*/
public function __construct($args){
@@ -35,9 +35,9 @@ Class errorManagement{ /**
* Put an error message corresponding to a base error in the output
*
- * @param $error the error triggered
+ * @param Exception $error the exception triggered
*
- * @return String BaseError message
+ * @return NULL
*/
public function BaseErrorHandler($error){
$this->app->setOutput("Error", "BaseError");
@@ -46,49 +46,49 @@ Class errorManagement{ /**
* Put an error message corresponding to a bad response in function of the status code in the output
*
- * @param $error the error triggered
+ * @param Exception $error the exception triggered
*
- * @return String Error message
+ * @return NULL
*/
public function BadResponseHandler($error){
$statusCode = $error->getResponse()->getStatusCode();
switch ($statusCode) {
- case 400:
- $this->app->setOutput("Error", "Invalid input.");
- break;
+ case 400:
+ $this->app->setOutput("Error", "Invalid input.");
+ break;
- case 401:
- $this->app->setOutput("Error", "Authentification failed.");
- break;
+ case 401:
+ $this->app->setOutput("Error", "Authentification failed.");
+ break;
- case 403:
- $this->app->setOutput("Error", "Operation forbidden.");
- break;
+ case 403:
+ $this->app->setOutput("Error", "Operation forbidden.");
+ break;
- case 404:
- $this->app->setOutput("Error", "Ressource not found.");
- break;
+ case 404:
+ $this->app->setOutput("Error", "Ressource not found.");
+ break;
- case 500:
- $this->app->setOutput("Error", "Internal server error, please contact an administrator.");
- break;
+ case 500:
+ $this->app->setOutput("Error", "Internal server error, please contact an administrator.");
+ break;
- case 503:
- $this->app->setOutput("Error", "Service unvailable for the moment.");
- break;
+ case 503:
+ $this->app->setOutput("Error", "Service unvailable for the moment.");
+ break;
- default:
- $this->app->setOutput("Error", "Unknow error, please contact an administrator.");
- break;
+ default:
+ $this->app->setOutput("Error", "Unknow error, please contact an administrator.");
+ break;
}
}
/**
* Put an error message corresponding to a not implemented yet error in the output
*
- * @param $error the error triggered
+ * @param Exception $error the exception triggered
*
- * @return String internal error message
+ * @return NULL
*/
public function NotImplementedHandler($error){
$this->app->setOutput("Error", "Internal error (not implemented yet), please contact an administrator");
@@ -97,9 +97,9 @@ Class errorManagement{ /**
* Put an error message corresponding to a user input error in the output
*
- * @param $error the error triggered
+ * @param Exception $error the exception triggered
*
- * @return String User input error message
+ * @return NULL
*/
public function UserInputHandler($error){
$this->app->setOutput("Error", "UserInputError");
@@ -108,9 +108,9 @@ Class errorManagement{ /**
* Put an error message corresponding to an other error in the output
*
- * @param $error the error triggered
+ * @param Exception $error the exception triggered
*
- * @return String error message
+ * @return NULL
*/
public function OtherException($error){
$this->app->setOutput("Error", $error->getMessage());
diff --git a/server/core/Identity.php b/server/core/Identity.php index 464522a..f6179b0 100755 --- a/server/core/Identity.php +++ b/server/core/Identity.php @@ -7,15 +7,13 @@ * * @author Eole 'eoledev at outlook . fr' * -* @todo Complete the functions and finish the descriptions */ use OpenCloud\Common\Error; - + /** * Identity Class of the back-end application * -* This class allow the communication between the front-end application and -* the library which allow to send requests to an Openstack instance. +* This class implements the management for the identity request * */ class identity implements Core{ @@ -31,8 +29,6 @@ class identity implements Core{ * * @param App $app the main app object * - * @throws [Type] [<description>] - * * @return identity */ public function __construct($app){ @@ -47,11 +43,11 @@ class identity implements Core{ * * @param String $action name of another function of this class * - * @return void + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } /** @@ -65,7 +61,7 @@ class identity implements Core{ * @param String $type Required Type of credential : ec2, cert... * @param String $userId Required Id of the user which own the credential * - * @return void + * @return NULL */ private function addCredential(){ @@ -88,22 +84,22 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * List the credentials for a given user. * - * @return void + * @return NULL */ private function listCredentials(){ try{ @@ -114,15 +110,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -131,7 +127,7 @@ class identity implements Core{ * * @param String $credentialId Required credential id for which it retrieve the details * - * @return void + * @return NULL */ private function showCredential(){ $credentId = $this->app->getPostParam("credentialId"); @@ -149,15 +145,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -168,7 +164,7 @@ class identity implements Core{ * @param JsonString $blob Required credentials information with this structure for ec2: "{\"access\":\"181920\",\"secret\":\"secretKey\"}" * @param String $type Required Type of credential : ec2, cert... * - * @return void + * @return NULL */ private function updateCredential(){ @@ -194,15 +190,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -210,7 +206,7 @@ class identity implements Core{ * * @param String $credentialId Required credential id to delete * - * @return void + * @return NULL */ private function deleteCredential(){ @@ -229,16 +225,16 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + }- /** @@ -248,7 +244,7 @@ class identity implements Core{ * @param String $enabled Optional Domain enabled or not : value true or false * @param String $name Required Domain Name * - * @return void + * @return NULL */ private function addDomain(){ @@ -262,13 +258,13 @@ class identity implements Core{ } if(isset($enabled) && isset($description)) - $opt = array('description' => $description, 'enabled' => $enabled, 'name' => $name); + $opt = array('description' => $description, 'enabled' => $enabled, 'name' => $name); elseif(isset($enabled)) - $opt = array('enabled' => $enabled, 'name' => $name); + $opt = array('enabled' => $enabled, 'name' => $name); elseif(isset($description)) - $opt = array('description' => $description, 'name' => $name); + $opt = array('description' => $description, 'name' => $name); else - $opt = array('name' => $name); + $opt = array('name' => $name); try{ @@ -278,22 +274,22 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the different domain's list. * - * @return void + * @return NULL */ private function listDomains(){ @@ -305,15 +301,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -322,7 +318,7 @@ class identity implements Core{ * * @param String $domainId Required Domain id for which it retrieve the details * - * @return void + * @return NULL */ private function showDomain(){ @@ -341,15 +337,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -360,7 +356,7 @@ class identity implements Core{ * @param String $enabled Optional Domain enabled or not : value true or false * @param String $name Required Domain Name * - * @return void + * @return NULL */ private function updateDomain(){ @@ -374,17 +370,17 @@ class identity implements Core{ return; } - + try{ $domain = $this->libClass->getDomain($domId); if(isset($name)) - $domain->name = $name; + $domain->name = $name; if(isset($enabled)) - $domain->enabled = $enabled; + $domain->enabled = $enabled; if(isset($description)) - $domain->description = $description; + $domain->description = $description; $domain->update(); @@ -392,15 +388,15 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -408,7 +404,7 @@ class identity implements Core{ * * @param String $domainId Required Domain id to delete * - * @return void + * @return NULL */ private function deleteDomain(){ @@ -427,23 +423,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the different roles of a given user in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listRolesDomainUser(){ @@ -464,23 +458,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Grant a role to a given user in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function grantRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); @@ -496,31 +488,29 @@ class identity implements Core{ $domain = $this->libClass->getDomain($domId); $domain->grantUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Verify that a user has a given role in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function checkRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); @@ -545,23 +535,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a role for a given user in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function revokeRoleDomainUser(){ $domId = $this->app->getPostParam("domainId"); @@ -577,31 +565,29 @@ class identity implements Core{ $domain = $this->libClass->getDomain($domId); $domain->revokeUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the roles of a given group in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listRolesDomainGroup(){ $domId = $this->app->getPostParam("domainId"); @@ -622,23 +608,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a role to a given group in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function grantRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); @@ -654,31 +638,29 @@ class identity implements Core{ $domain = $this->libClass->getDomain($domId); $domain->grantGroupRole([ - 'groupId' => $groupId, - 'roleId' => $roleId, + 'groupId' => $groupId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Verify that a role is associated with a given group in a domain. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function checkRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); @@ -703,29 +685,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a role for a given group in a domain. * - * A *description*, that can span multiple lines, to go _in-depth_ into the details of this element - * and to provide some background information or textual references. - * - * @param string $myArgument With a *description* of this argument, these may also - * span multiple lines. - * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function revokeRoleDomainGroup(){ $domId = $this->app->getPostParam("domainId"); @@ -741,8 +715,8 @@ class identity implements Core{ $domain = $this->libClass->getDomain($roleId); $domain->revokeGroupRole([ - 'groupId' => $groupId, - 'roleId' => $roleId, + 'groupId' => $groupId, + 'roleId' => $roleId, ]); @@ -750,23 +724,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add an endpoint to the Openstack instance * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addEndpoint(){ $servId = $this->app->getPostParam("serviceId"); @@ -781,34 +753,32 @@ class identity implements Core{ try{ $endpoint = $this->libClass->createEndpoint([ - 'interface' => \OpenStack\Identity\v3\Enum::INTERFACE_INTERNAL, - 'name' => $name, - 'region' => $region, - 'url' => $url, - 'serviceId' => $servId + 'interface' => \OpenStack\Identity\v3\Enum::INTERFACE_INTERNAL, + 'name' => $name, + 'region' => $region, + 'url' => $url, + 'serviceId' => $servId ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the endpoint for the given id * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function getEndpoint(){ @@ -826,24 +796,24 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the list of the different endpoints * - * @return void + * @return NULL */ private function listEndpoints(){ - + try{ $res = $this->libClass->listEndpoints(); @@ -852,64 +822,30 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Update a given endpoint * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function updateEndpoint(){ //Not Implemented Yet - - /*$domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - - //TODO PARAMETERS - try{ - - $endpoint = $this->libClass->getEndpoint('{endpointId}'); - - $endpoint->interface = \OpenStack\Identity\v3\Enum::INTERFACE_PUBLIC; - - $endpoint->update(); - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * Delete a given endpoint * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deleteEndpoint(){ $endId = $this->app->getPostParam("endpointId"); @@ -927,129 +863,48 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addGroup(){ //Not Implemented Yet - - /*$domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * Retrieve the group's list. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listGroups(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * Retrieve the details of a given group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function showGroup(){ //Not Implemented Yet - - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * Update a given group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function updateGroup(){ //Todo Argument Optional @@ -1066,9 +921,9 @@ class identity implements Core{ $group = $this->libClass->getGroup($groupId); if(isset($description)) - $group->description = 'foo'; + $group->description = 'foo'; if(isset($name)) - $group->name = 'bar'; + $group->name = 'bar'; $group->update(); @@ -1076,23 +931,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete the given group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deleteGroup(){ @@ -1112,23 +965,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the users of a given group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listGroupUsers(){ @@ -1148,23 +999,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a user to a group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addGroupUser(){ @@ -1185,23 +1034,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Remove a user from a given group. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function removeGroupUser(){ @@ -1222,23 +1069,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Check if a group contains a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function checkGroupUser(){ @@ -1259,199 +1104,67 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * @todo * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addPolicies(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * @todo * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listPolicies(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * @todo * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function showPolicie(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * @todo * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function updatePolicies(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * @todo * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deletePolicies(){ //Not Implemented Yet - /* - $domId = $this->app->getPostParam("domainId"); - $groupId = $this->app->getPostParam("groupId"); - - if(!isset($domId) || !isset($groupId)){ - - } - try{ - - $this->libClass->listCredentials() - - //TODO parse answer - - }catch(BadResponseError $e){ - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }*/ } /** * Add a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addProject(){ //Todo Parameters Optional @@ -1465,30 +1178,30 @@ class identity implements Core{ try{ $project = $this->libClass->createProject([ - 'description' => $description, - 'enabled' => true, - 'name' => $name + 'description' => $description, + 'enabled' => true, + 'name' => $name ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the different projects. * - * @return void + * @return NULL */ private function listProjects(){ @@ -1500,23 +1213,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the details of a given project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function showProject(){ @@ -1535,23 +1246,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Update a given project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function updateProject(){ //Todo Parameters Optionnal @@ -1577,23 +1286,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a given project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deleteProject(){ $projId = $this->app->getPostParam("projId"); @@ -1612,23 +1319,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * List the roles of a given user in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listRolesProjectUser(){ @@ -1649,25 +1354,23 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Grant a role to an user in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function grantRoleProjectUser(){ @@ -1684,31 +1387,29 @@ class identity implements Core{ $project = $this->libClass->getProject($projId); $project->grantUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Check if a given user has a role in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function checkRoleProjectUser(){ $projId = $this->app->getPostParam("projetId"); @@ -1724,8 +1425,8 @@ class identity implements Core{ $project = $this->libClass->getProject($projId); $result = $project->checkUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); /*if (true === $result) { @@ -1735,23 +1436,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a role for a given user in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function revokeRoleProjectUser(){ @@ -1768,31 +1467,29 @@ class identity implements Core{ $project = $this->libClass->getProject($projId); $project->revokeUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * List the roles of a group in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listRolesProjectGroup(){ @@ -1803,7 +1500,7 @@ class identity implements Core{ if(!isset($projId) || !isset($groupId)){ } - + try{ $project = $this->libClass->getProject($projId); @@ -1814,23 +1511,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a role to a group in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function grantRoleProjectGroup(){ @@ -1841,37 +1536,35 @@ class identity implements Core{ if(!isset($projId) || !isset($userId) || !isset($roleId)){ } - + try{ $project = $this->libClass->getProject($projId); $project->grantUserRole([ - 'userId' => $userId, - 'roleId' => $roleId, + 'userId' => $userId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Check if a group has a given role in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function checkRoleProjectGroup(){ @@ -1888,8 +1581,8 @@ class identity implements Core{ $project = $this->libClass->getProject($projId); $result = $project->checkGroupRole([ - 'groupId' => $groupId, - 'roleId' => $roleId, + 'groupId' => $groupId, + 'roleId' => $roleId, ]); /*if (true === $result) { @@ -1898,23 +1591,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a role for a group in a project. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function revokeRoleProjectGroup(){ @@ -1931,31 +1622,29 @@ class identity implements Core{ $project = $this->libClass->getProject($projId); $project->revokeGroupRole([ - 'groupId' => $groupId, - 'roleId' => $roleId, + 'groupId' => $groupId, + 'roleId' => $roleId, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a role. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addRole(){ @@ -1968,28 +1657,28 @@ class identity implements Core{ try{ $role = $this->libClass->createRole([ - 'name' => $name, + 'name' => $name, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * List the different roles * - * @return void + * @return NULL */ private function listRoles(){ @@ -2001,21 +1690,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** - * @todo + * List the different assignments for a given role * - * @return void + * @return NULL */ private function listRoleAssignements(){ @@ -2027,23 +1716,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a service. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addService(){ $name = $this->app->getPostParam("name"); @@ -2056,29 +1743,29 @@ class identity implements Core{ try{ $service = $this->libClass->createService([ - 'name' => $name, - 'type' => $type, + 'name' => $name, + 'type' => $type, ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the different services. * - * @return void + * @return NULL */ private function listServices(){ @@ -2090,23 +1777,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the details for a given service. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function showService(){ $servId = $this->app->getPostParam("serviceId"); @@ -2123,23 +1808,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a given service. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deleteService(){ @@ -2159,23 +1842,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Generate a new token for a given user id. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function genTokenUserID(){ @@ -2189,33 +1870,31 @@ class identity implements Core{ try{ $token = $this->libClass->generateToken([ - 'user' => [ - 'id' => $userId, - 'password' => $userPass - ] + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ] ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Generate a new token for a given user name. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function genTokenUserName(){ $username = $this->app->getPostParam("username"); @@ -2230,36 +1909,34 @@ class identity implements Core{ try{ $token = $this->libClass->generateToken([ - 'user' => [ - 'name' => $username, - 'password' => $userPass, - 'domain' => [ - 'id' => $domId - ] - ] + 'user' => [ + 'name' => $username, + 'password' => $userPass, + 'domain' => [ + 'id' => $domId + ] + ] ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Generate a new token from another token ID. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function genTokenID(){ @@ -2273,31 +1950,29 @@ class identity implements Core{ try{ $token = $this->libClass->generateToken([ - 'tokenId' => $tokenId, - 'scope' => ['project' => ['id' => $projectId]] + 'tokenId' => $tokenId, + 'scope' => ['project' => ['id' => $projectId]] ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Generate a new token scoped by a project ID. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function genTokenScopedProjectID(){ @@ -2312,36 +1987,34 @@ class identity implements Core{ try{ $token = $this->libClass->generateToken([ - 'user' => [ - 'id' => $userId, - 'password' => $userPass - ], - 'scope' => [ - 'project' => ['id' => $projId] - ] + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => ['id' => $projId] + ] ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Generate a new token scoped by a project name. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function genTokenScopedProjectName(){ @@ -2357,41 +2030,39 @@ class identity implements Core{ try{ $token = $this->libClass->generateToken([ - 'user' => [ - 'id' => $userId, - 'password' => $userPass - ], - 'scope' => [ - 'project' => [ - 'name' => $projName, - 'domain' => [ - 'id' => $domId - ] - ] - ] + 'user' => [ + 'id' => $userId, + 'password' => $userPass + ], + 'scope' => [ + 'project' => [ + 'name' => $projName, + 'domain' => [ + 'id' => $domId + ] + ] + ] ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Check if a token is validate. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function validateToken(){ @@ -2413,23 +2084,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a given token. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function revokeToken(){ @@ -2447,23 +2116,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Add a new user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function addUser(){ //Todo Optionnal Parameter @@ -2475,40 +2142,40 @@ class identity implements Core{ $domId = $this->app->getPostParam("domId"); if(!isset($domId) || !isset($groupId)){ - + } try{ $user = $this->libClass->createUser([ - 'defaultProjectId' => $projId, - 'description' => $desc, - 'domainId' => $domId, - 'email' => $email, - 'enabled' => true, - 'name' => $name, - 'password' => $pass + 'defaultProjectId' => $projId, + 'description' => $desc, + 'domainId' => $domId, + 'email' => $email, + 'enabled' => true, + 'name' => $name, + 'password' => $pass ]); //TODO parse answer }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the different users. * - * @return void + * @return NULL */ private function listUsers(){ @@ -2520,23 +2187,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the details of a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function showUser(){ @@ -2555,23 +2220,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Update a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function updateUser(){ @@ -2596,23 +2259,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Delete a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function deleteUser(){ @@ -2631,23 +2292,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the groups which contains a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listUserGroups(){ @@ -2667,23 +2326,21 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** * Retrieve the projects which contains a given user. * - * @throws [Type] [<description>] - * - * @return void + * @return NULL */ private function listUserProjects(){ @@ -2703,14 +2360,14 @@ class identity implements Core{ }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } } diff --git a/server/core/Image.php b/server/core/Image.php index 334fce4..d930962 100755 --- a/server/core/Image.php +++ b/server/core/Image.php @@ -51,10 +51,10 @@ class image implements Core{ * * @param String $action name of another function of this class * - * @return void + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } /** @@ -78,13 +78,13 @@ class image implements Core{ if(isset($opt['name'])){ $imagesList = $this->listImage(); if(isset($imagesList)){ - foreach($imagesList as $image){ - if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error - $this->app->setOutput("Error", "Image name already exists"); - } - } - } - $options['name'] = $opt['name']; + foreach($imagesList as $image){ + if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error + $this->app->setOutput("Error", "Image name already exists"); + } + } + } + $options['name'] = $opt['name']; } else{ $this->app->setOutput("Error", "Missing parameter 'name' for the new image"); @@ -125,15 +125,15 @@ class image implements Core{ $image = $this->libClass->createImage($options); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } $this->app->setOutput("Images", $image); } @@ -152,15 +152,15 @@ class image implements Core{ } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } $this->app->setOutput("Images", $result); @@ -191,16 +191,16 @@ class image implements Core{ } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -254,15 +254,15 @@ class image implements Core{ $image->update($options); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } $this->app->setOutput("Images", $image); } } @@ -272,7 +272,7 @@ class image implements Core{ * * @param String $id Identifier of the image * - * @return void + * @return NULL */ private function deleteImage(){ $id = $this->app->getPostParam("id"); @@ -289,16 +289,16 @@ class image implements Core{ $image->delete(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -306,7 +306,7 @@ class image implements Core{ * * @param String $id Identifier of the image * - * @return void + * @return NULL */ private function reactivateImage(){ $id = $this->app->getPostParam("id"); @@ -326,16 +326,16 @@ class image implements Core{ $image->reactivate(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -343,7 +343,7 @@ class image implements Core{ * * @param String $id Identifier of the image * - * @return void + * @return NULL */ private function desactivateImage(){ $id = $this->app->getPostParam("id"); @@ -362,16 +362,16 @@ class image implements Core{ $image->deactivate(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -380,14 +380,14 @@ class image implements Core{ * @param String $id Identifier of the image * @param String $file_name Path of the image * - * @return void + * @return NULL */ private function uploadImage(){ $id = $this->app->getPostParam("id"); $file_name = $this->app->getPostParam("file_name"); - $file = $this->app->getPostParam("file"); + $file = $this->app->getPostParam("file"); error_log(print_r($file, true), 0); - + if(!isset($id)){ $this->app->setOutput("Error", "Incorrect id parameter"); } @@ -405,16 +405,16 @@ class image implements Core{ $image->uploadData($stream); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -440,17 +440,17 @@ class image implements Core{ $stream = $image->downloadData(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - $this->app->setOutput("Images", $stream); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + $this->app->setOutput("Images", $stream); + } } /** @@ -483,16 +483,16 @@ class image implements Core{ $this->app->setOutput("Images", $member_id); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } @@ -526,15 +526,15 @@ class image implements Core{ } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } $this->app->setOutput("Images", $members); } } @@ -572,15 +572,15 @@ class image implements Core{ } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } $this->app->setOutput("Images", $member); } } @@ -591,7 +591,7 @@ class image implements Core{ * @param String $image_id Identifier of the image * @param String $member_id Identifier of the member * - * @return void + * @return NULL */ private function removeMemberImage(){ $image_id = $this->app->getPostParam("image_id"); @@ -618,16 +618,16 @@ class image implements Core{ $member->delete(); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } /** @@ -637,7 +637,7 @@ class image implements Core{ * @param String $member_id Identifier of the member * @param String $status New status for the member * - * @return void + * @return NULL **/ private function updateMemberImage(){ $image_id = $this->app->getPostParam("image_id"); @@ -665,16 +665,16 @@ class image implements Core{ $member->updateStatus($status); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } + } } } diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 394db31..68a7dbd 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -22,33 +22,33 @@ class genTokenOptions $this->stack = HandlerStack::create(); $httpClient = new Client([ - 'base_uri' => Utils::normalizeUrl($options['authUrl']), - 'handler' => $this->stack, - ]); + 'base_uri' => Utils::normalizeUrl($options['authUrl']), + 'handler' => $this->stack, + ]); $this->httpClient = $httpClient; - $options['identityService'] = Service::factory($httpClient); + $options['identityService'] = Service::factory($httpClient); $options['authHandler'] = function () use ($options) { return $options['identityService']->generateToken($options); - }; + }; $this->optionsGlobal['Common'] = $options; } - - /** - * @codeCoverageIgnore - */ - private function addDebugMiddleware(array $options, HandlerStack &$stack) - { - if (!empty($options['debugLog']) - && !empty($options['logger']) - && !empty($options['messageFormatter']) - ) { - $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); - } - } + + /** + * @codeCoverageIgnore + */ + private function addDebugMiddleware(array $options, HandlerStack &$stack) + { + if (!empty($options['debugLog']) + && !empty($options['logger']) + && !empty($options['messageFormatter']) + ) { + $stack->push(GuzzleMiddleware::log($options['logger'], $options['messageFormatter'])); + } + } public function checkToken(){ //error_log(print_r($this->backup['time'], true), 0); @@ -73,9 +73,9 @@ class genTokenOptions $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Identity', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Identity'] = $options; @@ -98,15 +98,15 @@ class genTokenOptions $baseUrl = $this->backup['Identity']['baseUrl']; $stack = HandlerStack::create(); - + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Identity', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Identity'] = $options; @@ -122,14 +122,14 @@ class genTokenOptions $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Image', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Image'] = $options; @@ -150,7 +150,7 @@ class genTokenOptions $this->backup['Image'] = $opt; $token = $this->unserializeToken($this->backup['Image']['token']); $baseUrl = $this->backup['Image']['baseUrl']; - + $stack = HandlerStack::create(); $stack->push(Middleware::authHandler($options['authHandler'], $token)); @@ -158,9 +158,9 @@ class genTokenOptions $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Image', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Image'] = $options; } @@ -175,14 +175,14 @@ class genTokenOptions $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Network', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Network'] = $options; @@ -203,17 +203,17 @@ class genTokenOptions $this->backup['Network'] = $opt; $token = $this->unserializeToken($this->backup['Network']['token']); $baseUrl = $this->backup['Network']['baseUrl']; - + $stack = HandlerStack::create(); - + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Network', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Network'] = $options; } @@ -228,14 +228,14 @@ class genTokenOptions $stack = HandlerStack::create(); - $stack->push(Middleware::authHandler($options['authHandler'], $token)); + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Compute', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Compute'] = $options; @@ -257,17 +257,17 @@ class genTokenOptions $this->backup['Compute'] = $opt; $token = $this->unserializeToken($this->backup['Compute']['token']); $baseUrl = $this->backup['Compute']['baseUrl']; - + $stack = HandlerStack::create(); - + $stack->push(Middleware::authHandler($options['authHandler'], $token)); $this->addDebugMiddleware($options, $stack); $options['httpClient'] = new Client([ - 'base_uri' => Utils::normalizeUrl($baseUrl), - 'handler' => $stack, - ]); + 'base_uri' => Utils::normalizeUrl($baseUrl), + 'handler' => $stack, + ]); $this->saveBackup('Compute', array('token' => $token, 'baseUrl' => $baseUrl )); $this->optionsGlobal['Compute'] = $options; } @@ -426,7 +426,7 @@ class genTokenOptions $token->user->description = unserialize($this->backup["user"]["description"]); $token->issued = unserialize($tokenSerialized["issued"]); $token->id = unserialize($tokenSerialized["id"]); - + return $token; } } diff --git a/server/core/Network.php b/server/core/Network.php index e93c2c5..54b5d60 100755 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -22,9 +22,9 @@ use OpenCloud\Common\Error\UserInputError; */ class network{ -/** @var App $app protected, contains the main app object */ + /** @var App $app protected, contains the main app object */ protected $app; -/** @var OpenStack\Network $libClass protected, contains the library Network object */ + /** @var OpenStack\Network $libClass protected, contains the library Network object */ protected $libClass; @@ -49,11 +49,11 @@ class network{ * * @param String $action name of another function of this class * - * @return void + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } @@ -65,7 +65,7 @@ class network{ * @param String shared Specifies whether the network resource can be accessed by any tenant * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own * - * @return void + * @return NULL */ private function create_network() { @@ -102,19 +102,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } @@ -136,7 +136,7 @@ class network{ * * * - * @return void + * @return NULL */ private function create_subnet() @@ -200,24 +200,24 @@ class network{ try { - $subnet = $this->libClass->createSubnet($options); + $subnet = $this->libClass->createSubnet($options); } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } @@ -233,36 +233,36 @@ class network{ try { $ln = $this->libClass->listNetworks(); - + $list_ids = array(); - + foreach($ln as $n) { - + $list_ids[] = $n->id; - + } } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } - $this->app->setOutput("ListNetworkIds", $list_ids); + $this->app->setOutput("ListNetworkIds", $list_ids); } /** @@ -276,37 +276,37 @@ class network{ try { $ln = $this->libClass->listNetworks(); - + $list_names = array(); - + foreach($ln as $n) { - + $list_names[] = $n->name; - + } - + } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } - $this->app->setOutput("ListNetworkNames", $list_names); + $this->app->setOutput("ListNetworkNames", $list_names); } /** * List the CIDR of the SUBNETS @@ -317,32 +317,32 @@ class network{ { try { - $ls = $this->libClass->listSubnets(); - $list_cidr = array(); - foreach ($ls as $subnet) - { - - $list_cidr[] = $subnet->cidr; - } + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } - $this->app->setOutput("ListCidr", $list_cidr); + $this->app->setOutput("ListCidr", $list_cidr); } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** * retrieve a specific network @@ -364,21 +364,21 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } - $this->app->setOutput("Network", $network); + $this->app->setOutput("Network", $network); } /** @@ -401,21 +401,21 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } - return $network; + return $network; } /** @@ -437,21 +437,21 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } $this->app->setOutput("Subnet", subnet); - + } /** * internal function @@ -472,21 +472,21 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } return $subnet; - + } /** @@ -498,11 +498,11 @@ class network{ * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own * * - * @return void + * @return NULL **/ - private function updateNetwork() - { + private function updateNetwork() + { $options = array(); $name = $this->app->getPostParam("name"); $shared = $this->app->getPostParam("shared"); @@ -524,25 +524,25 @@ class network{ { $networkId = $this->app->getPostParam("networkId"); $network = getNetworkP($networkId); - + $network->update($options); } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -561,11 +561,11 @@ class network{ * @param String allocationPools Subranges of the CIDR available for dynamic allocation to ports * * - * @return void + * @return NULL **/ private function updateSubnet() - { + { $options = array(); $name = $this->app->getPostParam("name"); $networkId = $this->app->getPostParam("networkId"); @@ -596,19 +596,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -617,10 +617,10 @@ class network{ * @param String networkId ID if network which we want to delete * * - * @return void + * @return NULL **/ private function deleteNetwork() - { + { try { $networkId = $this->app->getPostParam("networkId"); @@ -630,19 +630,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -651,10 +651,10 @@ class network{ * @param String subnetId ID if network which we want to delete * * - * @return void + * @return NULL **/ private function deleteSubnet() - { + { try { $subnetId = $this->app->getPostParam("subnetId"); @@ -664,19 +664,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -692,7 +692,7 @@ class network{ * @param String securityGroups Specifies the IDs of any security groups associated with this port * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. * - * @return void + * @return NULL */ private function createPort() @@ -751,19 +751,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -781,19 +781,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -813,20 +813,20 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } + } /** @@ -846,20 +846,20 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } + } @@ -876,7 +876,7 @@ class network{ * @param String securityGroups Specifies the IDs of any security groups associated with this port * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. * - * @return void + * @return NULL */ private function updatePort() { @@ -935,28 +935,28 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** * Delete a port given * * @param String portId id of port which we wante to delete - * @return void + * @return NULL */ private function deletePort() - { + { try { @@ -967,19 +967,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -988,7 +988,7 @@ class network{ * @param String name A human-readable name for the security group. This name might not be unique * @param String description Description of the security group * - * @return void + * @return NULL */ private function createSecurityGroup() @@ -1012,20 +1012,20 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } + } /** @@ -1040,7 +1040,7 @@ class network{ *@param String remoteGroupId The remote group ID to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix *@param String remoteIpPrefix The remote IP prefix to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix * - * @return void + * @return NULL */ private function createSecurityGroupRule() { @@ -1093,19 +1093,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } @@ -1124,19 +1124,19 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } @@ -1150,26 +1150,26 @@ class network{ { try { - - $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); } catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } /** @@ -1189,20 +1189,20 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } + } /** @@ -1221,28 +1221,28 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } - + } + } /** * Delete a specific Security Groupe given * @param securityGroupeId ID of security Groupe which we want to get - * @return void + * @return NULL */ private function deleteSecurityGroupe() - { + { try { $securityGroupId = $this->app->getPostParam("securityGroupeId"); @@ -1252,18 +1252,18 @@ class network{ catch(BadResponseError $e) { $this->app->getErrorInstance->BadResponseHandler($e); - } + } catch(UserInputError $e) { $this->app->getErrorInstance->UserInputHandler($e); - } + } catch(BaseError $e) { $this->app->getErrorInstance->BaseErrorHandler($e); - } + } catch(NotImplementedError $e) { $this->app->getErrorInstance->NotImplementedHandler($e); - } + } } } diff --git a/server/core/NetworkLayer3.php b/server/core/NetworkLayer3.php index 30e8a78..c0b773a 100755 --- a/server/core/NetworkLayer3.php +++ b/server/core/NetworkLayer3.php @@ -51,10 +51,10 @@ class networkLayer3 { * * @param String $action name of another function of this class * - * @return void + * @return NULL */ public function action($action){ - $this->{$action.""}(); + $this->{$action.""}(); } @@ -75,15 +75,15 @@ class networkLayer3 { $this->app->setOutput("NetworkLayer3", $result); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -109,15 +109,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -147,7 +147,7 @@ class networkLayer3 { foreach ($res as $f) { if(strcmp($f->id, $id)){ $result = $f; - + } } @@ -159,15 +159,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -175,7 +175,7 @@ class networkLayer3 { * * @param id the id of the floatingip to update * - * @return void + * @return NULL */ private function updateFloatingIp(){ $id = $this->app->getPostParam("id"); @@ -197,7 +197,7 @@ class networkLayer3 { foreach ($res as $f) { if(strcmp($f->id, $id)){ $result = $f; - + } } @@ -208,15 +208,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } /** @@ -224,7 +224,7 @@ class networkLayer3 { * * @param string floatingip_id the floating-ip id to delete * - * @return void + * @return NULL */ private function deleteFloatingIp(){ $id = $this->app->getPostParam("id"); @@ -245,7 +245,7 @@ class networkLayer3 { foreach ($res as $f) { if(strcmp($f->id, $id)){ $result = $f; - + } } @@ -256,15 +256,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -273,7 +273,7 @@ class networkLayer3 { * * @param string floatingip_id the floating-ip id to retrieve * - * @return void + * @return NULL */ private function retrieveFloatingIp(){ $id = $this->app->getPostParam("id"); @@ -294,7 +294,7 @@ class networkLayer3 { foreach ($res as $f) { if(strcmp($f->id, $id)){ $result = $f; - + } } @@ -305,15 +305,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -344,15 +344,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -372,15 +372,15 @@ class networkLayer3 { $this->app->setOutput("NetworkLayer3", $result); }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -420,15 +420,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -437,7 +437,7 @@ class networkLayer3 { * * @param string router the router to delete * - * @return void + * @return NULL */ private function deleteRouter(){ $id = $this->app->getPostParam("id"); @@ -468,15 +468,15 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } @@ -485,7 +485,7 @@ class networkLayer3 { * * @param id the id of the floatingip to update * - * @return void + * @return NULL */ private function updateRouter(){ $id = $this->app->getPostParam("id"); @@ -507,7 +507,7 @@ class networkLayer3 { foreach ($res as $f) { if(strcmp($f->id, $id)){ $result = $f; - + } } @@ -518,14 +518,14 @@ class networkLayer3 { } }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ + }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ + }catch(BaseError $e){ $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ + }catch(NotImplementedError $e){ $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } + }catch(Exception $e){ + $this->app->getErrorInstance()->OtherException($e); + } } } |
