Search in sources :

Example 1 with MonitorConfig

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;
}
Also used : Draft(com.microsoft.azure.toolkit.intellij.common.Draft) WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) DiagnosticConfig(com.microsoft.azure.toolkit.lib.appservice.model.DiagnosticConfig) MonitorConfig(com.microsoft.azure.toolkit.lib.appservice.MonitorConfig) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Aggregations

Draft (com.microsoft.azure.toolkit.intellij.common.Draft)1 MonitorConfig (com.microsoft.azure.toolkit.lib.appservice.MonitorConfig)1 DiagnosticConfig (com.microsoft.azure.toolkit.lib.appservice.model.DiagnosticConfig)1 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)1 WebAppSettingModel (com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel)1