Init file for php-opencloud api - Config file
This commit is contained in:
parent
a44cc1d2e3
commit
5f34f504b0
4 changed files with 84 additions and 0 deletions
7
server/config.inc.php
Normal file
7
server/config.inc.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
<?php
|
||||
$config = Array();
|
||||
|
||||
$config["modules_enabled"] = "";
|
||||
?>
|
||||
|
||||
|
6
server/index.php
Normal file
6
server/index.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
require "vendor/autoload.php";
|
||||
include_once("config.inc.php");
|
||||
include_once("init.php");
|
||||
|
||||
|
35
server/init.php
Normal file
35
server/init.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
include_once("config.inc.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);
|
||||
|
||||
?>
|
36
server/test.php
Normal file
36
server/test.php
Normal file
|
@ -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." !!! ";
|
||||
//}
|
Loading…
Add table
Reference in a new issue