From 94629aeaf523f391f09ef18c1b2ca639e0b02d08 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Tue, 19 Apr 2016 23:57:03 +0200 Subject: tentative ip publique --- server/core/FloatingIp.php | 51 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'server/core/FloatingIp.php') 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,13 +100,61 @@ 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"); } else{ $this->app->setOutput("FloatingIp", $floatingip); } + }catch(BadResponseError $e){ + echo $e."
"; + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + echo $e."
"; + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + echo $e."
"; + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + echo $e."
"; + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + echo $e->getMessage()."
"; + $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){ -- cgit v1.2.3