public void Save(PolicyRuleProject project) { if (project == null) { throw new ArgumentNullException("project"); } var filePath = this.GetPolicyPath(project.Id); File.WriteAllText(filePath, project.RuleJson); }
public PolicyRuleProject Get(string azurePolicyId) { var filePath = this.GetPolicyPath(azurePolicyId); if (!File.Exists(filePath)) { throw new InvalidOperationException("Policy does not exist."); } var json = File.ReadAllText(filePath); var project = new PolicyRuleProject(azurePolicyId, json); return(project); }