PHP Interface Scalr\Modules\PlatformModuleInterface

显示文件 Open project: scalr/scalr Interface Usage Examples

Public Methods

Method Description
CheckServerSnapshotStatus ( BundleTask $BundleTask ) Checks server snapshot status
ClearCache ( ) Clears internal cache
CreateServerSnapshot ( BundleTask $BundleTask ) : boolean Creates server snapshot for specified bundle task
GetServerCloudLocation ( DBServer $DBServer ) : string Gets cloud location for the specified server
GetServerConsoleOutput ( DBServer $DBServer ) : string Gets console output for the specified server
GetServerExtendedInformation ( DBServer $DBServer, $extended = false ) : array | boolean Gets server extended information
GetServerID ( DBServer $DBServer ) : string Gets instance id for specified server
GetServerIPAddresses ( DBServer $DBServer ) : array Gets IP Addresses for the specified DB Server
GetServerRealStatus ( DBServer $DBServer ) : Scalr\Modules\Platforms\StatusAdapterInterface Gets the status for the specified DB Server
IsServerExists ( DBServer $DBServer ) : boolean Checks whether specified server exists
LaunchServer ( DBServer $DBServer, Scalr_Server_LaunchOptions $launchOptions = null ) : DBServer Launches new server
PutAccessData ( DBServer $DBServer, Scalr_Messaging_Msg $message ) Puts access data
RebootServer ( DBServer $DBServer, boolean $soft = true ) : boolean Reboots specified server
RemoveServerSnapshot ( Image $image ) Removes servers snapshot
TerminateServer ( DBServer $DBServer ) : boolean Terminates specified server
getConfigVariable ( string $name, Scalr_Environment $env, string $encrypted = true, string $cloudLocation = '' ) : string Gets platform property
getContainer ( ) : Container Gets DI container
getEndpointUrl ( Scalr_Environment $env, string $group = null ) : string | null Gets endpoint url for private clouds
getHttpClient ( DBServer $dbServer ) : mixed Gets API HTTP client configured for specified server
getImageInfo ( Scalr_Environment $environment, string $cloudLocation, string $imageId ) : array Get information for an image instance
getInstanceIdPropertyName ( ) : string Gets string which is used to retrieve instance is from server_properties table
getInstanceType ( string $instanceTypeId, Scalr_Environment $env, string $cloudLocation = null ) : Scalr\Model\Entity\CloudInstanceType | array Returns vCPUs for an instance by its ID
getInstanceTypes ( Scalr_Environment $env = null, string $cloudLocation = null, boolean $details = false ) : array Gets the list of all available flavors for the specified environment and cloud location
getLocations ( Scalr_Environment $environment = null ) : array Gets cloud locations
getOrphanedServers ( Environment $environment, string $cloudLocation, array $instanceIds = null ) : OrphanedServer[] Gets the list of the orphaned instances for the specified environment and location that are not managed by Scalr
hasCloudPrices ( Scalr_Environment $env ) : mixed Checks whether there is some price for the appropriate cloud and url from the specified environment
setConfigVariable ( array $pars, Scalr_Environment $env, string $encrypted = true, string $cloudLocation = '' ) Sets the values for the specified platform properties

Method Details

CheckServerSnapshotStatus() public method

Checks server snapshot status
public CheckServerSnapshotStatus ( BundleTask $BundleTask )
$BundleTask BundleTask The Bundle Task object

ClearCache() public method

Clears internal cache
public ClearCache ( )

CreateServerSnapshot() public method

Creates server snapshot for specified bundle task
public CreateServerSnapshot ( BundleTask $BundleTask ) : boolean
$BundleTask BundleTask The bundle task object
return boolean Returns true on success

GetServerCloudLocation() public method

Gets cloud location for the specified server
public GetServerCloudLocation ( DBServer $DBServer ) : string
$DBServer DBServer The DBServer object
return string Returns cloud location of the specified server

GetServerConsoleOutput() public method

Gets console output for the specified server
public GetServerConsoleOutput ( DBServer $DBServer ) : string
$DBServer DBServer The DB Server object
return string Returns console output if it is not empty otherwise it returns FALSE. If server can not be found it throws an exception.

GetServerExtendedInformation() public method

Gets server extended information
public GetServerExtendedInformation ( DBServer $DBServer, $extended = false ) : array | boolean
$DBServer DBServer The DBServer object
return array | boolean Returns array on success or false otherwise

GetServerID() public method

Gets instance id for specified server
public GetServerID ( DBServer $DBServer ) : string
$DBServer DBServer The DBServer object
return string Returns the identifier of the instance in the cloud

GetServerIPAddresses() public method

Gets IP Addresses for the specified DB Server
public GetServerIPAddresses ( DBServer $DBServer ) : array
$DBServer DBServer DB Server object
return array Returns array looks like array( 'localIp' => Local-IP, 'remoteIp' => Remote-IP, )

GetServerRealStatus() public method

Gets the status for the specified DB Server
public GetServerRealStatus ( DBServer $DBServer ) : Scalr\Modules\Platforms\StatusAdapterInterface
$DBServer DBServer DB Server object
return Scalr\Modules\Platforms\StatusAdapterInterface $status Returns the status

IsServerExists() public method

