in azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/service/impl/WebApp.java [158:192]
public WebApp commit() {
final DefinitionStages.Blank blank = WebApp.this.azureClient.webApps().define(getName());
final Runtime runtime = getRuntime();
final AppServicePlan appServicePlan = AppServiceUtils.getAppServicePlan(getAppServicePlanEntity(), azureClient);
if (appServicePlan == null) {
throw new AzureToolkitRuntimeException("Target app service plan not exists");
}
final DefinitionStages.WithCreate withCreate;
switch (runtime.getOperatingSystem()) {
case LINUX:
withCreate = createLinuxWebApp(blank, appServicePlan, runtime);
break;
case WINDOWS:
withCreate = createWindowsWebApp(blank, appServicePlan, runtime);
break;
case DOCKER:
final DockerConfiguration dockerConfiguration = getDockerConfiguration().get();
withCreate = createDockerWebApp(blank, appServicePlan, dockerConfiguration);
break;
default:
throw new AzureToolkitRuntimeException(String.format(UNSUPPORTED_OPERATING_SYSTEM, runtime.getOperatingSystem()));
}
if (getAppSettings() != null && getAppSettings().isPresent()) {
// todo: support remove app settings
withCreate.withAppSettings(getAppSettings().get());
}
if (getDiagnosticConfig() != null && getDiagnosticConfig().isPresent()) {
AppServiceUtils.defineDiagnosticConfigurationForWebAppBase(withCreate, getDiagnosticConfig().get());
}
WebApp.this.remote = withCreate.create();
WebApp.this.entity = AppServiceUtils.fromWebApp(WebApp.this.remote);
WebApp.this.refreshStatus();
Azure.az(AzureWebApp.class).refresh();
return WebApp.this;
}