PHP Class Scalr\Model\Entity\Server

Author: N.V.
Inheritance: extends Scalr\Model\AbstractEntity, implements Scalr\DataType\AccessPermissionsInterface
Mostra file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$accountId integer Identifier of the Client's Account
$added DateTime Added time
$cloudLocation string Server cloud location
$cloudLocationZone string Zone a cloud is located
$envId integer Environment identifier
$farmId integer Farm identifier
$farmIndex integer Index within the Farm
$farmRoleId integer Identifier for the role in a farm
$id integer The identifier of the Server
$imageId string Image identifier
$index integer Index within the Farm Role
$initialized DateTime Initialized time
$instanceTypeName string Server instance type name
$lastSync DateTime Time the synchronization occured last
$localIp string Server local Ip
$os string Server OS type
$platform string Server platform
$rebootStart DateTime Time when server has been either rebooted or started
$remoteIp string Server remote Ip
$scalarized boolean Whether server is scalarized
$serverId string Server unique identifier
$shutdownScheduled DateTime Sheduled time for shutdown
$status string Status of a server
$type string Server instance type

Protected Properties

Property Type Description
$_environment Scalr\Model\Entity\Account\Environment
$_farm Farm
$_farmRole FarmRole
$_image Image
$_properties Scalr\Model\Collections\SettingsCollection Server properties collection
$_scalarizr Scalr_Net_Scalarizr_Client
$_scalarizrUpdateClient Scalr_Net_Scalarizr_UpdateClient
$_serverHistory Scalr\Model\Entity\Server\History

Public Methods

Method Description
__get ( string $name ) : mixed Magic getter
__getDBServer ( ) : DBServer Gets old model from entity
__getEntityFromDBServer ( DBServer $DBServer ) : Server Gets entity from old model
delete ( )
findPk ( $serverId ) : mixed Temporary solution until we make serverId as primary key
findWithProperties ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : ArrayCollection | Server[] Searches servers by criteria and selecting and initiating their Properties
getEnvironment ( ) : Environment | null Get Environment entity
getFarm ( ) : Farm | null Get Farm entity
getFarmRole ( ) : FarmRole | null Get FarmRole entity
getHistory ( ) : Scalr\Model\Entity\Server\History Gets server history entity
getImage ( ) : Image | null Get Image entity
getImportantPropertyList ( ) : array Gets a list of important properties which must not be deleted
getPort ( string $portType ) : integer Gets port
getSettingCriteria ( string $name, string $value = null, array $criteria = null ) : array Gets filter criteria by the setting
getTerminateReason ( integer $reasonId ) : string Gets terminate reason
hasAccessPermissions ( $user, $environment = null, $modify = null )
isVersionSupported ( string $v ) : boolean Check if given version is less than scalarizr version
reboot ( boolean $hard = false ) Reboot action
resume ( ) Resume action
save ( )
setFreeFarmIndex ( ) Set free farm index for new server
setFreeFarmRoleIndex ( ) Set free farm role index for new server
setOs ( string $osType ) : Server Sets OS type
setTimeLog ( string $field, integer $secondsSinceBoot = null, integer $secondsSinceStart = null ) : boolean Add record for servers_launch_timelog
suspend ( User $user = null ) : boolean Marks server as to be suspended.
terminate ( integer | array $reason, boolean $forcefully = null, User $user = null ) : boolean Marks server as to be terminated.
updateStatus ( string $serverStatus ) : Server Updates Server status
versionInfo ( string $v ) : int[] Parses version info into machine representation

Method Details

__get() public method

Magic getter
public __get ( string $name ) : mixed
$name string Name of property that is accessed
return mixed Returns property value

__getDBServer() public method

Gets old model from entity
public __getDBServer ( ) : DBServer
return DBServer

__getEntityFromDBServer() public method

Gets entity from old model
public __getEntityFromDBServer ( DBServer $DBServer ) : Server
$DBServer DBServer Db server object
return Server

delete() public method

See also: AbstractEntity::delete()
public delete ( )

findPk() public static method

Temporary solution until we make serverId as primary key
public static findPk ( $serverId ) : mixed
$serverId
return mixed

findWithProperties() public static method

Searches servers by criteria and selecting and initiating their Properties
public static findWithProperties ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : ArrayCollection | Server[]
$criteria array optional The search criteria.
$group array optional The group by looks like [property1, ...], by default groups by `serverId`
$order array optional The results order looks like [property1 => true|false, ... ]
$limit integer optional The records limit
$offset integer optional The offset
$countRecords boolean optional True to calculate total number of the records without limit
return Scalr\Model\Collections\ArrayCollection | Server[] Returns collection of the entities.

getEnvironment() public method

Get Environment entity
public getEnvironment ( ) : Environment | null
return Scalr\Model\Entity\Account\Environment | null Return Environment entity or null

getFarm() public method

Get Farm entity
public getFarm ( ) : Farm | null
return Farm | null Returns the Farm entity which is associated with the Server or null otherwise

getFarmRole() public method

Get FarmRole entity
public getFarmRole ( ) : FarmRole | null
return FarmRole | null Returns the FarmRole entity which is associated with the Server or null otherwise

getHistory() public method

Gets server history entity
public getHistory ( ) : Scalr\Model\Entity\Server\History
return Scalr\Model\Entity\Server\History Returns server history entity

getImage() public method

Get Image entity
public getImage ( ) : Image | null
return Image | null Return Image entity or null

getImportantPropertyList() public static method

