protected override Task OnHandleAsync(T command, IExecutionContext context) { var webapp = new AzureWebapp(command.Webapp, command.ServicePrincipal); var settings = command.Operations.Where(x => x is not DeleteOperation).ToDictionary(x => x.Key, x => x.Value); var keysToDelete = command.Operations.Where(x => x is DeleteOperation).Select(x => x.Key).ToList(); return(OnUpdatingAsync(command, webapp, settings, keysToDelete, context.Out)); }
public static UpdateAppSettingsCommand CreateAppSettingsCommand(Webapp target, ServicePrincipal servicePrincipal, IDictionary <string, string> requestedSettings, bool includeDeletion) { var webapp = new AzureWebapp(target, servicePrincipal); var settingsInTarget = webapp.GetAppSettings(); var operations = GetOperations(requestedSettings, settingsInTarget, includeDeletion); return(new UpdateAppSettingsCommand { Webapp = target, ServicePrincipal = servicePrincipal, Operations = operations }); }
protected override Task <Dictionary <string, string> > OnGetValueAsync(GetModel model, IExecutionContext context) { var azure = new AzureWebapp(model.Webapp, model.ServicePrincipal); return(azure.GetAppSettingsAsync()); }
protected internal override Task OnUpdatingAsync(UpdateConnectionStringsCommand command, AzureWebapp webapp, Dictionary <string, string> settings, List <string> keysToDelete, IOutput output) { output.Write("Updating Connection strings in "); output.WriteLine(command.Webapp.Name, System.ConsoleColor.White); webapp.UpdateConnectionStrings(settings, keysToDelete); return(Task.CompletedTask); }
protected internal abstract Task OnUpdatingAsync(T command, AzureWebapp webapp, Dictionary <string, string> settings, List <string> keysToDelete, IOutput output);