use of com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel in project azure-tools-for-java by Microsoft.
the class WebAppConfiguration method saveModel.
public void saveModel(final WebAppComboBoxModel webAppComboBoxModel) {
setWebAppId(webAppComboBoxModel.getResourceId());
setWebAppName(webAppComboBoxModel.getAppName());
setResourceGroup(webAppComboBoxModel.getResourceGroup());
setSubscriptionId(webAppComboBoxModel.getSubscriptionId());
if (webAppComboBoxModel.isNewCreateResource()) {
setCreatingNew(true);
final WebAppSettingModel settingModel = webAppComboBoxModel.getWebAppSettingModel();
setCreatingResGrp(settingModel.isCreatingResGrp());
setCreatingAppServicePlan(settingModel.isCreatingAppServicePlan());
setAppServicePlanName(settingModel.getAppServicePlanName());
setRegion(settingModel.getRegion());
setPricing(settingModel.getPricing());
setAppServicePlanId(settingModel.getAppServicePlanId());
saveRuntime(settingModel.getRuntime());
setCreatingResGrp(settingModel.isCreatingResGrp());
setCreatingAppServicePlan(settingModel.isCreatingAppServicePlan());
webAppSettingModel.setEnableApplicationLog(settingModel.isEnableApplicationLog());
webAppSettingModel.setApplicationLogLevel(settingModel.getApplicationLogLevel());
webAppSettingModel.setEnableWebServerLogging(settingModel.isEnableWebServerLogging());
webAppSettingModel.setWebServerLogQuota(settingModel.getWebServerLogQuota());
webAppSettingModel.setWebServerRetentionPeriod(settingModel.getWebServerRetentionPeriod());
webAppSettingModel.setEnableDetailedErrorMessage(settingModel.isEnableDetailedErrorMessage());
webAppSettingModel.setEnableFailedRequestTracing(settingModel.isEnableFailedRequestTracing());
} else {
setCreatingNew(false);
final IWebApp webApp = webAppComboBoxModel.getResource();
if (webApp != null) {
saveRuntime(webApp.getRuntime());
setAppServicePlanId(webApp.entity().getAppServicePlanId());
setRegion(webApp.entity().getRegion().getName());
}
}
}
use of com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel in project azure-tools-for-java by Microsoft.
the class WebAppDeployDialog method collectData.
private void collectData() {
if (isDeployToSlot) {
webAppSettingModel = new WebAppSettingModel();
if (isCreateNewSlot) {
int index = comboSlotConf.getSelectionIndex();
webAppSettingModel.setNewSlotConfigurationSource(index < 0 ? "" : comboSlotConf.getItem(index));
webAppSettingModel.setNewSlotName(textSlotName.getText() == null ? "" : textSlotName.getText().trim());
} else {
int index = comboSlot.getSelectionIndex();
webAppSettingModel.setSlotName(index < 0 ? "" : comboSlot.getItem(index));
}
}
}
use of com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel in project azure-tools-for-java by Microsoft.
the class WebAppService method createWebApp.
@AzureOperation(name = "webapp.create_detail", params = { "config.getName()" }, type = AzureOperation.Type.SERVICE)
public IWebApp createWebApp(final WebAppConfig config) {
final WebAppSettingModel settings = convertConfig2Settings(config);
settings.setCreatingNew(true);
final Map<String, String> properties = settings.getTelemetryProperties(null);
final Operation operation = TelemetryManager.createOperation(WEBAPP, CREATE_WEBAPP);
try {
operation.start();
operation.trackProperties(properties);
return AzureWebAppMvpModel.getInstance().createWebAppFromSettingModel(settings);
} catch (final RuntimeException e) {
EventUtil.logError(operation, ErrorType.userError, e, properties, null);
throw e;
} finally {
operation.complete();
}
}
use of com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel in project azure-tools-for-java by Microsoft.
the class WebAppService method convertConfig2Settings.
@AzureOperation(name = "webapp.init_config", type = AzureOperation.Type.TASK)
public static WebAppSettingModel convertConfig2Settings(final WebAppConfig config) {
final WebAppSettingModel settings = new WebAppSettingModel();
settings.setSubscriptionId(config.getSubscription().getId());
// creating if id is empty
settings.setCreatingResGrp(config.getResourceGroup() instanceof Draft || StringUtils.isEmpty(config.getResourceGroup().getId()));
settings.setResourceGroup(config.getResourceGroup().getName());
settings.setWebAppName(config.getName());
settings.setRegion(config.getRegion().getName());
settings.saveRuntime(config.getRuntime());
// creating if id is empty
settings.setCreatingAppServicePlan(config.getServicePlan() instanceof Draft || StringUtils.isEmpty(config.getServicePlan().getId()));
if (settings.isCreatingAppServicePlan()) {
settings.setAppServicePlanName(config.getServicePlan().getName());
} else {
settings.setAppServicePlanId(config.getServicePlan().getId());
}
settings.setPricing(config.getServicePlan().getPricingTier().getSize());
final MonitorConfig monitorConfig = config.getMonitorConfig();
if (monitorConfig != null) {
final DiagnosticConfig diagnosticConfig = monitorConfig.getDiagnosticConfig();
settings.setEnableApplicationLog(diagnosticConfig.isEnableApplicationLog());
settings.setApplicationLogLevel(diagnosticConfig.getApplicationLogLevel() == null ? null : diagnosticConfig.getApplicationLogLevel().getValue());
settings.setEnableWebServerLogging(diagnosticConfig.isEnableWebServerLogging());
settings.setWebServerLogQuota(diagnosticConfig.getWebServerLogQuota());
settings.setWebServerRetentionPeriod(diagnosticConfig.getWebServerRetentionPeriod());
settings.setEnableDetailedErrorMessage(diagnosticConfig.isEnableDetailedErrorMessage());
settings.setEnableFailedRequestTracing(diagnosticConfig.isEnableFailedRequestTracing());
}
settings.setTargetName(config.getApplication() == null ? null : config.getApplication().toFile().getName());
settings.setTargetPath(config.getApplication() == null ? null : config.getApplication().toString());
return settings;
}
Aggregations