PHP 클래스 Scalr\Model\Entity\Role

부터: 5.0 (23.07.2014)
저자: Igor Vodiasov ([email protected])
상속: extends Scalr\Model\AbstractEntity, implements Scalr\DataType\ScopeInterface, implements Scalr\DataType\AccessPermissionsInterface
파일 보기 프로젝트 열기: scalr/scalr 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$accountId integer It is set when the Role is from account scope
$added DateTime The timestamp when the Role was added
$addedByEmail integer The email address of the User who added the Role
$addedByUserId integer The identifier of the User who added the Role
$behaviors string The list of the supported behaviors
$catId integer Identifier of the category
$description string The description
$envId integer It is set when the Role is from environment scope
$generation integer The generation
$id integer The identifier of the Role
$isDeprecated boolean Whether the role is deprecated
$isDevelopment boolean Whether it is development Role
$isQuickStart boolean Whether it is QuickStart Role
$isScalarized boolean Whether it is Scalarized Role
$lastUsed DateTime The timestamp when the Role was used last time
$name string The name of the role
$origin string
$osId string The identifier of the OS

보호된 프로퍼티들

프로퍼티 타입 설명
$behaviorsOverlaps array Rules of behavior compatibility Implies that the DB behaviors is mutually exclusive
$dbBehaviors array List of DB behaviors It is used to generate mutually exclusive rules of behavior compatibility

공개 메소드들

메소드 설명
__construct ( ) Constructor
fetchImagesArray ( ) : array Gets the list of the Images which correspond to the Role
getAllowedEnvironments ( ) : array Return array of environments where this role is allowed explicitly.
getBehaviors ( ) : string[] Gets role behaviors list
getBehaviorsConflicts ( array $behaviors ) : array Checks given set of behaviors on compatibility
getDbMsrBehavior ( ) : boolean | string If role has any database behavior, it will return behavior's name
getFarmsCount ( integer $accountId = null, integer $envId = null ) : integer Gets the number of Farms which are using this Role
getImage ( $platform, $cloudLocation ) : RoleImage Finds out the Image that corresponds to the Role by the specified criteria
getImages ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : EntityIterator Gets Images which are associated with the Role
getOs ( ) : Os Gets the Os entity which corresponds to the Role
getScope ( )
getScripts ( ) : array Get scripts of the Role TODO refactor this method to new Entities
getServersCount ( string $accountId = null, string $envId = null ) : integer Get the number of Servers which are using this Role
hasAccessPermissions ( $user, $environment = null, $modify = null )
hasBehavior ( string $behavior ) : boolean Check if role has behavior
hasDbBehavior ( ) : boolean Check if Role has database behavior
isNameUsed ( string $name, integer $accountId, integer $envId, integer $ignoreRoleId = null ) : boolean Check if given name is used on scalr, account or environment scopes
isUsed ( ) : boolean Checks whether the Role is already used in some Farm
isValidName ( string $name ) : boolean Validates the name
save ( )
setBehaviors ( array | JsonData $behaviors ) Sets role behaviors
setImage ( string $platform, string $cloudLocation, string $imageId, integer $userId, string $userEmail ) Add, replace or remove image in role
setScripts ( array $scripts ) Set scripts of the Role TODO refactor this method to new Entities

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( )

fetchImagesArray() 공개 메소드

Gets the list of the Images which correspond to the Role
public fetchImagesArray ( ) : array
리턴 array Return array of all role's images in format: [platform][cloudLocation] = [id, architecture, type]

getAllowedEnvironments() 공개 메소드

Empty array means everywhere.
public getAllowedEnvironments ( ) : array
리턴 array Array of envId

getBehaviors() 공개 메소드

Gets role behaviors list
public getBehaviors ( ) : string[]
리턴 string[]

getBehaviorsConflicts() 공개 정적인 메소드

Checks given set of behaviors on compatibility
public static getBehaviorsConflicts ( array $behaviors ) : array
$behaviors array Array of a Role behaviors
리턴 array Returns an array of behaviors that cannot be used together

getDbMsrBehavior() 공개 메소드

If role has any database behavior, it will return behavior's name
public getDbMsrBehavior ( ) : boolean | string
리턴 boolean | string Name of database behavior of false

getFarmsCount() 공개 메소드

Gets the number of Farms which are using this Role
public getFarmsCount ( integer $accountId = null, integer $envId = null ) : integer
$accountId integer optional Identifier of account
$envId integer optional Identifier of environment
리턴 integer Returns farm's count which uses current role

getImage() 공개 메소드

Finds out the Image that corresponds to the Role by the specified criteria
public getImage ( $platform, $cloudLocation ) : RoleImage
$platform string The cloud platform
$cloudLocation string The cloud location
리턴 RoleImage Returns the RoleImage object. It throws an exception when the RoleImage does not exist

getImages() 공개 메소드

Gets Images which are associated with the Role
public getImages ( array $criteria = null, array $group = null, array $order = null, integer $limit = null, integer $offset = null, boolean $countRecords = null ) : EntityIterator
$criteria array optional The search criteria on the Image result set.
$group array optional The group parameter
$order array optional The results order looks like [[property1 => true|false], ...]
$limit integer optional The records limit
$offset integer optional The offset
$countRecords boolean optional True to calculate total number of the records without limit
리턴 Scalr\Model\Collections\EntityIterator Returns Images which are associated with the role

