use of com.microsoft.azure.toolkit.lib.appservice.model.Runtime in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method onRuntimeChanged.
private void onRuntimeChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
final Runtime runtime = (Runtime) e.getItem();
final OperatingSystem operatingSystem = Objects.isNull(runtime) ? null : runtime.getOperatingSystem();
this.selectorServicePlan.setOperatingSystem(operatingSystem);
}
}
use of com.microsoft.azure.toolkit.lib.appservice.model.Runtime 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);
}
use of com.microsoft.azure.toolkit.lib.appservice.model.Runtime in project azure-tools-for-java by Microsoft.
the class AppServiceInfoBasicPanel method getData.
@SneakyThrows
@Override
public T getData() {
final String name = this.textName.getValue();
final Runtime platform = this.selectorRuntime.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T result = (T) (this.config == null ? initConfig() : this.config).toBuilder().build();
result.setName(name);
result.setRuntime(platform);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
result.setApplication(Paths.get(path));
}
this.config = result;
return result;
}
use of com.microsoft.azure.toolkit.lib.appservice.model.Runtime in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method getData.
@Override
public T getData() {
final Subscription subscription = this.selectorSubscription.getValue();
final ResourceGroup resourceGroup = this.selectorGroup.getValue();
final String name = this.textName.getValue();
final Runtime runtime = this.selectorRuntime.getValue();
final Region region = this.selectorRegion.getValue();
final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
final AzureArtifact artifact = this.selectorApplication.getValue();
final T config = supplier.get();
config.setSubscription(subscription);
config.setResourceGroup(resourceGroup);
config.setName(name);
config.setRuntime(runtime);
config.setRegion(region);
config.setServicePlan(servicePlan);
if (Objects.nonNull(artifact)) {
final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
config.setApplication(Paths.get(path));
}
return config;
}
use of com.microsoft.azure.toolkit.lib.appservice.model.Runtime in project azure-tools-for-java by Microsoft.
the class AppServiceInfoAdvancedPanel method init.
private void init() {
final String date = DATE_FORMAT.format(new Date());
final String defaultWebAppName = String.format("app-%s-%s", this.project.getName(), date);
this.textName.setValue(defaultWebAppName);
this.textSku.setBorder(JBUI.Borders.emptyLeft(5));
this.textSku.setText(NOT_APPLICABLE);
this.selectorServicePlan.addItemListener(this::onServicePlanChanged);
this.selectorSubscription.addItemListener(this::onSubscriptionChanged);
this.selectorRuntime.addItemListener(this::onRuntimeChanged);
this.selectorRegion.addItemListener(this::onRegionChanged);
this.textName.setRequired(true);
this.selectorServicePlan.setRequired(true);
this.selectorSubscription.setRequired(true);
this.selectorRuntime.setRequired(true);
this.selectorRegion.setRequired(true);
this.lblSubscription.setLabelFor(selectorSubscription);
this.lblResourceGroup.setLabelFor(selectorGroup);
this.lblName.setLabelFor(textName);
this.lblPlatform.setLabelFor(selectorRuntime);
this.lblRegion.setLabelFor(selectorRegion);
this.lblAppServicePlan.setLabelFor(selectorServicePlan);
this.lblArtifact.setLabelFor(selectorApplication);
this.selectorApplication.setFileFilter(virtualFile -> {
final String ext = FileNameUtils.getExtension(virtualFile.getPath());
final Runtime runtime = this.selectorRuntime.getValue();
return StringUtils.isNotBlank(ext) && isSupportedArtifactType(runtime, ext);
});
}
Aggregations