Scalr\Api\Service\User\V1beta0\Controller\Farms::deleteVariableAction PHP Method

deleteVariableAction() public method

Deletes farm's global variable
public deleteVariableAction ( integer $farmId, string $name ) : Scalr\Api\DataType\ResultEnvelope
$farmId integer Numeric identifier of the Farm
$name string Name of variable
return Scalr\Api\DataType\ResultEnvelope
    public function deleteVariableAction($farmId, $name)
    {
        $this->getFarm($farmId, Acl::PERM_FARMS_UPDATE);
        $fetch = $this->getGlobalVariable($name, $this->getVariableInstance(), 0, $farmId);
        $variable = GlobalVariable\FarmGlobalVariable::findPk($farmId, $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 scope.");
        }
        $variable->delete();
        return $this->result(null);
    }