tentative ip publique

This commit is contained in:
Yoggzo 2016-04-19 23:57:03 +02:00
parent 438b9b4dcd
commit 94629aeaf5
3 changed files with 111 additions and 7 deletions

View file

@ -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."</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){

View file

@ -40,7 +40,7 @@ class network{
public function __construct($app){
$this->app = $app;
$this->libClass = $app->getLibClass("network");
$this->libClass = $app->getLibClass("Network");
}