use of com.microsoft.azure.toolkit.lib.appservice.model.PricingTier in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method apply.
private void apply() {
model.setDockerFilePath(cpAcr.getDockerfilePath());
// set ACR info
model.setPrivateRegistryImageSetting(new PrivateRegistryImageSetting(cpAcr.getServerUrl(), cpAcr.getUserName(), cpAcr.getPassword(), cpAcr.getImageTag(), cpAcr.getStartupFile()));
// set target
model.setTargetPath(targetPath);
model.setTargetName(Paths.get(targetPath).getFileName().toString());
// set web app info
if (rdoExistingWebApp.getSelection()) {
// existing web app
model.setCreatingNewWebAppOnLinux(false);
IWebApp selectedWebApp = getSelectedWebApp();
if (selectedWebApp != null) {
model.setWebAppId(selectedWebApp.id());
model.setWebAppName(selectedWebApp.name());
model.setSubscriptionId(selectedWebApp.subscriptionId());
model.setResourceGroupName(selectedWebApp.resourceGroup());
} else {
model.setWebAppId(null);
model.setWebAppName(null);
model.setSubscriptionId(null);
model.setResourceGroupName(null);
}
} else if (rdoNewWebApp.getSelection()) {
// create new web app
model.setCreatingNewWebAppOnLinux(true);
model.setWebAppId("");
model.setWebAppName(cpNew.txtAppName.getText());
Subscription selectedSubscription = getSelectedSubscription();
if (selectedSubscription != null) {
model.setSubscriptionId(selectedSubscription.getId());
}
// resource group
if (cpNew.rdoExistingResourceGroup.getSelection()) {
// existing RG
model.setCreatingNewResourceGroup(false);
ResourceGroup selectedRg = getSelectedResourceGroup();
if (selectedRg != null) {
model.setResourceGroupName(selectedRg.getName());
} else {
model.setResourceGroupName(null);
}
} else if (cpNew.rdoNewResourceGroup.getSelection()) {
// new RG
model.setCreatingNewResourceGroup(true);
model.setResourceGroupName(cpNew.txtNewResourceGroupName.getText());
}
// app service plan
if (cpNew.rdoNewAppServicePlan.getSelection()) {
model.setCreatingNewAppServicePlan(true);
model.setAppServicePlanName(cpNew.txtAppServicePlanName.getText());
Region selectedLocation = getSelectedLocation();
if (selectedLocation != null) {
model.setLocationName(selectedLocation.getLabel());
} else {
model.setLocationName(null);
}
PricingTier selectedPricingTier = getSelectedPricingTier();
if (selectedPricingTier != null) {
model.setPricingSkuTier(selectedPricingTier.getTier());
model.setPricingSkuSize(selectedPricingTier.getSize());
} else {
model.setPricingSkuTier(null);
model.setPricingSkuSize(null);
}
} else if (cpNew.rdoExistingAppServicePlan.getSelection()) {
model.setCreatingNewAppServicePlan(false);
IAppServicePlan selectedAsp = getSelectedAppServicePlan();
if (selectedAsp != null) {
model.setAppServicePlanId(selectedAsp.id());
} else {
model.setAppServicePlanId(null);
}
}
}
}
use of com.microsoft.azure.toolkit.lib.appservice.model.PricingTier in project azure-tools-for-java by Microsoft.
the class AppServiceCreateDialog method collectData.
private void collectData() {
model.setCreatingNew(true);
model.setWebAppName(textAppName.getText().trim());
int index = comboSubscription.getSelectionIndex();
model.setSubscriptionId(index < 0 ? null : binderSubscriptionDetails.get(index).getId());
// Resource Group
boolean isCreatingNewResGrp = btnResourceGroupCreateNew.getSelection();
model.setCreatingResGrp(isCreatingNewResGrp);
if (isCreatingNewResGrp) {
model.setResourceGroup(textResourceGroupName.getText().trim());
} else {
index = comboResourceGroup.getSelectionIndex();
model.setResourceGroup(index < 0 ? null : binderResourceGroup.get(index).getName());
}
// App Service Plan
boolean isCreatingAppServicePlan = btnAppServiceCreateNew.getSelection();
model.setCreatingAppServicePlan(isCreatingAppServicePlan);
if (isCreatingAppServicePlan) {
model.setAppServicePlanName(textAppSevicePlanName.getText().trim());
index = comboAppServicePlanLocation.getSelectionIndex();
model.setRegion(index < 0 ? null : binderAppServicePlanLocation.get(index).getName());
model.setPricing(Optional.ofNullable(getSelectedPricingTier()).map(PricingTier::toString).orElse(APPSETTINGS_TOOLTIP));
} else {
index = comboAppServicePlan.getSelectionIndex();
model.setAppServicePlanId(index < 0 ? null : binderAppServicePlan.get(index).id());
}
// Runtime
final OperatingSystem os = getSelectedOS();
final Runtime runtime = os == OperatingSystem.LINUX ? getSelectedRuntimeStack() : Runtime.getRuntime(OperatingSystem.WINDOWS, getSelectedWebcontainer(), getSelectedJavaVersion());
model.saveRuntime(runtime);
}
use of com.microsoft.azure.toolkit.lib.appservice.model.PricingTier 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.PricingTier in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method renderPricingTierList.
@Override
public void renderPricingTierList(List<PricingTier> list) {
// TODO Auto-generated method stub
pricingTierList = list;
cpNew.cbPricingTier.removeAll();
for (PricingTier pt : pricingTierList) {
cpNew.cbPricingTier.add(pt.toString());
}
if (cpNew.cbPricingTier.getItemCount() > 0) {
cpNew.cbPricingTier.select(0);
}
}
use of com.microsoft.azure.toolkit.lib.appservice.model.PricingTier in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method getSelectedPricingTier.
private PricingTier getSelectedPricingTier() {
PricingTier pt = null;
int index = cpNew.cbPricingTier.getSelectionIndex();
if (pricingTierList != null && index >= 0 && index < pricingTierList.size()) {
pt = pricingTierList.get(index);
}
return pt;
}
Aggregations