use of com.microsoft.azure.toolkit.lib.appservice.MonitorConfig 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