getOs() 공개 메소드

Gets the Os entity which corresponds to the Role
public getOs ( ) : Os
리턴 Os Returns the Os entity which corresponds to the Role. If OS has not been defined it will return NULL.

getScope() 공개 메소드

또한 보기: Scalr\DataType\ScopeInterface::getScope()
public getScope ( )

getScripts() 공개 메소드

Get scripts of the Role TODO refactor this method to new Entities
public getScripts ( ) : array
리턴 array

getServersCount() 공개 메소드

Get the number of Servers which are using this Role
public getServersCount ( string $accountId = null, string $envId = null ) : integer
$accountId string optional Identifier of account
$envId string optional Identifier of environment
리턴 integer

hasAccessPermissions() 공개 메소드

또한 보기: Scalr\DataType\AccessPermissionsInterface::hasAccessPermissions()
public hasAccessPermissions ( $user, $environment = null, $modify = null )

hasBehavior() 공개 메소드

Check if role has behavior
public hasBehavior ( string $behavior ) : boolean
$behavior string Behavior name
리턴 boolean Returns true if role has behavior, false otherwise

hasDbBehavior() 공개 메소드

Check if Role has database behavior
public hasDbBehavior ( ) : boolean
리턴 boolean

isNameUsed() 공개 정적인 메소드

Check if given name is used on scalr, account or environment scopes
public static isNameUsed ( string $name, integer $accountId, integer $envId, integer $ignoreRoleId = null ) : boolean
$name string Role's name to check
$accountId integer Identifier of account
$envId integer Identifier of environment
$ignoreRoleId integer Role id to ignore
리턴 boolean Returns TRUE if a such name has been already used on scalr or account (or environment) scopes

isUsed() 공개 메소드

Checks whether the Role is already used in some Farm
public isUsed ( ) : boolean
리턴 boolean Returns TRUE if the Role is already used or FALSE otherwise

isValidName() 공개 정적인 메소드

Validates the name
public static isValidName ( string $name ) : boolean
$name string The name of the Role
리턴 boolean Returns TRUE when the name is valid or FALSE otherwise

save() 공개 메소드

public save ( )

setBehaviors() 공개 메소드

Sets role behaviors
public setBehaviors ( array | JsonData $behaviors )
$behaviors array | Scalr\UI\Request\JsonData Array of behaviors

setImage() 공개 메소드

Add, replace or remove image in role
public setImage ( string $platform, string $cloudLocation, string $imageId, integer $userId, string $userEmail )
$platform string The cloud platform
$cloudLocation string The cloud location
$imageId string optional Either Identifier of the Image to add or NULL to remove
$userId integer The identifier of the User who adds the Image
$userEmail string The email address of the User who adds the Image

setScripts() 공개 메소드

Set scripts of the Role TODO refactor this method to new Entities
public setScripts ( array $scripts )
$scripts array

프로퍼티 상세

$accountId 공개적으로 프로퍼티

It is set when the Role is from account scope
public int $accountId
리턴 integer

$added 공개적으로 프로퍼티

The timestamp when the Role was added
public DateTime $added
리턴 DateTime

$addedByEmail 공개적으로 프로퍼티

The email address of the User who added the Role
public int $addedByEmail
리턴 integer

$addedByUserId 공개적으로 프로퍼티

The identifier of the User who added the Role
public int $addedByUserId
리턴 integer

$behaviors 공개적으로 프로퍼티

The list of the supported behaviors
public string $behaviors
리턴 string

$behaviorsOverlaps 보호되어 있는 정적으로 프로퍼티

Rules of behavior compatibility Implies that the DB behaviors is mutually exclusive
protected static array $behaviorsOverlaps
리턴 array

$catId 공개적으로 프로퍼티

Identifier of the category
public int $catId
리턴 integer

$dbBehaviors 보호되어 있는 정적으로 프로퍼티

List of DB behaviors It is used to generate mutually exclusive rules of behavior compatibility
protected static array $dbBehaviors
리턴 array

$description 공개적으로 프로퍼티

The description
public string $description
리턴 string

$envId 공개적으로 프로퍼티

It is set when the Role is from environment scope
public int $envId
리턴 integer

$generation 공개적으로 프로퍼티

The generation
사용 중단:
public int $generation
리턴 integer

$id 공개적으로 프로퍼티

The identifier of the Role
public int $id
리턴 integer

$isDeprecated 공개적으로 프로퍼티

Whether the role is deprecated
public bool $isDeprecated
리턴 boolean

$isDevelopment 공개적으로 프로퍼티

Whether it is development Role
public bool $isDevelopment
리턴 boolean

$isQuickStart 공개적으로 프로퍼티

Whether it is QuickStart Role
public bool $isQuickStart
리턴 boolean

$isScalarized 공개적으로 프로퍼티

Whether it is Scalarized Role
public bool $isScalarized
리턴 boolean

$lastUsed 공개적으로 프로퍼티

The timestamp when the Role was used last time
public DateTime $lastUsed
리턴 DateTime

$name 공개적으로 프로퍼티

The name of the role
public string $name
리턴 string

$origin 공개적으로 프로퍼티

사용 중단:
public string $origin
리턴 string

$osId 공개적으로 프로퍼티

The identifier of the OS
public string $osId
리턴 string