use of com.microsoft.azure.toolkit.lib.appservice.entity.AppServiceBaseEntity in project azure-tools-for-java by Microsoft.
the class WebAppBasePropertyViewPresenter method generateProperty.
protected <T extends AppServiceBaseEntity> WebAppProperty generateProperty(@Nonnull final IAppService<T> appService, @Nonnull final IAppServicePlan plan) {
final AppServiceBaseEntity appServiceEntity = appService.entity();
final AppServicePlanEntity planEntity = plan.entity();
final Map<String, String> appSettingsMap = appServiceEntity.getAppSettings();
final Map<String, Object> propertyMap = new HashMap<>();
propertyMap.put(KEY_NAME, appServiceEntity.getName());
propertyMap.put(KEY_RESOURCE_GRP, appServiceEntity.getResourceGroup());
propertyMap.put(KEY_LOCATION, appServiceEntity.getRegion().getLabel());
propertyMap.put(KEY_SUB_ID, appService.subscriptionId());
propertyMap.put(KEY_STATUS, appService.state());
propertyMap.put(KEY_PLAN, plan.name());
propertyMap.put(KEY_URL, appService.hostName());
final PricingTier pricingTier = planEntity.getPricingTier();
propertyMap.put(KEY_PRICING, String.format("%s_%s", pricingTier.getTier(), pricingTier.getSize()));
final Runtime runtime = appService.getRuntime();
final JavaVersion javaVersion = runtime.getJavaVersion();
if (javaVersion != null && ObjectUtils.notEqual(javaVersion, JavaVersion.OFF)) {
propertyMap.put(KEY_JAVA_VERSION, javaVersion.getValue());
propertyMap.put(KEY_JAVA_CONTAINER, runtime.getWebContainer().getValue());
}
propertyMap.put(KEY_OPERATING_SYS, runtime.getOperatingSystem());
propertyMap.put(KEY_APP_SETTING, appSettingsMap);
return new WebAppProperty(propertyMap);
}
Aggregations