PHP Class DBServer

Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$clientId
$cloudLocation
$cloudLocationZone
$dateAdded
$dateInitialized
$dateRebootStart
$dateShutdownScheduled
$envId
$farmId
$farmIndex
$farmRoleId
$imageId
$index
$instanceTypeName
$isScalarized
$lastSync
$localIp
$operations
$osType
$platform
$platformPropsClasses
$remoteIp
$serverId
$status

Public Methods

Method Description
Create ( ServerCreateInfo $creInfo, boolean $isImport = false, $setPendingStatus = false ) : DBServer
GetAllProperties ( )
GetClient ( ) : Client
GetCloudLocation ( ) : string Return cloud location (region)
GetCloudServerID ( boolean $skipCache = false ) : string Return real (Cloud) server ID
GetCloudUserData ( )
GetEnvironmentObject ( ) : Scalr_Environment
GetFarmObject ( ) : DBFarm Returns DBFarme object
GetFarmRoleObject ( ) : DBFarmRole Returns DBFarmRole object
GetFreeDeviceName ( $isHvm = false )
GetKey ( boolean $plain = false ) : string Returns Server authentification key (For messaging and Query-Env)
GetOsType ( ) : string
GetProperty ( string $propertyName, boolean $ignoreCache = false ) : mixed Get Server Property
GetRealStatus ( $skipCache = false ) : Scalr\Modules\Platforms\StatusAdapterInterface Gets real status
GetScalarizrVersion ( ) : array Return information about scalarizr version installed on instance
GetScriptingVars ( ) : array
GetSsh2Client ( ) : Scalr_Net_Ssh2_Client
IsExists ( $serverId )
IsRebooting ( )
IsSupported ( $v )
LoadByFarmRoleIDAndIndex ( integer $farm_roleid, integer $index ) : DBServer
LoadByID ( string $serverId ) : DBServer Loads server by specified identifier
LoadByLocalIp ( $localIp, $farmId )
LoadByPropertyValue ( string $propName, string $propValue ) : DBServer Return DBServer by property value
Remove ( ) : void Removes server from database
Save ( )
SendMessage ( Scalr_Messaging_Msg $message, $isEventNotice = false, $delayed = false ) : Scalr_Messaging_Msg Send message to instance
SetProperties ( array $props ) Set multiple server properties
SetProperty ( string $propertyName, mixed $propertyValue ) : void Set server property
__construct ( $serverId )
__destruct ( )
__get ( $name )
__sleep ( )
applyGlobalVarsToValue ( $value )
checkRequestRate ( string $resourseName = '' ) : integer Checks scalr inbound request rate (req/min)
executeScript ( array $script, Scalr_Messaging_Msg_ExecScript $msg ) : void Executes script
getAwsTags ( string $addNameTag = false ) : array Return list of tags that should be applied on EC2 resources
getAzureTags ( ) : array Return list of tags that should be applied for Azure instances
getFieldPropertyMap ( ) : array Gets array of DBServer public fields and db columns
getLaunchReason ( $reasonId )
getNameByConvention ( )
getOpenstackTags ( ) : array Return list of tags that should be applied for Openstack instances
getPort ( $portType )
getScalarizrRepository ( )
getServerHistory ( ) : Scalr\Model\Entity\Server\History Gets server history object
getSzrHost ( )
getTerminateReason ( integer $reasonId ) : string Gets terminate reason
getTerminatingServers ( ) : array Gets a list of servers which in the termination process
getType ( ) : string Return server flavor (instance type)
isCloudstack ( )
isOpenstack ( )
listByFilter ( array $filter = null ) : array Gets a list of servers by filter
load ( $serverinfo )
setOsType ( string $osType ) : DBServer Sets OS type
setScalarizrVersion ( $version )
setType ( string $type ) : DBServer Sets instance type type
suspend ( string | array $reason, boolean $forcefully = null, Scalr_Account_User | integer $user = null ) Marks server as to be suspended.
terminate ( integer | array $reason, boolean $forcefully = null, Scalr_Account_User | integer $user = null ) Marks server as to be terminated.
update ( array | Iterator $props ) Updates specified properties to database
updateStatus ( string $serverStatus ) : DBServer Updates Server status
updateTimelog ( $pointName, $secondsSinceBoot = null, $secondsSinceStart = null )

Private Methods

