Search in sources :

Example 1 with AzureAppService

use of com.microsoft.azure.toolkit.lib.appservice.AzureAppService in project azure-tools-for-java by Microsoft.

the class AzureWebAppMvpModel method getOrCreateAppServicePlan.

private IAppServicePlan getOrCreateAppServicePlan(AppServicePlanEntity servicePlanEntity) {
    final AzureAppService az = getAzureAppServiceClient(servicePlanEntity.getSubscriptionId());
    final IAppServicePlan appServicePlan = az.appServicePlan(servicePlanEntity);
    if (appServicePlan.exists()) {
        return appServicePlan;
    }
    return appServicePlan.create().withName(servicePlanEntity.getName()).withResourceGroup(servicePlanEntity.getResourceGroup()).withRegion(com.microsoft.azure.toolkit.lib.common.model.Region.fromName(servicePlanEntity.getRegion())).withPricingTier(servicePlanEntity.getPricingTier()).withOperatingSystem(servicePlanEntity.getOperatingSystem()).commit();
}
Also used : AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)

Example 2 with AzureAppService

use of com.microsoft.azure.toolkit.lib.appservice.AzureAppService in project azure-tools-for-java by Microsoft.

the class WebAppRunState method getOrCreateDeployTargetFromAppSettingModel.

@NotNull
private IWebAppBase getOrCreateDeployTargetFromAppSettingModel(@NotNull RunProcessHandler processHandler) throws Exception {
    final AzureAppService azureAppService = AzureWebAppMvpModel.getInstance().getAzureAppServiceClient(webAppSettingModel.getSubscriptionId());
    final IWebApp webApp = getOrCreateWebappFromAppSettingModel(azureAppService, processHandler);
    if (!isDeployToSlot()) {
        return webApp;
    }
    // todo: add new boolean indicator instead of comparing string values
    if (StringUtils.equals(webAppSettingModel.getSlotName(), Constants.CREATE_NEW_SLOT)) {
        return createDeploymentSlot(webApp, processHandler);
    } else {
        return webApp.deploymentSlot(webAppSettingModel.getSlotName());
    }
}
Also used : AzureAppService(com.microsoft.azure.toolkit.lib.appservice.AzureAppService) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

AzureAppService (com.microsoft.azure.toolkit.lib.appservice.AzureAppService)2 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)1 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)1 NotNull (org.jetbrains.annotations.NotNull)1