Add Network class Generation in App
This commit is contained in:
parent
fa77d200c5
commit
82cae7df99
2 changed files with 29 additions and 5 deletions
|
@ -6,6 +6,7 @@ class AppTest{
|
|||
|
||||
protected $openstack;
|
||||
protected $pluginsApi;
|
||||
protected $postParams;
|
||||
protected $tokenClass;
|
||||
protected $tokenPost;
|
||||
protected $output;
|
||||
|
@ -15,8 +16,10 @@ class AppTest{
|
|||
$this->tokenPost = NULL;
|
||||
$this->tokenClass = new genTokenOptions($args);
|
||||
$this->openstack = new OpenStack\OpenStack([]);
|
||||
$this->pluginsApi = plugin_api::getInstance();
|
||||
$this->pluginsApi = plugin_api::getInstance();
|
||||
$this->errorClass = new errorManagement($this);
|
||||
$this->output = array();
|
||||
$this->postParams = $_POST;
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,6 +43,11 @@ class AppTest{
|
|||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->imagesV2($opt);
|
||||
break;
|
||||
case "Network":
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->networkingV2($opt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,10 +61,21 @@ class AppTest{
|
|||
$this->tokenClass->genNetworkToken();
|
||||
|
||||
$this->setOutput("token", $this->tokenClass->getBackup());
|
||||
}catch(Exception $e){
|
||||
echo $e;
|
||||
exit();
|
||||
}
|
||||
}catch(BadResponseError $e){
|
||||
$this->errorClass->BadResponseHandler($e);
|
||||
}catch(UserInputError $e){
|
||||
$this->errorClass->UserInputHandler($e);
|
||||
}catch(BaseError $e){
|
||||
$this->errorClass->BaseErrorHandler($e);
|
||||
}catch(NotImplementedError $e){
|
||||
$this->errorClass->NotImplementedHandler($e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPostParam($name){
|
||||
|
||||
return $this->postParams[$name];
|
||||
|
||||
}
|
||||
|
||||
|
|
5
server/core/App.php
Normal file → Executable file
5
server/core/App.php
Normal file → Executable file
|
@ -50,6 +50,11 @@ class App{
|
|||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->imagesV2($opt);
|
||||
break;
|
||||
case "Network":
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->networkingV2($opt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue