Azure: add PostgresSQL support and refactor to use resource graph (#8046)

* Azure: add PostgresSQL support and refactor to use resource graph
- Refactored to use @azure/arm-resourcegraph for all queries
- Refactored database lookup to do just 2 queries
(all servers, all DBS) instead of waiting serially on 1 query per RG
- Added Azure Database for PostgresSQL Servers support in the tree
- Removed use of older azure APIs in preference to ones compatible with resource graph
- Note: Had to use v1.0 of new subscriptions package because resourcegraph is 2month out of date vs all other packages
This commit is contained in:
Kevin Cunnane
2019-10-28 09:47:38 -07:00
committed by GitHub
parent a7f597c943
commit 067af76904
21 changed files with 565 additions and 176 deletions

View File

@@ -3,9 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import * as msRest from '@azure/ms-rest-js';
import { ServiceClientCredentials } from 'ms-rest';
import { Account, DidChangeAccountsParams } from 'azdata';
import { Event } from 'vscode';
@@ -13,17 +12,15 @@ import { azureResource } from './azure-resource';
export interface IAzureResourceAccountService {
getAccounts(): Promise<Account[]>;
readonly onDidChangeAccounts: Event<DidChangeAccountsParams>;
}
export interface IAzureResourceSubscriptionService {
getSubscriptions(account: Account, credential: ServiceClientCredentials): Promise<azureResource.AzureResourceSubscription[]>;
getSubscriptions(account: Account, credential: msRest.ServiceClientCredentials): Promise<azureResource.AzureResourceSubscription[]>;
}
export interface IAzureResourceSubscriptionFilterService {
getSelectedSubscriptions(account: Account): Promise<azureResource.AzureResourceSubscription[]>;
saveSelectedSubscriptions(account: Account, selectedSubscriptions: azureResource.AzureResourceSubscription[]): Promise<void>;
}
@@ -50,7 +47,7 @@ export interface AzureSqlResource {
}
export interface IAzureResourceService<T extends AzureSqlResource> {
getResources(subscription: azureResource.AzureResourceSubscription, credential: ServiceClientCredentials): Promise<T[]>;
getResources(subscription: azureResource.AzureResourceSubscription, credential: msRest.ServiceClientCredentials): Promise<T[]>;
}
@@ -60,6 +57,7 @@ export interface AzureResourceDatabase extends AzureSqlResource {
}
export interface AzureResourceDatabaseServer extends AzureSqlResource {
id?: string;
fullName: string;
defaultDatabaseName: string;
}