\CloudMunch\helperServerHelper

Class ServerHelper This is a helper class to perform actions on server like providing methods to add ,read and update servers.

Summary

Methods
Properties
Constants
__construct()
getServer()
addServer()
updateServer()
deleteServer()
checkServerExists()
checkConnect()
No public properties found
APPLICATIONS
ASSETS
No protected methods found
No protected properties found
N/A
No private methods found
$appContext
$cmDataManager
$logHelper
N/A

Constants

APPLICATIONS

APPLICATIONS

ASSETS

ASSETS

Properties

$appContext

$appContext : \CloudMunch\helper\CloudMunch\AppContext

Type

\CloudMunch\helper\CloudMunch\AppContext — Reference to AppContext object.

$cmDataManager

$cmDataManager : \CloudMunch\helper\CloudMunch\datamanager\CMDataManager

Type

\CloudMunch\helper\CloudMunch\datamanager\CMDataManager — Reference to CMDataManager object.

$logHelper

$logHelper : \CloudMunch\helper\CloudMunch\loghandling\LogHandler

Type

\CloudMunch\helper\CloudMunch\loghandling\LogHandler — Reference to LogHandler object.

Methods

__construct()

__construct(\CloudMunch\helper\CloudMunch\AppContext  $appContext, \CloudMunch\helper\CloudMunch\loghandling\LogHandler  $logHandler) 

Constructor to initialise Application Context and LogHandler.

Parameters

\CloudMunch\helper\CloudMunch\AppContext $appContext
\CloudMunch\helper\CloudMunch\loghandling\LogHandler $logHandler

getServer()

getServer(string  $servername) : \CloudMunch\Server

This method retreives the details of server from cloudmunch.

Parameters

string $servername

Name of the server as registered in cloudmunch.

Returns

\CloudMunch\Server

addServer()

addServer(\CloudMunch\Server  $server, string  $serverstatus) 

This method can be used to add or register a server to cloudmunch data .

Parameters

\CloudMunch\Server $server
string $serverstatus

server status

updateServer()

updateServer(\CloudMunch\Server  $server,   $serverid) 

This method is used to update server data.

Parameters

\CloudMunch\Server $server
$serverid

deleteServer()

deleteServer(  $assetID) 

This method is to delete server from cloudmunch.

Parameters

$assetID

Asset ID.

checkServerExists()

checkServerExists(  $servername) : boolean

This method checks if server exists or is registered in cloudmunch data.

Parameters

$servername

Name of server.

Returns

boolean

checkConnect()

checkConnect(string  $dns, \CloudMunch\helper\number  $sshport = 22) : string

Checks if server is up and running

Parameters

string $dns

: dns of target server

\CloudMunch\helper\number $sshport

: ssh port to be used to check for connection

Returns

string —

Success : displays an appropriate message Failure : exits with a failure status with an appropriate message