PHP Interface Scalr\Modules\PlatformModuleInterface

Afficher le fichier Open project: scalr/scalr Interface Usage Examples

Méthodes publiques

Méthode 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 méthode

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

ClearCache() public méthode

Clears internal cache
public ClearCache ( )

CreateServerSnapshot() public méthode

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

GetServerCloudLocation() public méthode

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

GetServerConsoleOutput() public méthode

Gets console output for the specified server
public GetServerConsoleOutput ( DBServer $DBServer ) : string
$DBServer DBServer The DB Server object
Résultat 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 méthode

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

GetServerID() public méthode

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

GetServerIPAddresses() public méthode

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

GetServerRealStatus() public méthode

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

IsServerExists() public méthode

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

LaunchServer() public méthode

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
Résultat DBServer Returns DBServer object on success or throws an exception

PutAccessData() public méthode

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 méthode

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
Résultat boolean Returns TRUE on success or throws an Exception otherwise.

RemoveServerSnapshot() public méthode

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

TerminateServer() public méthode

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
Résultat boolean Returns TRUE on success or throws an Exception otherwise.

getConfigVariable() public méthode

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
Résultat string Returns the value of the specified platform property

getContainer() public méthode

Gets DI container
public getContainer ( ) : Container
Résultat Scalr\DependencyInjection\Container Returns DI container

getEndpointUrl() public méthode

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
Résultat string | null Returns endpoint url for private clouds. Null otherwise.

getHttpClient() public méthode

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

getImageInfo() public méthode

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
Résultat array Array of image related information

getInstanceIdPropertyName() public méthode

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

getInstanceType() public méthode

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
Résultat Scalr\Model\Entity\CloudInstanceType | array Cloud Instance Type entity or array for Ec2 platform

getInstanceTypes() public méthode

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)
Résultat array Returns array of the available flavors. It should look like array(flavor => name).

getLocations() public méthode

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

getOrphanedServers() public méthode

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
Résultat Scalr\Modules\Platforms\OrphanedServer[] Returns array of orphaned servers

hasCloudPrices() public méthode

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
Résultat 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 méthode

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