@Override public void processSettings(Update update) throws MojoExecutionException { final Map appSettings = mojo.getAppSettings(); if (appSettings != null && !appSettings.isEmpty()) { update.withAppSettings(appSettings); } } }
/** * Update container settings for existing Web App on Linux. * * @param sid Subscription id * @param webAppId id of Web App on Linux instance * @param imageSetting new container settings * @return instance of the updated Web App on Linux */ public WebApp updateWebAppOnDocker(String sid, String webAppId, ImageSetting imageSetting) throws Exception { WebApp app = getWebAppById(sid, webAppId); clearTags(app); if (imageSetting instanceof PrivateRegistryImageSetting) { PrivateRegistryImageSetting pr = (PrivateRegistryImageSetting) imageSetting; app.update().withPrivateRegistryImage(pr.getImageTagWithServerUrl(), pr.getServerUrl()) .withCredentials(pr.getUsername(), pr.getPassword()) .withStartUpCommand(pr.getStartupFile()).apply(); } else { // TODO: other types of ImageSetting, e.g. Docker Hub } // status-free restart. stopWebApp(sid, webAppId); startWebApp(sid, webAppId); return app; }
/** * Update app settings of webapp. * * @param sid subscription id * @param webAppId webapp id * @param toUpdate entries to add/modify * @param toRemove entries to remove * @throws Exception exception */ public void updateWebAppSettings(String sid, String webAppId, Map<String, String> toUpdate, Set<String> toRemove) throws Exception { WebApp app = getWebAppById(sid, webAppId); clearTags(app); com.microsoft.azure.management.appservice.WebAppBase.Update<WebApp> update = app.update() .withAppSettings(toUpdate); for (String key : toRemove) { update = update.withoutAppSetting(key); } update.apply(); }
protected void updateWebApp(final RuntimeHandler runtimeHandler, final WebApp app) throws Exception { final Update update = runtimeHandler.updateAppRuntime(app); if (update == null) { info(UPDATE_WEBAPP_SKIP); } else { info(UPDATE_WEBAPP); getFactory().getSettingsHandler(this).processSettings(update); update.apply(); info(UPDATE_WEBAPP_DONE); } if (isDeployToDeploymentSlot()) { info(CREATE_DEPLOYMENT_SLOT); getFactory().getDeploymentSlotHandler(this).createDeploymentSlotIfNotExist(); info(CREATE_DEPLOYMENT_SLOT_DONE); } }
@Override public Update updateAppRuntime(final WebApp app) throws Exception { WebAppUtils.assureWindowsWebApp(app); WebAppUtils.clearTags(app); final Update update = app.update(); update.withJavaVersion(javaVersion).withWebContainer(webContainer); return update; }
@Override public WebApp.Update updateAppRuntime(final WebApp app) throws Exception { WebAppUtils.assureLinuxWebApp(app); WebAppUtils.clearTags(app); final Server server = Utils.getServer(settings, serverId); assureServerExist(server, serverId); return app.update() .withPrivateDockerHubImage(image) .withCredentials(server.getUsername(), server.getPassword()); } }
@Override public Update updateAppRuntime(WebApp app) throws Exception { WebAppUtils.assureLinuxWebApp(app); WebAppUtils.clearTags(app); return app.update().withBuiltInImage(runtime); } }
@Override public WebApp.Update updateAppRuntime(final WebApp app) throws Exception { WebAppUtils.assureLinuxWebApp(app); WebAppUtils.clearTags(app); final Server server = Utils.getServer(settings, serverId); assureServerExist(server, serverId); return app.update() .withPrivateRegistryImage(image, registryUrl) .withCredentials(server.getUsername(), server.getPassword()); } }
@Override public WebApp.Update updateAppRuntime(final WebApp app) throws Exception { WebAppUtils.assureLinuxWebApp(app); WebAppUtils.clearTags(app); return app.update().withPublicDockerHubImage(image); } }