PHP 클래스 Scalr\Stats\CostAnalytics\Usage

부터: 5.0 (21.03.2014)
저자: Vitaliy Demidov ([email protected])
상속: use trait Scalr\Stats\CostAnalytics\Forecast
파일 보기 프로젝트 열기: scalr/scalr

보호된 프로퍼티들

프로퍼티 타입 설명
$cadb ADODB_mysqli Cost Analytics database connection
$db ADODB_mysqli Database instance

공개 메소드들

메소드 설명
__construct ( ADODB_mysqli $cadb ) Constructor
autoCostCentre ( ) : string Gets an identifier of the cost centre using fixture
autoProject ( ) : string Gets an identifier of the project using fixture
createDefaultCostCenter ( ) Creates default Cost Center and Project from the fixture
createHostedScalrAccountCostCenter ( Scalr_Account $account, Scalr_Account_User $user = null ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Creates default Cost Center for the Hosted Scalr new account
fetchFarmName ( mixed $farmId ) : string Fetches farm's name
findFarmsByKey ( integer $envId, string $key = null ) : ArrayCollection Finds farms by key It searches by name
fixture ( ) : array Defines default cost center and project
get ( array $criteria, DateTime $begin, DateTime $end, array | string $breakdown = null, boolean $rawResult = false ) : Scalr\DataType\AggregationCollection | array Gets the usage for specified cost centre breakdown by specified tags
getContainer ( ) : Container Gets DI container
getCostCenterMovingAverageToDate ( string $ccId, string $mode, string $date, string $startDate, string $endDate ) : array Gets cost center moving average to date
getCostCenterPeriodData ( string $ccId, string $mode, string $startDate, string $endDate ) : array Gets analytics data for the cost center
getDashboardPeriodData ( string $mode, string $startDate, string $endDate ) : array Gets cost analytics for dashboard
getDisplayHours ( integer | float $hours, integer $precision ) : string Gets formatted user-friendly hours field
getEnvironmentPeriodData ( Scalr_Environment $env, string $mode, string $startDate, string $endDate ) : array Gets cost analytics for environment scope
getFarmCostMetering ( integer $accountId, integer $farmId, string $mode = 'custom', string $startDate = null, string $endDate = null ) : array Gets farm cost metering data
getFarmData ( string $accountId, array $criteria, DateTime $begin, DateTime $end, array | string $breakdown = null, boolean $rawResult = false ) : Scalr\DataType\AggregationCollection | array Gets cost metering data
getFarmPeriodData ( integer $farmId, Scalr_Environment $environment, string $mode, string $startDate, string $endDate ) : array Gets analytics data for the specified farm and period
getFarmPointData ( integer $accountId, string $projectId = null, integer $envId = null, integer | array $farmId = null, integer $farmRoleId = null, string $mode, string $date, string $start, string $end ) : array Get period data for one point on chart
getInstanceTypeName ( string $instanceTypeId, string $envId, string $platform, string $cloudLocation ) : string Gets cloud instance type's name
getMeasure ( string $usageType ) : string Gets measure for selected usage type
getProjectFarmsTopUsageOnDate ( string | null $projectId, string $platform, string $mode, string $date, string $start, string $end, string $ccId = null ) : array Gets detailed top 5 usage by farms for specified project on date
getProjectMovingAverageToDate ( string | null $projectId, string $mode, string $date, string $startDate, string $endDate, string $ccId = null ) : array Gets project moving average to date
getProjectPeriodData ( string $projectId, string $mode, string $startDate, string $endDate, array $filter = null ) : array Gets analytics data for the specified project and period
getTopFarmsPeriodData ( integer $accountId, array $allowedEnvs, string $mode, string $startDate, string $endDate, integer $farmCount = 5 ) : array Gets period data for top farms
initDefault ( ) Initializes default cost centres and projects according to fixtures
isLead ( string $email ) : boolean Checks if user is the lead of at least one project or cost center

비공개 메소드들

메소드 설명
initServerProperties ( ) Initializes server's properties which are necessary for cloud cost analytics

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( ADODB_mysqli $cadb )
$cadb ADODB_mysqli Analytics database connection instance

autoCostCentre() 공개 메소드

Gets an identifier of the cost centre using fixture
public autoCostCentre ( ) : string
리턴 string Returns UUID of the cost centre

autoProject() 공개 메소드

Gets an identifier of the project using fixture
public autoProject ( ) : string
리턴 string Returns UUID of the project

createDefaultCostCenter() 공개 메소드

Creates default Cost Center and Project from the fixture

createHostedScalrAccountCostCenter() 공개 메소드

Creates default Cost Center for the Hosted Scalr new account
public createHostedScalrAccountCostCenter ( Scalr_Account $account, Scalr_Account_User $user = null ) : Scalr\Stats\CostAnalytics\Entity\CostCentreEntity
$account Scalr_Account The account object
$user Scalr_Account_User optional The account owner user
리턴 Scalr\Stats\CostAnalytics\Entity\CostCentreEntity Returns a new Cost Center

fetchFarmName() 공개 메소드

Fetches farm's name
public fetchFarmName ( mixed $farmId ) : string
$farmId mixed The identifier of the farm
리턴 string Returns display name of the farm

findFarmsByKey() 공개 메소드

Finds farms by key It searches by name
public findFarmsByKey ( integer $envId, string $key = null ) : ArrayCollection
$envId integer Current enviroment id
$key string optional Search key
리턴 Scalr\Model\Collections\ArrayCollection Returns collection of the farm objects

fixture() 공개 메소드

Defines default cost center and project
public fixture ( ) : array
리턴 array Returns the fixture of the cost centres

get() 공개 메소드

Gets the usage for specified cost centre breakdown by specified tags
public get ( array $criteria, DateTime $begin, DateTime $end, array | string $breakdown = null, boolean $rawResult = false ) : Scalr\DataType\AggregationCollection | array
$criteria array The list of the criterias ['ccId' => [], 'projectId' => []]
$begin DateTime Begin date
$end DateTime End date
$breakdown array | string optional The identifier of the tag or list looks like ['day', TagEntity::TAG_ID_PROJECT, TagEntity::TAG_ID_FARM ...] The inteval to group data [12 hours, day, week, month]
$rawResult boolean optional Whether it should return raw result
리턴 Scalr\DataType\AggregationCollection | array Returns collection or array with raw result

getContainer() 공개 메소드

Gets DI container
public getContainer ( ) : Container
리턴 Scalr\DependencyInjection\Container

getCostCenterMovingAverageToDate() 공개 메소드

Gets cost center moving average to date
public getCostCenterMovingAverageToDate ( string $ccId, string $mode, string $date, string $startDate, string $endDate ) : array
$ccId string The identifier of the Cost center
$mode string The mode
$date string The date within specified period 'Y-m-d H:00'
$startDate string The start date of the period 'Y-m-d'
$endDate string The end date of the period 'Y-m-d'
리턴 array Returns cost center moving average to date

getCostCenterPeriodData() 공개 메소드

Gets analytics data for the cost center
public getCostCenterPeriodData ( string $ccId, string $mode, string $startDate, string $endDate ) : array
$ccId string The identifier of the cost center (UUID)
$mode string Mode (week, month, quarter, year, custom)
$startDate string Start date in UTC (Y-m-d)
$endDate string End date in UTC (Y-m-d)
리턴 array Returns analytics data for the specified cost center

getDashboardPeriodData() 공개 메소드

Gets cost analytics for dashboard
public getDashboardPeriodData ( string $mode, string $startDate, string $endDate ) : array
$mode string The mode (week, month, quarter, year)
$startDate string The start date of the period in UTC ('Y-m-d')
$endDate string The end date of the period in UTC ('Y-m-d')
리턴 array Returns cost analytics data for dashboard

getDisplayHours() 공개 메소드

Gets formatted user-friendly hours field
public getDisplayHours ( integer | float $hours, integer $precision ) : string
$hours integer | float Usage hours
$precision integer optional Precision
리턴 string

getEnvironmentPeriodData() 공개 메소드

Gets cost analytics for environment scope
public getEnvironmentPeriodData ( Scalr_Environment $env, string $mode, string $startDate, string $endDate ) : array
$env Scalr_Environment Current environment
$mode string The mode (week, month, quarter, year)
$startDate string The start date of the period in UTC ('Y-m-d')
$endDate string The end date of the period in UTC ('Y-m-d')
리턴 array Returns cost analytics data for environment scope

getFarmCostMetering() 공개 메소드

Gets farm cost metering data
public getFarmCostMetering ( integer $accountId, integer $farmId, string $mode = 'custom', string $startDate = null, string $endDate = null ) : array
$accountId integer Client identifier
$farmId integer Id of the farm
$mode string optional Mode (week, month, quarter, year, custom)
$startDate string optional Begin date
$endDate string optional End date
리턴 array Return farm cost metering data

getFarmData() 공개 메소드

Gets cost metering data
public getFarmData ( string $accountId, array $criteria, DateTime $begin, DateTime $end, array | string $breakdown = null, boolean $rawResult = false ) : Scalr\DataType\AggregationCollection | array
$accountId string Client identifier
$criteria array Filter array. ['fieldName' => 'fieldValue'] or ['fieldName' => ['value1', 'value2']]
$begin DateTime Begin date
$end DateTime End date
$breakdown array | string optional The identifier of the tag or list looks like ['day', TagEntity::TAG_ID_FARM ...] The interval to group data [12 hours, day, week, month]
$rawResult boolean optional Whether it should return raw result
리턴 Scalr\DataType\AggregationCollection | array Returns collection or array with raw result

getFarmPeriodData() 공개 메소드

Gets analytics data for the specified farm and period
public getFarmPeriodData ( integer $farmId, Scalr_Environment $environment, string $mode, string $startDate, string $endDate ) : array
$farmId integer The identifier of the Farm
$environment Scalr_Environment Current environment
$mode string Mode (week, month, quarter, year, custom)
$startDate string Start date in UTC (Y-m-d)
$endDate string End date in UTC (Y-m-d)
리턴 array Returns analytics data for the specified farm and period

getFarmPointData() 공개 메소드

Get period data for one point on chart
public getFarmPointData ( integer $accountId, string $projectId = null, integer $envId = null, integer | array $farmId = null, integer $farmRoleId = null, string $mode, string $date, string $start, string $end ) : array
$accountId integer Identifier of the Account
$projectId string optional Identifier of the Project
$envId integer optional Identifier of the Environment
$farmId integer | array optional Identifier of the Farm, or the list of the farms which should be excluded
$farmRoleId integer optional Identifier of the Farm Role Id
$mode string The mode (chart)
$date string The UTC date within period ('Y-m-d H:00')
$start string The start date of the period in UTC ('Y-m-d')
$end string The end date of the period in UTC ('Y-m-d')
리턴 array

getInstanceTypeName() 공개 메소드

Gets cloud instance type's name
public getInstanceTypeName ( string $instanceTypeId, string $envId, string $platform, string $cloudLocation ) : string
$instanceTypeId string Instance type identifier
$envId string Environment identifier
$platform string Platform
$cloudLocation string Cloud location
리턴 string

getMeasure() 공개 메소드

Gets measure for selected usage type
public getMeasure ( string $usageType ) : string
$usageType string Usage type name
리턴 string

getProjectFarmsTopUsageOnDate() 공개 메소드

Gets detailed top 5 usage by farms for specified project on date
public getProjectFarmsTopUsageOnDate ( string | null $projectId, string $platform, string $mode, string $date, string $start, string $end, string $ccId = null ) : array
$projectId string | null The identifier of the project
$platform string The cloud platform
$mode string The mode
$date string The UTC date within period ('Y-m-d H:00')
$start string The start date of the period in UTC ('Y-m-d')
$end string The end date of the period in UTC ('Y-m-d')
$ccId string optional The identifier of the cost center (It is used only when project is null)
리턴 array Returns detailed top 5 usage by farms for specified project on date

getProjectMovingAverageToDate() 공개 메소드

Gets project moving average to date
public getProjectMovingAverageToDate ( string | null $projectId, string $mode, string $date, string $startDate, string $endDate, string $ccId = null ) : array
$projectId string | null The identifier of the project
$mode string The mode
$date string The UTC date within period ('Y-m-d H:00')
$startDate string The start date of the period in UTC ('Y-m-d')
$endDate string The end date of the period in UTC ('Y-m-d')
$ccId string optional The identifier of the cost center (It is used only when project is null)
리턴 array Returns project moving average to date

getProjectPeriodData() 공개 메소드

Gets analytics data for the specified project and period
public getProjectPeriodData ( string $projectId, string $mode, string $startDate, string $endDate, array $filter = null ) : array
$projectId string The identifier of the Project (UUID)
$mode string Mode (week, month, quarter, year, custom)
$startDate string Start date in UTC (Y-m-d)
$endDate string End date in UTC (Y-m-d)
$filter array Filter array [envId => value, accountId => value]
리턴 array Returns analytics data for the specified project and period

getTopFarmsPeriodData() 공개 메소드

Gets period data for top farms
public getTopFarmsPeriodData ( integer $accountId, array $allowedEnvs, string $mode, string $startDate, string $endDate, integer $farmCount = 5 ) : array
$accountId integer The current client id
$allowedEnvs array Array of allowed environments' ids for current user
$mode string The mode (week, month, quarter, year)
$startDate string The start date of the period in UTC ('Y-m-d')
$endDate string The end date of the period in UTC ('Y-m-d')
$farmCount integer Top farms count
리턴 array Returns cost analytics data for environment scope

initDefault() 공개 메소드

Initializes default cost centres and projects according to fixtures
public initDefault ( )

isLead() 공개 메소드

Checks if user is the lead of at least one project or cost center
public isLead ( string $email ) : boolean
$email string User's email
리턴 boolean Returns true if user is project or cc lead

프로퍼티 상세

$cadb 보호되어 있는 프로퍼티

Cost Analytics database connection
protected ADODB_mysqli $cadb
리턴 ADODB_mysqli

$db 보호되어 있는 프로퍼티

Database instance
protected ADODB_mysqli $db
리턴 ADODB_mysqli