Scalr\Api\Service\User\V1beta0\Controller\Roles::deleteAction PHP Method

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
    public function deleteAction($roleId)
    {
        $this->checkScopedPermissions('ROLES', 'MANAGE');
        $role = $this->getRole($roleId, true, true);
        if ($role->isUsed()) {
            throw new ApiErrorException(409, ErrorMessage::ERR_OBJECT_IN_USE, "It's strictly forbidden to remove a Role currently in use as the Farms become broken.");
        }
        $role->delete();
        return $this->result(null);
    }