trying test floatingip
This commit is contained in:
parent
2d260aa6f5
commit
3795d05a97
3 changed files with 53 additions and 24 deletions
|
@ -14,7 +14,7 @@ use OpenCloud\Common\Error\BaseError;
|
|||
use OpenCloud\Common\Error\NotImplementedError;
|
||||
use OpenCloud\Common\Error\UserInputError;
|
||||
|
||||
include("CoreInterface.php");
|
||||
//include("CoreInterface.php");
|
||||
|
||||
/**
|
||||
* Image Class of the back-end application
|
||||
|
@ -22,7 +22,7 @@ include("CoreInterface.php");
|
|||
* Management of images
|
||||
*
|
||||
*/
|
||||
class floatingIp implements Core{
|
||||
class floatingIp {
|
||||
|
||||
/** @var App $app protected, contains the main app object */
|
||||
protected $app;
|
||||
|
@ -31,11 +31,11 @@ class floatingIp implements Core{
|
|||
protected $libClass;
|
||||
|
||||
/**
|
||||
* Image constructor
|
||||
* floatingip constructor
|
||||
*
|
||||
* @param App $app the main app object
|
||||
*
|
||||
* @return Image
|
||||
* @return floatingip
|
||||
*/
|
||||
public function __construct($app){
|
||||
if(!isset($app)){
|
||||
|
@ -57,6 +57,36 @@ class floatingIp implements Core{
|
|||
$this->{$action.""}();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* List floatingip
|
||||
*
|
||||
* @return list of the floatingip
|
||||
*/
|
||||
private function listFloatingIp(){
|
||||
try{
|
||||
$result = array();
|
||||
$l = $this->libClass->getFloatingIps();
|
||||
|
||||
|
||||
|
||||
foreach ($l as $tmp) {
|
||||
$serult[] = $tmp;
|
||||
}
|
||||
$this->app->setOutput("FloatingIp", $result);
|
||||
}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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new floating IP adress
|
||||
*
|
||||
|
@ -72,7 +102,7 @@ class floatingIp implements Core{
|
|||
}
|
||||
try{
|
||||
$floatingip = $this->libClass->create($opt);
|
||||
if(!isset){
|
||||
if(!isset($floatingip)){
|
||||
$this->app->setOutput("Error", "Unknowing error during floating ip creation");
|
||||
}
|
||||
else{
|
||||
|
@ -118,9 +148,6 @@ class floatingIp implements Core{
|
|||
|
||||
$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){
|
||||
|
@ -161,9 +188,6 @@ class floatingIp implements Core{
|
|||
|
||||
$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){
|
||||
|
@ -203,10 +227,6 @@ class floatingIp implements Core{
|
|||
}
|
||||
|
||||
$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){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue