Consolidate getSubscriptions (#16821)

* Consolidate getSubscriptions

* Undo test change
This commit is contained in:
Charles Gagnon
2021-08-18 12:56:45 -07:00
committed by GitHub
parent 8c858f9990
commit df49d67f7d
9 changed files with 39 additions and 58 deletions

View File

@@ -43,7 +43,7 @@ export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNode
let subscriptions: azureResource.AzureResourceSubscription[] = [];
if (this._isClearingCache) {
subscriptions = await this._subscriptionService.getAllSubscriptions(this.account);
subscriptions = await this._subscriptionService.getSubscriptions(this.account);
this.updateCache<azureResource.AzureResourceSubscription[]>(subscriptions);
this._isClearingCache = false;
} else {

View File

@@ -118,7 +118,7 @@ async function getSubscriptionInfo(account: AzureAccount, subscriptionService: I
total: number,
selected: number
}> {
let subscriptions = await subscriptionService.getAllSubscriptions(account);
let subscriptions = await subscriptionService.getSubscriptions(account);
const total = subscriptions.length;
let selected = total;

View File

@@ -7,7 +7,6 @@ import * as vscode from 'vscode';
import * as azdata from 'azdata';
import { AppContext } from '../../appContext';
import * as nls from 'vscode-nls';
import { TokenCredentials } from '@azure/ms-rest-js';
const localize = nls.loadMessageBundle();
import { TreeNode } from '../treeNode';
@@ -123,9 +122,7 @@ class ResourceLoader {
for (const account of accounts) {
for (const tenant of account.properties.tenants) {
const token = await azdata.accounts.getAccountSecurityToken(account, tenant.id, azdata.AzureResource.ResourceManagement);
for (const subscription of await this.subscriptionService.getSubscriptions(account, new TokenCredentials(token.token, token.tokenType), tenant.id)) {
for (const subscription of await this.subscriptionService.getSubscriptions(account, [tenant.id])) {
for (const providerId of await this.resourceService.listResourceProviderIds()) {
for (const group of await this.resourceService.getRootChildren(providerId, account, subscription, subscription.tenant)) {
const children = await this.resourceService.getChildren(providerId, group.resourceNode);