Example #1
0
        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));
        }
Example #2
0
        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());
        }
Example #4
0
        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);
        }
Example #5
0
 protected internal abstract Task OnUpdatingAsync(T command, AzureWebapp webapp, Dictionary <string, string> settings, List <string> keysToDelete, IOutput output);