PHP Class Scalr\Api\Service\User\V1beta0\Controller\Roles

Since: 5.4.0 (04.03.2015)
Author: Vitaliy Demidov ([email protected])
Inheritance: extends Scalr\Api\Rest\Controller\ApiController, use trait GlobalVariableTrait
Show file Open project: scalr/scalr Class Usage Examples

Public Methods

Method Description
createAction ( ) Creates a new Role in this Environment
createVariableAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope Creates role's global var
deleteAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope Deletes the role from the environment
deleteVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope Deletes role's global variable
deregisterImageAction ( integer $roleId, string $imageId ) : Scalr\Api\DataType\ResultEnvelope Disassociates the specified Image.
describeAction ( ) Retrieves the list of the roles that are available on the Environment
describeImagesAction ( integer $roleId ) : array Retrieves the list of the Images associated with this Role
describeVariablesAction ( integer $roleId ) : array Gets the list of the available Global Variables of the role
fetchAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope Retrieves a specified role
fetchImageAction ( integer $roleId, string $imageId ) : mixed Fetches specified Image. It actually checks relations and redirects to Image
fetchVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope Gets specific global var of the role
getImage ( integer $roleId, string $imageId ) : Image Gets the Image that is associated with the specified Role using User's Environment
getRole ( integer $roleId, boolean $restrictToCurrentScope = false, boolean $modify = null ) : Role | null Gets role from database using User's Environment
getVariableInstance ( ) : Scalr_Scripting_GlobalVariables Gets global variable object
modifyAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope Modifies role attributes
modifyVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope Modifies role's global variable
registerImageAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope Associates a new Image with the Role
replaceImageAction ( integer $roleId, string $imageId ) : Scalr\Api\DataType\ResultEnvelope Associates a new Image with the Role

Protected Methods

Method Description
setImage ( ) Add, replace or remove image in role

Private Methods

Method Description
getDefaultCriteria ( ) : array Gets Default search criteria for the Environment scope

Method Details

createAction() public method

Creates a new Role in this Environment
public createAction ( )

createVariableAction() public method

Creates role's global var
public createVariableAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer
return Scalr\Api\DataType\ResultEnvelope

deleteAction() public method

Deletes the role from the environment
public deleteAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The identifier of the role
return Scalr\Api\DataType\ResultEnvelope

deleteVariableAction() public method

Deletes role's global variable
public deleteVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer
$name string
return Scalr\Api\DataType\ResultEnvelope

deregisterImageAction() public method

It actually checks relations before deletion.
public deregisterImageAction ( integer $roleId, string $imageId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The identifier of the Role
$imageId string The identifier of the Image (uuid)
return Scalr\Api\DataType\ResultEnvelope

describeAction() public method

Retrieves the list of the roles that are available on the Environment
public describeAction ( )

describeImagesAction() public method

Retrieves the list of the Images associated with this Role
public describeImagesAction ( integer $roleId ) : array
$roleId integer The identifier of the role
return array

describeVariablesAction() public method

Gets the list of the available Global Variables of the role
public describeVariablesAction ( integer $roleId ) : array
$roleId integer
return array

fetchAction() public method

Retrieves a specified role
public fetchAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The identifier of the role
return Scalr\Api\DataType\ResultEnvelope

fetchImageAction() public method

Fetches specified Image. It actually checks relations and redirects to Image
public fetchImageAction ( integer $roleId, string $imageId ) : mixed
$roleId integer The identifier of the Role
$imageId string The identifier of the Image (uuid)
return mixed

fetchVariableAction() public method

Gets specific global var of the role
public fetchVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer
$name string
return Scalr\Api\DataType\ResultEnvelope

getImage() public method

Gets the Image that is associated with the specified Role using User's Environment
public getImage ( integer $roleId, string $imageId ) : Image
$roleId integer The identifier of the Role
$imageId string The identifier of the Image which is expected to be associated with the Role
return Scalr\Model\Entity\Image Returns the Image which corresponds the specified Role

getRole() public method

Gets role from database using User's Environment
public getRole ( integer $roleId, boolean $restrictToCurrentScope = false, boolean $modify = null ) : Role | null
$roleId integer The identifier of the Role
$restrictToCurrentScope boolean optional Whether it should additionally check that role corresponds to current scope
$modify boolean optional Whether it should check access permission with modify flag
return Scalr\Model\Entity\Role | null Returns Role entity on success or NULL otherwise

getVariableInstance() public method

Gets global variable object
public getVariableInstance ( ) : Scalr_Scripting_GlobalVariables
return Scalr_Scripting_GlobalVariables

modifyAction() public method

Modifies role attributes
public modifyAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The identifier of the role
return Scalr\Api\DataType\ResultEnvelope

modifyVariableAction() public method

Modifies role's global variable
public modifyVariableAction ( integer $roleId, string $name ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer
$name string
return Scalr\Api\DataType\ResultEnvelope

registerImageAction() public method

Associates a new Image with the Role
public registerImageAction ( integer $roleId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The Identifier of the role
return Scalr\Api\DataType\ResultEnvelope

replaceImageAction() public method

Associates a new Image with the Role
public replaceImageAction ( integer $roleId, string $imageId ) : Scalr\Api\DataType\ResultEnvelope
$roleId integer The Identifier of the role
$imageId string The Identifier of the image
return Scalr\Api\DataType\ResultEnvelope

setImage() protected method

It wraps into separate call to avoid code duplicates on catching Exceptions
protected setImage ( )