PHP Class Scalr\Stats\CostAnalytics\Prices

Since: 5.0 (05.02.2014)
Author: Vitaliy Demidov ([email protected])
Afficher le fichier Open project: scalr/scalr

Protected Properties

Свойство Type Description
$cadb ADODB_mysqli Analytics database connection

Méthodes publiques

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

Constructor
public __construct ( ADODB_mysqli $cadb )
$cadb ADODB_mysqli

get() public méthode

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.
Résultat Scalr\Stats\CostAnalytics\Entity\PriceHistoryEntity | boolean Returns price history entity that contains current prices on success or false if nothing found.

getActualPrices() public méthode

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]
Résultat Scalr\Model\Collections\ArrayCollection Returns a collection of price entities

getCloudLocations() public méthode

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

getDetails() public méthode

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.
Résultat Scalr\Model\Collections\ArrayCollection Returns all prices which are associated with this price history ID

getHistory() public méthode

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
Résultat Scalr\Model\Collections\ArrayCollection Returns collection of the PriceHistoryEntity objects

getSupportedClouds() public méthode

Gets array of supported clouds
public getSupportedClouds ( ) : array
Résultat array

getUnsupportedClouds() public méthode

Gets array of unsupported clouds
public getUnsupportedClouds ( ) : array
Résultat array

hasPriceForUrl() public méthode

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
Résultat boolean Returns TRUE if there is some price for specified platform and url or FALSE otherwise

normalizeUrl() public méthode

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

save() public méthode

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_oe property

Analytics database connection
protected ADODB_mysqli $cadb
Résultat ADODB_mysqli