public RestConfigurationChangeSummary(ConfigurationChangeRequest change) { Id = change.Id; Name = change.Entry.Name; Action = change.Action; Links = new List <RestLink>(); }
private void PurgeAllExistingItems(ConfigurationChangeRequest change) { var filespec = Path.ChangeExtension(change.Entry.Name, CONFIG_FILE_EXTENSION); foreach (var filename in Directory.GetFiles(BaseFolder, filespec, SearchOption.AllDirectories)) { File.Delete(filename); } }
public IActionResult SetConfiguration([FromBody] ConfigurationChangeRequest request) { configChangeService.ChangeConfiguration(request.Select(opt => new ConfigurationOption { Key = opt.Key, Value = opt.Value })); return(Ok()); }
public void Save(ConfigurationChangeRequest update) { lock (SyncObj) { if (_restartPending) { throw new InvalidOperationException(string.Format("Restart in progress")); } update.Entry.Tags.RemoveAll(SpecialTags.ThatShouldNotBePersisted); _pendingChanges.Add(update); } }
public override void Save(ConfigurationChangeRequest change) { if (!change.Entry.Tags.ContainsAll(SpecialTags.ACTIVITY)) { return; } var filepath = Path.Combine(BaseFolder, Path.ChangeExtension(change.Entry.Name, CONFIG_FILE_EXTENSION)); if (!HandleChange(change, filepath)) { throw new InvalidOperationException(string.Format("Unknown ChangeRequest action '{0}'", change.Action)); } }
protected bool HandleChange(ConfigurationChangeRequest change, string filepath) { switch (change.Action.ToLowerInvariant()) { case ConfigurationActions.Delete: File.Delete(filepath); return(true); case ConfigurationActions.Update: WriteConfigFile(change.Entry, filepath); return(true); } return(false); }
public override void Save(ConfigurationChangeRequest change) { if (!change.Entry.Tags.ContainsAll(SpecialTags.HEALTH_CHECK)) { return; } string scheduler; if (!change.Entry.RequiredProperties.TryGetValue(ConfigurationEntry.RequiredPropertyNames.SCHEDULER, out scheduler)) { throw new InvalidOperationException(string.Format("Unable to update configuration, '{0}' property is missing", ConfigurationEntry.RequiredPropertyNames.SCHEDULER)); } PurgeAllExistingItems(change); var filepath = Path.Combine(BaseFolder, scheduler, Path.ChangeExtension(change.Entry.Name, CONFIG_FILE_EXTENSION)); if (!HandleChange(change, filepath)) { throw new InvalidOperationException(string.Format("Unknown ChangeRequest action '{0}'", change.Action)); } }
public abstract void Save(ConfigurationChangeRequest change);
public static void Update(ConfigurationChangeRequest change) { _instance.Save(change); }
public override void Save(ConfigurationChangeRequest change) { throw new global::System.NotImplementedException(); }