Search in sources :

Example 41 with SubscriptionDetail

use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.

the class ApplicationInsightsPreferencePage method loadInfoFirstTime.

private void loadInfoFirstTime() {
    try {
        if (AuthMethodManager.getInstance().isSignedIn()) {
            AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
            List<SubscriptionDetail> subList = azureManager.getSubscriptionManager().getSubscriptionDetails();
            if (subList.size() > 0) {
                //				if (!ApplicationInsightsPreferences.isLoaded()) {
                // authenticated using AD. Proceed for updating application insights registry.
                ApplicationInsightsResourceRegistryEclipse.updateApplicationInsightsResourceRegistry(subList);
            } else {
                ApplicationInsightsResourceRegistryEclipse.keeepManuallyAddedList();
            }
        //				} else {
        //					// show list from preferences - getTableContent() does it. So nothing to handle here
        //				}
        } else {
            // just show manually added list from preferences
            ApplicationInsightsResourceRegistryEclipse.keeepManuallyAddedList();
        }
    } catch (Exception ex) {
        Activator.getDefault().log(Messages.importErrMsg, ex);
    }
}
Also used : AzureManager(com.microsoft.azuretools.sdkmanage.AzureManager) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail)

Example 42 with SubscriptionDetail

use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.

the class ApplicationInsightsNewDialog method populateValues.

private void populateValues() {
    try {
        subscription.removeAll();
        AzureManager azureManager = AuthMethodManager.getInstance().getAzureManager();
        if (azureManager == null) {
            return;
        }
        List<SubscriptionDetail> subList = azureManager.getSubscriptionManager().getSubscriptionDetails();
        // check at least single subscription is associated with the account
        if (subList.size() > 0) {
            for (SubscriptionDetail sub : subList) {
                subscription.add(sub.getSubscriptionName());
                subscription.setData(sub.getSubscriptionName(), sub);
            }
            subscription.select(0);
            currentSub = subList.get(0);
            populateResourceGroupValues(currentSub.getSubscriptionId(), "");
            List<String> regionList = AzureSDKManager.getLocationsForApplicationInsights(currentSub);
            String[] regionArray = regionList.toArray(new String[regionList.size()]);
            region.setItems(regionArray);
            region.setText(regionArray[0]);
        }
        enableOkBtn();
    } catch (Exception ex) {
        Activator.getDefault().log(Messages.getValuesErrMsg, ex);
    }
}
Also used : AzureManager(com.microsoft.azuretools.sdkmanage.AzureManager) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail)

Example 43 with SubscriptionDetail

use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.

the class ApplicationInsightsNewDialog method createSubCmpnt.

private void createSubCmpnt(Composite container) {
    Label lblName = new Label(container, SWT.LEFT);
    GridData gridData = gridDataForLbl();
    lblName.setLayoutData(gridData);
    lblName.setText(Messages.sub);
    subscription = new Combo(container, SWT.READ_ONLY);
    gridData = gridDataForText(180);
    subscription.setLayoutData(gridData);
    subscription.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent arg0) {
            SubscriptionDetail newSub = (SubscriptionDetail) subscription.getData(subscription.getText());
            String prevResGrpVal = resourceGrpCombo.getText();
            if (currentSub.equals(newSub)) {
                populateResourceGroupValues(currentSub.getSubscriptionId(), prevResGrpVal);
            } else {
                populateResourceGroupValues(newSub.getSubscriptionId(), "");
            }
            currentSub = newSub;
            enableOkBtn();
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent arg0) {
        }
    });
}
Also used : Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail) Combo(org.eclipse.swt.widgets.Combo) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 44 with SubscriptionDetail

use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.

the class WebAppDeployDialog method fillAppServiceDetails.

