Search in sources :

Example 1 with Performance

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);
}
Also used : Performance(com.microsoft.azure.toolkit.lib.storage.model.Performance)

Example 2 with Performance

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);
    }
}
Also used : Redundancy(com.microsoft.azure.toolkit.lib.storage.model.Redundancy) Kind(com.microsoft.azure.toolkit.lib.storage.model.Kind) Performance(com.microsoft.azure.toolkit.lib.storage.model.Performance)

Example 3 with Performance

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);
    }
}
Also used : Performance(com.microsoft.azure.toolkit.lib.storage.model.Performance)

Example 4 with Performance

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);
        }
    }
}
Also used : Performance(com.microsoft.azure.toolkit.lib.storage.model.Performance)

Example 5 with Performance

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();
}
Also used : DraftResourceGroup(com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup) Kind(com.microsoft.azure.toolkit.lib.storage.model.Kind) Region(com.microsoft.azure.toolkit.lib.common.model.Region) AzureGroup(com.microsoft.azure.toolkit.lib.resource.AzureGroup) Performance(com.microsoft.azure.toolkit.lib.storage.model.Performance) DraftResourceGroup(com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Aggregations

Performance (com.microsoft.azure.toolkit.lib.storage.model.Performance)5 Kind (com.microsoft.azure.toolkit.lib.storage.model.Kind)2 Region (com.microsoft.azure.toolkit.lib.common.model.Region)1 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)1 AzureGroup (com.microsoft.azure.toolkit.lib.resource.AzureGroup)1 Redundancy (com.microsoft.azure.toolkit.lib.storage.model.Redundancy)1 DraftResourceGroup (com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup)1