Search in sources :

Example 21 with Subscription

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

the class AppInsightsMngmtPanel method updateApplicationInsightsResourceRegistry.

public static void updateApplicationInsightsResourceRegistry(List<Subscription> subList, Project project) throws Exception {
    // remove all resourecs that were not manually added
    keeepManuallyAddedList(project);
    for (Subscription sub : subList) {
        if (sub.isSelected()) {
            try {
                // fetch resources available for particular subscription
                List<ApplicationInsightsComponent> resourceList = AzureSDKManager.getInsightsResources(sub.getId());
                // Removal logic
                List<ApplicationInsightsResource> importedList = ApplicationInsightsResourceRegistry.prepareAppResListFromRes(resourceList, sub);
                // Addition logic
                ApplicationInsightsResourceRegistry.getAppInsightsResrcList().addAll(importedList);
            } catch (Exception ex) {
                AzurePlugin.log("Error loading AppInsights information for subscription '" + sub.getName() + "'");
            }
        }
    }
    AzureSettings.getSafeInstance(project).saveAppInsights();
}
Also used : ApplicationInsightsResource(com.microsoft.applicationinsights.preference.ApplicationInsightsResource) ApplicationInsightsComponent(com.microsoft.azure.management.applicationinsights.v2015_05_01.ApplicationInsightsComponent) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 22 with Subscription

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

the class AzureExplorer method getTitle.

private String getTitle() {
    try {
        final AzureAccount az = Azure.az(AzureAccount.class);
        final Account account = az.account();
        final List<Subscription> subscriptions = account.getSelectedSubscriptions();
        if (subscriptions.size() == 1) {
            return String.format("Azure(%s)", subscriptions.get(0).getName());
        }
    } catch (final Exception ignored) {
    }
    return "Azure";
}
Also used : Account(com.microsoft.azure.toolkit.lib.auth.Account) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) AzureAccount(com.microsoft.azure.toolkit.lib.auth.AzureAccount) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 23 with Subscription

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

the class SpringCloudDeploymentConfigurationPanel method onSubscriptionChanged.

private void onSubscriptionChanged(final ItemEvent e) {
    if (e.getStateChange() == ItemEvent.SELECTED || e.getStateChange() == ItemEvent.DESELECTED) {
        final Subscription subscription = (Subscription) e.getItem();
        this.selectorCluster.setSubscription(subscription);
    }
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 24 with Subscription

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

the class StorageAccountResourcePanel method init.

private void init() {
    this.subscriptionComboBox.addItemListener(e -> {
        if (e.getStateChange() == ItemEvent.SELECTED) {
            final Subscription subscription = (Subscription) e.getItem();
            this.accountComboBox.refreshItems();
        } else if (e.getStateChange() == ItemEvent.DESELECTED) {
            this.accountComboBox.clear();
        }
    });
}
Also used : Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription)

Example 25 with Subscription

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

the class VirtualNetworkComboBox method resetResourceDraft.

private void resetResourceDraft() {
    final Network value = getValue();
    if (value != null && !StringUtils.equals(value.status(), IAzureBaseResource.Status.DRAFT)) {
        draftNetwork = DraftNetwork.getDefaultNetworkDraft();
        draftNetwork.setRegion(region);
        draftNetwork.setResourceGroup(Optional.ofNullable(resourceGroup).map(ResourceGroup::getName).orElse(null));
        draftNetwork.setSubscriptionId(Optional.ofNullable(subscription).map(Subscription::getId).orElse(null));
        setValue(draftNetwork);
    }
}
Also used : DraftNetwork(com.microsoft.azure.toolkit.lib.compute.network.DraftNetwork) AzureNetwork(com.microsoft.azure.toolkit.lib.compute.network.AzureNetwork) Network(com.microsoft.azure.toolkit.lib.compute.network.Network) Subscription(com.microsoft.azure.toolkit.lib.common.model.Subscription) ResourceGroup(com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)

Aggregations

Subscription (com.microsoft.azure.toolkit.lib.common.model.Subscription)64 ResourceGroup (com.microsoft.azure.toolkit.lib.common.model.ResourceGroup)13 Region (com.microsoft.azure.toolkit.lib.common.model.Region)9 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)9 AzureAccount (com.microsoft.azure.toolkit.lib.auth.AzureAccount)7 ArrayList (java.util.ArrayList)7 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 Project (com.intellij.openapi.project.Project)4 Azure (com.microsoft.azure.toolkit.lib.Azure)4 IAppServicePlan (com.microsoft.azure.toolkit.lib.appservice.service.IAppServicePlan)4 IWebApp (com.microsoft.azure.toolkit.lib.appservice.service.IWebApp)4 IOException (java.io.IOException)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 Point (org.eclipse.swt.graphics.Point)4 GridData (org.eclipse.swt.layout.GridData)4 Combo (org.eclipse.swt.widgets.Combo)4 PricingTier (com.microsoft.azure.toolkit.lib.appservice.model.PricingTier)3 AzureOperation (com.microsoft.azure.toolkit.lib.common.operation.AzureOperation)3 EventType (com.microsoft.azuretools.telemetrywrapper.EventType)3 EventUtil (com.microsoft.azuretools.telemetrywrapper.EventUtil)3