in azure-toolkit-libs/azure-toolkit-appservice-lib/src/main/java/com/microsoft/azure/toolkit/lib/appservice/service/impl/FunctionApp.java [188:222]
public FunctionApp commit() {
final Blank blank = FunctionApp.this.azureClient.functionApps().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 WithCreate withCreate;
switch (runtime.getOperatingSystem()) {
case LINUX:
withCreate = createLinuxFunctionApp(blank, appServicePlan, runtime);
break;
case WINDOWS:
withCreate = createWindowsFunctionApp(blank, appServicePlan, runtime);
break;
case DOCKER:
final DockerConfiguration dockerConfiguration = getDockerConfiguration().get();
withCreate = createDockerFunctionApp(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());
}
FunctionApp.this.remote = withCreate.create();
FunctionApp.this.entity = AppServiceUtils.fromFunctionApp(FunctionApp.this.remote);
FunctionApp.this.refreshStatus();
Azure.az(AzureFunction.class).refresh(); // todo: refactor to support refresh single subscription
return FunctionApp.this;
}