PHP Class Scalr\Stats\CostAnalytics\Prices

Since: 5.0 (05.02.2014)
Author: Vitaliy Demidov ([email protected])
Show file Open project: scalr/scalr

Protected Properties

Property Type Description
$cadb ADODB_mysqli Analytics database connection

Public Methods

Method Description
__construct ( ADODB_mysqli $cadb ) Constructor
get ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string $price ) : Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | boolean Gets price
getActualPrices ( string $platform, string $cloudLocation, string $url = null, DateTime $applied = null, integer $accountId = null, string $instanceType = null, integer $os = null ) : ArrayCollection Gets actual prices on specified date
getCloudLocations ( string $platform ) : array Gets all known cloud locations for the specified platform.
getDetails ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string $price ) : ArrayCollection Gets the collection of the prices for the specified price_id
getHistory ( string $platform, string $cloudLocation, string $url = null, string $accountId = null ) : ArrayCollection Gets the history of the changes of the specified price
getSupportedClouds ( ) : array Gets array of supported clouds
getUnsupportedClouds ( ) : array Gets array of unsupported clouds
hasPriceForUrl ( string $platform, string $url, string $cloudLocation = null ) : boolean Checks whether there is some price for specified platform and url
normalizeUrl ( string $url ) : string Normalizes an url from environment settings to use for price_history table
save ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity $price ) Saves price

Method Details

__construct() public method

Constructor
public __construct ( ADODB_mysqli $cadb )
$cadb ADODB_mysqli

get() public method

Gets price
public get ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string $price ) : Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | boolean
$price Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string The identifier of the price or PriceHistoryEntity object. If you provide with object either priceId or both platform and cloudLocation properties must be set for it. Identifier must be provided as UUID without hyphens.
return Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | boolean Returns price history entity that contains current prices on success or false if nothing found.

getActualPrices() public method

Gets actual prices on specified date
public getActualPrices ( string $platform, string $cloudLocation, string $url = null, DateTime $applied = null, integer $accountId = null, string $instanceType = null, integer $os = null ) : ArrayCollection
$platform string The name of the cloud platform
$cloudLocation string The location of the cloud
$url string optional The keystone url for the private clouds
$applied DateTime optional The date in UTC
$accountId integer optional ID of the account (global level by default)
$instanceType string optional Type of the instance
$os integer optional Os type [Linux - 0, Windows - 1]
return Scalr\Model\Collections\ArrayCollection Returns a collection of price entities

getCloudLocations() public method

These locations are retrieved from prices table, not from the environment settings.
public getCloudLocations ( string $platform ) : array
$platform string The cloud platform
return array Returns array looks like array(url1 => array(cloudLocation1, cloudLocation2, ...), url2 => ...);

getDetails() public method

Gets the collection of the prices for the specified price_id
public getDetails ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string $price ) : ArrayCollection
$price Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | string The PriceHistoryEntity or identifier of the price. Identifier must be provided as UUID without hyphens.
return Scalr\Model\Collections\ArrayCollection Returns all prices which are associated with this price history ID

getHistory() public method

Gets the history of the changes of the specified price
public getHistory ( string $platform, string $cloudLocation, string $url = null, string $accountId = null ) : ArrayCollection
$platform string The cloud platform
$cloudLocation string The cloud location
$url string optional The keystone url for the private cloud
$accountId string optional The identifier of the account for overridden price
return Scalr\Model\Collections\ArrayCollection Returns collection of the PriceHistoryEntity objects

getSupportedClouds() public method

Gets array of supported clouds
public getSupportedClouds ( ) : array
return array

getUnsupportedClouds() public method

Gets array of unsupported clouds
public getUnsupportedClouds ( ) : array
return array

hasPriceForUrl() public method

Checks whether there is some price for specified platform and url
public hasPriceForUrl ( string $platform, string $url, string $cloudLocation = null ) : boolean
$platform string Cloud platform
$url string The endpoint url
$cloudLocation string optional The cloud location
return boolean Returns TRUE if there is some price for specified platform and url or FALSE otherwise

normalizeUrl() public method

Normalizes an url from environment settings to use for price_history table
public normalizeUrl ( string $url ) : string
$url string Original url
return string Returns normalized url to use in price_history database table

save() public method

Saves price
public save ( Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity $price )
$price Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity The PriceHistoryEntity with details set.

Property Details

$cadb protected property

Analytics database connection
protected ADODB_mysqli $cadb
return ADODB_mysqli