diff options
Diffstat (limited to 'server/core')
| -rwxr-xr-x | server/core/FloatingIp.php | 51 | ||||
| -rwxr-xr-x | server/core/Network.php | 2 |
2 files changed, 50 insertions, 3 deletions
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php index f26c3fb..528ab4f 100755 --- a/server/core/FloatingIp.php +++ b/server/core/FloatingIp.php @@ -68,7 +68,6 @@ class floatingIp { $result = array(); $l = $this->libClass->listFloatingIps(); error_log(var_export($l, true), 0); - echo 'toto'; foreach ($l as $tmp) { $result[] = $tmp; } @@ -101,7 +100,8 @@ class floatingIp { $this->app->setOutput("Error", "Incorrect parameter opt"); } try{ - $floatingip = $this->libClass->create($opt); + $floatingip = $this->libClass->createFloatingIp($opt); + echo 'YOLO'; if(!isset($floatingip)){ $this->app->setOutput("Error", "Unknowing error during floating ip creation"); } @@ -109,6 +109,53 @@ class floatingIp { $this->app->setOutput("FloatingIp", $floatingip); } }catch(BadResponseError $e){ + echo $e."</br>"; + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + echo $e."</br>"; + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + echo $e."</br>"; + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + echo $e."</br>"; + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + echo $e->getMessage()."</br>"; + $this->app->getErrorInstance()->OtherException($e); + } + } + + + /** + * Show floatingip details + * + * @param String id the id of the floatingip + * + * @return floatingip details + */ + private function getFloatingIp(){ + $id = $this->app->getPostParam("id"); + if(!isset($id)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + + try{ + /*$l = $this->listFloatingIp(); + $res = null; + foreach ($l as $f) { + if($f['id']==$id){ + $res = $f; + } + } + if(!isset($f)){ + $this->app->setOutput("Error", "Unknow id"); + } + else{*/ + $res = $this->libClass->getFloatingIp($id); + $this->app->setOutput("FloatingIp", $res); + //} + }catch(BadResponseError $e){ $this->app->getErrorInstance()->BadResponseHandler($e); }catch(UserInputError $e){ $this->app->getErrorInstance()->UserInputHandler($e); diff --git a/server/core/Network.php b/server/core/Network.php index 9564f06..3e5e2ca 100755 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -40,7 +40,7 @@ class network{ public function __construct($app){ $this->app = $app; - $this->libClass = $app->getLibClass("network"); + $this->libClass = $app->getLibClass("Network"); } |
