Search in sources :

Example 1 with DeploymentSlotConfig

use of com.microsoft.azure.maven.webapp.configuration.DeploymentSlotConfig in project azure-maven-plugins by microsoft.

the class DeployMojo method createOrUpdateResource.

private IWebAppBase<?> createOrUpdateResource() throws AzureExecutionException {
    final boolean skipCreate = skipAzureResourceCreate || skipCreateAzureResource;
    if (!isDeployToDeploymentSlot()) {
        final AppServiceConfig appServiceConfig = getConfigParser().getAppServiceConfig();
        IWebApp app = Azure.az(AzureAppService.class).webapp(appServiceConfig.resourceGroup(), appServiceConfig.appName());
        final boolean newWebApp = !app.exists();
        AppServiceConfig defaultConfig = !newWebApp ? fromAppService(app, app.plan()) : buildDefaultConfig(appServiceConfig.subscriptionId(), appServiceConfig.resourceGroup(), appServiceConfig.appName());
        mergeAppServiceConfig(appServiceConfig, defaultConfig);
        if (appServiceConfig.pricingTier() == null) {
            appServiceConfig.pricingTier(appServiceConfig.runtime().webContainer() == WebContainer.JBOSS_7 ? PricingTier.PREMIUM_P1V3 : PricingTier.PREMIUM_P1V2);
        }
        final CreateOrUpdateWebAppTask task = new CreateOrUpdateWebAppTask(appServiceConfig);
        task.setSkipCreateAzureResource(skipCreate);
        return task.execute();
    } else {
        // todo: New CreateOrUpdateDeploymentSlotTask
        final DeploymentSlotConfig config = getConfigParser().getDeploymentSlotConfig();
        final IWebAppDeploymentSlot slot = getDeploymentSlot(config);
        final boolean slotExists = slot.exists();
        if (!slotExists && skipCreate) {
            throwForbidCreateResourceWarning("Deployment slot", config.getName());
        }
        return slotExists ? updateDeploymentSlot(slot, config) : createDeploymentSlot(slot, config);
    }
}
Also used : CreateOrUpdateWebAppTask(com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask) DeploymentSlotConfig(com.microsoft.azure.maven.webapp.configuration.DeploymentSlotConfig) AppServiceConfig(com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig) AppServiceConfigUtils.mergeAppServiceConfig(com.microsoft.azure.toolkit.lib.appservice.utils.AppServiceConfigUtils.mergeAppServiceConfig) AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) IWebAppDeploymentSlot(com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Aggregations

DeploymentSlotConfig (com.microsoft.azure.maven.webapp.configuration.DeploymentSlotConfig)1 AzureAppService (com.microsoft.azure.toolkit.lib.appservice.AzureAppService)1 AppServiceConfig (com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig)1 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)1 IWebAppDeploymentSlot (com.microsoft.azure.toolkit.lib.appservice.service.IWebAppDeploymentSlot)1 CreateOrUpdateWebAppTask (com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask)1 AppServiceConfigUtils.mergeAppServiceConfig (com.microsoft.azure.toolkit.lib.appservice.utils.AppServiceConfigUtils.mergeAppServiceConfig)1