Checks whether specified server exists
public IsServerExists ( DBServer $DBServer ) : boolean
$DBServer DBServer The DBServer object
return boolean Returns true if server exists of false otherwise

LaunchServer() public method

Launches new server
public LaunchServer ( DBServer $DBServer, Scalr_Server_LaunchOptions $launchOptions = null ) : DBServer
$DBServer DBServer The DBServer instance
$launchOptions Scalr_Server_LaunchOptions optional The options used in this instance
return DBServer Returns DBServer object on success or throws an exception

PutAccessData() public method

Puts access data
public PutAccessData ( DBServer $DBServer, Scalr_Messaging_Msg $message )
$DBServer DBServer The DBServer object
$message Scalr_Messaging_Msg The message object

RebootServer() public method

This method should throw valid InstanceNotFound excepiton for the case when the node does not exist in the cloud.
public RebootServer ( DBServer $DBServer, boolean $soft = true ) : boolean
$DBServer DBServer The DB Server object
$soft boolean Soft reboot or HARD
return boolean Returns TRUE on success or throws an Exception otherwise.

RemoveServerSnapshot() public method

Removes servers snapshot
public RemoveServerSnapshot ( Image $image )
$image Scalr\Model\Entity\Image The Image object

TerminateServer() public method

This method should throw valid InstanceNotFound excepiton for the case when the node does not exist in the cloud.
public TerminateServer ( DBServer $DBServer ) : boolean
$DBServer DBServer The DB Server object
return boolean Returns TRUE on success or throws an Exception otherwise.

getConfigVariable() public method

Gets platform property
Deprecation: by cloud credentials
public getConfigVariable ( string $name, Scalr_Environment $env, string $encrypted = true, string $cloudLocation = '' ) : string
$name string The name of the platform property
$env Scalr_Environment The environment
$encrypted string optional This is ignored
$cloudLocation string optional The cloud location
return string Returns the value of the specified platform property

getContainer() public method

Gets DI container
public getContainer ( ) : Container
return Scalr\DependencyInjection\Container Returns DI container

getEndpointUrl() public method

Gets endpoint url for private clouds
public getEndpointUrl ( Scalr_Environment $env, string $group = null ) : string | null
$env Scalr_Environment The scalr environment object
$group string optional The group name
return string | null Returns endpoint url for private clouds. Null otherwise.

getHttpClient() public method

Gets API HTTP client configured for specified server
public getHttpClient ( DBServer $dbServer ) : mixed
$dbServer DBServer DBServer to configure client
return mixed Returns low-level API HTTP client

getImageInfo() public method

Get information for an image instance
public getImageInfo ( Scalr_Environment $environment, string $cloudLocation, string $imageId ) : array
$environment Scalr_Environment Environment object
$cloudLocation string Location if exists
$imageId string Image identifier
return array Array of image related information

getInstanceIdPropertyName() public method

Gets string which is used to retrieve instance is from server_properties table
public getInstanceIdPropertyName ( ) : string
return string Returns instance id's property name for each platform

getInstanceType() public method

Returns vCPUs for an instance by its ID
public getInstanceType ( string $instanceTypeId, Scalr_Environment $env, string $cloudLocation = null ) : Scalr\Model\Entity\CloudInstanceType | array
$instanceTypeId string Instance type identifier
$env Scalr_Environment The Scalr environment object
$cloudLocation string optional The cloud location
return Scalr\Model\Entity\CloudInstanceType | array Cloud Instance Type entity or array for Ec2 platform

getInstanceTypes() public method

Gets the list of all available flavors for the specified environment and cloud location
public getInstanceTypes ( Scalr_Environment $env = null, string $cloudLocation = null, boolean $details = false ) : array
$env Scalr_Environment optional The scalr environment object
$cloudLocation string optional The cloud location
$details boolean optional Return instance type with detalis (CPU, RAM, DISK, etc)
return array Returns array of the available flavors. It should look like array(flavor => name).

getLocations() public method

Gets cloud locations
public getLocations ( Scalr_Environment $environment = null ) : array
$environment Scalr_Environment The environment object.
return array Returns cloud locations available for current cloud platform. Array looks like array(location => description).

getOrphanedServers() public method

Gets the list of the orphaned instances for the specified environment and location that are not managed by Scalr
public getOrphanedServers ( Environment $environment, string $cloudLocation, array $instanceIds = null ) : OrphanedServer[]
$environment Scalr\Model\Entity\Account\Environment Environment Entity
$cloudLocation string Location name
$instanceIds array optional List of instanceId to filter
return Scalr\Modules\Platforms\OrphanedServer[] Returns array of orphaned servers

hasCloudPrices() public method

It returns first found url which has not any price set for.
public hasCloudPrices ( Scalr_Environment $env ) : mixed
$env Scalr_Environment The scalr environment object
return mixed Returns first found url which has not any price set for. Returns TRUE if there is some price for the cloud OR Returns FALSE if it is public cloud and no price has been set

setConfigVariable() public method

Sets the values for the specified platform properties
public setConfigVariable ( array $pars, Scalr_Environment $env, string $encrypted = true, string $cloudLocation = '' )
$pars array Associative array of the keys -> value
$env Scalr_Environment The environment object
$encrypted string optional This parameter is already ignored
$cloudLocation string The cloud location