Search in sources :

Example 1 with WebApp

use of com.microsoft.azure.toolkit.lib.appservice.webapp.WebApp in project azure-gradle-plugins by microsoft.

the class DeployTask method createOrUpdateWebapp.

private WebAppBase<?, ?, ?> createOrUpdateWebapp(GradleWebAppConfig config) {
    final AppServiceConfig appServiceConfig = convert(config);
    final WebApp app = Azure.az(AzureWebApp.class).webApps(appServiceConfig.subscriptionId()).get(appServiceConfig.resourceGroup(), appServiceConfig.appName());
    boolean skipCreate = BooleanUtils.toBoolean(System.getProperty("azure.resource.create.skip", "false"));
    final AppServiceConfig defaultConfig = app != null && app.exists() ? fromAppService(app, Objects.requireNonNull(app.getAppServicePlan())) : buildDefaultConfig(appServiceConfig.subscriptionId(), appServiceConfig.resourceGroup(), appServiceConfig.appName());
    mergeAppServiceConfig(appServiceConfig, defaultConfig);
    if (appServiceConfig.pricingTier() == null) {
        appServiceConfig.pricingTier(StringUtils.containsIgnoreCase(Objects.toString(appServiceConfig.runtime().webContainer()), "jboss") ? PricingTier.PREMIUM_P1V3 : PricingTier.PREMIUM_P1V2);
    }
    CreateOrUpdateWebAppTask task = new CreateOrUpdateWebAppTask(appServiceConfig);
    task.setSkipCreateAzureResource(skipCreate);
    return task.execute();
}
Also used : CreateOrUpdateWebAppTask(com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask) AppServiceConfig(com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig) AppServiceConfigUtils.mergeAppServiceConfig(com.microsoft.azure.toolkit.lib.appservice.utils.AppServiceConfigUtils.mergeAppServiceConfig) WebApp(com.microsoft.azure.toolkit.lib.appservice.webapp.WebApp) AzureWebApp(com.microsoft.azure.toolkit.lib.appservice.webapp.AzureWebApp)

Aggregations

AppServiceConfig (com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig)1 CreateOrUpdateWebAppTask (com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask)1 AppServiceConfigUtils.mergeAppServiceConfig (com.microsoft.azure.toolkit.lib.appservice.utils.AppServiceConfigUtils.mergeAppServiceConfig)1 AzureWebApp (com.microsoft.azure.toolkit.lib.appservice.webapp.AzureWebApp)1 WebApp (com.microsoft.azure.toolkit.lib.appservice.webapp.WebApp)1