Search in sources :

Example 11 with IAppServicePlan

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

the class WebAppDeployDialog method fillAppServiceDetails.

private void fillAppServiceDetails() {
    validated();
    int selectedRow = table.getSelectionIndex();
    if (selectedRow < 0) {
        browserAppServiceDetails.setText("");
        btnDelete.setEnabled(false);
        return;
    }
    btnDelete.setEnabled(true);
    String appServiceName = table.getItems()[selectedRow].getText(0);
    IWebApp webApp = webAppDetailsMap.get(appServiceName);
    IAppServicePlan asp = webApp.plan();
    Subscription subscription = Azure.az(AzureAccount.class).account().getSubscription(webApp.subscriptionId());
    StringBuilder sb = new StringBuilder();
    sb.append(String.format("App Service name: %s \n", appServiceName));
    sb.append(String.format("Subscription name: %s ; id: %s \n", subscription.getName(), subscription.getId()));
    String aspName = asp == null ? "N/A" : asp.name();
    String aspPricingTier = asp == null ? "N/A" : asp.entity().getPricingTier().toString();
    sb.append(String.format("App Service Plan name: %s ; Pricing tier: %s \n", aspName, aspPricingTier));
    String link = buildSiteLink(webApp, null);
    sb.append(String.format("Link: <a href=\"%s\">%s</a> \n", link, link));
    sb.append(String.format("<a href=\"%s\">%s</a> \n", ftpLinkString, "Show FTP deployment credentials"));
    browserAppServiceDetails.setText(sb.toString());
}
Also used : IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) Point(org.eclipse.swt.graphics.Point) IWebApp(com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)

Example 12 with IAppServicePlan

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

the class FunctionAppService method getOrCreateAppServicePlan.

private IAppServicePlan getOrCreateAppServicePlan(final FunctionAppConfig config) {
    final String servicePlanName = config.getServicePlan().getName();
    final String servicePlanGroup = StringUtils.firstNonBlank(config.getServicePlan().getResourceGroup(), config.getResourceGroup().getName());
    final IAppServicePlan appServicePlan = Azure.az(AzureAppService.class).subscription(config.getSubscription().getId()).appServicePlan(servicePlanGroup, servicePlanName);
    if (!appServicePlan.exists()) {
        AzureMessager.getMessager().info(CREATE_APP_SERVICE_PLAN);
        AzureTelemetry.getActionContext().setProperty(CREATE_NEW_APP_SERVICE_PLAN, String.valueOf(true));
        appServicePlan.create().withName(servicePlanName).withResourceGroup(servicePlanGroup).withRegion(config.getRegion()).withPricingTier(config.getServicePlan().getPricingTier()).withOperatingSystem(config.getRuntime().getOperatingSystem()).commit();
        AzureMessager.getMessager().info(String.format(CREATE_APP_SERVICE_DONE, appServicePlan.name()));
    }
    return appServicePlan;
}
Also used : IAppServicePlan(com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)

Aggregations

IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)12 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)5 Point (org.eclipse.swt.graphics.Point)4 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)3 Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)3 AzureAppService (com.microsoft.azure.toolkit.lib.appservice.AzureAppService)2 AppServicePlanEntity (com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity)2 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)2 Region (com.microsoft.azure.toolkit.lib.common.model.Region)2 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)2 Azure (com.microsoft.azure.toolkit.lib.Azure)1 DiagnosticConfig (com.microsoft.azure.toolkit.lib.appservice.model.DiagnosticConfig)1 DockerConfiguration (com.microsoft.azure.toolkit.lib.appservice.model.DockerConfiguration)1 JavaVersion (com.microsoft.azure.toolkit.lib.appservice.model.JavaVersion)1 OperatingSystem (com.microsoft.azure.toolkit.lib.appservice.model.OperatingSystem)1 Runtime (com.microsoft.azure.toolkit.lib.appservice.model.Runtime)1 WebContainer (com.microsoft.azure.toolkit.lib.appservice.model.WebContainer)1 IFunctionApp (com.microsoft.azure.toolkit.lib.appservice.service.IFunctionApp)1 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)1 AzureGroup (com.microsoft.azure.toolkit.lib.resource.AzureGroup)1