use of com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig in project azure-maven-plugins by microsoft.
the class AppServiceConfigUtils method buildDefaultWebAppConfig.
public static AppServiceConfig buildDefaultWebAppConfig(String subscriptionId, String resourceGroup, String appName, String packaging, JavaVersion javaVersion) {
final AppServiceConfig appServiceConfig = AppServiceConfig.buildDefaultWebAppConfig(resourceGroup, appName, packaging, javaVersion);
final List<Region> regions = Azure.az(AzureAppService.class).listSupportedRegions(subscriptionId);
// replace with first region when the default region is not present
appServiceConfig.region(Utils.selectFirstOptionIfCurrentInvalid("region", regions, appServiceConfig.region()));
return appServiceConfig;
}
use of com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig in project azure-maven-plugins by microsoft.
the class ConfigMojo method getConfigurationFromExisting.
private WebAppConfiguration getConfigurationFromExisting(IWebApp webapp, WebAppConfiguration.WebAppConfigurationBuilder<?, ?> builder) {
final AppServiceConfig appServiceConfig = fromAppService(webapp, webapp.plan());
// common configuration
builder.appName(appServiceConfig.appName()).resourceGroup(appServiceConfig.resourceGroup()).subscriptionId(appServiceConfig.subscriptionId()).region(appServiceConfig.region());
builder.os(appServiceConfig.runtime().os());
if (AppServiceUtils.isDockerAppService(webapp)) {
final Map<String, String> settings = webapp.entity().getAppSettings();
builder.image(appServiceConfig.runtime().image());
builder.registryUrl(appServiceConfig.runtime().registryUrl());
final String dockerUsernameSetting = settings.get(SETTING_REGISTRY_USERNAME);
if (StringUtils.isNotBlank(dockerUsernameSetting)) {
builder.serverId(String.format(SERVER_ID_TEMPLATE, dockerUsernameSetting));
}
} else {
builder.webContainer(Objects.toString(appServiceConfig.runtime().webContainer()));
builder.javaVersion(Objects.toString(appServiceConfig.runtime().javaVersion()));
}
builder.servicePlanName(appServiceConfig.servicePlanName());
builder.servicePlanResourceGroup(appServiceConfig.servicePlanResourceGroup());
builder.pricingTier(Objects.toString(appServiceConfig.pricingTier()));
return builder.build();
}
use of com.microsoft.azure.toolkit.lib.appservice.config.AppServiceConfig 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