syntax correction

This commit is contained in:
stupidon 2016-03-22 17:13:08 +01:00
commit 58f772e69c

View file

@ -34,34 +34,51 @@ class compute
*/ */
public function listServers() public function listServers()
{ {
$serverList = $this->libClass->listServers(true); try{
$servers = Array(); $serverList = $this->libClass->listServers(true);
foreach($serverList as $server){ $servers = Array();
$servers[$server->id] = Array(); foreach($serverList as $server){
$server->flavor->retrieve(); $servers[$server->id] = Array();
$server->image->retrieve(); $server->flavor->retrieve();
$server->retrieve(); $server->image->retrieve();
$servers[$server->id]["id"] = $server->id; $server->retrieve();
$servers[$server->id]["name"] = $server->name; $servers[$server->id]["id"] = $server->id;
$servers[$server->id]["image"] = $server->image; $servers[$server->id]["name"] = $server->name;
$servers[$server->id]["ram"] = $server->flavor->ram; $servers[$server->id]["image"] = $server->image;
$servers[$server->id]["disk"] = $server->flavor->disk; $servers[$server->id]["ram"] = $server->flavor->ram;
$servers[$server->id]["flavor"] = $server->flavor; $servers[$server->id]["disk"] = $server->flavor->disk;
$servers[$server->id]["status"] = $server->status; $servers[$server->id]["flavor"] = $server->flavor;
$servers[$server->id]["created"] = $server->created; $servers[$server->id]["status"] = $server->status;
$servers[$server->id]["updated"] = $server->updated; $servers[$server->id]["created"] = $server->created;
$servers[$server->id]["ipv4"] = $server->ipv4; $servers[$server->id]["updated"] = $server->updated;
$servers[$server->id]["ipv6"] = $server->ipv6; $servers[$server->id]["ipv4"] = $server->ipv4;
$servers[$server->id]["progress"] = $server->progress; $servers[$server->id]["ipv6"] = $server->ipv6;
$servers[$server->id]["hostId"] = $server->hostId; $servers[$server->id]["progress"] = $server->progress;
$servers[$server->id]["tenantId"] = $server->tenantId; $servers[$server->id]["hostId"] = $server->hostId;
$servers[$server->id]["userId"] = $server->userId; $servers[$server->id]["tenantId"] = $server->tenantId;
$servers[$server->id]["taskState"] = $server->taskState; $servers[$server->id]["userId"] = $server->userId;
$servers[$server->id]["addresses"] = $server->addresses; $servers[$server->id]["taskState"] = $server->taskState;
$servers[$server->id]["links"] = $server->links; $servers[$server->id]["addresses"] = $server->addresses;
$servers[$server->id]["metadata"] = $server->metadata; $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; return;
} }
/** /**
@ -70,19 +87,36 @@ class compute
*/ */
public function listFlavors() public function listFlavors()
{ {
$flavorList = $this->libClass->listFlavors(); try{
$flavors = Array(); $flavorList = $this->libClass->listFlavors();
foreach($flavorList as $flavor){ $flavors = Array();
$flavors[$flavor->id] = Array(); foreach($flavorList as $flavor){
$flavor->retrieve(); $flavors[$flavor->id] = Array();
$flavors[$flavor->id]["id"] = $flavor->id; $flavor->retrieve();
$flavors[$flavor->id]["name"] = $flavor->name; $flavors[$flavor->id]["id"] = $flavor->id;
$flavors[$flavor->id]["ram"] = $flavor->ram; $flavors[$flavor->id]["name"] = $flavor->name;
$flavors[$flavor->id]["disk"] = $flavor->disk; $flavors[$flavor->id]["ram"] = $flavor->ram;
$flavors[$flavor->id]["vcpus"] = $flavor->vcpus; $flavors[$flavor->id]["disk"] = $flavor->disk;
$flavors[$flavor->id]["links"] = $flavor->links; $flavors[$flavor->id]["vcpus"] = $flavor->vcpus;
$flavors[$flavor->id]["links"] = $flavor->links;
} }
$this->app->setOutput("Flavors", $flavors); $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; return;
} }
/** /**
@ -91,23 +125,40 @@ class compute
*/ */
public function listImages() public function listImages()
{ {
$imageList = $this->libClass->listImages(); try{
$images = Array(); $imageList = $this->libClass->listImages();
foreach($imageList as $image){ $images = Array();
$images[$image->id] = Array(); foreach($imageList as $image){
$image->retrieve(); $images[$image->id] = Array();
$images[$image->id]["id"] = $image->id; $image->retrieve();
$images[$image->id]["name"] = $image->name; $images[$image->id]["id"] = $image->id;
$images[$image->id]["status"] = $image->status; $images[$image->id]["name"] = $image->name;
$images[$image->id]["created"] = $image->created; $images[$image->id]["status"] = $image->status;
$images[$image->id]["updated"] = $image->updated; $images[$image->id]["created"] = $image->created;
$images[$image->id]["minDisk"] = $image->minDisk; $images[$image->id]["updated"] = $image->updated;
$images[$image->id]["minRam"] = $image->minRam; $images[$image->id]["minDisk"] = $image->minDisk;
$images[$image->id]["progress"] = $image->progress; $images[$image->id]["minRam"] = $image->minRam;
$images[$image->id]["links"] = $image->links; $images[$image->id]["progress"] = $image->progress;
$images[$image->id]["metadata"] = $image->metadata; $images[$image->id]["links"] = $image->links;
$images[$image->id]["metadata"] = $image->metadata;
} }
$this->app->setOutput("Images", $images); $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; return;
} }
/** /**
@ -116,15 +167,32 @@ class compute
*/ */
public function getServer() public function getServer()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
if(!isset($serverId)){ $serverId = $this->app->getPostParam("serverId");
$this->app->setOutput("Error", "Server ID is missing, son!"); if(!isset($serverId)){
return; $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);
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->retrieve(); }
$this->app->setOutput("MyServer", $server); 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; return;
} }
/** /**
@ -133,15 +201,32 @@ class compute
*/ */
public function getFlavor() public function getFlavor()
{ {
$flavorId = $this->app->getPostParam("flavorId"); try{
if(!isset($serverId)){ $flavorId = $this->app->getPostParam("flavorId");
$this->app->setOutput("Error", "Flavor ID is missing, son!"); if(!isset($serverId)){
return; $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);
} }
$opt = array('id' => $flavorId); catch(BadResponseError $e){
$flavor = $this->libClass->getFlavor($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$flavor->retrieve(); }
$this->app->setOutput("MyFlavor", $flavor); 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; return;
} }
/** /**
@ -150,15 +235,32 @@ class compute
*/ */
public function getImage() public function getImage()
{ {
$imageId = $this->app->getPostParam("imageId"); try{
if(!isset($serverId)){ $imageId = $this->app->getPostParam("imageId");
$this->app->setOutput("Error", "Image ID is missing, son!"); if(!isset($serverId)){
return; $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);
} }
$opt = array('id' => $imageId); catch(BadResponseError $e){
$image = $this->libClass->getImage($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$image->retrieve(); }
$this->app->setOutput("MyImage", $image); 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; return;
} }
/** /**
@ -167,15 +269,33 @@ class compute
*/ */
public function createServer() public function createServer()
{ {
$name = $this->app->getPostParam("name"); try{
$imageId = $this->app->getPostParam("imageId"); $name = $this->app->getPostParam("name");
$flavorId = $this->app->getPostParam("flavorId"); $imageId = $this->app->getPostParam("imageId");
if(!isset($name) || !isset($imageId) || !isset($flavorId)){ $flavorId = $this->app->getPostParam("flavorId");
$this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID."); if(!isset($name) || !isset($imageId) || !isset($flavorId)){
return; $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);
} }
$opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId); catch(BadResponseError $e){
$server = $this->libClass->createServer($opt); $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;
} }
/** /**
@ -184,27 +304,44 @@ class compute
*/ */
public function updateServer() public function updateServer()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
$newName = $this->app->getPostParam("newName"); $serverId = $this->app->getPostParam("serverId");
$newIpv4 = $this->app->getPostParam("newIpv4"); $newName = $this->app->getPostParam("newName");
$newIpv6 = $this->app->getPostParam("newIpv6"); $newIpv4 = $this->app->getPostParam("newIpv4");
if(!isset($serverId)|| !(isset($newName) || isset($newIpv4) || isset($newIpv6)) ){ $newIpv6 = $this->app->getPostParam("newIpv6");
$this->app->setOutput("Error", "You'll have to provide server ID and the new attribute(IP(v4/v6)/Name) you desire to update!"); if(!isset($serverId)|| !(isset($newName) || isset($newIpv4) || isset($newIpv6)) ){
return; $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); $opt = array('id' => $serverId);
} $server = $this->libClass->getServer($opt);
$server->update($attr); if (isset($newName)){
$this->app->setOutput("Success", $serverId." has been updated successfully."); 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; return;
} }
/** /**
@ -213,15 +350,32 @@ class compute
*/ */
public function deleteServer() public function deleteServer()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
if(!isset($serverId)){ $serverId = $this->app->getPostParam("serverId");
$this->app->setOutput("Error", "Server ID is missing, son!"); if(!isset($serverId)){
return; $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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->delete(); }
$this->app->setOutput("Success", $serverId." has been deleted successfully."); 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; return;
} }
/** /**
@ -230,16 +384,33 @@ class compute
*/ */
public function changePassword() public function changePassword()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
$password = $this->app->getPostParam("newPassword"); $serverId = $this->app->getPostParam("serverId");
if(!isset($serverId) || !isset($password)){ $password = $this->app->getPostParam("newPassword");
$this->app->setOutput("Error", "Server ID or new password missing."); if(!isset($serverId) || !isset($password)){
return; $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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->changePassword($password); }
$this->app->setOutput("Success", "Password for ".$serverId." has been updated successfully."); 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; return;
} }
/** /**
@ -248,15 +419,32 @@ class compute
*/ */
public function reboot() public function reboot()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
if(!isset($serverId)){ $serverId = $this->app->getPostParam("serverId");
$this->app->setOutput("Error", "Server ID is missing, son!"); if(!isset($serverId)){
return; $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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->reboot(); }
$this->app->setOutput("Success", $serverId." has been deleted successfully."); 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; return;
} }
/** /**
@ -272,12 +460,36 @@ class compute
if(!isset($serverId)|| !isset($imageId) || isset($newName) || isset($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!"); $this->app->setOutput("Error", "You'll have to provide server ID and the new image, name and admin password!");
return; 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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$attr = array('imageId' => $imageId, 'name' => $newName, 'adminPass' => $adminPass); }
$server->rebuild($attr); catch(UserInputError $e){
$this->app->setOutput("Success", $serverId." has been rebuilt successfully with the new image."); $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; return;
} }
/** /**
@ -287,15 +499,32 @@ class compute
*/ */
public function resize() public function resize()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
$newFlavorId = $this->app->getPostParam("newFlavorId"); $serverId = $this->app->getPostParam("serverId");
if(!isset($serverId)|| !isset($flavorId)){ $newFlavorId = $this->app->getPostParam("newFlavorId");
$this->app->setOutput("Error", "You'll have to provide server ID and the new flavor ID!"); if(!isset($serverId)|| !isset($flavorId)){
return; $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);
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->resize($newFlavorId); }
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; return;
} }
/** /**
@ -304,15 +533,32 @@ class compute
*/ */
public function confirmResize() public function confirmResize()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
if(!isset($serverId)){ $serverId = $this->app->getPostParam("serverId");
$this->app->setOutput("Error", "Server ID is missing!"); if(!isset($serverId)){
return; $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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->confirmResize(); }
$this->app->setOutput("Success", $serverId." has been resized successfully as the new flavor."); 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; return;
} }
/** /**
@ -321,46 +567,68 @@ class compute
*/ */
public function revertResize() public function revertResize()
{ {
$serverId = $this->app->getPostParam("serverId"); try{
if(!isset($serverId)){ $serverId = $this->app->getPostParam("serverId");
$this->app->setOutput("Error", "Server ID is missing!"); if(!isset($serverId)){
return; $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.");
} }
$opt = array('id' => $serverId); catch(BadResponseError $e){
$server = $this->libClass->getServer($opt); $this->app->getErrorInstance()->BadResponseHandler($e);
$server->revertResize(); }
$this->app->setOutput("Success", $serverId." : resize operation has been reverted to the old flavor."); 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; return;
} }
/* /**
public function createImage(array $options) * List private and public addresses of a server
{ * @return void
//TODO */
}
public function listAddresses(array $options = []) 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
}
*/
} }