Method Description
GetVersionInfo ( $v )
Unbind ( )

Method Details

Create() public static method

public static Create ( ServerCreateInfo $creInfo, boolean $isImport = false, $setPendingStatus = false ) : DBServer
$creInfo ServerCreateInfo
$isImport boolean
return DBServer

GetAllProperties() public method

public GetAllProperties ( )

GetClient() public method

public GetClient ( ) : Client
return Client

GetCloudLocation() public method

Return cloud location (region)
public GetCloudLocation ( ) : string
return string

GetCloudServerID() public method

Return real (Cloud) server ID
public GetCloudServerID ( boolean $skipCache = false ) : string
$skipCache boolean
return string

GetCloudUserData() public method

public GetCloudUserData ( )

GetEnvironmentObject() public method

public GetEnvironmentObject ( ) : Scalr_Environment
return Scalr_Environment

GetFarmObject() public method

Returns DBFarme object
public GetFarmObject ( ) : DBFarm
return DBFarm

GetFarmRoleObject() public method

Returns DBFarmRole object
public GetFarmRoleObject ( ) : DBFarmRole
return DBFarmRole

GetFreeDeviceName() public method

public GetFreeDeviceName ( $isHvm = false )

GetKey() public method

Returns Server authentification key (For messaging and Query-Env)
public GetKey ( boolean $plain = false ) : string
$plain boolean
return string

GetOsType() public method

public GetOsType ( ) : string
return string windows | linux

GetProperty() public method

Get Server Property
public GetProperty ( string $propertyName, boolean $ignoreCache = false ) : mixed
$propertyName string
$ignoreCache boolean
return mixed

GetRealStatus() public method

Gets real status
public GetRealStatus ( $skipCache = false ) : Scalr\Modules\Platforms\StatusAdapterInterface
return Scalr\Modules\Platforms\StatusAdapterInterface

GetScalarizrVersion() public method

Return information about scalarizr version installed on instance
public GetScalarizrVersion ( ) : array
return array

GetScriptingVars() public method

public GetScriptingVars ( ) : array
return array

GetSsh2Client() public method

public GetSsh2Client ( ) : Scalr_Net_Ssh2_Client
return Scalr_Net_Ssh2_Client Enter description here ...

IsExists() public static method

public static IsExists ( $serverId )

IsRebooting() public method

public IsRebooting ( )

IsSupported() public method

public IsSupported ( $v )

LoadByFarmRoleIDAndIndex() public static method

public static LoadByFarmRoleIDAndIndex ( integer $farm_roleid, integer $index ) : DBServer
$farm_roleid integer
$index integer
return DBServer

LoadByID() public static method

Loads server by specified identifier
public static LoadByID ( string $serverId ) : DBServer
$serverId string
return DBServer

LoadByLocalIp() public static method

public static LoadByLocalIp ( $localIp, $farmId )

LoadByPropertyValue() public static method

Return DBServer by property value
public static LoadByPropertyValue ( string $propName, string $propValue ) : DBServer
$propName string
$propValue string
return DBServer

Remove() public method

Removes server from database
public Remove ( ) : void
return void

Save() public method

public Save ( )

SendMessage() public method

Send message to instance
public SendMessage ( Scalr_Messaging_Msg $message, $isEventNotice = false, $delayed = false ) : Scalr_Messaging_Msg
$message Scalr_Messaging_Msg
return Scalr_Messaging_Msg

SetProperties() public method

Set multiple server properties
public SetProperties ( array $props )
$props array Associative array of the properties array(property => value)

SetProperty() public method

Set server property
public SetProperty ( string $propertyName, mixed $propertyValue ) : void
$propertyName string
$propertyValue mixed
return void

__construct() public method

public __construct ( $serverId )

__destruct() public method

public __destruct ( )

__get() public method

public __get ( $name )

__sleep() public method

public __sleep ( )

applyGlobalVarsToValue() public method

public applyGlobalVarsToValue ( $value )

checkRequestRate() public method

Checks scalr inbound request rate (req/min)
public checkRequestRate ( string $resourseName = '' ) : integer
$resourseName string optional Resourse name
return integer Returns the number of the requests per minute

executeScript() public method

Executes script
public executeScript ( array $script, Scalr_Messaging_Msg_ExecScript $msg ) : void
$script array Script settings
$msg Scalr_Messaging_Msg_ExecScript Scalarizr message
return void

