diff options
| author | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-26 23:37:10 +0200 |
|---|---|---|
| committer | Loic GUEGAN <loic@Manzerbredes.home> | 2016-04-26 23:37:10 +0200 |
| commit | a845b20ee91cd6aa9981551206aec1a85dd407f8 (patch) | |
| tree | c5451bd27c727e0937871f86856ec1a22c7f84ef /server/core/FloatingIp.php | |
| parent | 91b6918ef3f830c46eac5aa0249edb7f52ba87cd (diff) | |
| parent | 477dc821824b422c11d0d34b644de4b68a596510 (diff) | |
Merge branch 'loic' into loic-image-edition
Diffstat (limited to 'server/core/FloatingIp.php')
| -rwxr-xr-x | server/core/FloatingIp.php | 195 |
1 files changed, 0 insertions, 195 deletions
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php deleted file mode 100755 index 4271a84..0000000 --- a/server/core/FloatingIp.php +++ /dev/null @@ -1,195 +0,0 @@ -<?php -/** -* File containing the FloatingIp Class. -* -* @version 1.0 Initialisation of this file -* @since 1.0 Core application's file -* -* @author Evan Pisani 'yogg at epsina . com' -* -* @todo Complete the functions with errors detection and finish the descriptions -*/ -use OpenCloud\Common\Error\BadResponseError; -use OpenCloud\Common\Error\BaseError; -use OpenCloud\Common\Error\NotImplementedError; -use OpenCloud\Common\Error\UserInputError; - -include("CoreInterface.php"); - -/** -* Image Class of the back-end application -* -* Management of images -* -*/ -class floatingIp implements Core{ - - /** @var App $app protected, contains the main app object */ - protected $app; - - /** @var OpenStack\Identity $libClass protected, contains the library Identity object */ - protected $libClass; - - /** - * Image constructor - * - * @param App $app the main app object - * - * @return Image - */ - public function __construct($app){ - if(!isset($app)){ - $this->app->setOutput("Error", "Incorrect parameter app"); - } - $this->app = $app; - $this->libClass = $app->getLibClass("FloatingIp"); - } - - - /** - * Execute an action - * - * @param String $action name of another function of this class - * - * @return void - */ - public function action($action){ - $this->{$action.""}(); - } - - /** - * Create a new floating IP adress - * - * @param array $opt Options for the floating ip creation (floatingipo and floating network id are required, others are optionals) - * - * @return floatingip - */ - private function createFloatingIp(){ - $opt = $this->app->getPostParam("opt"); - - if(!isset($opt)){ - $this->app->setOutput("Error", "Incorrect parameter opt"); - } - try{ - $floatingip = $this->libClass->create($opt); - if(!isset){ - $this->app->setOutput("Error", "Unknowing error during floating ip creation"); - } - else{ - $this->app->setOutput("FloatingIp", $floatingip); - } - }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 floating ip - * - * @param id the id of the floatingip to update - * - * @return Image - */ - private function updateFloatingIp(){ - $id = $this->app->getPostParam("id"); - - if(!isset($id)){ - $this->app->setOutput("Error", "Incorrect parameter opt"); - } - try{ - $floatingip = null; //obtenir ip - - $floatingip->update(); - - if(!isset){ - $this->app->setOutput("Error", "Unknowing error during floating ip creation"); - } - }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 floating ip - * - * @param string floatingip_id the floating-ip id to delete - * - * @return void - */ - private function deleteFloatingIp(){ - $id = $this->app->getPostParam("id"); - - if(!isset($id)){ - $this->app->setOutput("Error", "Incorrect parameter opt"); - } - try{ - $floatingip = null; //obtenir ip - - $floatingip->delete(); - - if(!isset){ - $this->app->setOutput("Error", "Unknowing error during floating ip creation"); - } - }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 a floating ip - * - * @param string floatingip_id the floating-ip id to retrieve - * - * @return void - */ - private function retrieveFloatingIp(){ - $id = $this->app->getPostParam("id"); - - if(!isset($id)){ - $this->app->setOutput("Error", "Incorrect parameter opt"); - } - try{ - $floatingip = null; //obtenir ip - - $floatingip->retrieve(); - - if(!isset){ - $this->app->setOutput("Error", "Unknowing error during floating ip creation"); - } - }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); - } - } -} |
