Merge branch 'develop' of github.com:manzerbredes/istic-openstack into develop
This commit is contained in:
commit
4819078870
9 changed files with 1932 additions and 82 deletions
server/core
|
@ -1,13 +1,21 @@
|
|||
<?php
|
||||
include_once("core/Plugin_Api.php");
|
||||
include_once("core/LibOverride/genTokenOptions.php");
|
||||
include_once("core/ErrorManagement.php");
|
||||
|
||||
use OpenStack\Common\Error\BadResponseError;
|
||||
use OpenStack\Common\Error\BaseError;
|
||||
use OpenStack\Common\Error\NotImplementedError;
|
||||
use OpenStack\Common\Error\UserInputError;
|
||||
|
||||
class App{
|
||||
|
||||
protected $openstack;
|
||||
protected $pluginsApi;
|
||||
protected $postParams;
|
||||
protected $tokenClass;
|
||||
protected $tokenPost;
|
||||
protected $errorClass;
|
||||
protected $output;
|
||||
|
||||
public function __construct($args){
|
||||
|
@ -16,7 +24,9 @@ class App{
|
|||
$this->tokenClass = new genTokenOptions($args);
|
||||
$this->openstack = new OpenStack\OpenStack([]);
|
||||
$this->pluginsApi = plugin_api::getInstance();
|
||||
$this->errorClass = new errorManagement($this);
|
||||
$this->output = array();
|
||||
$this->postParams = $_POST;
|
||||
|
||||
}
|
||||
|
||||
|
@ -31,14 +41,14 @@ class App{
|
|||
|
||||
switch($service){
|
||||
case "Identity":
|
||||
if($tokenPost == NULL) $tokenClass->genIdentityToken();
|
||||
$opt = $tokenClass->getOptions($service);
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genIdentityToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->identityV3($opt);
|
||||
break;
|
||||
case "Image":
|
||||
if($tokenPost == NULL) $tokenClass->genImageToken();
|
||||
$opt = $tokenClass->getOptions($service);
|
||||
return $this->$openstack->imagesV2($opt);
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genImageToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->imagesV2($opt);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -53,10 +63,21 @@ class App{
|
|||
$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];
|
||||
|
||||
}
|
||||
|
||||
|
@ -66,6 +87,12 @@ class App{
|
|||
|
||||
}
|
||||
|
||||
public function getErrorInstance(){
|
||||
|
||||
return $this->errorClass;
|
||||
|
||||
}
|
||||
|
||||
public function show(){
|
||||
echo json_encode($this->output);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue