Search in sources :

Example 86 with Subscription

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

the class PublishWebAppOnLinuxDialog method onSubscriptionSelection.

private void onSubscriptionSelection() {
    cpNew.cbExistingResourceGroup.removeAll();
    cpNew.cbLocation.removeAll();
    Subscription sb = getSelectedSubscription();
    if (sb != null) {
        webAppOnLinuxDeployPresenter.onLoadResourceGroup(sb.getId());
        webAppOnLinuxDeployPresenter.onLoadLocationList(sb.getId());
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 87 with Subscription

use of com.microsoft.azure.toolkit.lib.common.model.Subscription 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();
}
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 88 with Subscription

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

the class AppInsightsMngmtPanel method loadInfoFirstTime.

private void loadInfoFirstTime() {
    try {
        if (AuthMethodManager.getInstance().isSignedIn()) {
            AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
            List<Subscription> subList = azureManager.getSelectedSubscriptions();
            if (subList.size() > 0) {
                updateApplicationInsightsResourceRegistry(subList, myProject);
            } else {
                // just show manually added list from preferences
                // Neither clear subscription list nor show sign in dialog as user may just want to add key manually.
                keeepManuallyAddedList(myProject);
            }
        } else {
            // just show manually added list from preferences
            keeepManuallyAddedList(myProject);
        }
    } catch (Exception ex) {
        AzurePlugin.log(ex.getMessage(), ex);
    }
}
Also used : AzureManager(com.microsoft.azuretools.sdkmanage.AzureManager) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 89 with Subscription

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

the class AppServiceCreateDialog method fillResourceGroups.

protected void fillResourceGroups() {
    Subscription selectedSubscription = getSelectedSubscription();
    if (selectedSubscription == null) {
        return;
    }
    setComboRefreshingStatus(comboResourceGroup, true);
    Mono.fromCallable(() -> {
        List<ResourceGroup> list = Azure.az(AzureGroup.class).list(selectedSubscription.getId(), false);
        list.sort(Comparator.comparing(ResourceGroup::getName));
        return list;
    }).subscribeOn(Schedulers.boundedElastic()).subscribe(groupList -> {
        binderResourceGroup = new ArrayList<>();
        DefaultLoader.getIdeHelper().invokeLater(() -> {
            comboResourceGroup.removeAll();
            for (ResourceGroup rg : groupList) {
                comboResourceGroup.add(rg.getName());
                binderResourceGroup.add(rg);
            }
            if (comboResourceGroup.getItemCount() > 0) {
                comboResourceGroup.select(0);
            }
            String resourceGroup = CommonUtils.getPreference(CommonUtils.RG_NAME);
            CommonUtils.selectComboIndex(comboResourceGroup, resourceGroup);
        });
    });
}
Also used : AzureGroup(com.microsoft.azure.toolkit.lib.resource.AzureGroup) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Example 90 with Subscription

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

the class AppServiceCreateDialog method fillSubscriptions.

private void fillSubscriptions() {
    try {
        List<Subscription> selectedSubscriptions = Azure.az(AzureAccount.class).account().getSelectedSubscriptions();
        // reset model
        if (selectedSubscriptions == null) {
            return;
        }
        comboSubscription.removeAll();
        binderSubscriptionDetails = new ArrayList<>();
        for (Subscription sd : selectedSubscriptions) {
            comboSubscription.add(sd.getName());
            binderSubscriptionDetails.add(sd);
        }
        if (comboSubscription.getItemCount() > 0) {
            comboSubscription.select(0);
        }
        String subscription = CommonUtils.getPreference(CommonUtils.SUBSCRIPTION);
        CommonUtils.selectComboIndex(comboSubscription, subscription);
    } catch (Exception ex) {
        ex.printStackTrace();
        LOG.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "doFillSubscriptions@AppServiceCreateDialog", ex));
    }
}
Also used : Status(org.eclipse.core.runtime.Status) IStatus(org.eclipse.core.runtime.IStatus) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) PartInitException(org.eclipse.ui.PartInitException) MalformedURLException(java.net.MalformedURLException)

Aggregations

Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)130 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)26 Region (com.microsoft.azure.toolkit.lib.common.model.Region)18 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)18 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)15 ArrayList (java.util.ArrayList)14 IOException (java.io.IOException)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Project (com.intellij.openapi.project.Project)8 Azure (com.microsoft.azure.toolkit.lib.Azure)8 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)8 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)8 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)8 HashMap (java.util.HashMap)8 List (java.util.List)8 StringUtils (org.apache.commons.lang3.StringUtils)8 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)8 Point (org.eclipse.swt.graphics.Point)8 GridData (org.eclipse.swt.layout.GridData)8 Combo (org.eclipse.swt.widgets.Combo)8