use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class SettingPanel method apply.
/**
* Function triggered by any content change events.
*
* @param webAppOnLinuxDeployConfiguration configuration instance
*/
@Override
public void apply(WebAppOnLinuxDeployConfiguration webAppOnLinuxDeployConfiguration) {
webAppOnLinuxDeployConfiguration.setDockerFilePath(containerSettingPanel.getDockerPath());
// set ACR info
webAppOnLinuxDeployConfiguration.setPrivateRegistryImageSetting(new PrivateRegistryImageSetting(containerSettingPanel.getServerUrl().replaceFirst("^https?://", "").replaceFirst("/$", ""), containerSettingPanel.getUserName(), containerSettingPanel.getPassword(), containerSettingPanel.getImageTag(), containerSettingPanel.getStartupFile()));
final ISecureStore secureStore = AzureStoreManager.getInstance().getSecureStore();
secureStore.savePassword(PRIVATE_DOCKER_REGISTRY, containerSettingPanel.getServerUrl(), containerSettingPanel.getUserName(), containerSettingPanel.getPassword());
webAppOnLinuxDeployConfiguration.setTargetPath(getTargetPath());
webAppOnLinuxDeployConfiguration.setTargetName(getTargetName());
// set web app info
if (rdoUseExist.isSelected()) {
// existing web app
webAppOnLinuxDeployConfiguration.setCreatingNewWebAppOnLinux(false);
IWebApp selectedWebApp = null;
final int index = webAppTable.getSelectedRow();
if (cachedWebAppList != null && index >= 0 && index < cachedWebAppList.size()) {
selectedWebApp = cachedWebAppList.get(webAppTable.getSelectedRow());
}
if (selectedWebApp != null) {
webAppOnLinuxDeployConfiguration.setWebAppId(selectedWebApp.id());
webAppOnLinuxDeployConfiguration.setAppName(selectedWebApp.name());
webAppOnLinuxDeployConfiguration.setSubscriptionId(selectedWebApp.subscriptionId());
webAppOnLinuxDeployConfiguration.setResourceGroupName(selectedWebApp.resourceGroup());
} else {
webAppOnLinuxDeployConfiguration.setWebAppId(null);
webAppOnLinuxDeployConfiguration.setAppName(null);
webAppOnLinuxDeployConfiguration.setSubscriptionId(null);
webAppOnLinuxDeployConfiguration.setResourceGroupName(null);
}
} else if (rdoCreateNew.isSelected()) {
// create new web app
webAppOnLinuxDeployConfiguration.setCreatingNewWebAppOnLinux(true);
webAppOnLinuxDeployConfiguration.setWebAppId("");
webAppOnLinuxDeployConfiguration.setAppName(textAppName.getText());
final Subscription selectedSubscription = (Subscription) comboSubscription.getSelectedItem();
if (selectedSubscription != null) {
webAppOnLinuxDeployConfiguration.setSubscriptionId(selectedSubscription.getId());
}
// resource group
if (rdoUseExistResGrp.isSelected()) {
// existing RG
webAppOnLinuxDeployConfiguration.setCreatingNewResourceGroup(false);
final ResourceGroup selectedRg = (ResourceGroup) comboResourceGroup.getSelectedItem();
if (selectedRg != null) {
webAppOnLinuxDeployConfiguration.setResourceGroupName(selectedRg.getName());
} else {
webAppOnLinuxDeployConfiguration.setResourceGroupName(null);
}
} else if (rdoCreateResGrp.isSelected()) {
// new RG
webAppOnLinuxDeployConfiguration.setCreatingNewResourceGroup(true);
webAppOnLinuxDeployConfiguration.setResourceGroupName(txtNewResGrp.getText());
}
// app service plan
if (rdoCreateAppServicePlan.isSelected()) {
webAppOnLinuxDeployConfiguration.setCreatingNewAppServicePlan(true);
webAppOnLinuxDeployConfiguration.setAppServicePlanName(txtCreateAppServicePlan.getText());
final Region selectedLocation = (Region) cbLocation.getSelectedItem();
if (selectedLocation != null) {
webAppOnLinuxDeployConfiguration.setLocationName(selectedLocation.getName());
} else {
webAppOnLinuxDeployConfiguration.setLocationName(null);
}
final PricingTier selectedPricingTier = (PricingTier) cbPricing.getSelectedItem();
if (selectedPricingTier != null) {
webAppOnLinuxDeployConfiguration.setPricingSkuTier(selectedPricingTier.getTier());
webAppOnLinuxDeployConfiguration.setPricingSkuSize(selectedPricingTier.getSize());
} else {
webAppOnLinuxDeployConfiguration.setPricingSkuTier(null);
webAppOnLinuxDeployConfiguration.setPricingSkuSize(null);
}
} else if (rdoUseExistAppServicePlan.isSelected()) {
webAppOnLinuxDeployConfiguration.setCreatingNewAppServicePlan(false);
final AppServicePlan selectedAsp = (AppServicePlan) cbExistAppServicePlan.getSelectedItem();
if (selectedAsp != null) {
webAppOnLinuxDeployConfiguration.setAppServicePlanId(selectedAsp.id());
} else {
webAppOnLinuxDeployConfiguration.setAppServicePlanId(null);
}
}
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class SelectImageStep method fillPublishers.
private void fillPublishers() {
if (customImageBtn.isSelected()) {
disableNext();
final AzureString title = AzureOperationBundle.title("vm|publisher.list");
AzureTaskManager.getInstance().runInBackground(new AzureTask(project, title, false, () -> {
final ProgressIndicator progressIndicator = ProgressManager.getInstance().getProgressIndicator();
progressIndicator.setIndeterminate(true);
final Object selectedItem = regionComboBox.getSelectedItem();
final Region location = selectedItem instanceof Region ? (Region) selectedItem : null;
if (location == null) {
return;
}
clearSelection(publisherComboBox, offerComboBox, skuComboBox, imageLabelList);
RxJavaUtils.unsubscribeSubscription(fillPublisherSubscription);
fillPublisherSubscription = Observable.fromCallable(() -> azure.virtualMachineImages().publishers().listByRegion(location.getName())).subscribeOn(Schedulers.io()).subscribe(publisherList -> DefaultLoader.getIdeHelper().invokeLater(() -> {
publisherComboBox.setModel(new DefaultComboBoxModel(publisherList.toArray()));
fillOffers();
}), error -> {
final String msg = String.format(ERROR_MESSAGE_LIST_PUBLISHER, String.format(message("webappExpMsg"), error.getMessage()));
handleError(msg, error);
});
}));
}
}
Aggregations