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());
}
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;
}
Aggregations