Search in sources :

Example 6 with Region

use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.

the class CreateArmStorageAccountForm method fillRegions.

private void fillRegions() {
    Subscription subs = (Subscription) subscriptionComboBox.getData(subscriptionComboBox.getText());
    final List<Region> locations = Azure.az(AzureAccount.class).listRegions(subs.getId());
    AzureTaskManager.getInstance().runLater(() -> {
        for (Region location : locations) {
            regionComboBox.add(location.getLabel());
            regionComboBox.setData(location.getLabel(), location);
        }
        if (locations.size() > 0) {
            regionComboBox.select(0);
        }
    });
}
Also used : Region(com.microsoft.azure.toolkit.lib.common.model.Region) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 7 with Region

use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.

the class VMCreationDialog method onRegionChanged.

private void onRegionChanged(final ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED && e.getItem() instanceof Region) {
        final Region region = (Region) e.getItem();
        this.cbImage.setRegion(region);
        this.cbSize.setRegion(region);
        this.cbVirtualNetwork.setRegion(region);
        this.cbPublicIp.setRegion(region);
        this.cbSecurityGroup.setRegion(region);
    }
}
Also used : Region(com.microsoft.azure.toolkit.lib.common.model.Region)

Example 8 with Region

use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.

the class RedisCreationDialog method createUIComponents.

private void createUIComponents() {
    this.subscriptionComboBox = new SubscriptionComboBox();
    this.resourceGroupComboBox = new ResourceGroupComboBox();
    this.regionComboBox = new RegionComboBox() {

        protected List<? extends Region> loadItems() {
            if (Objects.nonNull(this.subscription)) {
                return Azure.az(AzureRedis.class).listSupportedRegions(subscription.getId());
            }
            return Collections.emptyList();
        }
    };
    this.redisNameTextField = new ValidationDebouncedTextInput();
    this.pricingComboBox = new AzureComboBoxSimple<>(PricingTier::values);
}
Also used : ResourceGroupComboBox(com.microsoft.azure.toolkit.intellij.common.component.resourcegroup.ResourceGroupComboBox) SubscriptionComboBox(com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox) Region(com.microsoft.azure.toolkit.lib.common.model.Region) List(java.util.List) RegionComboBox(com.microsoft.azure.toolkit.intellij.common.component.RegionComboBox) ValidationDebouncedTextInput(com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput)

Example 9 with Region

use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.

the class AzureMvpModel method listLocationsBySubscriptionId.

/**
 * List Location by Subscription ID.
 *
 * @param sid subscription Id
 * @return List of Location instances
 */
@AzureOperation(name = "common|region.list.subscription", params = { "sid" }, type = AzureOperation.Type.SERVICE)
public List<Region> listLocationsBySubscriptionId(String sid) {
    List<Region> locations = new ArrayList<>();
    Subscription subscription = getSubscriptionById(sid);
    try {
        locations.addAll(az(AzureAccount.class).listRegions(subscription.getId()));
    } catch (Exception e) {
        e.printStackTrace();
    }
    Collections.sort(locations, getComparator(Region::getName));
    return locations;
}
Also used : ArrayList(java.util.ArrayList) Region(com.microsoft.azure.toolkit.lib.common.model.Region) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) AzureOperation(com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)

Example 10 with Region

use of com.microsoft.azure.toolkit.lib.common.model.Region in project azure-tools-for-java by Microsoft.

the class AppServiceInfoAdvancedPanel method getData.

@Override
public T getData() {
    final Subscription subscription = this.selectorSubscription.getValue();
    final ResourceGroup resourceGroup = this.selectorGroup.getValue();
    final String name = this.textName.getValue();
    final Runtime runtime = this.selectorRuntime.getValue();
    final Region region = this.selectorRegion.getValue();
    final AppServicePlanEntity servicePlan = this.selectorServicePlan.getValue();
    final AzureArtifact artifact = this.selectorApplication.getValue();
    final T config = supplier.get();
    config.setSubscription(subscription);
    config.setResourceGroup(resourceGroup);
    config.setName(name);
    config.setRuntime(runtime);
    config.setRegion(region);
    config.setServicePlan(servicePlan);
    if (Objects.nonNull(artifact)) {
        final AzureArtifactManager manager = AzureArtifactManager.getInstance(this.project);
        final String path = manager.getFileForDeployment(this.selectorApplication.getValue());
        config.setApplication(Paths.get(path));
    }
    return config;
}
Also used : Runtime(com.microsoft.azure.toolkit.lib.appservice.model.Runtime) AzureArtifact(com.microsoft.azure.toolkit.intellij.common.AzureArtifact) AppServicePlanEntity(com.microsoft.azure.toolkit.lib.appservice.entity.AppServicePlanEntity) Region(com.microsoft.azure.toolkit.lib.common.model.Region) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) AzureArtifactManager(com.microsoft.azure.toolkit.intellij.common.AzureArtifactManager) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Aggregations

Region (com.microsoft.azure.toolkit.lib.common.model.Region)17 Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)8 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)6 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)5 RegionComboBox (com.microsoft.azure.toolkit.intellij.common.component.RegionComboBox)2 SubscriptionComboBox (com.microsoft.azure.toolkit.intellij.common.component.SubscriptionComboBox)2 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)2 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)2 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)2 AzureString (com.microsoft.azure.toolkit.lib.common.bundle.AzureString)2 AzureTask (com.microsoft.azure.toolkit.lib.common.task.AzureTask)2 DraftResourceGroup (com.microsoft.azuretools.azureexplorer.forms.common.DraftResourceGroup)2 PrivateRegistryImageSetting (com.microsoft.azuretools.core.mvp.model.webapp.PrivateRegistryImageSetting)2 List (java.util.List)2 Point (org.eclipse.swt.graphics.Point)2 FileChooserDescriptorFactory (com.intellij.openapi.fileChooser.FileChooserDescriptorFactory)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 Project (com.intellij.openapi.project.Project)1 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)1 MessageType (com.intellij.openapi.ui.MessageType)1