use of com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup in project azure-tools-for-java by Microsoft.
the class CreateRedisCacheForm method getData.
private RedisConfig getData() {
RedisConfig redisConfig = new RedisConfig();
redisConfig.setSubscription(this.currentSub);
redisConfig.setRegion(Region.fromName(selectedLocationValue));
redisConfig.setResourceGroup(newResGrp ? new DraftResourceGroup(this.currentSub, selectedResGrpValue) : com.microsoft.azure.toolkit.lib.Azure.az(AzureGroup.class).get(this.currentSub.getId(), selectedResGrpValue));
redisConfig.setEnableNonSslPort(noSSLPort);
redisConfig.setPricingTier(PricingTier.values().stream().filter(pricingTier -> StringUtils.equalsIgnoreCase(pricingTier.toString(), selectedPriceTierValue)).findFirst().orElse(null));
redisConfig.setName(dnsNameValue);
return redisConfig;
}
use of com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup 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