getAwsTags() public method

Return list of tags that should be applied on EC2 resources
public getAwsTags ( string $addNameTag = false ) : array
$addNameTag string
return array

getAzureTags() public method

Return list of tags that should be applied for Azure instances
public getAzureTags ( ) : array
return array

getFieldPropertyMap() public static method

Gets array of DBServer public fields and db columns
public static getFieldPropertyMap ( ) : array
return array

getLaunchReason() public static method

public static getLaunchReason ( $reasonId )

getNameByConvention() public method

public getNameByConvention ( )

getOpenstackTags() public method

Return list of tags that should be applied for Openstack instances
public getOpenstackTags ( ) : array
return array

getPort() public method

public getPort ( $portType )

getScalarizrRepository() public method

getServerHistory() public method

Gets server history object
See also: Scalr\Model\Entity\Server::getHistory()
Deprecation:
public getServerHistory ( ) : Scalr\Model\Entity\Server\History
return Scalr\Model\Entity\Server\History Returns server history object

getSzrHost() public method

public getSzrHost ( )

getTerminateReason() public static method

Gets terminate reason
See also: Scalr\Model\Entity\Server::getTerminateReason()
Deprecation:
public static getTerminateReason ( integer $reasonId ) : string
$reasonId integer Reason id
return string

getTerminatingServers() public static method

Gets a list of servers which in the termination process
public static getTerminatingServers ( ) : array
return array Returns the list of the servers

getType() public method

Return server flavor (instance type)
public getType ( ) : string
return string

isCloudstack() public method

public isCloudstack ( )

isOpenstack() public method

public isOpenstack ( )

listByFilter() public static method

Gets a list of servers by filter
public static listByFilter ( array $filter = null ) : array
$filter array optional Filter value ['envId' => 'value']
return array Returns array of DBServer objects

load() public static method

public static load ( $serverinfo )

setOsType() public method

Sets OS type
public setOsType ( string $osType ) : DBServer
$osType string Operating System type (linux/windows)
return DBServer

setScalarizrVersion() public method

public setScalarizrVersion ( $version )

setType() public method

Sets instance type type
public setType ( string $type ) : DBServer
$type string
return DBServer

suspend() public method

Marks server as to be suspended.
public suspend ( string | array $reason, boolean $forcefully = null, Scalr_Account_User | integer $user = null )
$reason string | array The reason possibly with the format parameters.
$forcefully boolean optional Method: forcefully (true) | gracefully (false)
$user Scalr_Account_User | integer optional The user object or its unique identifier

terminate() public method

Marks server as to be terminated.
public terminate ( integer | array $reason, boolean $forcefully = null, Scalr_Account_User | integer $user = null )
$reason integer | array The reason possibly with the format parameters.
$forcefully boolean optional Method: forcefully (true) | gracefully (false)
$user Scalr_Account_User | integer optional The user object or its unique identifier

update() public method

Updates specified properties to database
public update ( array | Iterator $props )
$props array | Iterator The list of the properties to update

updateStatus() public method

Updates Server status
public updateStatus ( string $serverStatus ) : DBServer
$serverStatus string The status
return DBServer

updateTimelog() public method

public updateTimelog ( $pointName, $secondsSinceBoot = null, $secondsSinceStart = null )

Property Details

$clientId public property

public $clientId

$cloudLocation public property

public $cloudLocation

$cloudLocationZone public property

public $cloudLocationZone

$dateAdded public property

public $dateAdded

$dateInitialized public property

public $dateInitialized

$dateRebootStart public property

public $dateRebootStart

$dateShutdownScheduled public property

public $dateShutdownScheduled

$envId public property

public $envId

$farmId public property

public $farmId

$farmIndex public property

public $farmIndex

$farmRoleId public property

public $farmRoleId

$imageId public property

public $imageId

$index public property

public $index

$instanceTypeName public property

public $instanceTypeName

$isScalarized public property

public $isScalarized

$lastSync public property

public $lastSync

$localIp public property

public $localIp

$operations public property

public $operations

$osType public property

public $osType

$platform public property

public $platform

$platformPropsClasses public static property

public static $platformPropsClasses

$remoteIp public property

public $remoteIp

$serverId public property

public $serverId

$status public property

public $status