Gets a list of important properties which must not be deleted
public static getImportantPropertyList ( ) : array
return array Returns array of properties

getPort() public method

Gets port
public getPort ( string $portType ) : integer
$portType string
return integer

getSettingCriteria() public method

Gets filter criteria by the setting
public getSettingCriteria ( string $name, string $value = null, array $criteria = null ) : array
$name string Setting name
$value string optional Setting value
$criteria array optional Criteria, if already exists
return array Returns extended criteria

getTerminateReason() public static method

Gets terminate reason
public static getTerminateReason ( integer $reasonId ) : string
$reasonId integer Reason id
return string

hasAccessPermissions() public method

See also: AccessPermissionsInterface::hasAccessPermissions()
public hasAccessPermissions ( $user, $environment = null, $modify = null )

isVersionSupported() public method

Check if given version is less than scalarizr version
public isVersionSupported ( string $v ) : boolean
$v string Version
return boolean

reboot() public method

Reboot action
public reboot ( boolean $hard = false )
$hard boolean optional Method: Hard (true) | Soft (false)

resume() public method

Resume action
public resume ( )

save() public method

See also: AbstractEntity::save()
public save ( )

setFreeFarmIndex() public method

Set free farm index for new server
public setFreeFarmIndex ( )

setFreeFarmRoleIndex() public method

Set free farm role index for new server

setOs() public method

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

setTimeLog() public method

Add record for servers_launch_timelog
public setTimeLog ( string $field, integer $secondsSinceBoot = null, integer $secondsSinceStart = null ) : boolean
$field string Field name which we should update
$secondsSinceBoot integer optional Seconds since boot. Field is used for field ts_hi If field is ts_launched, ts_hi, ts_bhu, ts_hu, value could be used as timestamp
$secondsSinceStart integer optional Seconds since start. Field is used for field ts_hi
return boolean

suspend() public method

Marks server as to be suspended.
public suspend ( User $user = null ) : boolean
$user Scalr\Model\Entity\Account\User optional The user entity
return boolean

terminate() public method

Marks server as to be terminated.
public terminate ( integer | array $reason, boolean $forcefully = null, User $user = null ) : boolean
$reason integer | array The reason possibly with the format parameters.
$forcefully boolean optional Method: forcefully (true) | gracefully (false)
$user Scalr\Model\Entity\Account\User optional The user entity
return boolean

updateStatus() public method

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

versionInfo() public static method

Parses version info into machine representation
public static versionInfo ( string $v ) : int[]
$v string String representation of a version
return int[]

Property Details

$_environment protected_oe property

protected Environment,Scalr\Model\Entity\Account $_environment
return Scalr\Model\Entity\Account\Environment

$_farm protected_oe property

protected Farm,Scalr\Model\Entity $_farm
return Farm

$_farmRole protected_oe property

protected FarmRole,Scalr\Model\Entity $_farmRole
return FarmRole

$_image protected_oe property

protected Image,Scalr\Model\Entity $_image
return Image

$_properties protected_oe property

Server properties collection
protected SettingsCollection,Scalr\Model\Collections $_properties
return Scalr\Model\Collections\SettingsCollection

$_scalarizr protected_oe property

protected Scalr_Net_Scalarizr_Client $_scalarizr
return Scalr_Net_Scalarizr_Client

$_scalarizrUpdateClient protected_oe property

protected Scalr_Net_Scalarizr_UpdateClient $_scalarizrUpdateClient
return Scalr_Net_Scalarizr_UpdateClient

$_serverHistory protected_oe property

protected History,Scalr\Model\Entity\Server $_serverHistory
return Scalr\Model\Entity\Server\History

$accountId public_oe property

Identifier of the Client's Account
public int $accountId
return integer

$added public_oe property

Added time
public DateTime $added
return DateTime

$cloudLocation public_oe property

Server cloud location
public string $cloudLocation
return string

$cloudLocationZone public_oe property

Zone a cloud is located
public string $cloudLocationZone
return string

$envId public_oe property

Environment identifier
public int $envId
return integer

$farmId public_oe property

Farm identifier
public int $farmId
return integer

$farmIndex public_oe property

Index within the Farm
public int $farmIndex
return integer

$farmRoleId public_oe property

Identifier for the role in a farm
public int $farmRoleId
return integer

$id public_oe property

The identifier of the Server
public int $id
return integer

$imageId public_oe property

Image identifier
public string $imageId
return string

$index public_oe property

Index within the Farm Role
public int $index
return integer

$initialized public_oe property

Initialized time
public DateTime $initialized
return DateTime

$instanceTypeName public_oe property

Server instance type name
public string $instanceTypeName
return string

$lastSync public_oe property

Time the synchronization occured last
public DateTime $lastSync
return DateTime

$localIp public_oe property

Server local Ip
public string $localIp
return string

$os public_oe property

Server OS type
public string $os
return string

$platform public_oe property

Server platform
public string $platform
return string

$rebootStart public_oe property

Time when server has been either rebooted or started
public DateTime $rebootStart
return DateTime

$remoteIp public_oe property

Server remote Ip
public string $remoteIp
return string

$scalarized public_oe property

Whether server is scalarized
public bool $scalarized
return boolean

$serverId public_oe property

Server unique identifier
public string $serverId
return string

$shutdownScheduled public_oe property

Sheduled time for shutdown
public DateTime $shutdownScheduled
return DateTime

$status public_oe property

Status of a server
public string $status
return string

$type public_oe property

Server instance type
public string $type
return string