private void fillAppServiceDetails() {
    validated();
    int selectedRow = table.getSelectionIndex();
    if (selectedRow < 0) {
        browserAppServiceDetailes.setText("");
        btnDelete.setEnabled(false);
        return;
    }
    btnDelete.setEnabled(true);
    String appServiceName = table.getItems()[selectedRow].getText(0);
    WebAppDetails wad = webAppDetailsMap.get(appServiceName);
    SubscriptionDetail sd = wad.subscriptionDetail;
    AppServicePlan asp = wad.appServicePlan;
    StringBuilder sb = new StringBuilder();
    sb.append("<div style=\"margin: 7px 7px 7px 7px; " + browserFontStyle + "\">");
    sb.append(String.format("App Service name:&nbsp;<b>%s</b>;<br/>", appServiceName));
    sb.append(String.format("Subscription name:&nbsp;<b>%s</b>;&nbsp;id:&nbsp;<b>%s</b>;<br/>", sd.getSubscriptionName(), sd.getSubscriptionId()));
    String aspName = asp == null ? "N/A" : asp.name();
    String aspPricingTier = asp == null ? "N/A" : asp.pricingTier().toString();
    sb.append(String.format("App Service Plan name:&nbsp;<b>%s</b>;&nbsp;Pricing tier:&nbsp;<b>%s</b>;<br/>", aspName, aspPricingTier));
    String link = buildSiteLink(wad.webApp, null);
    sb.append(String.format("Link:&nbsp;<a href=\"%s\">%s</a><br/>", link, link));
    sb.append(String.format("<a href=\"%s\">%s</a>", ftpLinkString, "Show FTP deployment credentials"));
    sb.append("</div>");
    browserAppServiceDetailes.setText(sb.toString());
}
Also used : WebAppDetails(com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail) AppServicePlan(com.microsoft.azure.management.appservice.AppServicePlan)

Example 45 with SubscriptionDetail

use of com.microsoft.azuretools.authmanage.models.SubscriptionDetail in project azure-tools-for-java by Microsoft.

the class CreateBlobContainer method actionPerformed.

@Override
public void actionPerformed(NodeActionEvent e) {
    String connectionString;
    if (parent instanceof BlobModule) {
        connectionString = StorageClientSDKManager.getConnectionString(((BlobModule) parent).getStorageAccount());
    } else {
        connectionString = StorageClientSDKManager.getConnectionString(((StorageNode) parent).getStorageAccount());
    }
    CreateBlobContainerForm form = new CreateBlobContainerForm(PluginUtil.getParentShell(), connectionString);
    if (parent instanceof StorageNode) {
        form.setSubscription(new SubscriptionDetail(((StorageNode) parent).getSubscriptionId(), null, null, true));
    }
    form.setOnCreate(new Runnable() {

        @Override
        public void run() {
            parent.removeAllChildNodes();
            parent.load(false);
        }
    });
    form.open();
}
Also used : CreateBlobContainerForm(com.microsoft.azuretools.azureexplorer.forms.CreateBlobContainerForm) SubscriptionDetail(com.microsoft.azuretools.authmanage.models.SubscriptionDetail) BlobModule(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.BlobModule) StorageNode(com.microsoft.tooling.msservices.serviceexplorer.azure.storage.StorageNode)

Aggregations

SubscriptionDetail (com.microsoft.azuretools.authmanage.models.SubscriptionDetail)52 AzureManager (com.microsoft.azuretools.sdkmanage.AzureManager)17 ResourceGroup (com.microsoft.azure.management.resources.ResourceGroup)13 SubscriptionManager (com.microsoft.azuretools.authmanage.SubscriptionManager)13 IOException (java.io.IOException)9 AppServicePlan (com.microsoft.azure.management.appservice.AppServicePlan)7 Location (com.microsoft.azure.management.resources.Location)7 List (java.util.List)7 WebApp (com.microsoft.azure.management.appservice.WebApp)5 AzureCmdException (com.microsoft.azuretools.azurecommons.helpers.AzureCmdException)5 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 Azure (com.microsoft.azure.management.Azure)4 Subscription (com.microsoft.azure.management.resources.Subscription)4 WebAppDetails (com.microsoft.azuretools.utils.WebAppUtils.WebAppDetails)4 HashMap (java.util.HashMap)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 GridData (org.eclipse.swt.layout.GridData)4 Label (org.eclipse.swt.widgets.Label)4 AccessTokenAzureManager (com.microsoft.azuretools.sdkmanage.AccessTokenAzureManager)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)3