use of com.microsoft.azure.toolkit.lib.storage.model.Performance in project azure-tools-for-java by Microsoft.
the class CreateArmStorageAccountForm method fillPerformanceComboBox.
private void fillPerformanceComboBox() {
performanceCombo.removeAll();
if (kindCombo.getData(kindCombo.getText()) == Kind.BLOB_STORAGE) {
performanceCombo.add(Performance.STANDARD.getName());
performanceCombo.setData(Performance.STANDARD.getName(), Performance.STANDARD);
} else {
for (Performance skuTier : Performance.values()) {
performanceCombo.setData(skuTier.getName(), skuTier);
performanceCombo.add(skuTier.getName());
}
}
performanceCombo.select(0);
}
use of com.microsoft.azure.toolkit.lib.storage.model.Performance in project azure-tools-for-java by Microsoft.
the class CreateArmStorageAccountForm method fillReplicationTypes.
private void fillReplicationTypes() {
replicationComboBox.removeAll();
Kind kind = (Kind) kindCombo.getData(kindCombo.getText());
Performance performance = (Performance) performanceCombo.getData(performanceCombo.getText());
List<Redundancy> redundancies = Objects.isNull(performance) ? Collections.emptyList() : Azure.az(AzureStorageAccount.class).listSupportedRedundancies(performance, kind);
for (Redundancy redundancy : redundancies) {
replicationComboBox.add(redundancy.getLabel());
replicationComboBox.setData(redundancy.getLabel(), redundancy);
}
if (redundancies.contains(Redundancy.STANDARD_RAGRS)) {
replicationComboBox.select(redundancies.indexOf(Redundancy.STANDARD_RAGRS));
} else {
replicationComboBox.select(0);
}
}
use of com.microsoft.azure.toolkit.lib.storage.model.Performance in project azure-tools-for-java by Microsoft.
the class BaseStorageAccountCreationDialog method onPerformanceChanged.
private void onPerformanceChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final Performance performance = (Performance) e.getItem();
this.redundancyComboBox.setPerformance(performance);
this.kindComboBox.setPerformance(performance);
} else if (e.getStateChange() == ItemEvent.DESELECTED) {
this.kindComboBox.setPerformance(null);
this.redundancyComboBox.setPerformance(null);
}
}
use of com.microsoft.azure.toolkit.lib.storage.model.Performance in project azure-tools-for-java by Microsoft.
the class StorageAccountCreationDialog method onPerformanceChanged.
private void onPerformanceChanged(final ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final Performance performance = (Performance) e.getItem();
final boolean kindVisible = Objects.equals(Performance.PREMIUM, performance);
this.kindComboBox.setVisible(kindVisible);
this.kindLabel.setVisible(kindVisible);
if (!kindVisible) {
this.kindComboBox.setValue(Kind.STORAGE_V2);
}
}
}
use of com.microsoft.azure.toolkit.lib.storage.model.Performance 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