Search in sources :

Example 1 with WebAppSettingModel

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());
        }
    }
}
Also used : WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 2 with WebAppSettingModel

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));
        }
    }
}
Also used : WebAppSettingModel(com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel) Point(org.eclipse.swt.graphics.Point)

Example 3 with WebAppSettingModel

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

Example 4 with WebAppSettingModel

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;
}
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

WebAppSettingModel (com.microsoft.azuretools.core.mvp.model.webapp.WebAppSettingModel)4 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)2 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 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)1 Operation (com.microsoft.azuretools.telemetrywrapper.Operation)1 Point (org.eclipse.swt.graphics.Point)1