diff options
Diffstat (limited to 'server')
| -rw-r--r-- | server/config.inc.php | 7 | ||||
| -rw-r--r-- | server/core/Compute.php | 1 | ||||
| -rw-r--r-- | server/core/Identity.php | 1 | ||||
| -rw-r--r-- | server/core/Image.php | 1 | ||||
| -rw-r--r-- | server/core/Network.php | 1 | ||||
| -rw-r--r-- | server/core/Plugin.php | 13 | ||||
| -rw-r--r-- | server/core/Plugin_Api.php | 24 | ||||
| -rw-r--r-- | server/core/Readme.txt | 1 | ||||
| -rw-r--r-- | server/index.php | 9 | ||||
| -rw-r--r-- | server/init.php | 37 | ||||
| -rw-r--r-- | server/modules/Readme.txt | 1 | ||||
| -rw-r--r-- | server/test.php | 36 |
12 files changed, 132 insertions, 0 deletions
diff --git a/server/config.inc.php b/server/config.inc.php new file mode 100644 index 0000000..07adcbd --- /dev/null +++ b/server/config.inc.php @@ -0,0 +1,7 @@ +<?php + $config = Array(); + + $config["modules_enabled"] = ""; +?> + + diff --git a/server/core/Compute.php b/server/core/Compute.php new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/core/Compute.php @@ -0,0 +1 @@ + diff --git a/server/core/Identity.php b/server/core/Identity.php new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/core/Identity.php @@ -0,0 +1 @@ + diff --git a/server/core/Image.php b/server/core/Image.php new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/core/Image.php @@ -0,0 +1 @@ + diff --git a/server/core/Network.php b/server/core/Network.php new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/core/Network.php @@ -0,0 +1 @@ + diff --git a/server/core/Plugin.php b/server/core/Plugin.php new file mode 100644 index 0000000..e6fd8a7 --- /dev/null +++ b/server/core/Plugin.php @@ -0,0 +1,13 @@ +<?php + +abstract class plugin{ + + public $api; + + public function __construct($api){ + + $this->api = $api; + + } + +} diff --git a/server/core/Plugin_Api.php b/server/core/Plugin_Api.php new file mode 100644 index 0000000..c2a9041 --- /dev/null +++ b/server/core/Plugin_Api.php @@ -0,0 +1,24 @@ +<?php + +//Init plugin directory +if (!defined('PLUGINS_DIR')) { + define('PLUGINS_DIR', INSTALL_PATH . 'plugins/'); +} + +class plugin_api{ + + static protected $instance; + + protected function __construct(){ + + } + + static function getInstance(){ + + if(!self::$instance){ + self::$instance = new plugin_api(); + } + + return self::$instance; + } +} diff --git a/server/core/Readme.txt b/server/core/Readme.txt new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/core/Readme.txt @@ -0,0 +1 @@ + diff --git a/server/index.php b/server/index.php new file mode 100644 index 0000000..ca84641 --- /dev/null +++ b/server/index.php @@ -0,0 +1,9 @@ +<?php + require "vendor/autoload.php"; + include_once("config.inc.php"); + include_once("init.php"); + + $task = $_POST["task"]; + $action = $_POST["action"]; + + diff --git a/server/init.php b/server/init.php new file mode 100644 index 0000000..ff7f90b --- /dev/null +++ b/server/init.php @@ -0,0 +1,37 @@ +<?php + include_once("config.inc.php"); + include_once("core/Plugin_Api.php"); + require "vendor/autoload.php"; + + //traitement requete, recuperation data + if(isset($_POST["key"])){ + //recuperation des donnes sauvegardes + + }else if(isset($_POST["user"]) && isset($_POST["password"]) && isset($_POST["project"]) ){ + + $user = $_POST["user"]; + $password = $_POST["password"]; + $project = $_POST["project"]; + + $Args = Array( + "user" => Array( + "name" => $user, + "password" => $password, + "domain" => Array( + "name" => "Default") + ), + "scope" => Array( + "project" => Array( + "name" => $project, + "domain" => Array( + "name" => "Default") + ) + ), + "authUrl" => $urlAuth + ); + } + + $openstack_api = new OpenStack\OpenStack($Args); + + $pluginApi = plugin_api::getInstance(); +?> diff --git a/server/modules/Readme.txt b/server/modules/Readme.txt new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/server/modules/Readme.txt @@ -0,0 +1 @@ + diff --git a/server/test.php b/server/test.php new file mode 100644 index 0000000..16555e4 --- /dev/null +++ b/server/test.php @@ -0,0 +1,36 @@ +<?php +ini_set('display_errors', 1); +date_default_timezone_set("Europe/Paris"); +require 'vendor/autoload.php'; + +$options = Array(); +$options["user"] = Array("name"=>"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]); +$options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"])); +$options["authUrl"] = "http://148.60.11.31:5000/v3"; + +$openstack = new OpenStack\OpenStack($options); + +//$identity = $openstack->identityV3(); +//var_dump($identity); +// Since usernames will not be unique across an entire OpenStack installation, +// when authenticating with them you must also provide your domain ID. You do +// not have to do this if you authenticate with a user ID. + +/*$token = $identity->generateToken([ + 'user' => [ + 'name' => 'admin', + 'password' => 'ae5or6cn', + 'domain' => [ + 'id' => 'Default' + ] + ] + ]); + */ +$compute = $openstack->computeV2(["region" => "RegionOne"]); +//var_dump($compute->client); +//$servers = $compute->listServers(true); + +//foreach($servers as $server){ +// echo $server->id." !!! "; +// echo $server->name." !!! "; +//} |
