diff --git a/client/partials/nav.html b/client/partials/nav.html
deleted file mode 100644
index b3ef76a..0000000
--- a/client/partials/nav.html
+++ /dev/null
@@ -1,41 +0,0 @@
-
diff --git a/client/partials/network/main.html b/client/partials/network/network.html
similarity index 100%
rename from client/partials/network/main.html
rename to client/partials/network/network.html
diff --git a/client/partials/status.html b/client/partials/status.html
new file mode 100644
index 0000000..01b9079
--- /dev/null
+++ b/client/partials/status.html
@@ -0,0 +1,29 @@
+
diff --git a/index.php b/index.php
index e69de29..cf60860 100644
--- a/index.php
+++ b/index.php
@@ -0,0 +1,3 @@
+
diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
index 4d7cab5..e1631c5 100755
--- a/server/Test/AppTestClass.php
+++ b/server/Test/AppTestClass.php
@@ -1,6 +1,12 @@
pluginsApi = plugin_api::getInstance();
$this->errorClass = new errorManagement($this);
$this->output = array();
+
+ $this->errorClass = new errorManagement($this);
+
$this->postParams = $_POST;
}
@@ -79,10 +89,16 @@ class AppTest{
}
public function getPostParam($name){
-
+
return $this->postParams[$name];
}
+
+ public function setPostParam($name, $value){
+
+ $this->postParams[$name] = $value;
+
+ }
public function setOutput($key, $out){
@@ -94,4 +110,12 @@ class AppTest{
return json_encode($this->output);
}
+
+ public function getErrorInstance(){
+
+ return $this->errorClass;
+
+ }
}
+
+
diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php
index 94ff7b6..d184d44 100644
--- a/server/Test/imageTests.php
+++ b/server/Test/imageTests.php
@@ -1,35 +1,6 @@
"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"]);
-//$image= $openstack->imagesV2(["region" => "RegionOne"]);
-//var_dump($compute->client);
-//$servers = $compute->listServers(true);
-echo 'toto';
+include('InitTest.php');
+include_once("../core/Image.php");
$image = new Image($App);
@@ -43,53 +14,38 @@ $opt['minDisk'] = 1;
$opt['protected'] = false;
$opt['minRam'] = 10;
-//$new_image = $image->create_image($opt);
+//$App->setPostParam('id', 'sdfihlus154dfhj');
+//$err = $image->action("createImage");
//Liste des images
-$images = $image->list_images();
+$image->action("listImage");
+$im = $App->show();
+$images = json_decode($im, true)["Images"];
+$recup;
echo "Images présentes :";
echo "";
-
foreach($images as $i){
- echo $i->name;
- if($i->name == "Test"){
- $id_image = $i->id;
- $list = $i->tags;
- echo $i->status;
- }
+ $recup = $i;
+ echo $recup['name'];
echo "";
-}
+ //echo $recup['id'];
+ }
echo "";
+echo "Erreur capturée: ";
+echo "";
+
+/*
+$App->setPostParam('id', 354);
+$err = $image->action("deleteImage");
+$temp = $App->show();
+$ret = json_decode($temp, true)["Images"];
+echo $ret['id'];
+*/
-if(isset($list)){
- foreach ($list as $l) {
- echo $l;
- echo "";
- }
-}
-// Détails Image
-//$details = $image->image_details($id_image);
-//$image->delete_image('123456');
-//$image->desactivate_image($id_image);
-//$image->reactivate_image($id_image);
-
-//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
-//$image->upload_image($id_image, $file_name);
-
-//$image->download_image($id_image);
-
-/*
-$opt_update = Array();
-$opt_update['name'] = "Test";
-$opt_update['tags'] = null;
-
-$update = $image->update_image($id_image, $opt_update);
-echo $update->name;
-*/
?>
\ No newline at end of file
diff --git a/server/composer.json b/server/composer.json
index d5e2dbc..9d44d6e 100644
--- a/server/composer.json
+++ b/server/composer.json
@@ -1,5 +1,6 @@
{
"require": {
- "php-opencloud/openstack": "dev-master"
+ "php-opencloud/openstack": "dev-master",
+ "php-opencloud/common": "dev-master"
}
}
diff --git a/server/composer.lock b/server/composer.lock
index c6598db..6ab8a7f 100644
--- a/server/composer.lock
+++ b/server/composer.lock
@@ -4,8 +4,8 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
- "hash": "e7cbd5d3df36fb1a3f3378b837068196",
- "content-hash": "125e4702f7a417475a4150c889ac6c3d",
+ "hash": "7647ed348aee68f2db6b71e4d2fb1fe7",
+ "content-hash": "82731500d050a65f09e92b70c1f96ea9",
"packages": [
{
"name": "guzzlehttp/guzzle",
@@ -71,16 +71,16 @@
},
{
"name": "guzzlehttp/promises",
- "version": "1.0.3",
+ "version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/guzzle/promises.git",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
+ "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8",
+ "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8",
"shasum": ""
},
"require": {
@@ -118,20 +118,20 @@
"keywords": [
"promise"
],
- "time": "2015-10-15 22:28:00"
+ "time": "2016-03-08 01:15:46"
},
{
"name": "guzzlehttp/psr7",
- "version": "1.2.2",
+ "version": "1.2.3",
"source": {
"type": "git",
"url": "https://github.com/guzzle/psr7.git",
- "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb"
+ "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5d04bdd2881ac89abde1fb78cc234bce24327bb",
- "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
+ "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
"shasum": ""
},
"require": {
@@ -176,7 +176,7 @@
"stream",
"uri"
],
- "time": "2016-01-23 01:23:02"
+ "time": "2016-02-18 21:54:00"
},
{
"name": "justinrainbow/json-schema",
@@ -245,28 +245,27 @@
"time": "2016-01-25 15:43:01"
},
{
- "name": "php-opencloud/openstack",
+ "name": "php-opencloud/common",
"version": "dev-master",
"source": {
"type": "git",
- "url": "https://github.com/php-opencloud/openstack.git",
- "reference": "15aca73f423166c7ef8337ba08615c103c66e931"
+ "url": "https://github.com/php-opencloud/common.git",
+ "reference": "fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/15aca73f423166c7ef8337ba08615c103c66e931",
- "reference": "15aca73f423166c7ef8337ba08615c103c66e931",
+ "url": "https://api.github.com/repos/php-opencloud/common/zipball/fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62",
+ "reference": "fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62",
"shasum": ""
},
"require": {
"guzzlehttp/guzzle": "~6.1",
"justinrainbow/json-schema": "~1.3",
- "php": ">=5.6"
+ "php": "~7.0"
},
"require-dev": {
"fabpot/php-cs-fixer": "~1.0",
"jakub-onderka/php-parallel-lint": "0.*",
- "phpspec/prophecy-phpunit": "~1.0",
"phpunit/phpunit": "~4.0",
"psr/log": "~1.0",
"sami/sami": "dev-master",
@@ -275,9 +274,9 @@
"type": "library",
"autoload": {
"psr-4": {
- "OpenStack\\": "src/",
- "OpenStack\\Test\\": "tests/unit/",
- "OpenStack\\Integration\\": "tests/integration/"
+ "OpenCloud\\": "src/",
+ "OpenCloud\\Test\\": "tests/unit/",
+ "OpenCloud\\Integration\\": "tests/integration/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -288,7 +287,57 @@
"homepage": "https://github.com/jamiehannaford"
}
],
- "time": "2016-01-25 10:35:10"
+ "time": "2016-03-08 12:56:34"
+ },
+ {
+ "name": "php-opencloud/openstack",
+ "version": "dev-master",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-opencloud/openstack.git",
+ "reference": "f2ee77024843659d970817a9e7055bb40a3724f9"
+ },
+ "dist": {
+ "type": "zip",
+<<<<<<< HEAD
+<<<<<<< Updated upstream
+ "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/15aca73f423166c7ef8337ba08615c103c66e931",
+=======
+ "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/f2ee77024843659d970817a9e7055bb40a3724f9",
+>>>>>>> develop
+ "reference": "15aca73f423166c7ef8337ba08615c103c66e931",
+=======
+ "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/f2ee77024843659d970817a9e7055bb40a3724f9",
+ "reference": "f2ee77024843659d970817a9e7055bb40a3724f9",
+>>>>>>> Stashed changes
+ "shasum": ""
+ },
+ "require": {
+ "php-opencloud/common": "dev-master"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.*",
+ "phpunit/phpunit": "~4.0",
+ "psr/log": "~1.0",
+ "sami/sami": "dev-master",
+ "satooshi/php-coveralls": "~1.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "OpenStack\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "Jamie Hannaford",
+ "email": "jamie.hannaford@rackspace.com",
+ "homepage": "https://github.com/jamiehannaford"
+ }
+ ],
+ "time": "2016-03-08 14:37:14"
},
{
"name": "psr/http-message",
@@ -344,7 +393,8 @@
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
- "php-opencloud/openstack": 20
+ "php-opencloud/openstack": 20,
+ "php-opencloud/common": 20
},
"prefer-stable": false,
"prefer-lowest": false,
diff --git a/server/core/App.php b/server/core/App.php
index edb75f6..d35ccc0 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -3,10 +3,10 @@ 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;
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
class App{
@@ -56,10 +56,10 @@ class App{
return $this->openstack->networkingV2($opt);
break;
case "Compute":
- if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
- $opt = $this->tokenClass->getOptions($service);
- return $this->openstack->computeV2($opt);
- break;
+ if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
+ $opt = $this->tokenClass->getOptions($service);
+ return $this->openstack->computeV2($opt);
+ break;
}
}
@@ -81,7 +81,29 @@ class App{
$this->errorClass->BaseErrorHandler($e);
}catch(NotImplementedError $e){
$this->errorClass->NotImplementedHandler($e);
- }
+ }
+
+ }
+
+ public function deauthenticate(){
+
+ try{
+
+ $this->tokenClass->revokeComputeToken();
+ $this->tokenClass->revokeImageToken();
+ $this->tokenClass->revokeNetworkToken();
+ $this->tokenClass->revokeIdentityToken();
+
+ $this->setOutput("deauthenticate", "Ok");
+ }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);
+ }
}
diff --git a/server/core/Compute.php b/server/core/Compute.php
old mode 100644
new mode 100755
index a5b8375..9b01d49
--- a/server/core/Compute.php
+++ b/server/core/Compute.php
@@ -1,7 +1,6 @@
app = $app;
- $this->libClass = $app->getLibClass("Compute");
- }
+ public function __construct($app)
+ {
+ $this->app = $app;
+ $this->libClass = $app->getLibClass("Compute");
+ }
/**
* Execute an action
*
@@ -35,21 +34,51 @@ class compute
*/
public function listServers()
{
- $serverList = $this->libClass->listServers(true);
- $servers = Array();
- foreach($serverList as $server){
- $servers[$server->id] = Array();
- $server->flavor->retrieve();
- $server->image->retrieve();
- $servers[$server->id]["id"] = $server->id;
- $servers[$server->id]["name"] = $server->name;
- $servers[$server->id]["imageId"] = $server->image->id;
- $servers[$server->id]["flavorId"] = $server->flavor->id;
- $servers[$server->id]["status"] = $server->status;
- $servers[$server->id]["ram"] = $server->flavor->ram;
- $servers[$server->id]["disk"] = $server->flavor->disk;
+ try{
+ $serverList = $this->libClass->listServers(true);
+ $servers = Array();
+ foreach($serverList as $server){
+ $servers[$server->id] = Array();
+ $server->flavor->retrieve();
+ $server->image->retrieve();
+ $server->retrieve();
+ $servers[$server->id]["id"] = $server->id;
+ $servers[$server->id]["name"] = $server->name;
+ $servers[$server->id]["image"] = $server->image;
+ $servers[$server->id]["ram"] = $server->flavor->ram;
+ $servers[$server->id]["disk"] = $server->flavor->disk;
+ $servers[$server->id]["flavor"] = $server->flavor;
+ $servers[$server->id]["status"] = $server->status;
+ $servers[$server->id]["created"] = $server->created;
+ $servers[$server->id]["updated"] = $server->updated;
+ $servers[$server->id]["ipv4"] = $server->ipv4;
+ $servers[$server->id]["ipv6"] = $server->ipv6;
+ $servers[$server->id]["progress"] = $server->progress;
+ $servers[$server->id]["hostId"] = $server->hostId;
+ $servers[$server->id]["tenantId"] = $server->tenantId;
+ $servers[$server->id]["userId"] = $server->userId;
+ $servers[$server->id]["taskState"] = $server->taskState;
+ $servers[$server->id]["addresses"] = $server->addresses;
+ $servers[$server->id]["links"] = $server->links;
+ $servers[$server->id]["metadata"] = $server->metadata;
+ }
+ $this->app->setOutput("Servers", $servers);
}
- $this->app->setOutput("Servers", $servers);
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
/**
@@ -58,14 +87,36 @@ class compute
*/
public function listFlavors()
{
- $flavorList = $this->libClass->listFlavors();
- $flavors = Array();
- foreach($flavorList as $flavor){
- $flavors[$flavor->id] = Array();
- $flavors[$flavor->id]["id"] = $flavor->id;
- $flavors[$flavor->id]["name"] = $flavor->name;
+ try{
+ $flavorList = $this->libClass->listFlavors();
+ $flavors = Array();
+ foreach($flavorList as $flavor){
+ $flavors[$flavor->id] = Array();
+ $flavor->retrieve();
+ $flavors[$flavor->id]["id"] = $flavor->id;
+ $flavors[$flavor->id]["name"] = $flavor->name;
+ $flavors[$flavor->id]["ram"] = $flavor->ram;
+ $flavors[$flavor->id]["disk"] = $flavor->disk;
+ $flavors[$flavor->id]["vcpus"] = $flavor->vcpus;
+ $flavors[$flavor->id]["links"] = $flavor->links;
}
$this->app->setOutput("Flavors", $flavors);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
/**
@@ -74,37 +125,74 @@ class compute
*/
public function listImages()
{
- $imageList = $this->libClass->listImages();
- $images = Array();
- foreach($imageList as $image){
- $images[$image->id] = Array();
- $images[$image->id]["id"] = $image->id;
- $images[$image->id]["name"] = $image->name;
+ try{
+ $imageList = $this->libClass->listImages();
+ $images = Array();
+ foreach($imageList as $image){
+ $images[$image->id] = Array();
+ $image->retrieve();
+ $images[$image->id]["id"] = $image->id;
+ $images[$image->id]["name"] = $image->name;
+ $images[$image->id]["status"] = $image->status;
+ $images[$image->id]["created"] = $image->created;
+ $images[$image->id]["updated"] = $image->updated;
+ $images[$image->id]["minDisk"] = $image->minDisk;
+ $images[$image->id]["minRam"] = $image->minRam;
+ $images[$image->id]["progress"] = $image->progress;
+ $images[$image->id]["links"] = $image->links;
+ $images[$image->id]["metadata"] = $image->metadata;
}
$this->app->setOutput("Images", $images);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
- /**
- * Create server.
- * @return array
- *
- public function createServer()
- {
-
- $server = $this->libClass->createServer();
- }
- */
- /**
+ /**
* Get server details.
* @return array
*/
public function getServer()
{
- $serverId = $this->app->getPostParam("serverId");
- $opt = array('id' => $serverId);
- $server = $this->libClass->getServer($opt);
- $server->retrieve();
- $this->app->setOutput("MyServer", $server);
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing, son!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->retrieve();
+ $this->app->setOutput("MyServer", $server);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
/**
@@ -113,11 +201,32 @@ class compute
*/
public function getFlavor()
{
- $flavorId = $this->app->getPostParam("flavorId");
- $opt = array('id' => $flavorId);
- $flavor = $this->libClass->getFlavor($opt);
- $flavor->retrieve();
- $this->app->setOutput("MyFlavor", $flavor);
+ try{
+ $flavorId = $this->app->getPostParam("flavorId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Flavor ID is missing, son!");
+ return;
+ }
+ $opt = array('id' => $flavorId);
+ $flavor = $this->libClass->getFlavor($opt);
+ $flavor->retrieve();
+ $this->app->setOutput("MyFlavor", $flavor);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
/**
@@ -126,76 +235,400 @@ class compute
*/
public function getImage()
{
- $imageId = $this->app->getPostParam("imageId");
- $opt = array('id' => $imageId);
- $image = $this->libClass->getImage($opt);
- $image->retrieve();
- $this->app->setOutput("MyImage", $image);
+ try{
+ $imageId = $this->app->getPostParam("imageId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Image ID is missing, son!");
+ return;
+ }
+ $opt = array('id' => $imageId);
+ $image = $this->libClass->getImage($opt);
+ $image->retrieve();
+ $this->app->setOutput("MyImage", $image);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
return;
}
- /* working on tests
-
- public function update()
+ /**
+ * Create server.
+ * @return array
+ */
+ public function createServer()
{
- $image = $this->app->getServer(array $options = []);
-
+ try{
+ $name = $this->app->getPostParam("name");
+ $imageId = $this->app->getPostParam("imageId");
+ $flavorId = $this->app->getPostParam("flavorId");
+ if(!isset($name) || !isset($imageId) || !isset($flavorId)){
+ $this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID.");
+ return;
+ }
+ $opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId);
+ $server = $this->libClass->createServer($opt);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function delete()
+
+ /**
+ * update a server
+ * @return void
+ */
+ public function updateServer()
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ $newName = $this->app->getPostParam("newName");
+ $newIpv4 = $this->app->getPostParam("newIpv4");
+ $newIpv6 = $this->app->getPostParam("newIpv6");
+ if(!isset($serverId)|| !(isset($newName) || isset($newIpv4) || isset($newIpv6)) ){
+ $this->app->setOutput("Error", "You'll have to provide server ID and the new attribute(IP(v4/v6)/Name) you desire to update!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ if (isset($newName)){
+ if(isset($newIpv4)){
+ if(isset($newIpv6)){
+ $attr = array('name' => $newName, 'accessIPv4' => $newIPv4, 'accessIPv6' => $newIpv6);
+ }
+ else $attr = array('name' => $newName, 'accessIPv4' => $newIPv4);
+ }
+ else $attr = array('name' => $newName);
+ }
+ $server->update($attr);
+ $this->app->setOutput("Success", $serverId." has been updated successfully.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function changePassword($newPassword)
+ /**
+ * Delete a server
+ * @return void
+ */
+ public function deleteServer()
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing, son!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->delete();
+ $this->app->setOutput("Success", $serverId." has been deleted successfully.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function reboot($type = Enum::REBOOT_SOFT)
+ /**
+ * Change the password of a server
+ * @return void
+ */
+ public function changePassword()
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ $password = $this->app->getPostParam("newPassword");
+ if(!isset($serverId) || !isset($password)){
+ $this->app->setOutput("Error", "Server ID or new password missing.");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->changePassword($password);
+ $this->app->setOutput("Success", "Password for ".$serverId." has been updated successfully.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function rebuild(array $options)
+ /**
+ * Reboot a server
+ * @return void
+ */
+ public function reboot()
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing, son!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->reboot();
+ $this->app->setOutput("Success", $serverId." has been deleted successfully.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function resize($flavorId)
+ /**
+ * Rebuild a server
+ * @return void
+ */
+ public function rebuild()
{
- //TODO
+ $serverId = $this->app->getPostParam("serverId");
+ $imageId = $this->app->getPostParam("imageId");
+ $newName = $this->app->getPostParam("newName");
+ $adminPass = $this->app->getPostParam("adminPass");
+ if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)) {
+ $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!");
+ return;
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ $imageId = $this->app->getPostParam("imageId");
+ $newName = $this->app->getPostParam("newName");
+ $adminPass = $this->app->getPostParam("adminPass");
+ if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($adminPass)){
+ $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass);
+ $server->rebuild($attr);
+ $this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
+ /**
+ * Resize a server
+ * A call to this method has to be followed by either confirmResize or revertResize
+ * @return void
+ */
+ public function resize()
+ {
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ $newFlavorId = $this->app->getPostParam("newFlavorId");
+ if(!isset($serverId)|| !isset($flavorId)){
+ $this->app->setOutput("Error", "You'll have to provide server ID and the new flavor ID!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->resize($newFlavorId);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
+ }
+ /**
+ * Confirm resize operation on a server
+ * @return void
+ */
public function confirmResize()
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->confirmResize();
+ $this->app->setOutput("Success", $serverId." has been resized successfully as the new flavor.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
+ /**
+ * Revert resize operation on a server
+ * @return void
+ */
public function revertResize()
{
- //TODO
- }
- public function createImage(array $options)
- {
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $server->revertResize();
+ $this->app->setOutput("Success", $serverId." : resize operation has been reverted to the old flavor.");
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
+ /**
+ * List private and public addresses of a server
+ * @return void
+ */
+
public function listAddresses(array $options = [])
{
- //TODO
+ try{
+ $serverId = $this->app->getPostParam("serverId");
+ if(!isset($serverId)){
+ $this->app->setOutput("Error", "Server ID is missing!");
+ return;
+ }
+ $opt = array('id' => $serverId);
+ $server = $this->libClass->getServer($opt);
+ $addresses = $server->listAddresses();
+ $this->app->setOutput("Addresses", $addresses);
+ }
+ catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }
+ catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }
+ catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }
+ catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }
+ catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ return;
}
- public function getMetadata()
- {
- //TODO
- }
- public function resetMetadata(array $metadata)
- {
- //TODO
- }
- public function mergeMetadata(array $metadata)
- {
- //TODO
- }
- public function getMetadataItem($key)
- {
- //TODO
- }
- public function deleteMetadataItem($key)
- {
- //TODO
- }
-*/
}
diff --git a/server/core/ErrorManagement.php b/server/core/ErrorManagement.php
index 6bff61f..3257dd3 100755
--- a/server/core/ErrorManagement.php
+++ b/server/core/ErrorManagement.php
@@ -1,9 +1,9 @@
app->setOutput("Error", $error->getMessage());
+ }
}
-?>
\ No newline at end of file
+?>
diff --git a/server/core/Identity.php b/server/core/Identity.php
index 2638985..464522a 100755
--- a/server/core/Identity.php
+++ b/server/core/Identity.php
@@ -9,7 +9,7 @@
*
* @todo Complete the functions and finish the descriptions
*/
-use OpenStack\Common\Error;
+use OpenCloud\Common\Error;
/**
* Identity Class of the back-end application
@@ -87,13 +87,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -111,13 +113,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -144,13 +148,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -187,13 +193,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -220,14 +228,17 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
+
}-
/**
@@ -266,13 +277,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -291,13 +304,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -325,13 +340,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -374,13 +391,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -407,13 +426,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -442,13 +463,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -480,13 +503,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -519,13 +544,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -557,13 +584,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -592,13 +621,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -630,13 +661,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -669,13 +702,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -714,13 +749,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -754,13 +791,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -786,13 +825,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -810,13 +851,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -849,13 +892,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -881,13 +926,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -914,13 +961,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -947,13 +996,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -981,13 +1032,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1022,13 +1075,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1056,13 +1111,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1090,13 +1147,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1125,13 +1184,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1160,13 +1221,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1195,13 +1258,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1228,13 +1293,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1261,13 +1328,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1294,13 +1363,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1328,13 +1399,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1361,13 +1434,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}*/
}
@@ -1398,13 +1473,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1422,13 +1499,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1455,13 +1534,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1495,13 +1576,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1528,13 +1611,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1563,13 +1648,17 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1602,13 +1691,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1643,13 +1734,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1682,13 +1775,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1718,13 +1813,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1757,13 +1854,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1798,13 +1897,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1837,13 +1938,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1871,13 +1974,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1895,13 +2000,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1919,13 +2026,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1954,13 +2063,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -1978,13 +2089,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2009,13 +2122,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2043,13 +2158,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2081,13 +2198,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2123,13 +2242,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2159,13 +2280,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2201,13 +2324,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2249,13 +2374,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2285,13 +2412,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2317,13 +2446,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2362,13 +2493,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2386,13 +2519,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2419,13 +2554,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2458,13 +2595,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2491,13 +2630,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2525,13 +2666,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
@@ -2559,13 +2702,15 @@ class identity implements Core{
//TODO parse answer
}catch(BadResponseError $e){
- $this->app->getErrorInstance->BadResponseHandler($e);
+ $this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
}
}
diff --git a/server/core/Image.php b/server/core/Image.php
old mode 100644
new mode 100755
index 4025595..71e19ce
--- a/server/core/Image.php
+++ b/server/core/Image.php
@@ -9,10 +9,12 @@
*
* @todo Complete the functions with errors detection and finish the descriptions
*/
-use OpenStack\Common\Error\BadResponseError;
-use OpenStack\Common\Error\BaseError;
-use OpenStack\Common\Error\NotImplementedError;
-use OpenStack\Common\Error\UserInputError;
+use OpenCloud\Common\Error\BadResponseError;
+use OpenCloud\Common\Error\BaseError;
+use OpenCloud\Common\Error\NotImplementedError;
+use OpenCloud\Common\Error\UserInputError;
+
+include("CoreInterface.php");
/**
* Image Class of the back-end application
@@ -33,26 +35,14 @@ class image implements Core{
*
* @param App $app the main app object
*
- * @throws [Type] []
- *
* @return Image
*/
public function __construct($app){
if(!isset($app)){
- $this->app->setOutput("Error", "Incorrect parameter");
+ $this->app->setOutput("Error", "Incorrect parameter app");
}
- try{
- $this->app = $app;
- $this->libClass = $app->getLibClass("Image");
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ $this->app = $app;
+ $this->libClass = $app->getLibClass("Image");
}
@@ -64,45 +54,46 @@ class image implements Core{
* @return void
*/
public function action($action){
-
- $this->{$action.""}();
-
+ $this->{$action.""}();
}
/**
- * Details about an image
+ * Create a new image
*
- * @param array $opt
- * options for the image creation
+ * @param array $opt Options for the image creation (name is required, others are optionals)
*
- **/
- private function createImage(array $opt){
+ * @return Image
+ */
+ private function createImage(){
+ $opt = $this->app->getPostParam("opt");
if(!isset($opt)){
- $this->app->setOutput("Error", "Incorrect parameter");
+ $this->app->setOutput("Error", "Incorrect parameter opt");
}
-
try{
- // VOIR SI MAUVAIS TYPE
$options = Array();
- if(isset($opt['name'])){ // if the image name already exists -> error
- $imagesList = listImage();
- if(isset($images)){
- foreach($imagesList as $image){
- if(strcmp($image->name, $opt['name']) == 0){
+ // Check the image name
+ if(isset($opt['name'])){
+ $imagesList = listImage();
+ if(isset($imagesList)){
+ foreach($imagesList as $image){
+ if(strcmp($image->name, $opt['name']) == 0){ // if the image name already exists -> error
+ $this->app->setOutput("Error", "Image name already exists");
}
}
}
}
else{
- $this->app->setOutput("Error", "Image name already exists");
+ $this->app->setOutput("Error", "Missing parameter 'name' for the new image");
}
+
+ // Check optionals arguments
if(isset($opt['id'])){ // UUID : nnnnnnnn-nnnn-nnnn-nnnn-nnnnnnnnnnnn
if($this->libClass->getImage($opt['id']) != null){ // if the id already exists -> error
-
+ $this->app->setOutput("Error", "Image id already exists");
}
$options['id'] = $opt['id'];
}
@@ -135,478 +126,561 @@ class image implements Core{
}catch(BadResponseError $e){
$this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
- return $image;
+ $this->app->setOutput("Images", $image);
+
}
/**
* List the images of the server
*
- * @return the list with all images on the server
+ * @return List of Image
*/
private function listImage(){
try{
+ $result = array();
$l = $this->libClass->listImages();
- if(!isset($l)){ // if the list is empty there is no images
- $this->app->setOutput("Error", "No image");
+ foreach($l as $tmp){
+ $result[] = $tmp;
}
}catch(BadResponseError $e){
$this->app->getErrorInstance()->BadResponseHandler($e);
}catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
+ $this->app->getErrorInstance()->UserInputHandler($e);
}catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
}catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
}
- return $l;
+
+ $this->app->setOutput("Images", $result);
}
/**
* Details about an image
*
- * @param string $id
- * identifier of the image
- *
- **/
- private function detailsImage($id){
- if(!isset($id)){
- // Renvoyer erreur
- }
- try{
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
-
- return $image;
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
- }
+ * @param String $id Identifier of the image
+ *
+ * @return Image
+ */
+ private function detailsImage(){
+ $id = $this->app->getPostParam("id");
- /**
- * Details about an image
- *
- * @param string $id
- * id of the image
- *
- * @param array $opt
- * options for the image creation
- **/
- private function updateImage($id, array $opt){
if(!isset($id)){
$this->app->setOutput("Error", "Incorrect id parameter");
}
- if(!isset($opt)){
+ else{
+ try{
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ else{
+ echo 'toto';
+ $this->app->setOutput("Images", $image);
+ }
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
+ }
+
+ /**
+ * Update informations about an image
+ *
+ * @param String $id id of the image
+ * @param array $opt Options for the image creation
+ *
+ * @return Image
+ */
+
+ private function updateImage(){
+ $id = $this->app->getPostParam("id");
+ $opt = $this->app->getPostParam("opt");
+
+ if(!isset($id)){
+ $this->app->setOutput("Error", "Incorrect id parameter");
+ }
+ else if(!isset($opt)){
$this->app->setOutput("Error", "Incorrect opt parameter");
}
+ else{
+ try{
+ //vérifier existence image
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
- try{
- //vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
+ $options = Array();
- $options = Array();
-
- // Voir vérification des types
- if(isset($opt['name'])){ //string
- $options['name'] = $opt['name'];
- }
- if(isset($opt['minDisk'])){ //int
- $options['minDisk'] = $opt['minDisk'];
- }
- if(isset($opt['minRam'])){ // int
- $options['minRam'] = $opt['minRam'];
- }
- if(isset($opt['protected'])){ // boolean
- $options['protected'] = $opt['protected'];
- }
- if(isset($opt['visibility'])){ // public, private
- $options['visibility'] = $opt['visibility'];
- }
- if(isset($opt['tags'])){ // list
- $options['tags'] = $opt['tags'];
- }
- $image->update($options);
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
- return $image;
+ // Voir vérification des types
+ if(isset($opt['name'])){ //string
+ $options['name'] = $opt['name'];
+ }
+ if(isset($opt['minDisk'])){ //int
+ $options['minDisk'] = $opt['minDisk'];
+ }
+ if(isset($opt['minRam'])){ // int
+ $options['minRam'] = $opt['minRam'];
+ }
+ if(isset($opt['protected'])){ // boolean
+ $options['protected'] = $opt['protected'];
+ }
+ if(isset($opt['visibility'])){ // public, private
+ $options['visibility'] = $opt['visibility'];
+ }
+ if(isset($opt['tags'])){ // list
+ $options['tags'] = $opt['tags'];
+ }
+ $image->update($options);
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ $this->app->setOutput("Images", $image);
+ }
}
/**
* Delete an image
*
- * @param string $id
- * identifier of the image
- **/
- private function deleteImage($id){
+ * @param String $id Identifier of the image
+ *
+ * @return void
+ */
+ private function deleteImage(){
// si protected = true, demander de le mettre a false
// vérifier existence image
+ $id = $this->app->getPostParam("id");
if(!isset($id)){
$this->app->setOutput("Error", "Image doesn't exist");
}
-
- try{
- $service = $this->libClass;
- $image = $this->libClass->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $image->delete();
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
-
+ else{
+ try{
+ $service = $this->libClass;
+ $image = $this->libClass->getImage($id);
+ if($image == null){ // if the image doesn't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $image->delete();
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
/**
* Resactive an image
*
- * @param string $id
- * identifier of the image
- **/
- private function reactivateImage($id){
+ * @param String $id Identifier of the image
+ *
+ * @return void
+ */
+ private function reactivateImage(){
+ $id = $this->app->getPostParam("id");
+
if(!isset($id)){
$this->app->setOutput("Error", "Incorrect parameter");
}
- try{
- // vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $image->reactivate();
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ else
+ {
+ try{
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $image->reactivate();
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
/**
* Desactive an image
*
- * @param string $id
- * identifier of the image
- **/
- private function desactivateImage($id){
+ * @param String $id Identifier of the image
+ *
+ * @return void
+ */
+ private function desactivateImage(){
+ $id = $this->app->getPostParam("id");
+
if(!isset($id)){
$this->app->setOutput("Error", "Incorrect parameter");
}
- try{
- // vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $image->deactivate();
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ else
+ {
+ try{
+ // vérifier existence image
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $image->deactivate();
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
/**
* Upload an image
*
- * @param string $id
- * identifier of the image
- *
- * @param string $file_name
- * path of the image
- **/
- private function uploadImage($id, $file_name){
+ * @param String $id Identifier of the image
+ * @param String $file_name Path of the image
+ *
+ * @return void
+ */
+ private function uploadImage(){
+ $id = $this->app->getPostParam("id");
+ $file_name = $this->app->getPostParam("file_name");
+
+
if(!isset($id)){
$this->app->setOutput("Error", "Incorrect id parameter");
}
- if(!isset($file_name)){
- $this->app->setOutput("Error", "Incorrect file_name parameter");
+ else if(!isset($file_name)){
+ $this->app->setOutput("Error", "Incorrect file name parameter");
}
- try{
- // vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r'));
- $image->uploadData($stream);
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
+ else{
+ try{
+ // vérifier existence image
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $stream = \GuzzleHttp\Psr7\stream_for(fopen($file_name, 'r'));
+ $image->uploadData($stream);
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
}
}
/**
* Download an image
*
- * @param string $id
- * identifier of the image
- **/
- private function downloadImage($id){
+ * @param String $id Identifier of the image
+ *
+ * @return Stream
+ */
+ private function downloadImage(){
+ $id = $this->app->getPostParam("id");
+
if(!isset($id)){
- $this->app->setOutput("Error", "Incorrect parameter");
+ $this->app->setOutput("Error", "Incorrect id parameter");
}
- try{
- // vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $stream = $image->downloadData();
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
- return $stream;
+ else{
+ try{
+ // vérifier existence image
+ $service = $this->libClass;
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $stream = $image->downloadData();
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ $this->app->setOutput("Images", $stream);
+ }
}
/**
* Add a member to image
*
- * @param string $image_id
- * identifier of the image
- *
- * @param string $member_id
- * identifier of the member
- **/
- private function addMemberImage($image_id, $member_id){
- if(!isset($image_id)){
- $this->app->setOutput("Error", "Incorrect parameter image_id");
- }
- if(!isset($member_id)){
- $this->app->setOutput("Error", "Incorrect parameter member_id");
- }
- try{
- $service = $this->libClass;
+ * @param String $image_id Identifier of the image
+ * @param String $member_id Identifier of the member
+ *
+ * @return Member
+ */
+ private function addMemberImage(){
+ $image_id = $this->app->getPostParam("image_id");
+ $member_id = $this->app->getPostParam("member_id");
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $member_id = $image->addMember($member_id);
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ if(!isset($image_id)){
+ $this->app->setOutput("Error", "Incorrect image id parameter");
+ }
+ else if(!isset($member_id)){
+ $this->app->setOutput("Error", "Incorrect member id parameter");
+ }
+ else{
+ try{
+ $service = $this->libClass;
+
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $member_id = $image->addMember($member_id);
+ $this->app->setOutput("Images", $member_id);
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
/**
* List members of an image
*
- * @param string $image_id
- * identifier of the image
- **/
- private function listMemberImage($image_id, $member_id){
+ * @param String $image_id identifier of the image
+ *
+ * @return List of Member
+ */
+ private function listMemberImage(){
+ $image_id = $this->app->getPostParam("image_id");
+ $member_id = $this->app->getPostParam("member_id");
+
if(!isset($image_id)){
- $this->app->setOutput("Error", "Incorrect parameter image_id");
+ $this->app->setOutput("Error", "Incorrect image id parameter");
}
- if(!isset($member_id)){
- $this->app->setOutput("Error", "Incorrect parameter member_id");
+ else if(!isset($member_id)){
+ $this->app->setOutput("Error", "Incorrect member id parameter");
+ }
+ else{
+ try{
+ // vérifier existence image
+ $service = $this->libClass;
+ $image = $service->getImage($image_id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $members = $image->listMembers();
+ if($members == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "No member");
+ }
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ $this->app->setOutput("Images", $members);
}
- try{
- // vérifier existence image
- $service = $this->libClass;
- $image = $service->getImage($image_id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $members = $image->listMembers();
- if($member == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "No member");
- }
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
- return $members;
}
/**
* Show details of a member of an image
*
- * @param string $image_id
- * identifier of the image
+ * @param String $image_id Identifier of the image
+ * @param String $member_id Identifier of the member
*
- * @param string $member_id
- * identifier of the member
- **/
- private function detailMemberImage($image_id, $member_id){
+ * @return Member
+ */
+ private function detailMemberImage(){
+ $image_id = $this->app->getPostParam("image_id");
+ $member_id = $this->app->getPostParam("member_id");
+
if(!isset($image_id)){
- $this->app->setOutput("Error", "Incorrect parameter image_id");
+ $this->app->setOutput("Error", "Incorrect image id parameter");
}
- if(!isset($member_id)){
- $this->app->setOutput("Error", "Incorrect parameter member_id");
+ else if(!isset($member_id)){
+ $this->app->setOutput("Error", "Incorrect member id parameter");
}
- try{
- // vérifier existence image
- // on doit être le proprio de l'image
- // vérifier membre existe
- $service = $this->libClass;
+ else{
+ try{
+ $service = $this->libClass;
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
- $member = $image->getMember($member_id);
- if($member == null){ // if the member don't exists -> error
- $this->app->setOutput("Error", "Member doesn't exist");
- }
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
- return $member;
+ $member = $image->getMember($member_id);
+ if($member == null){ // if the member don't exists -> error
+ $this->app->setOutput("Error", "Member doesn't exist");
+ }
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ $this->app->setOutput("Images", $member);
+ }
}
/**
* Remove a member of an image
*
- * @param string $image_id
- * identifier of the image
- *
- * @param string $member_id
- * identifier of the member
- **/
- private function removeMemberImage($image_id, $member_id){
- if(!isset($image_id)){
- $this->app->setOutput("Error", "Incorrect parameter image_id");
- }
- if(!isset($member_id)){
- $this->app->setOutput("Error", "Incorrect parameter member_id");
- }
- try{
- $service = $this->libClass;
+ * @param String $image_id Identifier of the image
+ * @param String $member_id Identifier of the member
+ *
+ * @return void
+ */
+ private function removeMemberImage(){
+ $image_id = $this->app->getPostParam("image_id");
+ $member_id = $this->app->getPostParam("member_id");
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $member = $image->getMember($member_id);
- if($member == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Member doesn't exist");
- }
- $member->delete();
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ if(!isset($image_id)){
+ $this->app->setOutput("Error", "Incorrect image id parameter");
+ }
+ else if(!isset($member_id)){
+ $this->app->setOutput("Error", "Incorrect member id parameter");
+ }
+ else{
+ try{
+ $service = $this->libClass;
+
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $member = $image->getMember($member_id);
+ if($member == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Member doesn't exist");
+ }
+ $member->delete();
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
/**
* Update a member of an image
*
- * @param string $image_id
- * identifier of the image
+ * @param String $image_id Identifier of the image
+ * @param String $member_id Identifier of the member
+ * @param String $status New status for the member
*
- * @param string $member_id
- * identifier of the member
- *
- * @param string $status
- * new status for the member
+ * @return void
**/
- private function updateMemberImage($image_id, $member_id, $status){
- if(!isset($image_id)){
- $this->app->setOutput("Error", "Incorrect parameter image_id");
- }
- if(!isset($member_id)){
- $this->app->setOutput("Error", "Incorrect parameter member_id");
- }
- try{
- $service = $this->libClass;
+ private function updateMemberImage(){
+ $image_id = $this->app->getPostParam("image_id");
+ $member_id = $this->app->getPostParam("member_id");
+ $status = $this->app->getPostParam("status");
- $image = $service->getImage($id);
- if($image == null){ // if the image don't exists -> error
- $this->app->setOutput("Error", "Image doesn't exist");
- }
- $member = $image->getMember($member_id);
- if($member == null){ // if the member don't exists -> error
- $this->app->setOutput("Error", "Member doesn't exist");
- }
- $member->updateStatus($status);
- }catch(BadResponseError $e){
- $this->app->getErrorInstance()->BadResponseHandler($e);
- }catch(UserInputError $e){
- $this->app->getErrorInstance->UserInputHandler($e);
- }catch(BaseError $e){
- $this->app->getErrorInstance->BaseErrorHandler($e);
- }catch(NotImplementedError $e){
- $this->app->getErrorInstance->NotImplementedHandler($e);
- }
+ if(!isset($image_id)){
+ $this->app->setOutput("Error", "Incorrect image id parameter");
+ }
+ else if(!isset($member_id)){
+ $this->app->setOutput("Error", "Incorrect member id parameter");
+ }
+ else{
+ try{
+ $service = $this->libClass;
+
+ $image = $service->getImage($id);
+ if($image == null){ // if the image don't exists -> error
+ $this->app->setOutput("Error", "Image doesn't exist");
+ }
+ $member = $image->getMember($member_id);
+ if($member == null){ // if the member don't exists -> error
+ $this->app->setOutput("Error", "Member doesn't exist");
+ }
+ $member->updateStatus($status);
+ }catch(BadResponseError $e){
+ $this->app->getErrorInstance()->BadResponseHandler($e);
+ }catch(UserInputError $e){
+ $this->app->getErrorInstance()->UserInputHandler($e);
+ }catch(BaseError $e){
+ $this->app->getErrorInstance()->BaseErrorHandler($e);
+ }catch(NotImplementedError $e){
+ $this->app->getErrorInstance()->NotImplementedHandler($e);
+ }catch(Exception $e){
+ $this->app->getErrorInstance()->OtherException($e);
+ }
+ }
}
}
diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php
index 50826ed..bdae8a6 100755
--- a/server/core/LibOverride/genTokenOptions.php
+++ b/server/core/LibOverride/genTokenOptions.php
@@ -1,12 +1,12 @@
optionsGlobal['Identity'] = $options;
}
+ public function revokeIdentityToken(){
+ $token = $this->unserializeToken($this->backup['Identity']['token']);
+ $this->optionsGlobal['Common']['identityService']->revokeToken($token->id);
+
+ }
+
public function loadIdentityBackup($opt){
$options = $this->optionsGlobal['Common'];
$options['catalogName'] = 'false';
@@ -123,6 +129,12 @@ class genTokenOptions
$this->optionsGlobal['Image'] = $options;
}
+ public function revokeImageToken(){
+ $token = $this->unserializeToken($this->backup['Image']['token']);
+ $this->optionsGlobal['Common']['identityService']->revokeToken($token->id);
+
+ }
+
public function loadImageBackup($opt){
$options = $this->optionsGlobal['Common'];
$options['catalogName'] = 'glance';
@@ -157,7 +169,7 @@ class genTokenOptions
$stack = HandlerStack::create();
- $stack->push(Middleware::authHandler($options['authHandler'], $token));
+ $stack->push(Middleware::authHandler($options['authHandler'], $token));
$this->addDebugMiddleware($options, $stack);
@@ -170,6 +182,12 @@ class genTokenOptions
$this->optionsGlobal['Network'] = $options;
}
+ public function revokeNetworkToken(){
+ $token = $this->unserializeToken($this->backup['Network']['token']);
+ $this->optionsGlobal['Common']['identityService']->revokeToken($token->id);
+
+ }
+
public function loadNetworkBackup($opt){
$options = $this->optionsGlobal['Common'];
$options['catalogName'] = 'neutron';
@@ -217,6 +235,12 @@ class genTokenOptions
$this->optionsGlobal['Compute'] = $options;
}
+ public function revokeComputeToken(){
+ $token = $this->unserializeToken($this->backup['Compute']['token']);
+ $this->optionsGlobal['Common']['identityService']->revokeToken($token->id);
+
+ }
+
public function loadComputeBackup($opt){
$options = $this->optionsGlobal['Common'];
@@ -245,7 +269,7 @@ class genTokenOptions
private function saveBackup($name, $data){
$token = $this->serializeToken($data["token"]);
$path = "core/LibOverride/projectTokenData/".$token['saved']["project"]["name"];
- error_log(print_r($path, true), 0);
+ //error_log(print_r($path, true), 0);
file_put_contents("core/LibOverride/projectTokenData/".$token['saved']["project"]["name"], serialize($token['saved']));
$this->backup["roles"] = $token["roles"];
$this->backup["project"] = $token['saved']["project"]["name"];
diff --git a/server/index.php b/server/index.php
old mode 100644
new mode 100755
index f888671..31feb08
--- a/server/index.php
+++ b/server/index.php
@@ -6,7 +6,7 @@
if(isset($_POST["task"]) && isset($_POST["action"])){
$task = $_POST["task"];
$action = $_POST["action"];
- }else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate"){
+ }else if(isset($_POST["task"]) && $_POST["task"] == "Authenticate" || $_POST["task"] == "Deauthenticate"){
$task = $_POST["task"];
}else{
//Gestion Erreur
@@ -17,36 +17,44 @@
$App->authenticate();
$App->show();
+ }else if($task == "Deauthenticate"){
+
+ $App->deauthenticate();
+ $App->show();
+
+ }else{
+ switch($task)
+ {
+ case "identity":
+ include_once("core/Identity.php");
+ $identityObject = new identity($App);
+ $identityObject->action($action);
+ $App->show();
+ break;
+
+ case "network":
+ include_once("core/Network.php");
+ $networkObject = new network($App);
+ $networkObject->action($action);
+ $App->show();
+ break;
+
+ case "image":
+ include_once("core/Image.php");
+ $imageObject = new image($App);
+ $imageObject->action($action);
+ $App->show();
+ break;
+
+ case "compute":
+ include_once("core/Compute.php");
+ $computeObject = new compute($App);
+ $computeObject->action($action);
+ $App->show();
+ break;
+ }
+
}
- switch($task)
- {
- case "identity":
- include_once("core/Identity.php");
- $identityObject = new identity($App);
- $identityObject->action($action);
- $App->show();
- break;
-
- case "network":
- include_once("core/Network.php");
- $networkObject = new network($App);
- $networkObject->action($action);
- $App->show();
- break;
-
- case "image":
- include_once("core/Image.php");
- $imageObject = new image($App);
- $imageObject->action($action);
- $App->show();
- break;
-
- case "compute":
- include_once("core/Compute.php");
- $computeObject = new compute($App);
- $computeObject->action($action);
- $App->show();
- break;
- }
+
diff --git a/server/vendor/composer/autoload_psr4.php b/server/vendor/composer/autoload_psr4.php
index 6c2e482..0b3ff02 100644
--- a/server/vendor/composer/autoload_psr4.php
+++ b/server/vendor/composer/autoload_psr4.php
@@ -7,9 +7,10 @@ $baseDir = dirname($vendorDir);
return array(
'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'),
- 'OpenStack\\Test\\' => array($vendorDir . '/php-opencloud/openstack/tests/unit'),
- 'OpenStack\\Integration\\' => array($vendorDir . '/php-opencloud/openstack/tests/integration'),
'OpenStack\\' => array($vendorDir . '/php-opencloud/openstack/src'),
+ 'OpenCloud\\Test\\' => array($vendorDir . '/php-opencloud/common/tests/unit'),
+ 'OpenCloud\\Integration\\' => array($vendorDir . '/php-opencloud/common/tests/integration'),
+ 'OpenCloud\\' => array($vendorDir . '/php-opencloud/common/src'),
'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'),
'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'),
diff --git a/server/vendor/composer/installed.json b/server/vendor/composer/installed.json
index 1dfb8d2..8f06408 100644
--- a/server/vendor/composer/installed.json
+++ b/server/vendor/composer/installed.json
@@ -1,57 +1,4 @@
[
- {
- "name": "guzzlehttp/promises",
- "version": "1.0.3",
- "version_normalized": "1.0.3.0",
- "source": {
- "type": "git",
- "url": "https://github.com/guzzle/promises.git",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/guzzle/promises/zipball/b1e1c0d55f8083c71eda2c28c12a228d708294ea",
- "reference": "b1e1c0d55f8083c71eda2c28c12a228d708294ea",
- "shasum": ""
- },
- "require": {
- "php": ">=5.5.0"
- },
- "require-dev": {
- "phpunit/phpunit": "~4.0"
- },
- "time": "2015-10-15 22:28:00",
- "type": "library",
- "extra": {
- "branch-alias": {
- "dev-master": "1.0-dev"
- }
- },
- "installation-source": "dist",
- "autoload": {
- "psr-4": {
- "GuzzleHttp\\Promise\\": "src/"
- },
- "files": [
- "src/functions_include.php"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "MIT"
- ],
- "authors": [
- {
- "name": "Michael Dowling",
- "email": "mtdowling@gmail.com",
- "homepage": "https://github.com/mtdowling"
- }
- ],
- "description": "Guzzle promises library",
- "keywords": [
- "promise"
- ]
- },
{
"name": "psr/http-message",
"version": "1.0",
@@ -167,54 +114,6 @@
"web service"
]
},
- {
- "name": "php-opencloud/openstack",
- "version": "dev-master",
- "version_normalized": "9999999-dev",
- "source": {
- "type": "git",
- "url": "https://github.com/php-opencloud/openstack.git",
- "reference": "15aca73f423166c7ef8337ba08615c103c66e931"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/15aca73f423166c7ef8337ba08615c103c66e931",
- "reference": "15aca73f423166c7ef8337ba08615c103c66e931",
- "shasum": ""
- },
- "require": {
- "guzzlehttp/guzzle": "~6.1",
- "justinrainbow/json-schema": "~1.3",
- "php": ">=5.6"
- },
- "require-dev": {
- "fabpot/php-cs-fixer": "~1.0",
- "jakub-onderka/php-parallel-lint": "0.*",
- "phpspec/prophecy-phpunit": "~1.0",
- "phpunit/phpunit": "~4.0",
- "psr/log": "~1.0",
- "sami/sami": "dev-master",
- "satooshi/php-coveralls": "~1.0"
- },
- "time": "2016-01-25 10:35:10",
- "type": "library",
- "installation-source": "source",
- "autoload": {
- "psr-4": {
- "OpenStack\\": "src/",
- "OpenStack\\Test\\": "tests/unit/",
- "OpenStack\\Integration\\": "tests/integration/"
- }
- },
- "notification-url": "https://packagist.org/downloads/",
- "authors": [
- {
- "name": "Jamie Hannaford",
- "email": "jamie.hannaford@rackspace.com",
- "homepage": "https://github.com/jamiehannaford"
- }
- ]
- },
{
"name": "justinrainbow/json-schema",
"version": "1.6.1",
@@ -284,18 +183,118 @@
]
},
{
- "name": "guzzlehttp/psr7",
- "version": "1.2.2",
- "version_normalized": "1.2.2.0",
+ "name": "php-opencloud/common",
+ "version": "dev-master",
+ "version_normalized": "9999999-dev",
"source": {
"type": "git",
- "url": "https://github.com/guzzle/psr7.git",
- "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb"
+ "url": "https://github.com/php-opencloud/common.git",
+ "reference": "fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5d04bdd2881ac89abde1fb78cc234bce24327bb",
- "reference": "f5d04bdd2881ac89abde1fb78cc234bce24327bb",
+ "url": "https://api.github.com/repos/php-opencloud/common/zipball/fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62",
+ "reference": "fd027b817c3dd8f83b0c8d9fb1df34ebf25f8c62",
+ "shasum": ""
+ },
+ "require": {
+ "guzzlehttp/guzzle": "~6.1",
+ "justinrainbow/json-schema": "~1.3",
+ "php": "~7.0"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.*",
+ "phpunit/phpunit": "~4.0",
+ "psr/log": "~1.0",
+ "sami/sami": "dev-master",
+ "satooshi/php-coveralls": "~1.0"
+ },
+ "time": "2016-03-08 12:56:34",
+ "type": "library",
+ "installation-source": "source",
+ "autoload": {
+ "psr-4": {
+ "OpenCloud\\": "src/",
+ "OpenCloud\\Test\\": "tests/unit/",
+ "OpenCloud\\Integration\\": "tests/integration/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "Jamie Hannaford",
+ "email": "jamie.hannaford@rackspace.com",
+ "homepage": "https://github.com/jamiehannaford"
+ }
+ ]
+ },
+ {
+ "name": "guzzlehttp/promises",
+ "version": "1.1.0",
+ "version_normalized": "1.1.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/promises.git",
+ "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/promises/zipball/bb9024c526b22f3fe6ae55a561fd70653d470aa8",
+ "reference": "bb9024c526b22f3fe6ae55a561fd70653d470aa8",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0"
+ },
+ "time": "2016-03-08 01:15:46",
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.0-dev"
+ }
+ },
+ "installation-source": "dist",
+ "autoload": {
+ "psr-4": {
+ "GuzzleHttp\\Promise\\": "src/"
+ },
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Michael Dowling",
+ "email": "mtdowling@gmail.com",
+ "homepage": "https://github.com/mtdowling"
+ }
+ ],
+ "description": "Guzzle promises library",
+ "keywords": [
+ "promise"
+ ]
+ },
+ {
+ "name": "guzzlehttp/psr7",
+ "version": "1.2.3",
+ "version_normalized": "1.2.3.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/guzzle/psr7.git",
+ "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/guzzle/psr7/zipball/2e89629ff057ebb49492ba08e6995d3a6a80021b",
+ "reference": "2e89629ff057ebb49492ba08e6995d3a6a80021b",
"shasum": ""
},
"require": {
@@ -308,7 +307,7 @@
"require-dev": {
"phpunit/phpunit": "~4.0"
},
- "time": "2016-01-23 01:23:02",
+ "time": "2016-02-18 21:54:00",
"type": "library",
"extra": {
"branch-alias": {
@@ -342,5 +341,48 @@
"stream",
"uri"
]
+ },
+ {
+ "name": "php-opencloud/openstack",
+ "version": "dev-master",
+ "version_normalized": "9999999-dev",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-opencloud/openstack.git",
+ "reference": "f2ee77024843659d970817a9e7055bb40a3724f9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-opencloud/openstack/zipball/f2ee77024843659d970817a9e7055bb40a3724f9",
+ "reference": "f2ee77024843659d970817a9e7055bb40a3724f9",
+ "shasum": ""
+ },
+ "require": {
+ "php-opencloud/common": "dev-master"
+ },
+ "require-dev": {
+ "fabpot/php-cs-fixer": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.*",
+ "phpunit/phpunit": "~4.0",
+ "psr/log": "~1.0",
+ "sami/sami": "dev-master",
+ "satooshi/php-coveralls": "~1.0"
+ },
+ "time": "2016-03-08 14:37:14",
+ "type": "library",
+ "installation-source": "source",
+ "autoload": {
+ "psr-4": {
+ "OpenStack\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "authors": [
+ {
+ "name": "Jamie Hannaford",
+ "email": "jamie.hannaford@rackspace.com",
+ "homepage": "https://github.com/jamiehannaford"
+ }
+ ]
}
]
diff --git a/server/vendor/guzzlehttp/promises/CHANGELOG.md b/server/vendor/guzzlehttp/promises/CHANGELOG.md
index 4031cb8..3871ac7 100644
--- a/server/vendor/guzzlehttp/promises/CHANGELOG.md
+++ b/server/vendor/guzzlehttp/promises/CHANGELOG.md
@@ -1,5 +1,11 @@
# CHANGELOG
+## 1.1.0 - 2016-03-07
+
+* Update EachPromise to prevent recurring on a iterator when advancing, as this
+ could trigger fatal generator errors.
+* Update Promise to allow recursive waiting without unwrapping exceptions.
+
## 1.0.3 - 2015-10-15
* Update EachPromise to immediately resolve when the underlying promise iterator
diff --git a/server/vendor/guzzlehttp/promises/src/EachPromise.php b/server/vendor/guzzlehttp/promises/src/EachPromise.php
index 5918429..0344686 100644
--- a/server/vendor/guzzlehttp/promises/src/EachPromise.php
+++ b/server/vendor/guzzlehttp/promises/src/EachPromise.php
@@ -24,6 +24,9 @@ class EachPromise implements PromisorInterface
/** @var Promise */
private $aggregate;
+ /** @var bool */
+ private $mutex;
+
/**
* Configuration hash can include the following key value pairs:
*
@@ -81,6 +84,7 @@ class EachPromise implements PromisorInterface
private function createPromise()
{
+ $this->mutex = false;
$this->aggregate = new Promise(function () {
reset($this->pending);
if (empty($this->pending) && !$this->iterable->valid()) {
@@ -169,11 +173,21 @@ class EachPromise implements PromisorInterface
private function advanceIterator()
{
+ // Place a lock on the iterator so that we ensure to not recurse,
+ // preventing fatal generator errors.
+ if ($this->mutex) {
+ return false;
+ }
+
+ $this->mutex = true;
+
try {
$this->iterable->next();
+ $this->mutex = false;
return true;
} catch (\Exception $e) {
$this->aggregate->reject($e);
+ $this->mutex = false;
return false;
}
}
@@ -186,9 +200,11 @@ class EachPromise implements PromisorInterface
}
unset($this->pending[$idx]);
- $this->advanceIterator();
- if (!$this->checkIfFinished()) {
+ // Only refill pending promises if we are not locked, preventing the
+ // EachPromise to recursively invoke the provided iterator, which
+ // cause a fatal error: "Cannot resume an already running generator"
+ if ($this->advanceIterator() && !$this->checkIfFinished()) {
// Add more pending promises if possible.
$this->refillPending();
}
diff --git a/server/vendor/guzzlehttp/promises/src/Promise.php b/server/vendor/guzzlehttp/promises/src/Promise.php
index c2cf969..86820b2 100644
--- a/server/vendor/guzzlehttp/promises/src/Promise.php
+++ b/server/vendor/guzzlehttp/promises/src/Promise.php
@@ -61,17 +61,19 @@ class Promise implements PromiseInterface
{
$this->waitIfPending();
- if (!$unwrap) {
- return null;
- }
+ $inner = $this->result instanceof PromiseInterface
+ ? $this->result->wait($unwrap)
+ : $this->result;
- if ($this->result instanceof PromiseInterface) {
- return $this->result->wait($unwrap);
- } elseif ($this->state === self::FULFILLED) {
- return $this->result;
- } else {
- // It's rejected so "unwrap" and throw an exception.
- throw exception_for($this->result);
+ if ($unwrap) {
+ if ($this->result instanceof PromiseInterface
+ || $this->state === self::FULFILLED
+ ) {
+ return $inner;
+ } else {
+ // It's rejected so "unwrap" and throw an exception.
+ throw exception_for($inner);
+ }
}
}
@@ -257,11 +259,10 @@ class Promise implements PromiseInterface
$this->waitList = null;
foreach ($waitList as $result) {
- descend:
$result->waitIfPending();
- if ($result->result instanceof Promise) {
+ while ($result->result instanceof Promise) {
$result = $result->result;
- goto descend;
+ $result->waitIfPending();
}
}
}
diff --git a/server/vendor/guzzlehttp/promises/src/TaskQueue.php b/server/vendor/guzzlehttp/promises/src/TaskQueue.php
index 5026363..39fe5bb 100644
--- a/server/vendor/guzzlehttp/promises/src/TaskQueue.php
+++ b/server/vendor/guzzlehttp/promises/src/TaskQueue.php
@@ -56,6 +56,7 @@ class TaskQueue
*/
public function run()
{
+ /** @var callable $task */
while ($task = array_shift($this->queue)) {
$task();
}
diff --git a/server/vendor/guzzlehttp/promises/src/functions.php b/server/vendor/guzzlehttp/promises/src/functions.php
index 89c6569..2fe61b7 100644
--- a/server/vendor/guzzlehttp/promises/src/functions.php
+++ b/server/vendor/guzzlehttp/promises/src/functions.php
@@ -146,9 +146,9 @@ function inspect(PromiseInterface $promise)
'value' => $promise->wait()
];
} catch (RejectionException $e) {
- return ['state' => 'rejected', 'reason' => $e->getReason()];
+ return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()];
} catch (\Exception $e) {
- return ['state' => 'rejected', 'reason' => $e];
+ return ['state' => PromiseInterface::REJECTED, 'reason' => $e];
}
}
@@ -304,10 +304,10 @@ function settle($promises)
return each(
$promises,
function ($value, $idx) use (&$results) {
- $results[$idx] = ['state' => 'fulfilled', 'value' => $value];
+ $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value];
},
function ($reason, $idx) use (&$results) {
- $results[$idx] = ['state' => 'rejected', 'reason' => $reason];
+ $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason];
}
)->then(function () use (&$results) {
ksort($results);
diff --git a/server/vendor/guzzlehttp/promises/tests/EachPromiseTest.php b/server/vendor/guzzlehttp/promises/tests/EachPromiseTest.php
index 0a0a851..08af2a0 100644
--- a/server/vendor/guzzlehttp/promises/tests/EachPromiseTest.php
+++ b/server/vendor/guzzlehttp/promises/tests/EachPromiseTest.php
@@ -39,8 +39,8 @@ class EachPromiseTest extends \PHPUnit_Framework_TestCase
public function testIsWaitable()
{
- $a = new Promise(function () use (&$a) { $a->resolve('a'); });
- $b = new Promise(function () use (&$b) { $b->resolve('b'); });
+ $a = $this->createSelfResolvingPromise('a');
+ $b = $this->createSelfResolvingPromise('b');
$called = [];
$each = new EachPromise([$a, $b], [
'fulfilled' => function ($value) use (&$called) { $called[] = $value; }
@@ -54,7 +54,7 @@ class EachPromiseTest extends \PHPUnit_Framework_TestCase
public function testCanResolveBeforeConsumingAll()
{
$called = 0;
- $a = new Promise(function () use (&$a) { $a->resolve('a'); });
+ $a = $this->createSelfResolvingPromise('a');
$b = new Promise(function () { $this->fail(); });
$each = new EachPromise([$a, $b], [
'fulfilled' => function ($value, $idx, Promise $aggregate) use (&$called) {
@@ -291,4 +291,46 @@ class EachPromiseTest extends \PHPUnit_Framework_TestCase
}
$this->assertEquals(range(0, 9), $results);
}
+
+ private function createSelfResolvingPromise($value)
+ {
+ $p = new Promise(function () use (&$p, $value) {
+ $p->resolve($value);
+ });
+
+ return $p;
+ }
+
+ public function testMutexPreventsGeneratorRecursion()
+ {
+ $results = $promises = [];
+ for ($i = 0; $i < 20; $i++) {
+ $p = $this->createSelfResolvingPromise($i);
+ $pending[] = $p;
+ $promises[] = $p;
+ }
+
+ $iter = function () use (&$promises, &$pending) {
+ foreach ($promises as $promise) {
+ // Resolve a promises, which will trigger the then() function,
+ // which would cause the EachPromise to try to add more
+ // promises to the queue. Without a lock, this would trigger
+ // a "Cannot resume an already running generator" fatal error.
+ if ($p = array_pop($pending)) {
+ $p->wait();
+ }
+ yield $promise;
+ }
+ };
+
+ $each = new EachPromise($iter(), [
+ 'concurrency' => 5,
+ 'fulfilled' => function ($r) use (&$results, &$pending) {
+ $results[] = $r;
+ }
+ ]);
+
+ $each->promise()->wait();
+ $this->assertCount(20, $results);
+ }
}
diff --git a/server/vendor/guzzlehttp/promises/tests/PromiseTest.php b/server/vendor/guzzlehttp/promises/tests/PromiseTest.php
index 946c627..599d8ae 100644
--- a/server/vendor/guzzlehttp/promises/tests/PromiseTest.php
+++ b/server/vendor/guzzlehttp/promises/tests/PromiseTest.php
@@ -172,6 +172,18 @@ class PromiseTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('Whoop', $p->wait());
}
+ public function testWaitsOnAPromiseChainEvenWhenNotUnwrapped()
+ {
+ $p2 = new Promise(function () use (&$p2) {
+ $p2->reject('Fail');
+ });
+ $p = new Promise(function () use ($p2, &$p) {
+ $p->resolve($p2);
+ });
+ $p->wait(false);
+ $this->assertSame(Promise::REJECTED, $p2->getState());
+ }
+
public function testCannotCancelNonPending()
{
$p = new Promise();
diff --git a/server/vendor/guzzlehttp/psr7/CHANGELOG.md b/server/vendor/guzzlehttp/psr7/CHANGELOG.md
index d875aa3..0e278bd 100644
--- a/server/vendor/guzzlehttp/psr7/CHANGELOG.md
+++ b/server/vendor/guzzlehttp/psr7/CHANGELOG.md
@@ -1,5 +1,11 @@
# CHANGELOG
+## 1.2.3 - 2016-02-18
+
+* Fixed support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote
+ streams, which can sometimes return fewer bytes than requested with `fread`.
+* Fixed handling of gzipped responses with FNAME headers.
+
## 1.2.2 - 2016-01-22
* Added support for URIs without any authority.
diff --git a/server/vendor/guzzlehttp/psr7/README.md b/server/vendor/guzzlehttp/psr7/README.md
index 0a4c341..c15ddd3 100644
--- a/server/vendor/guzzlehttp/psr7/README.md
+++ b/server/vendor/guzzlehttp/psr7/README.md
@@ -38,7 +38,7 @@ echo $composed(); // abc, 123. Above all listen to me.
`GuzzleHttp\Psr7\BufferStream`
-Provides a buffer stream that can be written to to fill a buffer, and read
+Provides a buffer stream that can be written to fill a buffer, and read
from to remove bytes from the buffer.
This stream returns a "hwm" metadata value that tells upstream consumers
@@ -106,7 +106,7 @@ echo $stream; // 0123456789
Compose stream implementations based on a hash of functions.
-Allows for easy testing and extension of a provided stream without needing to
+Allows for easy testing and extension of a provided stream without needing
to create a concrete class for a simple extension point.
```php
diff --git a/server/vendor/guzzlehttp/psr7/src/CachingStream.php b/server/vendor/guzzlehttp/psr7/src/CachingStream.php
index 420d5b0..ed68f08 100644
--- a/server/vendor/guzzlehttp/psr7/src/CachingStream.php
+++ b/server/vendor/guzzlehttp/psr7/src/CachingStream.php
@@ -60,9 +60,12 @@ class CachingStream implements StreamInterface
$diff = $byte - $this->stream->getSize();
if ($diff > 0) {
- // If the seek byte is greater the number of read bytes, then read
- // the difference of bytes to cache the bytes and inherently seek.
- $this->read($diff);
+ // Read the remoteStream until we have read in at least the amount
+ // of bytes requested, or we reach the end of the file.
+ while ($diff > 0 && !$this->remoteStream->eof()) {
+ $this->read($diff);
+ $diff = $byte - $this->stream->getSize();
+ }
} else {
// We can just do a normal seek since we've already seen this byte.
$this->stream->seek($byte);
diff --git a/server/vendor/guzzlehttp/psr7/src/InflateStream.php b/server/vendor/guzzlehttp/psr7/src/InflateStream.php
index 2c8628b..0051d3f 100644
--- a/server/vendor/guzzlehttp/psr7/src/InflateStream.php
+++ b/server/vendor/guzzlehttp/psr7/src/InflateStream.php
@@ -20,10 +20,33 @@ class InflateStream implements StreamInterface
public function __construct(StreamInterface $stream)
{
- // Skip the first 10 bytes
- $stream = new LimitStream($stream, -1, 10);
+ // read the first 10 bytes, ie. gzip header
+ $header = $stream->read(10);
+ $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header);
+ // Skip the header, that is 10 + length of filename + 1 (nil) bytes
+ $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength);
$resource = StreamWrapper::getResource($stream);
stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ);
$this->stream = new Stream($resource);
}
+
+ /**
+ * @param StreamInterface $stream
+ * @param $header
+ * @return int
+ */
+ private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header)
+ {
+ $filename_header_length = 0;
+
+ if (substr(bin2hex($header), 6, 2) === '08') {
+ // we have a filename, read until nil
+ $filename_header_length = 1;
+ while ($stream->read(1) !== chr(0)) {
+ $filename_header_length++;
+ }
+ }
+
+ return $filename_header_length;
+ }
}
diff --git a/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php b/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php
index 326f754..60a2636 100644
--- a/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php
+++ b/server/vendor/guzzlehttp/psr7/tests/CachingStreamTest.php
@@ -98,6 +98,33 @@ class CachingStreamTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('ing', $this->body->read(3));
}
+ public function testCanSeekToReadBytesWithPartialBodyReturned()
+ {
+ $stream = fopen('php://temp', 'r+');
+ fwrite($stream, 'testing');
+ fseek($stream, 0);
+
+ $this->decorated = $this->getMockBuilder('\GuzzleHttp\Psr7\Stream')
+ ->setConstructorArgs([$stream])
+ ->setMethods(['read'])
+ ->getMock();
+
+ $this->decorated->expects($this->exactly(2))
+ ->method('read')
+ ->willReturnCallback(function($length) use ($stream){
+ return fread($stream, 2);
+ });
+
+ $this->body = new CachingStream($this->decorated);
+
+ $this->assertEquals(0, $this->body->tell());
+ $this->body->seek(4, SEEK_SET);
+ $this->assertEquals(4, $this->body->tell());
+
+ $this->body->seek(0);
+ $this->assertEquals('test', $this->body->read(4));
+ }
+
public function testWritesToBufferStream()
{
$this->body->read(2);
diff --git a/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php b/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php
index 927fc0b..0e4b586 100644
--- a/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php
+++ b/server/vendor/guzzlehttp/psr7/tests/InflateStreamTest.php
@@ -13,4 +13,27 @@ class InflateStreamtest extends \PHPUnit_Framework_TestCase
$b = new InflateStream($a);
$this->assertEquals('test', (string) $b);
}
+
+ public function testInflatesStreamsWithFilename()
+ {
+ $content = $this->getGzipStringWithFilename('test');
+ $a = Psr7\stream_for($content);
+ $b = new InflateStream($a);
+ $this->assertEquals('test', (string) $b);
+ }
+
+ private function getGzipStringWithFilename($original_string)
+ {
+ $gzipped = bin2hex(gzencode($original_string));
+
+ $header = substr($gzipped, 0, 20);
+ // set FNAME flag
+ $header[6]=0;
+ $header[7]=8;
+ // make a dummy filename
+ $filename = "64756d6d7900";
+ $rest = substr($gzipped, 20);
+
+ return hex2bin($header . $filename . $rest);
+ }
}
diff --git a/server/vendor/guzzlehttp/psr7/tests/UriTest.php b/server/vendor/guzzlehttp/psr7/tests/UriTest.php
index a63293c..357ee25 100644
--- a/server/vendor/guzzlehttp/psr7/tests/UriTest.php
+++ b/server/vendor/guzzlehttp/psr7/tests/UriTest.php
@@ -154,7 +154,7 @@ class UriTest extends \PHPUnit_Framework_TestCase
[self::RFC3986_BASE, 'g;x=1/../y', 'http://a/b/c/y'],
['http://u@a/b/c/d;p?q', '.', 'http://u@a/b/c/'],
['http://u:p@a/b/c/d;p?q', '.', 'http://u:p@a/b/c/'],
- //[self::RFC3986_BASE, 'http:g', 'http:g'],
+ ['http://a/b/c/d/', 'e', 'http://a/b/c/d/e'],
];
}
diff --git a/server/vendor/php-opencloud/common/.gitignore b/server/vendor/php-opencloud/common/.gitignore
new file mode 100644
index 0000000..7ad09a8
--- /dev/null
+++ b/server/vendor/php-opencloud/common/.gitignore
@@ -0,0 +1,10 @@
+.idea/
+.test/
+coverage/
+vendor/
+
+*.pyc
+
+phpunit.xml
+coverage.xml
+composer.lock
diff --git a/server/vendor/php-opencloud/common/composer.json b/server/vendor/php-opencloud/common/composer.json
new file mode 100644
index 0000000..f2520ad
--- /dev/null
+++ b/server/vendor/php-opencloud/common/composer.json
@@ -0,0 +1,36 @@
+{
+ "name": "php-opencloud/common",
+ "authors": [
+ {
+ "name": "Jamie Hannaford",
+ "email": "jamie.hannaford@rackspace.com",
+ "homepage" : "https://github.com/jamiehannaford"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "OpenCloud\\": "src/",
+ "OpenCloud\\Test\\": "tests/unit/",
+ "OpenCloud\\Integration\\": "tests/integration/"
+ }
+ },
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "https://github.com/php-opencloud/Sami"
+ }
+ ],
+ "require": {
+ "php": "~7.0",
+ "guzzlehttp/guzzle": "~6.1",
+ "justinrainbow/json-schema": "~1.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "~4.0",
+ "sami/sami": "dev-master",
+ "psr/log": "~1.0",
+ "satooshi/php-coveralls": "~1.0",
+ "jakub-onderka/php-parallel-lint": "0.*",
+ "fabpot/php-cs-fixer": "~1.0"
+ }
+}
diff --git a/server/vendor/php-opencloud/common/phpunit.xml.dist b/server/vendor/php-opencloud/common/phpunit.xml.dist
new file mode 100644
index 0000000..cf698d5
--- /dev/null
+++ b/server/vendor/php-opencloud/common/phpunit.xml.dist
@@ -0,0 +1,21 @@
+
+
+
+
+
+ tests/unit
+
+
+
+
+
+ ./src
+
+ ./src
+ ./src
+ ./src
+
+
+
+
+
\ No newline at end of file
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
new file mode 100644
index 0000000..beee5e8
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Api/AbstractApi.php
@@ -0,0 +1,33 @@
+ true]);
+ }
+
+ protected function notRequired(array $param)
+ {
+ return array_merge($param, ['required' => false]);
+ }
+
+ protected function query(array $param)
+ {
+ return array_merge($param, ['location' => AbstractParams::QUERY]);
+ }
+
+ protected function url(array $param)
+ {
+ return array_merge($param, ['location' => AbstractParams::URL]);
+ }
+
+ public function documented(array $param)
+ {
+ return array_merge($param, ['required' => true]);
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
new file mode 100644
index 0000000..225e025
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Api/AbstractParams.php
@@ -0,0 +1,100 @@
+ self::INT_TYPE,
+ 'location' => 'query',
+ 'description' => << 'string',
+ 'location' => 'query',
+ 'description' => << sprintf("The unique ID, or identifier, for the %s", $type),
+ 'type' => self::STRING_TYPE,
+ 'location' => self::JSON,
+ ];
+ }
+
+ public function idPath()
+ {
+ return [
+ 'type' => self::STRING_TYPE,
+ 'location' => self::URL,
+ 'description' => 'The unique ID of the resource',
+ ];
+ }
+
+ public function name($resource)
+ {
+ return [
+ 'description' => sprintf("The name of the %s", $resource),
+ 'type' => self::STRING_TYPE,
+ 'location' => self::JSON,
+ ];
+ }
+
+
+ public function sortDir()
+ {
+ return [
+ 'type' => self::STRING_TYPE,
+ 'location' => self::QUERY,
+ 'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
+ 'enum' => ['asc', 'desc']
+ ];
+ }
+
+ public function sortKey()
+ {
+ return [
+ 'type' => self::STRING_TYPE,
+ 'location' => self::QUERY,
+ 'description' => "Sorts by one or more sets of attribute and sort direction combinations.",
+ ];
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
new file mode 100644
index 0000000..d5d26a0
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Api/ApiInterface.php
@@ -0,0 +1,20 @@
+method = $definition['method'];
+ $this->path = $definition['path'];
+
+ if (isset($definition['jsonKey'])) {
+ $this->jsonKey = $definition['jsonKey'];
+ }
+
+ $this->params = self::toParamArray($definition['params']);
+ }
+
+ /**
+ * @return string
+ */
+ public function getPath()
+ {
+ return $this->path;
+ }
+
+ /**
+ * @return string
+ */
+ public function getMethod()
+ {
+ return $this->method;
+ }
+
+ /**
+ * Indicates whether this operation supports a parameter.
+ *
+ * @param $key The name of a parameter
+ *
+ * @return bool
+ */
+ public function hasParam($key)
+ {
+ return isset($this->params[$key]);
+ }
+
+ /**
+ * @param $name
+ *
+ * @return Parameter
+ */
+ public function getParam($name)
+ {
+ return isset($this->params[$name]) ? $this->params[$name] : null;
+ }
+
+ /**
+ * @return string
+ */
+ public function getJsonKey()
+ {
+ return $this->jsonKey;
+ }
+
+ /**
+ * A convenience method that will take a generic array of data and convert it into an array of
+ * {@see Parameter} objects.
+ *
+ * @param array $data A generic data array
+ *
+ * @return array
+ */
+ public static function toParamArray(array $data)
+ {
+ $params = [];
+
+ foreach ($data as $name => $param) {
+ $params[$name] = new Parameter($param + ['name' => $name]);
+ }
+
+ return $params;
+ }
+
+ /**
+ * This method will validate all of the user-provided values and throw an exception if any
+ * failures are detected. This is useful for basic sanity-checking before a request is
+ * serialized and sent to the API.
+ *
+ * @param array $userValues The user-defined values
+ *
+ * @return bool TRUE if validation passes
+ * @throws \Exception If validate fails
+ */
+ public function validate(array $userValues)
+ {
+ foreach ($this->params as $paramName => $param) {
+ if (array_key_exists($paramName, $userValues)) {
+ $param->validate($userValues[$paramName]);
+ } elseif ($param->isRequired()) {
+ throw new \Exception(sprintf('"%s" is a required option, but it was not provided', $paramName));
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/Operator.php b/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
new file mode 100644
index 0000000..4325b69
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Api/Operator.php
@@ -0,0 +1,173 @@
+client = $client;
+ $this->api = $api;
+ }
+
+ /**
+ * Magic method for dictating how objects are rendered when var_dump is called.
+ * For the benefit of users, extremely verbose and heavy properties (such as HTTP clients) are
+ * removed to provide easier access to normal state, such as resource attributes.
+ *
+ * @codeCoverageIgnore
+ * @return array
+ */
+ public function __debugInfo()
+ {
+ $excludedVars = ['client', 'errorBuilder', 'api'];
+
+ $output = [];
+
+ foreach (get_object_vars($this) as $key => $val) {
+ if (!in_array($key, $excludedVars)) {
+ $output[$key] = $val;
+ }
+ }
+
+ return $output;
+ }
+
+ /**
+ * Retrieves a populated Operation according to the definition and values provided. A
+ * HTTP client is also injected into the object to allow it to communicate with the remote API.
+ *
+ * @param array $definition The data that dictates how the operation works
+ *
+ * @return Operation
+ */
+ public function getOperation(array $definition)
+ {
+ return new Operation($definition);
+ }
+
+ protected function sendRequest(Operation $operation, array $userValues = [], $async = false)
+ {
+ $operation->validate($userValues);
+
+ $options = (new RequestSerializer)->serializeOptions($operation, $userValues);
+ $method = $async ? 'requestAsync' : 'request';
+ $uri = uri_template($operation->getPath(), $userValues);
+
+ return $this->client->$method($operation->getMethod(), $uri, $options);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function execute(array $definition, array $userValues = [])
+ {
+ return $this->sendRequest($this->getOperation($definition), $userValues);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function executeAsync(array $definition, array $userValues = [])
+ {
+ return $this->sendRequest($this->getOperation($definition), $userValues, true);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function model($class, $data = null)
+ {
+ $model = new $class($this->client, $this->api);
+
+ // @codeCoverageIgnoreStart
+ if (!$model instanceof ResourceInterface) {
+ throw new \RuntimeException(sprintf('%s does not implement %s', $class, ResourceInterface::class));
+ }
+ // @codeCoverageIgnoreEnd
+
+ if ($data instanceof ResponseInterface) {
+ $model->populateFromResponse($data);
+ } elseif (is_array($data)) {
+ $model->populateFromArray($data);
+ }
+
+ return $model;
+ }
+
+ /**
+ * Will create a new instance of this class with the current HTTP client and API injected in. This
+ * is useful when enumerating over a collection since multiple copies of the same resource class
+ * are needed.
+ *
+ * @return static
+ */
+ public function newInstance()
+ {
+ return new static($this->client, $this->api);
+ }
+
+ /**
+ * @return \GuzzleHttp\Psr7\Uri
+ */
+ protected function getHttpBaseUrl()
+ {
+ return $this->client->getConfig('base_uri');
+ }
+
+ /**
+ * Magic method which intercepts async calls, finds the sequential version, and wraps it in a
+ * {@see Promise} object. In order for this to happen, the called methods need to be in the
+ * following format: `createAsync`, where `create` is the sequential method being wrapped.
+ *
+ * @param $methodName The name of the method being invoked.
+ * @param $args The arguments to be passed to the sequential method.
+ *
+ * @throws \RuntimeException If method does not exist
+ *
+ * @return Promise
+ */
+ public function __call($methodName, $args)
+ {
+ $e = function ($name) {
+ return new \RuntimeException(sprintf('%s::%s is not defined', get_class($this), $name));
+ };
+
+ if (substr($methodName, -5) === 'Async') {
+ $realMethod = substr($methodName, 0, -5);
+ if (!method_exists($this, $realMethod)) {
+ throw $e($realMethod);
+ }
+
+ $promise = new Promise(
+ function () use (&$promise, $realMethod, $args) {
+ $value = call_user_func_array([$this, $realMethod], $args);
+ $promise->resolve($value);
+ }
+ );
+
+ return $promise;
+ }
+
+ throw $e($methodName);
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php b/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
new file mode 100644
index 0000000..43c6ce2
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Api/OperatorInterface.php
@@ -0,0 +1,51 @@
+hydrate($data);
+
+ $this->required = (bool)$this->required;
+
+ $this->stockLocation($data);
+ $this->stockItemSchema($data);
+ $this->stockProperties($data);
+ }
+
+ private function stockLocation(array $data)
+ {
+ $this->location = isset($data['location']) ? $data['location'] : self::DEFAULT_LOCATION;
+
+ if (!AbstractParams::isSupportedLocation($this->location)) {
+ throw new \RuntimeException(sprintf("%s is not a permitted location", $this->location));
+ }
+ }
+
+ private function stockItemSchema(array $data)
+ {
+ if (isset($data['items'])) {
+ $this->itemSchema = new Parameter($data['items']);
+ }
+ }
+
+ private function stockProperties(array $data)
+ {
+ if (isset($data['properties'])) {
+ if (stripos($this->name, 'metadata') !== false) {
+ $this->properties = new Parameter($data['properties']);
+ } else {
+ foreach ($data['properties'] as $name => $property) {
+ $this->properties[$name] = new Parameter($property + ['name' => $name]);
+ }
+ }
+ }
+ }
+
+ /**
+ * Retrieve the name that will be used over the wire.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ return $this->sentAs ?: $this->name;
+ }
+
+ /**
+ * Indicates whether the user must provide a value for this parameter.
+ *
+ * @return bool
+ */
+ public function isRequired()
+ {
+ return $this->required === true;
+ }
+
+ /**
+ * Validates a given user value and checks whether it passes basic sanity checking, such as types.
+ *
+ * @param $userValues The value provided by the user
+ *
+ * @return bool TRUE if the validation passes
+ * @throws \Exception If validation fails
+ */
+ public function validate($userValues)
+ {
+ $this->validateEnums($userValues);
+ $this->validateType($userValues);
+
+ if ($this->isArray()) {
+ $this->validateArray($userValues);
+ } elseif ($this->isObject()) {
+ $this->validateObject($userValues);
+ }
+
+ return true;
+ }
+
+ private function validateEnums($userValues)
+ {
+ if (!empty($this->enum) && $this->type == 'string' && !in_array($userValues, $this->enum)) {
+ throw new \Exception(sprintf(
+ 'The only permitted values are %s. You provided %s', implode(', ', $this->enum), print_r($userValues, true)
+ ));
+ }
+ }
+
+ private function validateType($userValues)
+ {
+ if (!$this->hasCorrectType($userValues)) {
+ throw new \Exception(sprintf(
+ 'The key provided "%s" has the wrong value type. You provided %s (%s) but was expecting %s',
+ $this->name, print_r($userValues, true), gettype($userValues), $this->type
+ ));
+ }
+ }
+
+ private function validateArray($userValues)
+ {
+ foreach ($userValues as $userValue) {
+ $this->itemSchema->validate($userValue);
+ }
+ }
+
+ private function validateObject($userValues)
+ {
+ foreach ($userValues as $key => $userValue) {
+ $property = $this->getNestedProperty($key);
+ $property->validate($userValue);
+ }
+ }
+
+ /**
+ * Internal method which retrieves a nested property for object parameters.
+ *
+ * @param $key The name of the child parameter
+ *
+ * @returns Parameter
+ * @throws \Exception
+ */
+ private function getNestedProperty($key)
+ {
+ if (stripos($this->name, 'metadata') !== false && $this->properties instanceof Parameter) {
+ return $this->properties;
+ } elseif (isset($this->properties[$key])) {
+ return $this->properties[$key];
+ } else {
+ throw new \Exception(sprintf('The key provided "%s" is not defined', $key));
+ }
+ }
+
+ /**
+ * Internal method which indicates whether the user value is of the same type as the one expected
+ * by this parameter.
+ *
+ * @param $userValue The value being checked
+ *
+ * @return bool
+ */
+ private function hasCorrectType($userValue)
+ {
+ // Helper fn to see whether an array is associative (i.e. a JSON object)
+ $isAssociative = function ($value) {
+ return is_array($value) && array_keys($value) !== range(0, count($value) - 1);
+ };
+
+ // For params defined as objects, we'll let the user get away with
+ // passing in an associative array - since it's effectively a hash
+ if ($this->type == 'object' && $isAssociative($userValue)) {
+ return true;
+ }
+
+ if (class_exists($this->type) || interface_exists($this->type)) {
+ return is_a($userValue, $this->type);
+ }
+
+ if (!$this->type) {
+ return true;
+ }
+
+ return gettype($userValue) == $this->type;
+ }
+
+ /**
+ * Indicates whether this parameter represents an array type
+ *
+ * @return bool
+ */
+ public function isArray()
+ {
+ return $this->type == 'array' && $this->itemSchema instanceof Parameter;
+ }
+
+ /**
+ * Indicates whether this parameter represents an object type
+ *
+ * @return bool
+ */
+ public function isObject()
+ {
+ return $this->type == 'object' && !empty($this->properties);
+ }
+
+ public function getLocation()
+ {
+ return $this->location;
+ }
+
+ /**
+ * Verifies whether the given location matches the parameter's location.
+ *
+ * @param $value
+ *
+ * @return bool
+ */
+ public function hasLocation($value)
+ {
+ return $this->location == $value;
+ }
+
+ /**
+ * Retrieves the parameter's path.
+ *
+ * @return string|null
+ */
+ public function getPath()
+ {
+ return $this->path;
+ }
+
+ /**
+ * Retrieves the common schema that an array parameter applies to all its child elements.
+ *
+ * @return Parameter
+ */
+ public function getItemSchema()
+ {
+ return $this->itemSchema;
+ }
+
+ /**
+ * Sets the name of the parameter to a new value
+ *
+ * @param string $name
+ */
+ public function setName($name)
+ {
+ $this->name = $name;
+ }
+
+ /**
+ * Retrieves the child parameter for an object parameter.
+ *
+ * @param string $name The name of the child property
+ *
+ * @return null|Parameter
+ */
+ public function getProperty($name)
+ {
+ if ($this->properties instanceof Parameter) {
+ $this->properties->setName($name);
+ return $this->properties;
+ }
+
+ return isset($this->properties[$name]) ? $this->properties[$name] : null;
+ }
+
+ /**
+ * Retrieves the prefix for a parameter, if any.
+ *
+ * @return string|null
+ */
+ public function getPrefix()
+ {
+ return $this->prefix;
+ }
+
+ public function getPrefixedName()
+ {
+ return $this->prefix . $this->getName();
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php b/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php
new file mode 100644
index 0000000..72bcfce
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/ArrayAccessTrait.php
@@ -0,0 +1,67 @@
+internalState[] = $value;
+ } else {
+ $this->internalState[$offset] = $value;
+ }
+ }
+
+ /**
+ * Checks whether an internal key exists.
+ *
+ * @param string $offset
+ *
+ * @return bool
+ */
+ public function offsetExists($offset)
+ {
+ return isset($this->internalState[$offset]);
+ }
+
+ /**
+ * Unsets an internal key.
+ *
+ * @param string $offset
+ */
+ public function offsetUnset($offset)
+ {
+ unset($this->internalState[$offset]);
+ }
+
+ /**
+ * Retrieves an internal key.
+ *
+ * @param string $offset
+ *
+ * @return mixed|null
+ */
+ public function offsetGet($offset)
+ {
+ return $this->offsetExists($offset) ? $this->internalState[$offset] : null;
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php b/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php
new file mode 100644
index 0000000..1a36cc0
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Auth/AuthHandler.php
@@ -0,0 +1,73 @@
+nextHandler = $nextHandler;
+ $this->tokenGenerator = $tokenGenerator;
+ $this->token = $token;
+ }
+
+ /**
+ * This method is invoked before every HTTP request is sent to the API. When this happens, it
+ * checks to see whether a token is set and valid, and then sets the ``X-Auth-Token`` header
+ * for the HTTP request before letting it continue on its merry way.
+ *
+ * @param RequestInterface $request
+ * @param array $options
+ *
+ * @return mixed|void
+ */
+ public function __invoke(RequestInterface $request, array $options)
+ {
+ $fn = $this->nextHandler;
+
+ if ($this->shouldIgnore($request)) {
+ return $fn($request, $options);
+ }
+
+ if (!$this->token || $this->token->hasExpired()) {
+ $this->token = call_user_func($this->tokenGenerator);
+ }
+
+ $modify = ['set_headers' => ['X-Auth-Token' => $this->token->getId()]];
+
+ return $fn(modify_request($request, $modify), $options);
+ }
+
+ /**
+ * Internal method which prevents infinite recursion. For certain requests, like the initial
+ * auth call itself, we do NOT want to send a token.
+ *
+ * @param RequestInterface $request
+ *
+ * @return bool
+ */
+ private function shouldIgnore(RequestInterface $request)
+ {
+ return strpos((string) $request->getUri(), 'tokens') !== false && $request->getMethod() == 'POST';
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php b/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php
new file mode 100644
index 0000000..b4ab381
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Auth/Catalog.php
@@ -0,0 +1,20 @@
+request = $request;
+ }
+
+ public function setResponse(ResponseInterface $response)
+ {
+ $this->response = $response;
+ }
+
+ public function getRequest()
+ {
+ return $this->request;
+ }
+
+ public function getResponse()
+ {
+ return $this->response;
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php b/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php
new file mode 100644
index 0000000..a7cb26e
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Error/BaseError.php
@@ -0,0 +1,12 @@
+client = $client ?: new Client();
+ }
+
+ /**
+ * Internal method used when outputting headers in the error description.
+ *
+ * @param $name
+ *
+ * @return string
+ */
+ private function header($name)
+ {
+ return sprintf("%s\n%s\n", $name, str_repeat('~', strlen($name)));
+ }
+
+ /**
+ * Before outputting custom links, it is validated to ensure that the user is not
+ * directed off to a broken link. If a 404 is detected, it is hidden.
+ *
+ * @param $link The proposed link
+ *
+ * @return bool
+ */
+ private function linkIsValid($link)
+ {
+ $link = $this->docDomain . $link;
+
+ try {
+ return $this->client->request('HEAD', $link)->getStatusCode() < 400;
+ } catch (ClientException $e) {
+ return false;
+ }
+ }
+
+ /**
+ * @param MessageInterface $message
+ *
+ * @codeCoverageIgnore
+ * @return string
+ */
+ public function str(MessageInterface $message)
+ {
+ if ($message instanceof RequestInterface) {
+ $msg = trim($message->getMethod() . ' '
+ . $message->getRequestTarget())
+ . ' HTTP/' . $message->getProtocolVersion();
+ if (!$message->hasHeader('host')) {
+ $msg .= "\r\nHost: " . $message->getUri()->getHost();
+ }
+ } elseif ($message instanceof ResponseInterface) {
+ $msg = 'HTTP/' . $message->getProtocolVersion() . ' '
+ . $message->getStatusCode() . ' '
+ . $message->getReasonPhrase();
+ }
+
+ foreach ($message->getHeaders() as $name => $values) {
+ $msg .= "\r\n{$name}: " . implode(', ', $values);
+ }
+
+ if ($message->getBody()->getSize() < ini_get('memory_limit')) {
+ $msg .= "\r\n\r\n" . $message->getBody();
+ }
+
+ return $msg;
+ }
+
+ /**
+ * Helper method responsible for constructing and returning {@see BadResponseError} exceptions.
+ *
+ * @param RequestInterface $request The faulty request
+ * @param ResponseInterface $response The error-filled response
+ *
+ * @return BadResponseError
+ */
+ public function httpError(RequestInterface $request, ResponseInterface $response)
+ {
+ $message = $this->header('HTTP Error');
+
+ $message .= sprintf("The remote server returned a \"%d %s\" error for the following transaction:\n\n",
+ $response->getStatusCode(), $response->getReasonPhrase());
+
+ $message .= $this->header('Request');
+ $message .= trim($this->str($request)) . PHP_EOL . PHP_EOL;
+
+ $message .= $this->header('Response');
+ $message .= trim($this->str($response)) . PHP_EOL . PHP_EOL;
+
+ $message .= $this->header('Further information');
+ $message .= $this->getStatusCodeMessage($response->getStatusCode());
+
+ $message .= "Visit http://docs.php-opencloud.com/en/latest/http-codes for more information about debugging "
+ . "HTTP status codes, or file a support issue on https://github.com/php-opencloud/openstack/issues.";
+
+ $e = new BadResponseError($message);
+ $e->setRequest($request);
+ $e->setResponse($response);
+
+ return $e;
+ }
+
+ private function getStatusCodeMessage($statusCode)
+ {
+ $errors = [
+ 400 => 'Please ensure that your input values are valid and well-formed. ',
+ 401 => 'Please ensure that your authentication credentials are valid. ',
+ 404 => "Please ensure that the resource you're trying to access actually exists. ",
+ 500 => 'Please try this operation again once you know the remote server is operational. ',
+ ];
+
+ return isset($errors[$statusCode]) ? $errors[$statusCode] : '';
+ }
+
+ /**
+ * Helper method responsible for constructing and returning {@see UserInputError} exceptions.
+ *
+ * @param string $expectedType The type that was expected from the user
+ * @param mixed $userValue The incorrect value the user actually provided
+ * @param string|null $furtherLink A link to further information if necessary (optional).
+ *
+ * @return UserInputError
+ */
+ public function userInputError($expectedType, $userValue, $furtherLink = null)
+ {
+ $message = $this->header('User Input Error');
+
+ $message .= sprintf("%s was expected, but the following value was passed in:\n\n%s\n",
+ $expectedType, print_r($userValue, true));
+
+ $message .= "Please ensure that the value adheres to the expectation above. ";
+
+ if ($furtherLink && $this->linkIsValid($furtherLink)) {
+ $message .= sprintf("Visit %s for more information about input arguments. ", $this->docDomain . $furtherLink);
+ }
+
+ $message .= 'If you run into trouble, please open a support issue on https://github.com/php-opencloud/openstack/issues.';
+
+ return new UserInputError($message);
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php b/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php
new file mode 100644
index 0000000..3e01d74
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/Error/NotImplementedError.php
@@ -0,0 +1,12 @@
+ $val) {
+ $key = isset($aliases[$key]) ? $aliases[$key] : $key;
+ if (property_exists($this, $key)) {
+ $this->$key = $val;
+ }
+ }
+ }
+
+ private function set($key, $property, array $data, callable $fn = null)
+ {
+ if (isset($data[$key]) && property_exists($this, $property)) {
+ $value = $fn ? call_user_func($fn, $data[$key]) : $data[$key];
+ $this->$property = $value;
+ }
+ }
+}
diff --git a/server/vendor/php-opencloud/common/src/Common/JsonPath.php b/server/vendor/php-opencloud/common/src/Common/JsonPath.php
new file mode 100644
index 0000000..0a6372e
--- /dev/null
+++ b/server/vendor/php-opencloud/common/src/Common/JsonPath.php
@@ -0,0 +1,119 @@
+['foo' => ['bar' => ['baz' => 'some_value']]]
+ *
+ * and you wanted to insert or extract an element. Usually, you would use:
+ *
+ *
$array['foo']['bar']['baz'] = 'new_value';
+ *
+ * but sometimes you do not have access to the variable - so a string representation is needed. Using
+ * XPath-like syntax, this class allows you to do this:
+ *
+ *