PHP Class DBFarm

Show file Open project: scalr/scalr Class Usage Examples

Public Properties

Property Type Description
$ClientID
$Comments
$EnvID
$Hash
$ID
$Name
$RolesLaunchOrder
$ScalarizrCertificate
$Status
$TermOnSyncFail
$changedByUserId
$changedTime
$createdByUserEmail
$ownerId

Public Methods

Method Description
AddRole ( DBRole $DBRole, string $platform, string $cloudLocation, integer $launchIndex, string $alias = "" ) : DBFarmRole Adds a role to farm
GetAllSettings ( ) : unknown_type Returns all farm settings
GetEnvironmentObject ( ) : Scalr_Environment
GetFarmRoleByBehavior ( string $behavior ) :
GetFarmRoleByRoleID ( integer $role_id ) : DBFarmRole
GetFarmRoleIdByAlias ( $alias )
GetFarmRoles ( ) : DBFarmRole[] Gets the list of the FarmRoles ordered by launch index.
GetMySQLInstances ( $only_master = false, $only_slaves = false )
GetServersByFilter ( array $filter_args = [], array $ufilter_args = [] ) : DBServer[] Gets the list of the servers by specified filter
GetSetting ( string $name ) : mixed Get Farm setting by name
LoadByID ( $id ) : DBFarm Load DBInstance by database id
LoadByIDOnlyName ( $id )
SetSetting ( string $name, mixed $value ) : void Set farm setting
__construct ( $id = null ) : void Constructor
__getNewFarmObject ( ) : Farm
__sleep ( )
__wakeup ( )
applyGlobalVarsToValue ( $value )
cloneFarm ( string | boolean $name = false, Scalr_Account_User $user, integer $envId ) : DBFarm Creates clone for the farm
cloneFarmRoles ( DBFarm $newFarm ) Clones FarmRoles with settings from this Farm to a new Farm
create ( string $name, Scalr_Account_User $user, integer $envId ) : DBFarm Initializes a new farm
getAwsTags ( ) : array Gets AWS tags that should be applied to the resource
getDefinition ( )
isLocked ( $throwException = true ) : boolean Check if farm is locked
loadFields ( array $record ) : DBFarm Load DBInstance
lock ( $userId, $comment, $restrict )
save ( )
setProject ( ProjectEntity | string $project ) : string Associates cost analytics project with the farm
unlock ( $userId )

Method Details

AddRole() public method

Adds a role to farm
public AddRole ( DBRole $DBRole, string $platform, string $cloudLocation, integer $launchIndex, string $alias = "" ) : DBFarmRole
$DBRole DBRole The role object
$platform string The cloud platform
$cloudLocation string The cloud location
$launchIndex integer Launch index
$alias string optional
return DBFarmRole

GetAllSettings() public method

Returns all farm settings
public GetAllSettings ( ) : unknown_type
return unknown_type

GetEnvironmentObject() public method

public GetEnvironmentObject ( ) : Scalr_Environment
return Scalr_Environment

GetFarmRoleByBehavior() public method

public GetFarmRoleByBehavior ( string $behavior ) :
$behavior string
return

GetFarmRoleByRoleID() public method

public GetFarmRoleByRoleID ( integer $role_id ) : DBFarmRole
$role_id integer
return DBFarmRole

GetFarmRoleIdByAlias() public method

public GetFarmRoleIdByAlias ( $alias )

GetFarmRoles() public method

Gets the list of the FarmRoles ordered by launch index.
public GetFarmRoles ( ) : DBFarmRole[]
return DBFarmRole[] Returns the list of the FarmRoles

GetMySQLInstances() public method

public GetMySQLInstances ( $only_master = false, $only_slaves = false )

GetServersByFilter() public method

Gets the list of the servers by specified filter
public GetServersByFilter ( array $filter_args = [], array $ufilter_args = [] ) : DBServer[]
$filter_args array optional Positive logic of filtering
$ufilter_args array optional Negation logic of filtering
return DBServer[] Returns the list of the DBServers

GetSetting() public method

Get Farm setting by name
public GetSetting ( string $name ) : mixed
$name string
return mixed

LoadByID() public static method

Load DBInstance by database id
public static LoadByID ( $id ) : DBFarm
$id
return DBFarm

LoadByIDOnlyName() public static method

public static LoadByIDOnlyName ( $id )

SetSetting() public method

Set farm setting
public SetSetting ( string $name, mixed $value ) : void
$name string
$value mixed
return void

__construct() public method

Constructor
public __construct ( $id = null ) : void
return void

__getNewFarmObject() public method

public __getNewFarmObject ( ) : Farm
return Scalr\Model\Entity\Farm

__sleep() public method

public __sleep ( )

__wakeup() public method

public __wakeup ( )

applyGlobalVarsToValue() public method

public applyGlobalVarsToValue ( $value )

cloneFarm() public method

Creates clone for the farm
public cloneFarm ( string | boolean $name = false, Scalr_Account_User $user, integer $envId ) : DBFarm
$name string | boolean The name of the farm
$user Scalr_Account_User The user object
$envId integer The identifier of the environment
return DBFarm Returns clone

cloneFarmRoles() public method

Clones FarmRoles with settings from this Farm to a new Farm
public cloneFarmRoles ( DBFarm $newFarm )
$newFarm DBFarm A Farm into which Roles be cloned

create() public static method

TODO: Rewrite this terrible code.
public static create ( string $name, Scalr_Account_User $user, integer $envId ) : DBFarm
$name string The name of the farm
$user Scalr_Account_User The user
$envId integer The identifier of the environment
return DBFarm

getAwsTags() public method

Gets AWS tags that should be applied to the resource
public getAwsTags ( ) : array
return array Returns list of the AWS tags

getDefinition() public method

public getDefinition ( )

isLocked() public method

Check if farm is locked
public isLocked ( $throwException = true ) : boolean
$throwException
return boolean

loadFields() public static method

Load DBInstance
public static loadFields ( array $record ) : DBFarm
$record array Array of farm fields
return DBFarm

lock() public method

public lock ( $userId, $comment, $restrict )
$userId integer
$comment string
$restrict bool

save() public method

public save ( )

setProject() public method

It does not perform any actions if cost analytics is disabled
public setProject ( ProjectEntity | string $project ) : string
$project Scalr\Stats\CostAnalytics\Entity\ProjectEntity | string The project entity or its identifier
return string Returns identifier of the associated project

unlock() public method

public unlock ( $userId )
$userId integer

Property Details

$ClientID public property

public $ClientID

$Comments public property

public $Comments

$EnvID public property

public $EnvID

$Hash public property

public $Hash

$ID public property

public $ID

$Name public property

public $Name

$RolesLaunchOrder public property

public $RolesLaunchOrder

$ScalarizrCertificate public property

public $ScalarizrCertificate

$Status public property

public $Status

$TermOnSyncFail public property

public $TermOnSyncFail

$changedByUserId public property

public $changedByUserId

$changedTime public property

public $changedTime

$createdByUserEmail public property

public $createdByUserEmail

$ownerId public property

public $ownerId