Scalr\Api\Service\User\V1beta0\Controller\AccountScripts::getRule PHP Method

getRule() public method

Gets specified orchestration rule
public getRule ( integer $ruleId, boolean $modify = false ) : Scalr\Model\Entity\AccountScript
$ruleId integer Numeric identifier of the rule
$modify boolean optional Modifying flag
return Scalr\Model\Entity\AccountScript Returns the Script Entity on success
    public function getRule($ruleId, $modify = false)
    {
        $rule = AccountScript::findPk($ruleId);
        if (!$rule) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Rule either does not exist or is not owned by your account.");
        }
        if (!$this->hasPermissions($rule, $modify)) {
            //Checks entity level write access permissions
            throw new ApiErrorException(403, ErrorMessage::ERR_PERMISSION_VIOLATION, "Insufficient permissions");
        }
        return $rule;
    }