public DeploymentSlot getDeploymentSlot(final WebApp app, final String slotName) { DeploymentSlot slot = null; if (StringUtils.isNotEmpty(slotName)) { try { slot = app.deploymentSlots().getByName(slotName); } catch (NoSuchElementException deploymentSlotNotExistException) { } } return slot; }
/** * Download publish profile of deployment slot. */ public boolean getSlotPublishingProfileXmlWithSecrets(final String sid, final String webAppId, final String slotName, final String filePath) throws Exception { final WebApp app = getWebAppById(sid, webAppId); final DeploymentSlot slot = app.deploymentSlots().getByName(slotName); final File file = new File(Paths.get(filePath, slotName + "_" + System.currentTimeMillis() + ".PublishSettings") .toString()); file.createNewFile(); try (final InputStream inputStream = slot.manager().inner().webApps() .listPublishingProfileXmlWithSecretsSlot(slot.resourceGroupName(), app.name(), slotName, PublishingProfileFormat.FTP); OutputStream outputStream = new FileOutputStream(file); ) { IOUtils.copy(inputStream, outputStream); return true; } catch (IOException e) { e.printStackTrace(); return false; } }
public void restartDeploymentSlot(final String subscriptionId, final String appId, final String slotName) throws IOException { final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId); app.deploymentSlots().getByName(slotName).restart(); }
@Override protected WebAppBase getWebAppBase(@NotNull final String sid, @NotNull final String webAppId, @Nullable final String name) throws Exception { return AzureWebAppMvpModel.getInstance().getWebAppById(sid, webAppId).deploymentSlots().getByName(name); } }
public void startDeploymentSlot(final String subscriptionId, final String appId, final String slotName) throws IOException { final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId); app.deploymentSlots().getByName(slotName).start(); }
public void stopDeploymentSlot(final String subscriptionId, final String appId, final String slotName) throws IOException { final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId); app.deploymentSlots().getByName(slotName).stop(); }
public void swapSlotWithProduction(final String subscriptionId, final String appId, final String slotName) throws IOException { final WebApp app = AuthMethodManager.getInstance().getAzureClient(subscriptionId).webApps().getById(appId); final DeploymentSlot slot = app.deploymentSlots().getByName(slotName); slot.swap("production"); }
/** * Update app settings of deployment slot. */ public void updateDeploymentSlotAppSettings(final String subsciptionId, final String webAppId, final String slotName, final Map<String, String> toUpdate, final Set<String> toRemove) throws Exception { final DeploymentSlot slot = getWebAppById(subsciptionId, webAppId).deploymentSlots().getByName(slotName); clearTags(slot); com.microsoft.azure.management.appservice.WebAppBase.Update<DeploymentSlot> update = slot.update() .withAppSettings(toUpdate); for (String key : toRemove) { update = update.withoutAppSetting(key); } update.apply(); }
public void onRefreshNode(final String subscriptionId, final String webAppId, final String slotName) throws Exception { final WebApp app = AzureWebAppMvpModel.getInstance().getWebAppById(subscriptionId, webAppId); final DeploymentSlot slot = app.deploymentSlots().getByName(slotName); final DeploymentSlotNodeView view = getMvpView(); if (!isViewDetached()) { view.renderNode(WebAppBaseState.fromString(slot.state())); } }