use of com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask 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();
}
use of com.microsoft.azure.toolkit.lib.appservice.task.CreateOrUpdateWebAppTask 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);
}
}
Aggregations