Scalr\Api\Service\User\V1beta0\Controller\FarmRoles::deleteVariableAction PHP Méthode

deleteVariableAction() public méthode

Deletes farm role's global variable
public deleteVariableAction ( integer $farmRoleId, string $name ) : Scalr\Api\DataType\ResultEnvelope
$farmRoleId integer Numeric identifier of the Farm Role
$name string Name of variable
Résultat Scalr\Api\DataType\ResultEnvelope
    public function deleteVariableAction($farmRoleId, $name)
    {
        $farmRole = $this->getFarmRole($farmRoleId, null, true);
        $fetch = $this->getGlobalVariable($name, $this->getVariableInstance(), $farmRole->roleId, $farmRole->farmId, $farmRoleId);
        $variable = GlobalVariable\FarmRoleGlobalVariable::findPk($farmRoleId, $name);
        if (empty($fetch)) {
            throw new ApiErrorException(404, ErrorMessage::ERR_OBJECT_NOT_FOUND, "Requested Global Variable does not exist.");
        }
        if (empty($variable)) {
            throw new ApiErrorException(403, ErrorMessage::ERR_SCOPE_VIOLATION, "You can only delete Global Variables declared in Farm Role scope.");
        }
        $variable->delete();
        return $this->result(null);
    }