use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class MySQLCreationAdvancedPanel method loadSupportedRegions.
public static List<Region> loadSupportedRegions(AzureService service, String subscriptionId) {
// this the sequence in listSupportedRegions is alphabetical order for mysql
// we need to rearrange it according to: az account list-regions
final List<Region> regions = Azure.az(AzureAccount.class).listRegions(subscriptionId);
final List supportedRegions = service.listSupportedRegions(subscriptionId);
return regions.stream().filter(supportedRegions::contains).collect(Collectors.toList());
}
use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class PublishWebAppOnLinuxDialog method renderLocationList.
@Override
public void renderLocationList(List<Region> list) {
// TODO Auto-generated method stub
locationList = list;
cpNew.cbLocation.removeAll();
for (Region l : locationList) {
cpNew.cbLocation.add(l.getLabel());
}
if (cpNew.cbLocation.getItemCount() > 0) {
cpNew.cbLocation.select(0);
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method fillLocationsAndResourceGrps.
private void fillLocationsAndResourceGrps(Subscription selectedSub) {
cbLocations.removeAll();
List<? extends Region> locations = com.microsoft.azure.toolkit.lib.Azure.az(AzureAccount.class).listRegions(selectedSub.getId());
if (locations != null) {
sortedLocations = locations.stream().sorted(Comparator.comparing(Region::getLabel)).collect(Collectors.toList());
for (Region location : sortedLocations) {
cbLocations.add(location.getLabel());
}
if (sortedLocations.size() > 0) {
cbLocations.select(0);
selectedLocationValue = sortedLocations.get(0).getLabel();
}
}
cbUseExisting.removeAll();
List<ResourceGroup> groups = AzureMvpModel.getInstance().getResourceGroups(selectedSub.getId()).stream().map(ResourceEx::getResource).collect(Collectors.toList());
if (groups != null) {
sortedGroups = groups.stream().map(ResourceGroup::getName).sorted().collect(Collectors.toList());
for (String group : sortedGroups) {
cbUseExisting.add(group);
}
if (sortedGroups.size() > 0) {
cbUseExisting.select(0);
if (rdoUseExisting.getSelection()) {
newResGrp = false;
selectedResGrpValue = sortedGroups.get(0);
}
}
}
}
use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class SelectImageStep method fillRegions.
private void fillRegions() {
regionComboBox.removeAll();
Subscription subs = wizard.getSubscription();
List<Region> locations = Azure.az(AzureAccount.class).listRegions(subs.getId());
for (Region location : locations) {
regionComboBox.add(location.getLabel());
regionComboBox.setData(location.getLabel(), location);
}
if (locations.size() > 0) {
regionComboBox.select(0);
selectRegion();
}
regionComboBox.setEnabled(true);
validateNext();
}
use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.
the class CreateArmStorageAccountForm method okPressed.
@Override
protected void okPressed() {
if (nameTextField.getText().length() < 3 || nameTextField.getText().length() > 24 || !nameTextField.getText().matches("[a-z0-9]+")) {
DefaultLoader.getUIHelper().showError("Invalid storage account name. The name should be between 3 and 24 characters long and " + "can contain only lowercase letters and numbers.", "Azure Explorer");
return;
}
if (subscription == null) {
subscription = (Subscription) subscriptionComboBox.getData(subscriptionComboBox.getText());
}
final boolean isNewResourceGroup = createNewRadioButton.getSelection();
final ResourceGroup resourceGroup = isNewResourceGroup ? new DraftResourceGroup(subscription, resourceGrpField.getText()) : Azure.az(AzureGroup.class).subscription(subscription.getId()).getByName(resourceGrpCombo.getText());
Region region = ((Region) regionComboBox.getData(regionComboBox.getText()));
Kind kind = (Kind) kindCombo.getData(kindCombo.getText());
String name = nameTextField.getText();
newStorageAccount = StorageAccountConfig.builder().name(name).region(region).kind(kind).resourceGroup(resourceGroup).performance((Performance) performanceCombo.getData(performanceCombo.getText())).redundancy((Redundancy) replicationComboBox.getData(replicationComboBox.getText())).subscription(subscription).accessTier(Optional.ofNullable(accessTierComboBox).map(t -> (AccessTier) accessTierComboBox.getData(accessTierComboBox.getText())).orElse(null)).build();
this.onCreate.run();
super.okPressed();
}
Aggregations