PHP Интерфейс Scalr\Modules\PlatformModuleInterface

Показать файл Открыть проект Примеры использования интерфейса

Открытые методы

Метод Описание
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

Описание методов

CheckServerSnapshotStatus() публичный Метод

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

ClearCache() публичный Метод

Clears internal cache
public ClearCache ( )

CreateServerSnapshot() публичный Метод

Creates server snapshot for specified bundle task
public CreateServerSnapshot ( BundleTask $BundleTask ) : boolean
$BundleTask BundleTask The bundle task object
Результат boolean Returns true on success

GetServerCloudLocation() публичный Метод

Gets cloud location for the specified server
public GetServerCloudLocation ( DBServer $DBServer ) : string
$DBServer DBServer The DBServer object
Результат string Returns cloud location of the specified server

GetServerConsoleOutput() публичный Метод

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

GetServerExtendedInformation() публичный Метод

Gets server extended information
public GetServerExtendedInformation ( DBServer $DBServer, $extended = false ) : array | boolean
$DBServer DBServer The DBServer object
Результат array | boolean Returns array on success or false otherwise

GetServerID() публичный Метод

Gets instance id for specified server
public GetServerID ( DBServer $DBServer ) : string
$DBServer DBServer The DBServer object
Результат string Returns the identifier of the instance in the cloud

GetServerIPAddresses() публичный Метод

Gets IP Addresses for the specified DB Server
public GetServerIPAddresses ( DBServer $DBServer ) : array
$DBServer DBServer DB Server object
Результат array Returns array looks like array( 'localIp' => Local-IP, 'remoteIp' => Remote-IP, )

GetServerRealStatus() публичный Метод

Gets the status for the specified DB Server
public GetServerRealStatus ( DBServer $DBServer ) : Scalr\Modules\Platforms\StatusAdapterInterface
$DBServer DBServer DB Server object
Результат Scalr\Modules\Platforms\StatusAdapterInterface $status Returns the status

IsServerExists() публичный Метод

Checks whether specified server exists
public IsServerExists ( DBServer $DBServer ) : boolean
$DBServer DBServer The DBServer object
Результат boolean Returns true if server exists of false otherwise

LaunchServer() публичный Метод

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
Результат DBServer Returns DBServer object on success or throws an exception

PutAccessData() публичный Метод

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

RebootServer() публичный Метод

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
Результат boolean Returns TRUE on success or throws an Exception otherwise.

RemoveServerSnapshot() публичный Метод

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

TerminateServer() публичный Метод

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
Результат boolean Returns TRUE on success or throws an Exception otherwise.

getConfigVariable() публичный Метод

Gets platform property
Устаревший: 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
Результат string Returns the value of the specified platform property

getContainer() публичный Метод

Gets DI container
public getContainer ( ) : Container
Результат Scalr\DependencyInjection\Container Returns DI container

getEndpointUrl() публичный Метод

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
Результат string | null Returns endpoint url for private clouds. Null otherwise.

getHttpClient() публичный Метод

Gets API HTTP client configured for specified server
public getHttpClient ( DBServer $dbServer ) : mixed
$dbServer DBServer DBServer to configure client
Результат mixed Returns low-level API HTTP client

getImageInfo() публичный Метод

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
Результат array Array of image related information

getInstanceIdPropertyName() публичный Метод

Gets string which is used to retrieve instance is from server_properties table
public getInstanceIdPropertyName ( ) : string
Результат string Returns instance id's property name for each platform

getInstanceType() публичный Метод

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
Результат Scalr\Model\Entity\CloudInstanceType | array Cloud Instance Type entity or array for Ec2 platform

getInstanceTypes() публичный Метод

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)
Результат array Returns array of the available flavors. It should look like array(flavor => name).

getLocations() публичный Метод

Gets cloud locations
public getLocations ( Scalr_Environment $environment = null ) : array
$environment Scalr_Environment The environment object.
Результат array Returns cloud locations available for current cloud platform. Array looks like array(location => description).

getOrphanedServers() публичный Метод

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
Результат Scalr\Modules\Platforms\OrphanedServer[] Returns array of orphaned servers

hasCloudPrices() публичный Метод

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
Результат 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() публичный Метод

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