diff options
| author | EoleDev <EoleDev@outlook.fr> | 2016-02-05 00:07:31 +0100 |
|---|---|---|
| committer | EoleDev <EoleDev@outlook.fr> | 2016-02-05 00:07:31 +0100 |
| commit | c2a5b1880c19c1490c42eb40a6a15ce2bc64b9e9 (patch) | |
| tree | 8a83582ed8d5feb01b4b68ecad541a83fe385ace /server/core/App.php | |
| parent | b39f5c1cd4631be3259b272e1f6cbe9b4915410b (diff) | |
Request Analyse reviewed, Server Initialisation Reviewed, Core Class Interface Created, App created
Diffstat (limited to 'server/core/App.php')
| -rwxr-xr-x | server/core/App.php | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/server/core/App.php b/server/core/App.php new file mode 100755 index 0000000..45f6922 --- /dev/null +++ b/server/core/App.php @@ -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);
+ }
+
+}
\ No newline at end of file |
