use of com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan in project azure-tools-for-java by Microsoft.
the class FunctionAppService method createFunctionApp.
public IFunctionApp createFunctionApp(final FunctionAppConfig config) {
AzureTelemetry.getActionContext().setProperty(CREATE_NEW_FUNCTION_APP, String.valueOf(true));
final ResourceGroup resourceGroup = getOrCreateResourceGroup(config);
final IAppServicePlan appServicePlan = getOrCreateAppServicePlan(config);
AzureMessager.getMessager().info(String.format(CREATE_FUNCTION_APP, config.getName()));
final Map<String, String> appSettings = getAppSettings(config);
// get/create ai instances only if user didn't specify ai connection string in app settings
AzureTelemetry.getActionContext().setProperty(DISABLE_APP_INSIGHTS, String.valueOf(config.getMonitorConfig().getApplicationInsightsConfig() == null));
bindApplicationInsights(appSettings, config);
final IFunctionApp result = Azure.az(AzureAppService.class).subscription(config.getSubscription()).functionApp(resourceGroup.getName(), config.getName()).create().withName(config.getName()).withResourceGroup(resourceGroup.getName()).withPlan(appServicePlan.id()).withRuntime(config.getRuntime()).withAppSettings(appSettings).withDiagnosticConfig(config.getMonitorConfig().getDiagnosticConfig()).commit();
AzureMessager.getMessager().info(String.format(CREATE_FUNCTION_APP_DONE, result.name()));
return result;
}
use of com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method fillAppServicePlans.
protected void fillAppServicePlans() {
Subscription selectedSubscription = getSelectedSubscription();
if (selectedSubscription == null) {
return;
}
OperatingSystem os = getSelectedOS();
setComboRefreshingStatus(comboAppServicePlan, true);
Mono.fromCallable(() -> {
return Azure.az(AzureAppService.class).appServicePlans(selectedSubscription.getId(), false).stream().filter(asp -> asp.entity().getOperatingSystem() == null || asp.entity().getOperatingSystem() == os).collect(Collectors.toList());
}).subscribeOn(Schedulers.boundedElastic()).subscribe(appServicePlans -> {
appServicePlans.sort(Comparator.comparing(IAppServicePlan::name));
DefaultLoader.getIdeHelper().invokeLater(() -> {
setComboRefreshingStatus(comboAppServicePlan, false);
binderAppServicePlan = new ArrayList<>();
for (IAppServicePlan asp : appServicePlans) {
binderAppServicePlan.add(asp);
comboAppServicePlan.add(asp.name());
}
if (comboAppServicePlan.getItemCount() > 0) {
comboAppServicePlan.select(0);
}
String aspName = CommonUtils.getPreference(CommonUtils.ASP_NAME);
CommonUtils.selectComboIndex(comboAppServicePlan, aspName);
fillAppServicePlansDetails();
});
});
}
use of com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method fillAppServicePlansDetails.
protected void fillAppServicePlansDetails() {
int i = comboAppServicePlan.getSelectionIndex();
if (i < 0) {
lblAppSevicePlanLocation.setText(NOT_AVAILABLE);
lblAppServicePlanPricingTier.setText(NOT_AVAILABLE);
} else {
IAppServicePlan asp = binderAppServicePlan.get(i);
lblAppSevicePlanLocation.setText(asp.entity().getRegion());
lblAppServicePlanPricingTier.setText(asp.entity().getPricingTier().toString());
}
}
use of com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method onAppServicePlanSelection.
private void onAppServicePlanSelection() {
cpNew.lblLocationValue.setText("N/A");
cpNew.lblPricingTierValue.setText("N/A");
IAppServicePlan asp = getSelectedAppServicePlan();
if (asp != null) {
cpNew.lblLocationValue.setText(asp.entity().getRegion());
cpNew.lblPricingTierValue.setText(asp.entity().getPricingTier().getSize());
}
}
use of com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method renderAppServicePlanList.
@Override
public void renderAppServicePlanList(List<IAppServicePlan> list) {
// TODO Auto-generated method stub
appServicePlanList = list;
cpNew.cbExistingAppServicePlan.removeAll();
for (IAppServicePlan asp : appServicePlanList) {
cpNew.cbExistingAppServicePlan.add(asp.name());
}
if (cpNew.cbExistingAppServicePlan.getItemCount() > 0) {
cpNew.cbExistingAppServicePlan.select(0);
}
onAppServicePlanSelection();
}
Aggregations