Request Analyse reviewed, Server Initialisation Reviewed, Core Class Interface Created, App created

This commit is contained in:
EoleDev 2016-02-05 00:07:31 +01:00
parent b39f5c1cd4
commit c2a5b1880c
6 changed files with 147 additions and 83 deletions

68
server/core/App.php Executable file
View file

@ -0,0 +1,68 @@
<?php
include_once("core/Plugin_Api.php");
include_once("core/LibOverride/genTokenOptions.php");
class App{
protected $openstack;
protected $pluginsApi;
protected $tokenClass;
protected $tokenPost;
protected $output;
public function __construct($args){
$this->tokenPost = NULL;
$this->tokenClass = new genTokenOptions($args);
$this->openstack = new OpenStack\OpenStack([]);
$this->pluginsApi = plugin_api::getInstance();
$this->output = array();
}
public function setToken($token){
$this->tokenPost = $token;
$this->tokenClass->loadBackup($his->tokenPost);
}
public function getLibClass($service){
switch($service){
case "Identity":
if($tokenPost == NULL) $tokenClass->genIdentityToken();
$opt = $tokenClass->getOptions($service);
return $this->openstack->identityV3($opt);
break;
}
}
public function authenticate(){
try{
$this->tokenClass->genIdentityToken();
$this->tokenClass->genComputeToken();
$this->tokenClass->genImageToken();
$this->tokenClass->genNetworkToken();
$this->setOutput("token", $this->tokenClass->getBackup());
}catch(Exception $e){
echo $e;
exit();
}
}
public function setOutput($key, $out){
$this->output[$key] = $out;
}
public function show(){
echo json_encode($this->output);
}
}