diff --git a/extensions/azurecore/src/azureDataGridProvider.ts b/extensions/azurecore/src/azureDataGridProvider.ts index 42a706b06b..67a47086a3 100644 --- a/extensions/azurecore/src/azureDataGridProvider.ts +++ b/extensions/azurecore/src/azureDataGridProvider.ts @@ -7,7 +7,7 @@ import * as azdata from 'azdata'; import { AppContext } from './appContext'; import { AzureResourceServiceNames } from './azureResource/constants'; import { IAzureResourceSubscriptionService } from './azureResource/interfaces'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import * as azureResourceUtils from './azureResource/utils'; import * as constants from './constants'; import * as loc from './localizedConstants'; diff --git a/extensions/azurecore/src/azureResource/azure-resource.d.ts b/extensions/azurecore/src/azureResource/azure-resource.d.ts deleted file mode 100644 index 26017ce20c..0000000000 --- a/extensions/azurecore/src/azureResource/azure-resource.d.ts +++ /dev/null @@ -1,158 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the Source EULA. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -declare module 'azureResource' { - import { TreeDataProvider } from 'vscode'; - import { DataProvider, TreeItem } from 'azdata'; - import { BlobItem } from '@azure/storage-blob'; - import { AzureAccount } from 'azurecore'; - - export namespace azureResource { - - /** - * AzureCore core extension supports following resource types of Azure Resource Graph. - * To add more resources, please refer this guide: https://docs.microsoft.com/en-us/azure/governance/resource-graph/reference/supported-tables-resources - */ - export const enum AzureResourceType { - resourceGroup = 'microsoft.resources/subscriptions/resourcegroups', - sqlServer = 'microsoft.sql/servers', - sqlDatabase = 'microsoft.sql/servers/databases', - sqlManagedInstance = 'microsoft.sql/managedinstances', - azureArcSqlManagedInstance = 'microsoft.azuredata/sqlmanagedinstances', - virtualMachines = 'microsoft.compute/virtualmachines', - kustoClusters = 'microsoft.kusto/clusters', - azureArcPostgresServer = 'microsoft.azuredata/postgresinstances', - postgresServer = 'microsoft.dbforpostgresql/servers', - azureArcService = 'microsoft.azuredata/datacontrollers', - storageAccount = 'microsoft.storage/storageaccounts', - logAnalytics = 'microsoft.operationalinsights/workspaces' - } - - export interface IAzureResourceProvider extends DataProvider { - getTreeDataProvider(): IAzureResourceTreeDataProvider; - } - - export interface IAzureResourceTreeDataProvider extends TreeDataProvider { - browseConnectionMode: boolean; - } - - export interface IAzureResourceNode { - readonly account: AzureAccount; - readonly subscription: AzureResourceSubscription; - readonly tenantId: string; - readonly treeItem: TreeItem; - } - - export interface IAzureSubscriptionInfo { - id: string; - name: string; - } - - export interface AzureResource { - name: string; - id: string; - subscription: IAzureSubscriptionInfo; - resourceGroup?: string; - tenant?: string; - } - - export interface AzureResourceSubscription extends Omit { - } - - export interface AzureSqlResource extends AzureResource { - loginName: string; - } - - export interface AzureGraphResource extends Omit { - tenantId: string; - subscriptionId: string; - type: string; - location: string; - } - - export interface AzureResourceResourceGroup extends AzureResource { - location?: string; - managedBy?: string; - properties?: { - provisioningState?: string - }; - type?: string; - } - - export interface AzureLocation { - id: string, - name: string, - displayName: string, - regionalDisplayName: string, - metadata: { - regionType: string, - regionCategory: string, - geographyGroup: string, - longitude: number, - latitude: number, - physicalLocation: string, - pairedRegion: { - name: string, - id: string, - }[], - }, - } - - export interface AzureSqlManagedInstance extends AzureGraphResource { - sku: { - capacity: number; - family: string; - name: string; - tier: 'GeneralPurpose' | 'BusinessCritical'; - }, - properties: { - provisioningState: string, - storageAccountType: string, - maintenanceConfigurationId: string, - state: string, - licenseType: string, - zoneRedundant: false, - fullyQualifiedDomainName: string, - collation: string, - administratorLogin: string, - minimalTlsVersion: string, - subnetId: string, - publicDataEndpointEnabled: boolean, - storageSizeInGB: number, - timezoneId: string, - proxyOverride: string, - vCores: number, - dnsZone: string, - } - - } - - export interface ManagedDatabase { - id: string, - location: string, - name: string, - properties: { - sourceDatabaseId: string, - status: string - }, - type: string - } - - export interface AzureResourceDatabase extends AzureSqlResource { - serverName: string; - serverFullName: string; - } - - export interface AzureResourceDatabaseServer extends AzureSqlResource { - fullName: string; - defaultDatabaseName: string; - } - export interface BlobContainer extends AzureResource { } - - export interface FileShare extends AzureResource { } - - export interface Blob extends BlobItem { } - } -} diff --git a/extensions/azurecore/src/azureResource/commands.ts b/extensions/azurecore/src/azureResource/commands.ts index 6104695924..c1c81eb72f 100644 --- a/extensions/azurecore/src/azureResource/commands.ts +++ b/extensions/azurecore/src/azureResource/commands.ts @@ -9,13 +9,12 @@ import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); import { AppContext } from '../appContext'; -import { azureResource } from 'azureResource'; import { TreeNode } from './treeNode'; import { AzureResourceTreeProvider } from './tree/treeProvider'; import { AzureResourceAccountTreeNode } from './tree/accountTreeNode'; import { IAzureResourceSubscriptionService, IAzureResourceSubscriptionFilterService, IAzureTerminalService } from '../azureResource/interfaces'; import { AzureResourceServiceNames } from './constants'; -import { AzureAccount, Tenant } from 'azurecore'; +import { AzureAccount, Tenant, azureResource } from 'azurecore'; import { FlatAccountTreeNode } from './tree/flatAccountTreeNode'; import { ConnectionDialogTreeProvider } from './tree/connectionDialogTreeProvider'; import { AzureResourceErrorMessageUtil } from './utils'; diff --git a/extensions/azurecore/src/azureResource/interfaces.ts b/extensions/azurecore/src/azureResource/interfaces.ts index 3478227db0..a7304d9c16 100644 --- a/extensions/azurecore/src/azureResource/interfaces.ts +++ b/extensions/azurecore/src/azureResource/interfaces.ts @@ -5,8 +5,7 @@ import * as msRest from '@azure/ms-rest-js'; -import { azureResource } from 'azureResource'; -import { AzureAccount, Tenant } from 'azurecore'; +import { AzureAccount, Tenant, azureResource } from 'azurecore'; export interface IAzureResourceSubscriptionService { /** diff --git a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorProvider.ts b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorProvider.ts index 60c1af45d3..5becd2fec5 100644 --- a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { AzureMonitorTreeDataProvider as AzureMonitorTreeDataProvider } from './azuremonitorTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorService.ts b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorService.ts index 0151933c75..6ef82845fb 100644 --- a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorService.ts +++ b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; export interface AzureMonitorGraphData extends GraphData { diff --git a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorTreeDataProvider.ts index 8b04ffa766..1817030647 100644 --- a/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/azuremonitor/azuremonitorTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureMonitorTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.AzureMonitorContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/database/databaseProvider.ts b/extensions/azurecore/src/azureResource/providers/database/databaseProvider.ts index f4ade4e9af..bb19ac58b2 100644 --- a/extensions/azurecore/src/azureResource/providers/database/databaseProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/database/databaseProvider.ts @@ -6,7 +6,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { AzureResourceDatabaseTreeDataProvider } from './databaseTreeDataProvider'; import { IAzureResourceService } from '../../interfaces'; diff --git a/extensions/azurecore/src/azureResource/providers/database/databaseService.ts b/extensions/azurecore/src/azureResource/providers/database/databaseService.ts index 7540773443..49bc3767ab 100644 --- a/extensions/azurecore/src/azureResource/providers/database/databaseService.ts +++ b/extensions/azurecore/src/azureResource/providers/database/databaseService.ts @@ -4,12 +4,11 @@ *--------------------------------------------------------------------------------------------*/ import { ServiceClientCredentials } from '@azure/ms-rest-js'; -import { azureResource } from 'azureResource'; import { IAzureResourceService } from '../../interfaces'; import { serversQuery, DbServerGraphData } from '../databaseServer/databaseServerService'; import { ResourceGraphClient } from '@azure/arm-resourcegraph'; import { queryGraphResources, GraphData } from '../resourceTreeDataProviderBase'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; interface DatabaseGraphData extends GraphData { kind: string; diff --git a/extensions/azurecore/src/azureResource/providers/database/databaseTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/database/databaseTreeDataProvider.ts index 66ba0549b3..34d4e3bc48 100644 --- a/extensions/azurecore/src/azureResource/providers/database/databaseTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/database/databaseTreeDataProvider.ts @@ -8,12 +8,11 @@ import * as vscode from 'vscode'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { azureResource } from 'azureResource'; import { AzureResourceItemType } from '../../../azureResource/constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureResourceDatabaseTreeDataProvider extends ResourceTreeDataProviderBase { diff --git a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerProvider.ts b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerProvider.ts index 307e6dc662..77ec4e8afe 100644 --- a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { AzureResourceDatabaseServerTreeDataProvider } from './databaseServerTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerService.ts b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerService.ts index 005b002220..c9a93011a6 100644 --- a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerService.ts +++ b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerService.ts @@ -5,7 +5,7 @@ import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; export interface DbServerGraphData extends GraphData { properties: { diff --git a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerTreeDataProvider.ts index 7e20309c85..1c9c11e8cc 100644 --- a/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/databaseServer/databaseServerTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../../azureResource/constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureResourceDatabaseServerTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.databaseServer.treeDataProvider.databaseServerContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/kusto/kustoProvider.ts b/extensions/azurecore/src/azureResource/providers/kusto/kustoProvider.ts index 3e29b093ce..8fe27a383a 100644 --- a/extensions/azurecore/src/azureResource/providers/kusto/kustoProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/kusto/kustoProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { KustoTreeDataProvider as KustoTreeDataProvider } from './kustoTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/kusto/kustoService.ts b/extensions/azurecore/src/azureResource/providers/kusto/kustoService.ts index b95ed6edfd..a9e6526d8d 100644 --- a/extensions/azurecore/src/azureResource/providers/kusto/kustoService.ts +++ b/extensions/azurecore/src/azureResource/providers/kusto/kustoService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; export interface KustoGraphData extends GraphData { diff --git a/extensions/azurecore/src/azureResource/providers/kusto/kustoTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/kusto/kustoTreeDataProvider.ts index bdf10a3fa7..9b926710f6 100644 --- a/extensions/azurecore/src/azureResource/providers/kusto/kustoTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/kusto/kustoTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class KustoTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.KustoContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerProvider.ts b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerProvider.ts index 6fc0ea72c6..b25d73eaf6 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { PostgresServerArcTreeDataProvider as PostgresServerArcTreeDataProvider } from './postgresServerTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerService.ts b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerService.ts index 3b215afbb8..921676ca73 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerService.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; export interface PostgresArcServerGraphData extends GraphData { properties: { diff --git a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerTreeDataProvider.ts index 7589790e5b..46a61fffe3 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresArcServer/postgresServerTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class PostgresServerArcTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.postgresArcServer.treeDataProvider.postgresServerContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerProvider.ts b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerProvider.ts index 206fe62daa..ea5363d1a1 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { PostgresServerTreeDataProvider as PostgresServerTreeDataProvider } from './postgresServerTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerService.ts b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerService.ts index dbecdcfd94..03b4d089a3 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerService.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerService.ts @@ -5,7 +5,7 @@ import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; interface DbServerGraphData extends GraphData { diff --git a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerTreeDataProvider.ts index 59b394ab6a..5d0b7807c6 100644 --- a/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/postgresServer/postgresServerTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class PostgresServerTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.databaseServer.treeDataProvider.postgresServerContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/resourceGroup/resourceGroupService.ts b/extensions/azurecore/src/azureResource/providers/resourceGroup/resourceGroupService.ts index a285080bc1..f45d6feb78 100644 --- a/extensions/azurecore/src/azureResource/providers/resourceGroup/resourceGroupService.ts +++ b/extensions/azurecore/src/azureResource/providers/resourceGroup/resourceGroupService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { DbServerGraphData } from '../databaseServer/databaseServerService'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ResourceServiceBase } from '../resourceTreeDataProviderBase'; export class AzureResourceGroupService extends ResourceServiceBase { diff --git a/extensions/azurecore/src/azureResource/providers/resourceTreeDataProviderBase.ts b/extensions/azurecore/src/azureResource/providers/resourceTreeDataProviderBase.ts index ef3ded3c53..b019df8ac7 100644 --- a/extensions/azurecore/src/azureResource/providers/resourceTreeDataProviderBase.ts +++ b/extensions/azurecore/src/azureResource/providers/resourceTreeDataProviderBase.ts @@ -6,11 +6,10 @@ import * as azdata from 'azdata'; import * as msRest from '@azure/ms-rest-js'; -import { azureResource } from 'azureResource'; import { IAzureResourceService } from '../interfaces'; import { AzureResourceErrorMessageUtil } from '../utils'; import { ResourceGraphClient } from '@azure/arm-resourcegraph'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export abstract class ResourceTreeDataProviderBase implements azureResource.IAzureResourceTreeDataProvider { public browseConnectionMode: boolean = false; diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceProvider.ts b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceProvider.ts index 0dff7ee4e4..986ce8a0fd 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { SqlInstanceTreeDataProvider as SqlInstanceTreeDataProvider } from './sqlInstanceTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceService.ts b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceService.ts index 99af435b08..00ab0f59b8 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceService.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceService.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; interface SqlInstanceGraphData extends GraphData { diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceTreeDataProvider.ts index 841591350d..39fe0724a5 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstance/sqlInstanceTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class SqlInstanceTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.sqlInstanceContainer'; diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcProvider.ts b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcProvider.ts index 0ad6cfc86a..6cb6caad55 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcProvider.ts @@ -5,7 +5,7 @@ import { ExtensionContext } from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IAzureResourceService } from '../../interfaces'; import { SqlInstanceArcTreeDataProvider as SqlInstanceArcTreeDataProvider } from './sqlInstanceArcTreeDataProvider'; diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcService.ts b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcService.ts index e7c2b4182a..d502559460 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcService.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcService.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; export interface SqlInstanceArcGraphData extends GraphData { properties: { diff --git a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcTreeDataProvider.ts b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcTreeDataProvider.ts index 0de65d6347..44a8875576 100644 --- a/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcTreeDataProvider.ts +++ b/extensions/azurecore/src/azureResource/providers/sqlinstanceArc/sqlInstanceArcTreeDataProvider.ts @@ -12,8 +12,7 @@ import { AzureResourceItemType } from '../../constants'; import { generateGuid } from '../../utils'; import { IAzureResourceService } from '../../interfaces'; import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase'; -import { azureResource } from 'azureResource'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class SqlInstanceArcTreeDataProvider extends ResourceTreeDataProviderBase { private static readonly containerId = 'azure.resource.providers.sqlInstanceArcContainer'; diff --git a/extensions/azurecore/src/azureResource/resourceService.ts b/extensions/azurecore/src/azureResource/resourceService.ts index fdc0d07b49..1535b446d7 100644 --- a/extensions/azurecore/src/azureResource/resourceService.ts +++ b/extensions/azurecore/src/azureResource/resourceService.ts @@ -5,9 +5,8 @@ import { extensions, TreeItem } from 'vscode'; -import { azureResource } from 'azureResource'; import { IAzureResourceNodeWithProviderId } from './interfaces'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureResourceService { private _areResourceProvidersLoaded: boolean = false; diff --git a/extensions/azurecore/src/azureResource/services/subscriptionFilterService.ts b/extensions/azurecore/src/azureResource/services/subscriptionFilterService.ts index 06695f6219..aba69bddaf 100644 --- a/extensions/azurecore/src/azureResource/services/subscriptionFilterService.ts +++ b/extensions/azurecore/src/azureResource/services/subscriptionFilterService.ts @@ -3,8 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { AzureAccount } from 'azurecore'; -import { azureResource } from 'azureResource'; +import { AzureAccount, azureResource } from 'azurecore'; import { IAzureResourceSubscriptionFilterService, IAzureResourceCacheService } from '../interfaces'; interface AzureResourceSelectedSubscriptionsCache { diff --git a/extensions/azurecore/src/azureResource/services/subscriptionService.ts b/extensions/azurecore/src/azureResource/services/subscriptionService.ts index b08a4742c5..81281efd0f 100644 --- a/extensions/azurecore/src/azureResource/services/subscriptionService.ts +++ b/extensions/azurecore/src/azureResource/services/subscriptionService.ts @@ -6,15 +6,13 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; import { SubscriptionClient } from '@azure/arm-subscriptions'; - -import { azureResource } from 'azureResource'; +import { AzureAccount, azureResource } from 'azurecore'; import { IAzureResourceSubscriptionService } from '../interfaces'; import { TokenCredentials } from '@azure/ms-rest-js'; import { AzureSubscriptionError } from '../errors'; import { AzureResourceErrorMessageUtil } from '../utils'; import * as nls from 'vscode-nls'; -import { AzureAccount } from 'azurecore'; const localize = nls.loadMessageBundle(); export class AzureResourceSubscriptionService implements IAzureResourceSubscriptionService { diff --git a/extensions/azurecore/src/azureResource/tree/accountTreeNode.ts b/extensions/azurecore/src/azureResource/tree/accountTreeNode.ts index a6b6a54514..da49cc5ce2 100644 --- a/extensions/azurecore/src/azureResource/tree/accountTreeNode.ts +++ b/extensions/azurecore/src/azureResource/tree/accountTreeNode.ts @@ -10,7 +10,6 @@ import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); import { AppContext } from '../../appContext'; -import { azureResource } from 'azureResource'; import { TreeNode } from '../treeNode'; import { AzureSubscriptionError } from '../errors'; import { AzureResourceContainerTreeNodeBase } from './baseTreeNodes'; @@ -20,7 +19,7 @@ import { AzureResourceMessageTreeNode } from '../messageTreeNode'; import { AzureResourceErrorMessageUtil } from '../utils'; import { IAzureResourceTreeChangeHandler } from './treeChangeHandler'; import { IAzureResourceSubscriptionService, IAzureResourceSubscriptionFilterService } from '../../azureResource/interfaces'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureResourceAccountTreeNode extends AzureResourceContainerTreeNodeBase { public constructor( diff --git a/extensions/azurecore/src/azureResource/tree/flatAccountTreeNode.ts b/extensions/azurecore/src/azureResource/tree/flatAccountTreeNode.ts index f603648fa8..f0dc700269 100644 --- a/extensions/azurecore/src/azureResource/tree/flatAccountTreeNode.ts +++ b/extensions/azurecore/src/azureResource/tree/flatAccountTreeNode.ts @@ -10,14 +10,13 @@ import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); import { AppContext } from '../../appContext'; -import { azureResource } from 'azureResource'; import { TreeNode } from '../treeNode'; import { AzureSubscriptionError } from '../errors'; import { AzureResourceContainerTreeNodeBase } from './baseTreeNodes'; import { AzureResourceItemType, AzureResourceServiceNames } from '../constants'; import { IAzureResourceTreeChangeHandler } from './treeChangeHandler'; import { IAzureResourceSubscriptionService, IAzureResourceSubscriptionFilterService } from '../../azureResource/interfaces'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; import { AzureResourceService } from '../resourceService'; import { AzureResourceResourceTreeNode } from '../resourceTreeNode'; import { AzureResourceErrorMessageUtil } from '../utils'; diff --git a/extensions/azurecore/src/azureResource/tree/subscriptionTreeNode.ts b/extensions/azurecore/src/azureResource/tree/subscriptionTreeNode.ts index 170f081355..6d36ec12ed 100644 --- a/extensions/azurecore/src/azureResource/tree/subscriptionTreeNode.ts +++ b/extensions/azurecore/src/azureResource/tree/subscriptionTreeNode.ts @@ -9,7 +9,6 @@ import { AppContext } from '../../appContext'; import * as nls from 'vscode-nls'; const localize = nls.loadMessageBundle(); -import { azureResource } from 'azureResource'; import { TreeNode } from '../treeNode'; import { IAzureResourceNodeWithProviderId } from '../interfaces'; import { AzureResourceContainerTreeNodeBase } from './baseTreeNodes'; @@ -19,7 +18,7 @@ import { AzureResourceMessageTreeNode } from '../messageTreeNode'; import { AzureResourceErrorMessageUtil } from '../utils'; import { AzureResourceService } from '../resourceService'; import { AzureResourceResourceTreeNode } from '../resourceTreeNode'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; export class AzureResourceSubscriptionTreeNode extends AzureResourceContainerTreeNodeBase { public constructor( diff --git a/extensions/azurecore/src/azureResource/utils.ts b/extensions/azurecore/src/azureResource/utils.ts index f911c2bfd2..7021bfde0b 100644 --- a/extensions/azurecore/src/azureResource/utils.ts +++ b/extensions/azurecore/src/azureResource/utils.ts @@ -7,8 +7,7 @@ import { ResourceGraphClient } from '@azure/arm-resourcegraph'; import { TokenCredentials } from '@azure/ms-rest-js'; import axios, { AxiosRequestConfig } from 'axios'; import * as azdata from 'azdata'; -import { AzureRestResponse, GetResourceGroupsResult, GetSubscriptionsResult, ResourceQueryResult, GetBlobContainersResult, GetFileSharesResult, HttpRequestMethod, GetLocationsResult, GetManagedDatabasesResult, CreateResourceGroupResult, GetBlobsResult, GetStorageAccountAccessKeyResult, AzureAccount } from 'azurecore'; -import { azureResource } from 'azureResource'; +import { AzureRestResponse, GetResourceGroupsResult, GetSubscriptionsResult, ResourceQueryResult, GetBlobContainersResult, GetFileSharesResult, HttpRequestMethod, GetLocationsResult, GetManagedDatabasesResult, CreateResourceGroupResult, GetBlobsResult, GetStorageAccountAccessKeyResult, AzureAccount, azureResource } from 'azurecore'; import { EOL } from 'os'; import * as nls from 'vscode-nls'; import { AppContext } from '../appContext'; diff --git a/extensions/azurecore/src/azurecore.d.ts b/extensions/azurecore/src/azurecore.d.ts index 0cd1c32ae6..e3b90916ca 100644 --- a/extensions/azurecore/src/azurecore.d.ts +++ b/extensions/azurecore/src/azurecore.d.ts @@ -5,7 +5,8 @@ declare module 'azurecore' { import * as azdata from 'azdata'; - import { azureResource } from 'azureResource'; + import { TreeDataProvider } from 'vscode'; + import { BlobItem } from '@azure/storage-blob'; /** * Covers defining what the azurecore extension exports to other extensions @@ -320,4 +321,151 @@ declare module 'azurecore' { export type AzureRestResponse = { response: any, errors: Error[] }; export type GetBlobsResult = { blobs: azureResource.Blob[], errors: Error[] }; export type GetStorageAccountAccessKeyResult = { keyName1: string, keyName2: string, errors: Error[] }; + + export namespace azureResource { + + /** + * AzureCore core extension supports following resource types of Azure Resource Graph. + * To add more resources, please refer this guide: https://docs.microsoft.com/en-us/azure/governance/resource-graph/reference/supported-tables-resources + */ + export const enum AzureResourceType { + resourceGroup = 'microsoft.resources/subscriptions/resourcegroups', + sqlServer = 'microsoft.sql/servers', + sqlDatabase = 'microsoft.sql/servers/databases', + sqlManagedInstance = 'microsoft.sql/managedinstances', + azureArcSqlManagedInstance = 'microsoft.azuredata/sqlmanagedinstances', + virtualMachines = 'microsoft.compute/virtualmachines', + kustoClusters = 'microsoft.kusto/clusters', + azureArcPostgresServer = 'microsoft.azuredata/postgresinstances', + postgresServer = 'microsoft.dbforpostgresql/servers', + azureArcService = 'microsoft.azuredata/datacontrollers', + storageAccount = 'microsoft.storage/storageaccounts', + logAnalytics = 'microsoft.operationalinsights/workspaces' + } + + export interface IAzureResourceProvider extends azdata.DataProvider { + getTreeDataProvider(): IAzureResourceTreeDataProvider; + } + + export interface IAzureResourceTreeDataProvider extends TreeDataProvider { + browseConnectionMode: boolean; + } + + export interface IAzureResourceNode { + readonly account: AzureAccount; + readonly subscription: AzureResourceSubscription; + readonly tenantId: string; + readonly treeItem: azdata.TreeItem; + } + + export interface IAzureSubscriptionInfo { + id: string; + name: string; + } + + export interface AzureResource { + name: string; + id: string; + subscription: IAzureSubscriptionInfo; + resourceGroup?: string; + tenant?: string; + } + + export interface AzureResourceSubscription extends Omit { + } + + export interface AzureSqlResource extends AzureResource { + loginName: string; + } + + export interface AzureGraphResource extends Omit { + tenantId: string; + subscriptionId: string; + type: string; + location: string; + } + + export interface AzureResourceResourceGroup extends AzureResource { + location?: string; + managedBy?: string; + properties?: { + provisioningState?: string + }; + type?: string; + } + + export interface AzureLocation { + id: string, + name: string, + displayName: string, + regionalDisplayName: string, + metadata: { + regionType: string, + regionCategory: string, + geographyGroup: string, + longitude: number, + latitude: number, + physicalLocation: string, + pairedRegion: { + name: string, + id: string, + }[], + }, + } + + export interface AzureSqlManagedInstance extends AzureGraphResource { + sku: { + capacity: number; + family: string; + name: string; + tier: 'GeneralPurpose' | 'BusinessCritical'; + }, + properties: { + provisioningState: string, + storageAccountType: string, + maintenanceConfigurationId: string, + state: string, + licenseType: string, + zoneRedundant: false, + fullyQualifiedDomainName: string, + collation: string, + administratorLogin: string, + minimalTlsVersion: string, + subnetId: string, + publicDataEndpointEnabled: boolean, + storageSizeInGB: number, + timezoneId: string, + proxyOverride: string, + vCores: number, + dnsZone: string, + } + + } + + export interface ManagedDatabase { + id: string, + location: string, + name: string, + properties: { + sourceDatabaseId: string, + status: string + }, + type: string + } + + export interface AzureResourceDatabase extends AzureSqlResource { + serverName: string; + serverFullName: string; + } + + export interface AzureResourceDatabaseServer extends AzureSqlResource { + fullName: string; + defaultDatabaseName: string; + } + export interface BlobContainer extends AzureResource { } + + export interface FileShare extends AzureResource { } + + export interface Blob extends BlobItem { } + } } diff --git a/extensions/azurecore/src/extension.ts b/extensions/azurecore/src/extension.ts index 2b4e77e822..483bac4a1c 100644 --- a/extensions/azurecore/src/extension.ts +++ b/extensions/azurecore/src/extension.ts @@ -37,7 +37,6 @@ import { SqlInstanceArcProvider } from './azureResource/providers/sqlinstanceArc import { SqlInstanceArcResourceService } from './azureResource/providers/sqlinstanceArc/sqlInstanceArcService'; import { PostgresServerArcProvider } from './azureResource/providers/postgresArcServer/postgresServerProvider'; import { PostgresServerArcService } from './azureResource/providers/postgresArcServer/postgresServerService'; -import { azureResource } from 'azureResource'; import * as azurecore from 'azurecore'; import * as azureResourceUtils from './azureResource/utils'; import * as utils from './utils'; @@ -120,15 +119,15 @@ export async function activate(context: vscode.ExtensionContext): Promise { return azureResourceUtils.getResourceGroups(appContext, account, subscription, ignoreErrors); }, + getResourceGroups(account?: azurecore.AzureAccount, subscription?: azurecore.azureResource.AzureResourceSubscription, ignoreErrors?: boolean): Promise { return azureResourceUtils.getResourceGroups(appContext, account, subscription, ignoreErrors); }, getLocations(account?: azurecore.AzureAccount, - subscription?: azureResource.AzureResourceSubscription, + subscription?: azurecore.azureResource.AzureResourceSubscription, ignoreErrors?: boolean): Promise { return azureResourceUtils.getLocations(appContext, account, subscription, ignoreErrors); }, - provideResources(): azureResource.IAzureResourceProvider[] { + provideResources(): azurecore.azureResource.IAzureResourceProvider[] { const arcFeaturedEnabled = vscode.workspace.getConfiguration(constants.extensionConfigSectionName).get('enableArcFeatures'); - const providers: azureResource.IAzureResourceProvider[] = [ + const providers: azurecore.azureResource.IAzureResourceProvider[] = [ new KustoProvider(new KustoResourceService(), extensionContext), new AzureMonitorProvider(new AzureMonitorResourceService(), extensionContext), new AzureResourceDatabaseServerProvider(new AzureResourceDatabaseServerService(), extensionContext), @@ -145,65 +144,65 @@ export async function activate(context: vscode.ExtensionContext): Promise { - return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azureResource.AzureResourceType.sqlManagedInstance}"`); + return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azurecore.azureResource.AzureResourceType.sqlManagedInstance}"`); }, getManagedDatabases(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, - managedInstance: azureResource.AzureSqlManagedInstance, + subscription: azurecore.azureResource.AzureResourceSubscription, + managedInstance: azurecore.azureResource.AzureSqlManagedInstance, ignoreErrors: boolean): Promise { return azureResourceUtils.getManagedDatabases(account, subscription, managedInstance, ignoreErrors); }, getSqlServers(account: azurecore.AzureAccount, - subscriptions: azureResource.AzureResourceSubscription[], + subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors: boolean): Promise { - return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azureResource.AzureResourceType.sqlServer}"`); + return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azurecore.azureResource.AzureResourceType.sqlServer}"`); }, getSqlVMServers(account: azurecore.AzureAccount, - subscriptions: azureResource.AzureResourceSubscription[], + subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors: boolean): Promise { - return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azureResource.AzureResourceType.virtualMachines}" and properties.storageProfile.imageReference.publisher == "microsoftsqlserver"`); + return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azurecore.azureResource.AzureResourceType.virtualMachines}" and properties.storageProfile.imageReference.publisher == "microsoftsqlserver"`); }, getStorageAccounts(account: azurecore.AzureAccount, - subscriptions: azureResource.AzureResourceSubscription[], + subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors: boolean): Promise { - return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azureResource.AzureResourceType.storageAccount}"`); + return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, `where type == "${azurecore.azureResource.AzureResourceType.storageAccount}"`); }, getBlobContainers(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, - storageAccount: azureResource.AzureGraphResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors: boolean): Promise { return azureResourceUtils.getBlobContainers(account, subscription, storageAccount, ignoreErrors); }, getFileShares(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, - storageAccount: azureResource.AzureGraphResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors: boolean): Promise { return azureResourceUtils.getFileShares(account, subscription, storageAccount, ignoreErrors); }, getStorageAccountAccessKey(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, - storageAccount: azureResource.AzureGraphResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors: boolean): Promise { return azureResourceUtils.getStorageAccountAccessKey(account, subscription, storageAccount, ignoreErrors); }, getBlobs(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, - storageAccount: azureResource.AzureGraphResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + storageAccount: azurecore.azureResource.AzureGraphResource, containerName: string, ignoreErrors: boolean): Promise { return azureResourceUtils.getBlobs(account, subscription, storageAccount, containerName, ignoreErrors); }, createResourceGroup(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, + subscription: azurecore.azureResource.AzureResourceSubscription, resourceGroupName: string, location: string, ignoreErrors: boolean): Promise { return azureResourceUtils.createResourceGroup(account, subscription, resourceGroupName, location, ignoreErrors); }, makeAzureRestRequest(account: azurecore.AzureAccount, - subscription: azureResource.AzureResourceSubscription, + subscription: azurecore.azureResource.AzureResourceSubscription, path: string, requestType: azurecore.HttpRequestMethod, requestBody: any, @@ -213,8 +212,8 @@ export async function activate(context: vscode.ExtensionContext): Promise(account: azurecore.AzureAccount, - subscriptions: azureResource.AzureResourceSubscription[], + runGraphQuery(account: azurecore.AzureAccount, + subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors: boolean, query: string): Promise> { return azureResourceUtils.runResourceQuery(account, subscriptions, ignoreErrors, query); diff --git a/extensions/azurecore/src/test/azureResource/providers/database/databaseTreeDataProvider.test.ts b/extensions/azurecore/src/test/azureResource/providers/database/databaseTreeDataProvider.test.ts index eab241e573..653b38f0e8 100644 --- a/extensions/azurecore/src/test/azureResource/providers/database/databaseTreeDataProvider.test.ts +++ b/extensions/azurecore/src/test/azureResource/providers/database/databaseTreeDataProvider.test.ts @@ -10,11 +10,10 @@ import * as vscode from 'vscode'; import * as sinon from 'sinon'; import 'mocha'; -import { azureResource } from 'azureResource'; import { AzureResourceDatabaseTreeDataProvider } from '../../../../azureResource/providers/database/databaseTreeDataProvider'; import { AzureResourceItemType } from '../../../../azureResource/constants'; import { IAzureResourceService } from '../../../../azureResource/interfaces'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; import settings from '../../../../account-provider/providerSettings'; // Mock services diff --git a/extensions/azurecore/src/test/azureResource/providers/databaseServer/databaseServerTreeDataProvider.test.ts b/extensions/azurecore/src/test/azureResource/providers/databaseServer/databaseServerTreeDataProvider.test.ts index 7e957b50aa..298c401381 100644 --- a/extensions/azurecore/src/test/azureResource/providers/databaseServer/databaseServerTreeDataProvider.test.ts +++ b/extensions/azurecore/src/test/azureResource/providers/databaseServer/databaseServerTreeDataProvider.test.ts @@ -10,7 +10,6 @@ import * as vscode from 'vscode'; import * as sinon from 'sinon'; import 'mocha'; -import { azureResource } from 'azureResource'; import { AzureResourceDatabaseServerTreeDataProvider } from '../../../../azureResource/providers/databaseServer/databaseServerTreeDataProvider'; import { AzureResourceItemType } from '../../../../azureResource/constants'; import { IAzureResourceService } from '../../../../azureResource/interfaces'; @@ -19,7 +18,7 @@ import { IAzureResourceService } from '../../../../azureResource/interfaces'; let mockDatabaseServerService: TypeMoq.IMock>; let mockExtensionContext: TypeMoq.IMock; import settings from '../../../../account-provider/providerSettings'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; // Mock test data const mockAccount: AzureAccount = { diff --git a/extensions/azurecore/src/test/azureResource/resourceService.test.ts b/extensions/azurecore/src/test/azureResource/resourceService.test.ts index 71ca93850f..2ea35e144f 100644 --- a/extensions/azurecore/src/test/azureResource/resourceService.test.ts +++ b/extensions/azurecore/src/test/azureResource/resourceService.test.ts @@ -8,9 +8,8 @@ import * as TypeMoq from 'typemoq'; import 'mocha'; import { fail } from 'assert'; -import { azureResource } from 'azureResource'; import { AzureResourceService } from '../../azureResource/resourceService'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; import settings from '../../account-provider/providerSettings'; // Mock test data diff --git a/extensions/azurecore/src/test/azureResource/resourceTreeNode.test.ts b/extensions/azurecore/src/test/azureResource/resourceTreeNode.test.ts index 8244b476a8..ebd6bf2a75 100644 --- a/extensions/azurecore/src/test/azureResource/resourceTreeNode.test.ts +++ b/extensions/azurecore/src/test/azureResource/resourceTreeNode.test.ts @@ -8,13 +8,12 @@ import * as TypeMoq from 'typemoq'; import * as vscode from 'vscode'; import 'mocha'; -import { azureResource } from 'azureResource'; import { AzureResourceService } from '../../azureResource/resourceService'; import { AzureResourceResourceTreeNode } from '../../azureResource/resourceTreeNode'; import { AppContext } from '../../appContext'; import { AzureResourceServiceNames } from '../../azureResource/constants'; import settings from '../../account-provider/providerSettings'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; // Mock test data const mockAccount: AzureAccount = { diff --git a/extensions/azurecore/src/test/azureResource/tree/accountTreeNode.test.ts b/extensions/azurecore/src/test/azureResource/tree/accountTreeNode.test.ts index b1e0bf95bd..36b3983d2d 100644 --- a/extensions/azurecore/src/test/azureResource/tree/accountTreeNode.test.ts +++ b/extensions/azurecore/src/test/azureResource/tree/accountTreeNode.test.ts @@ -11,7 +11,6 @@ import * as sinon from 'sinon'; import 'mocha'; import { AppContext } from '../../../appContext'; -import { azureResource } from 'azureResource'; import { IAzureResourceCacheService, IAzureResourceSubscriptionService, @@ -23,7 +22,7 @@ import { AzureResourceSubscriptionTreeNode } from '../../../azureResource/tree/s import { AzureResourceItemType, AzureResourceServiceNames } from '../../../azureResource/constants'; import { AzureResourceMessageTreeNode } from '../../../azureResource/messageTreeNode'; import { generateGuid } from '../../../azureResource/utils'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; // Mock services let mockExtensionContext: TypeMoq.IMock; diff --git a/extensions/azurecore/src/test/azureResource/tree/subscriptionTreeNode.test.ts b/extensions/azurecore/src/test/azureResource/tree/subscriptionTreeNode.test.ts index 935db93233..fefcc0ba6e 100644 --- a/extensions/azurecore/src/test/azureResource/tree/subscriptionTreeNode.test.ts +++ b/extensions/azurecore/src/test/azureResource/tree/subscriptionTreeNode.test.ts @@ -9,7 +9,6 @@ import * as vscode from 'vscode'; import 'mocha'; import { AppContext } from '../../../appContext'; -import { azureResource } from 'azureResource'; import { IAzureResourceTreeChangeHandler } from '../../../azureResource/tree/treeChangeHandler'; import { AzureResourceSubscriptionTreeNode } from '../../../azureResource/tree/subscriptionTreeNode'; import { AzureResourceItemType, AzureResourceServiceNames } from '../../../azureResource/constants'; @@ -17,7 +16,7 @@ import { AzureResourceService } from '../../../azureResource/resourceService'; import { AzureResourceResourceTreeNode } from '../../../azureResource/resourceTreeNode'; import { IAzureResourceCacheService } from '../../../azureResource/interfaces'; import { generateGuid } from '../../../azureResource/utils'; -import { AzureAccount } from 'azurecore'; +import { AzureAccount, azureResource } from 'azurecore'; // Mock services let appContext: AppContext; diff --git a/extensions/azurecore/src/utils.ts b/extensions/azurecore/src/utils.ts index b28cb9a4f7..1f0041beb1 100644 --- a/extensions/azurecore/src/utils.ts +++ b/extensions/azurecore/src/utils.ts @@ -3,9 +3,8 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { azureResource } from 'azureResource'; import * as loc from './localizedConstants'; -import { AzureRegion } from 'azurecore'; +import { AzureRegion, azureResource } from 'azurecore'; import { AppContext } from './appContext'; /** diff --git a/extensions/machine-learning/src/modelManagement/azureModelRegistryService.ts b/extensions/machine-learning/src/modelManagement/azureModelRegistryService.ts index fe6dff9322..0201dc8022 100644 --- a/extensions/machine-learning/src/modelManagement/azureModelRegistryService.ts +++ b/extensions/machine-learning/src/modelManagement/azureModelRegistryService.ts @@ -8,7 +8,6 @@ import * as vscode from 'vscode'; import * as azurecore from 'azurecore'; import { ApiWrapper } from '../common/apiWrapper'; import * as constants from '../common/constants'; -import { azureResource } from 'azureResource'; import { AzureMachineLearningWorkspaces } from '@azure/arm-machinelearningservices'; import { TokenCredentials } from '@azure/ms-rest-js'; import { WorkspaceModels } from './workspacesModels'; @@ -52,7 +51,7 @@ export class AzureModelRegistryService { * Returns list of azure subscriptions * @param account azure account */ - public async getSubscriptions(account: azdata.Account | undefined): Promise { + public async getSubscriptions(account: azdata.Account | undefined): Promise { const data: azurecore.GetSubscriptionsResult = await (await this._apiWrapper.getAzurecoreApi()).getSubscriptions(account, true); return data?.subscriptions; } @@ -64,7 +63,7 @@ export class AzureModelRegistryService { */ public async getGroups( account: azdata.Account | undefined, - subscription: azureResource.AzureResourceSubscription | undefined): Promise { + subscription: azurecore.azureResource.AzureResourceSubscription | undefined): Promise { const data: azurecore.GetResourceGroupsResult = await (await this._apiWrapper.getAzurecoreApi()).getResourceGroups(account, subscription, true); return data?.resourceGroups; } @@ -77,8 +76,8 @@ export class AzureModelRegistryService { */ public async getWorkspaces( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource | undefined): Promise { + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource | undefined): Promise { return await this.fetchWorkspaces(account, subscription, resourceGroup); } @@ -91,8 +90,8 @@ export class AzureModelRegistryService { */ public async getModels( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource, workspace: Workspace): Promise { return await this.fetchModels(account, subscription, resourceGroup, workspace); } @@ -107,8 +106,8 @@ export class AzureModelRegistryService { */ public async downloadModel( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource, workspace: Workspace, model: WorkspaceModel): Promise { let downloadedFilePath: string = ''; @@ -153,7 +152,7 @@ export class AzureModelRegistryService { return tempFilePath; } - private async fetchWorkspaces(account: azdata.Account, subscription: azureResource.AzureResourceSubscription, resourceGroup: azureResource.AzureResource | undefined): Promise { + private async fetchWorkspaces(account: azdata.Account, subscription: azurecore.azureResource.AzureResourceSubscription, resourceGroup: azurecore.azureResource.AzureResource | undefined): Promise { let resources: Workspace[] = []; try { @@ -172,8 +171,8 @@ export class AzureModelRegistryService { private async fetchModels( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource, workspace: Workspace): Promise { let resources: WorkspaceModel[] = []; @@ -195,8 +194,8 @@ export class AzureModelRegistryService { } private async fetchModelAsset( - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource, workspace: Workspace, model: WorkspaceModel, client: AzureMachineLearningWorkspaces): Promise { @@ -212,8 +211,8 @@ export class AzureModelRegistryService { private async getAssetArtifactsDownloadLinks( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, - resourceGroup: azureResource.AzureResource, + subscription: azurecore.azureResource.AzureResourceSubscription, + resourceGroup: azurecore.azureResource.AzureResource, workspace: Workspace, model: WorkspaceModel, tenant: any): Promise { @@ -297,7 +296,7 @@ export class AzureModelRegistryService { private async getAmlClient( account: azdata.Account, - subscription: azureResource.AzureResourceSubscription, + subscription: azurecore.azureResource.AzureResourceSubscription, tenant: any, options: AzureMachineLearningWorkspacesOptions | undefined = undefined, apiVersion: string | undefined = undefined): Promise { diff --git a/extensions/machine-learning/src/test/modelManagement/azureModelRegistryService.test.ts b/extensions/machine-learning/src/test/modelManagement/azureModelRegistryService.test.ts index 03374d03d0..a5ad43986b 100644 --- a/extensions/machine-learning/src/test/modelManagement/azureModelRegistryService.test.ts +++ b/extensions/machine-learning/src/test/modelManagement/azureModelRegistryService.test.ts @@ -11,7 +11,7 @@ import * as should from 'should'; import { AzureModelRegistryService } from '../../modelManagement/azureModelRegistryService'; import { Config } from '../../configurations/config'; import { HttpClient } from '../../common/httpClient'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import * as utils from '../utils'; import { Workspace, WorkspacesListByResourceGroupResponse } from '@azure/arm-machinelearningservices/esm/models'; diff --git a/extensions/machine-learning/src/test/stubs.ts b/extensions/machine-learning/src/test/stubs.ts index 55fb5dcee1..763d565d0f 100644 --- a/extensions/machine-learning/src/test/stubs.ts +++ b/extensions/machine-learning/src/test/stubs.ts @@ -5,58 +5,57 @@ import * as azdata from 'azdata'; import * as azurecore from 'azurecore'; -import { azureResource } from 'azureResource'; export class AzurecoreApiStub implements azurecore.IExtension { - getStorageAccountAccessKey(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _storageAccount: azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { + getStorageAccountAccessKey(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _storageAccount: azurecore.azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getBlobs(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _storageAccount: azureResource.AzureGraphResource, _containerName: string, _ignoreErrors?: boolean): Promise { + getBlobs(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _storageAccount: azurecore.azureResource.AzureGraphResource, _containerName: string, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - createResourceGroup(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _resourceGroupName: string, _location: string, _ignoreErrors?: boolean): Promise { + createResourceGroup(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _resourceGroupName: string, _location: string, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getManagedDatabases(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _managedInstance: azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { + getManagedDatabases(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _managedInstance: azurecore.azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getLocations(_account?: azdata.Account, _subscription?: azureResource.AzureResourceSubscription, _ignoreErrors?: boolean): Promise { + getLocations(_account?: azdata.Account, _subscription?: azurecore.azureResource.AzureResourceSubscription, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - makeAzureRestRequest(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _serviceUrl: string, _requestType: azurecore.HttpRequestMethod, _requestBody?: any, _ignoreErrors?: boolean): Promise { + makeAzureRestRequest(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _serviceUrl: string, _requestType: azurecore.HttpRequestMethod, _requestBody?: any, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getFileShares(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _storageAccount: azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { + getFileShares(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _storageAccount: azurecore.azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getBlobContainers(_account: azdata.Account, _subscription: azureResource.AzureResourceSubscription, _storageAccount: azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { + getBlobContainers(_account: azdata.Account, _subscription: azurecore.azureResource.AzureResourceSubscription, _storageAccount: azurecore.azureResource.AzureGraphResource, _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getSqlManagedInstances(_account: azdata.Account, _subscriptions: azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { + getSqlManagedInstances(_account: azdata.Account, _subscriptions: azurecore.azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getSqlServers(_account: azdata.Account, _subscriptions: azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { + getSqlServers(_account: azdata.Account, _subscriptions: azurecore.azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getSqlVMServers(_account: azdata.Account, _subscriptions: azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { + getSqlVMServers(_account: azdata.Account, _subscriptions: azurecore.azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - getStorageAccounts(_account: azdata.Account, _subscriptions: azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { + getStorageAccounts(_account: azdata.Account, _subscriptions: azurecore.azureResource.AzureResourceSubscription[], _ignoreErrors?: boolean): Promise { throw new Error('Method not implemented.'); } - runGraphQuery(_account: azdata.Account, _subscriptions: azureResource.AzureResourceSubscription[], _ignoreErrors: boolean, _query: string): Promise> { + runGraphQuery(_account: azdata.Account, _subscriptions: azurecore.azureResource.AzureResourceSubscription[], _ignoreErrors: boolean, _query: string): Promise> { throw new Error('Method not implemented.'); } getSubscriptions(_account?: azdata.Account | undefined, _ignoreErrors?: boolean | undefined, _selectedOnly?: boolean | undefined): Promise { throw new Error('Method not implemented.'); } - getResourceGroups(_account?: azdata.Account | undefined, _subscription?: azureResource.AzureResourceSubscription | undefined, _ignoreErrors?: boolean | undefined): Promise { + getResourceGroups(_account?: azdata.Account | undefined, _subscription?: azurecore.azureResource.AzureResourceSubscription | undefined, _ignoreErrors?: boolean | undefined): Promise { throw new Error('Method not implemented.'); } getRegionDisplayName(_region?: string | undefined): string { throw new Error('Method not implemented.'); } - provideResources(): azureResource.IAzureResourceProvider[] { + provideResources(): azurecore.azureResource.IAzureResourceProvider[] { throw new Error('Method not implemented.'); } diff --git a/extensions/machine-learning/src/test/views/models/ModelManagementController.test.ts b/extensions/machine-learning/src/test/views/models/ModelManagementController.test.ts index 47bc61f6ba..752c913579 100644 --- a/extensions/machine-learning/src/test/views/models/ModelManagementController.test.ts +++ b/extensions/machine-learning/src/test/views/models/ModelManagementController.test.ts @@ -9,7 +9,7 @@ import * as TypeMoq from 'typemoq'; import 'mocha'; import { createContext } from './utils'; import { ImportedModel, ModelParameters, WorkspaceModel } from '../../../modelManagement/interfaces'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import { ModelManagementController } from '../../../views/models/modelManagementController'; import { DatabaseTable, TableColumn } from '../../../prediction/interfaces'; diff --git a/extensions/machine-learning/src/test/views/models/azureModelsComponent.test.ts b/extensions/machine-learning/src/test/views/models/azureModelsComponent.test.ts index 1829aa038a..ab8a7e1137 100644 --- a/extensions/machine-learning/src/test/views/models/azureModelsComponent.test.ts +++ b/extensions/machine-learning/src/test/views/models/azureModelsComponent.test.ts @@ -9,7 +9,7 @@ import 'mocha'; import { createContext, ParentDialog } from './utils'; import { AzureModelsComponent } from '../../../views/models/azureModelsComponent'; import { ListAccountsEventName, ListSubscriptionsEventName, ListGroupsEventName, ListWorkspacesEventName, ListAzureModelsEventName } from '../../../views/models/modelViewBase'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import { ViewBase } from '../../../views/viewBase'; import { WorkspaceModel } from '../../../modelManagement/interfaces'; diff --git a/extensions/machine-learning/src/test/views/models/predictWizard.test.ts b/extensions/machine-learning/src/test/views/models/predictWizard.test.ts index d5f0ca7f7c..10e43704c5 100644 --- a/extensions/machine-learning/src/test/views/models/predictWizard.test.ts +++ b/extensions/machine-learning/src/test/views/models/predictWizard.test.ts @@ -13,7 +13,7 @@ import { } from '../../../views/models/modelViewBase'; import { ImportedModel, ModelParameters, WorkspaceModel } from '../../../modelManagement/interfaces'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import { ViewBase } from '../../../views/viewBase'; import { PredictWizard } from '../../../views/models/prediction/predictWizard'; diff --git a/extensions/machine-learning/src/test/views/models/registerModelWizard.test.ts b/extensions/machine-learning/src/test/views/models/registerModelWizard.test.ts index ac58d0328f..2bf78f53f4 100644 --- a/extensions/machine-learning/src/test/views/models/registerModelWizard.test.ts +++ b/extensions/machine-learning/src/test/views/models/registerModelWizard.test.ts @@ -9,7 +9,7 @@ import 'mocha'; import { createContext } from './utils'; import { ListModelsEventName, ListAccountsEventName, ListSubscriptionsEventName, ListGroupsEventName, ListWorkspacesEventName, ListAzureModelsEventName, ModelSourceType, ListDatabaseNamesEventName, ListTableNamesEventName, VerifyImportTableEventName } from '../../../views/models/modelViewBase'; import { ImportedModel, WorkspaceModel } from '../../../modelManagement/interfaces'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import { ViewBase } from '../../../views/viewBase'; import { ImportModelWizard } from '../../../views/models/manageModels/importModelWizard'; diff --git a/extensions/machine-learning/src/typings/ref.d.ts b/extensions/machine-learning/src/typings/ref.d.ts index 2b35c0bf9f..82467fb3d1 100644 --- a/extensions/machine-learning/src/typings/ref.d.ts +++ b/extensions/machine-learning/src/typings/ref.d.ts @@ -7,6 +7,5 @@ /// /// /// -/// /// /// diff --git a/extensions/machine-learning/src/views/interfaces.ts b/extensions/machine-learning/src/views/interfaces.ts index a1fb8f8261..a25c0a387d 100644 --- a/extensions/machine-learning/src/views/interfaces.ts +++ b/extensions/machine-learning/src/views/interfaces.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as azdata from 'azdata'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import { WorkspaceModel } from '../modelManagement/interfaces'; diff --git a/extensions/machine-learning/src/views/models/azureResourceFilterComponent.ts b/extensions/machine-learning/src/views/models/azureResourceFilterComponent.ts index 2250fb2d75..9396bb77fb 100644 --- a/extensions/machine-learning/src/views/models/azureResourceFilterComponent.ts +++ b/extensions/machine-learning/src/views/models/azureResourceFilterComponent.ts @@ -7,7 +7,7 @@ import * as vscode from 'vscode'; import * as azdata from 'azdata'; import { ModelViewBase } from './modelViewBase'; import { ApiWrapper } from '../../common/apiWrapper'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; import * as constants from '../../common/constants'; import { AzureWorkspaceResource, IDataComponent } from '../interfaces'; diff --git a/extensions/machine-learning/src/views/models/modelManagementController.ts b/extensions/machine-learning/src/views/models/modelManagementController.ts index a2fed4c440..66dd91006a 100644 --- a/extensions/machine-learning/src/views/models/modelManagementController.ts +++ b/extensions/machine-learning/src/views/models/modelManagementController.ts @@ -5,7 +5,7 @@ import * as azdata from 'azdata'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ApiWrapper } from '../../common/apiWrapper'; import { AzureModelRegistryService } from '../../modelManagement/azureModelRegistryService'; import { Workspace } from '@azure/arm-machinelearningservices/esm/models'; diff --git a/extensions/machine-learning/src/views/models/modelViewBase.ts b/extensions/machine-learning/src/views/models/modelViewBase.ts index ed29bbfb47..dc0f2f6f21 100644 --- a/extensions/machine-learning/src/views/models/modelViewBase.ts +++ b/extensions/machine-learning/src/views/models/modelViewBase.ts @@ -5,7 +5,7 @@ import * as azdata from 'azdata'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { ApiWrapper } from '../../common/apiWrapper'; import { ViewBase } from '../viewBase'; import { ImportedModel, WorkspaceModel, ImportedModelDetails, ModelParameters } from '../../modelManagement/interfaces'; diff --git a/extensions/resource-deployment/src/typings/ref.d.ts b/extensions/resource-deployment/src/typings/ref.d.ts index 2def73fd1e..26ae98ab65 100644 --- a/extensions/resource-deployment/src/typings/ref.d.ts +++ b/extensions/resource-deployment/src/typings/ref.d.ts @@ -9,5 +9,4 @@ /// /// /// -/// /// diff --git a/extensions/resource-deployment/src/ui/deployAzureSQLDBWizard/pages/azureSettingsPage.ts b/extensions/resource-deployment/src/ui/deployAzureSQLDBWizard/pages/azureSettingsPage.ts index 86ddd66945..74597d7c47 100644 --- a/extensions/resource-deployment/src/ui/deployAzureSQLDBWizard/pages/azureSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/deployAzureSQLDBWizard/pages/azureSettingsPage.ts @@ -7,7 +7,7 @@ import * as azdata from 'azdata'; import { EOL } from 'os'; import * as constants from '../constants'; import { apiService } from '../../../services/apiService'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import * as vscode from 'vscode'; import { BasePage } from './basePage'; import * as nls from 'vscode-nls'; diff --git a/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/pages/azureSettingsPage.ts b/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/pages/azureSettingsPage.ts index f24b8d2bf4..cd03f94f0e 100644 --- a/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/pages/azureSettingsPage.ts +++ b/extensions/resource-deployment/src/ui/deployAzureSQLVMWizard/pages/azureSettingsPage.ts @@ -6,7 +6,7 @@ import * as azdata from 'azdata'; import * as constants from '../constants'; import { apiService } from '../../../services/apiService'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import * as vscode from 'vscode'; import * as localizedConstants from '../../../localizedConstants'; import { BasePage } from './basePage'; diff --git a/extensions/resource-deployment/src/ui/modelViewUtils.ts b/extensions/resource-deployment/src/ui/modelViewUtils.ts index b4d8ebe50b..c56ef28d9b 100644 --- a/extensions/resource-deployment/src/ui/modelViewUtils.ts +++ b/extensions/resource-deployment/src/ui/modelViewUtils.ts @@ -3,7 +3,7 @@ * Licensed under the Source EULA. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ import * as azdata from 'azdata'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import * as fs from 'fs'; import { EOL } from 'os'; import * as path from 'path'; diff --git a/extensions/sql-migration/src/api/azure.ts b/extensions/sql-migration/src/api/azure.ts index c92d6d0595..cccbbf260c 100644 --- a/extensions/sql-migration/src/api/azure.ts +++ b/extensions/sql-migration/src/api/azure.ts @@ -6,7 +6,6 @@ import * as vscode from 'vscode'; import * as azdata from 'azdata'; import * as azurecore from 'azurecore'; -import { azureResource } from 'azureResource'; import * as constants from '../constants/strings'; import { getSessionIdHeader } from './utils'; import { ProvisioningState } from '../models/migrationLocalStorage'; @@ -19,7 +18,7 @@ async function getAzureCoreAPI(): Promise { return api; } -export type Subscription = azureResource.AzureResourceSubscription; +export type Subscription = azurecore.azureResource.AzureResourceSubscription; export async function getSubscriptions(account: azdata.Account): Promise { const api = await getAzureCoreAPI(); const subscriptions = await api.getSubscriptions(account, false); @@ -28,7 +27,7 @@ export async function getSubscriptions(account: azdata.Account): Promise { +export async function getLocations(account: azdata.Account, subscription: Subscription): Promise { const api = await getAzureCoreAPI(); const response = await api.getLocations(account, subscription, true); const dataMigrationResourceProvider = (await api.makeAzureRestRequest(account, subscription, `/subscriptions/${subscription.id}/providers/Microsoft.DataMigration?api-version=2021-04-01`, azurecore.HttpRequestMethod.GET)).response.data; @@ -47,22 +46,22 @@ export async function getLocations(account: azdata.Account, subscription: Subscr return filteredLocations; } -export type AzureProduct = azureResource.AzureGraphResource; +export type AzureProduct = azurecore.azureResource.AzureGraphResource; -export async function getResourceGroups(account: azdata.Account, subscription: Subscription): Promise { +export async function getResourceGroups(account: azdata.Account, subscription: Subscription): Promise { const api = await getAzureCoreAPI(); const result = await api.getResourceGroups(account, subscription, true); sortResourceArrayByName(result.resourceGroups); return result.resourceGroups; } -export async function createResourceGroup(account: azdata.Account, subscription: Subscription, resourceGroupName: string, location: string): Promise { +export async function createResourceGroup(account: azdata.Account, subscription: Subscription, resourceGroupName: string, location: string): Promise { const api = await getAzureCoreAPI(); const result = await api.createResourceGroup(account, subscription, resourceGroupName, location, false); return result.resourceGroup; } -export type SqlManagedInstance = azureResource.AzureSqlManagedInstance; +export type SqlManagedInstance = azurecore.azureResource.AzureSqlManagedInstance; export async function getAvailableManagedInstanceProducts(account: azdata.Account, subscription: Subscription): Promise { const api = await getAzureCoreAPI(); const result = await api.getSqlManagedInstances(account, [subscription], false); @@ -70,7 +69,7 @@ export async function getAvailableManagedInstanceProducts(account: azdata.Accoun return result.resources; } -export async function getSqlManagedInstanceDatabases(account: azdata.Account, subscription: Subscription, managedInstance: SqlManagedInstance): Promise { +export async function getSqlManagedInstanceDatabases(account: azdata.Account, subscription: Subscription, managedInstance: SqlManagedInstance): Promise { const api = await getAzureCoreAPI(); const result = await api.getManagedDatabases(account, subscription, managedInstance, false); sortResourceArrayByName(result.databases); @@ -118,7 +117,7 @@ export async function getAvailableStorageAccounts(account: azdata.Account, subsc return result.resources; } -export async function getFileShares(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise { +export async function getFileShares(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise { const api = await getAzureCoreAPI(); let result = await api.getFileShares(account, subscription, storageAccount, true); let fileShares = result.fileShares; @@ -126,7 +125,7 @@ export async function getFileShares(account: azdata.Account, subscription: Subsc return fileShares!; } -export async function getBlobContainers(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise { +export async function getBlobContainers(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise { const api = await getAzureCoreAPI(); let result = await api.getBlobContainers(account, subscription, storageAccount, true); let blobContainers = result.blobContainers; @@ -134,7 +133,7 @@ export async function getBlobContainers(account: azdata.Account, subscription: S return blobContainers!; } -export async function getBlobs(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount, containerName: string): Promise { +export async function getBlobs(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount, containerName: string): Promise { const api = await getAzureCoreAPI(); let result = await api.getBlobs(account, subscription, storageAccount, containerName, true); let blobNames = result.blobs; @@ -361,7 +360,7 @@ export async function getLocationDisplayName(location: string): Promise return await api.getRegionDisplayName(location); } -type SortableAzureResources = AzureProduct | azureResource.FileShare | azureResource.BlobContainer | azureResource.Blob | azureResource.AzureResourceSubscription | SqlMigrationService; +type SortableAzureResources = AzureProduct | azurecore.azureResource.FileShare | azurecore.azureResource.BlobContainer | azurecore.azureResource.Blob | azurecore.azureResource.AzureResourceSubscription | SqlMigrationService; export function sortResourceArrayByName(resourceArray: SortableAzureResources[]): void { if (!resourceArray) { return; diff --git a/extensions/sql-migration/src/dialog/createResourceGroup/createResourceGroupDialog.ts b/extensions/sql-migration/src/dialog/createResourceGroup/createResourceGroupDialog.ts index fe62e3b6fc..6d419d180e 100644 --- a/extensions/sql-migration/src/dialog/createResourceGroup/createResourceGroupDialog.ts +++ b/extensions/sql-migration/src/dialog/createResourceGroup/createResourceGroupDialog.ts @@ -5,7 +5,7 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { EventEmitter } from 'events'; import { createResourceGroup } from '../../api/azure'; import * as constants from '../../constants/strings'; diff --git a/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts b/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts index 1674dbbd2b..b9b235504e 100644 --- a/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts +++ b/extensions/sql-migration/src/dialog/createSqlMigrationService/createSqlMigrationServiceDialog.ts @@ -10,7 +10,7 @@ import { MigrationStateModel, NetworkContainerType } from '../../models/stateMac import { logError, TelemetryViews } from '../../telemtery'; import * as constants from '../../constants/strings'; import * as os from 'os'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { IconPathHelper } from '../../constants/iconPathHelper'; import { CreateResourceGroupDialog } from '../createResourceGroup/createResourceGroupDialog'; import { createAuthenticationKeyTable } from '../../wizard/integrationRuntimePage'; diff --git a/extensions/sql-migration/src/dialog/retryMigration/retryMigrationDialog.ts b/extensions/sql-migration/src/dialog/retryMigration/retryMigrationDialog.ts index be0fad765d..0103d791ef 100644 --- a/extensions/sql-migration/src/dialog/retryMigration/retryMigrationDialog.ts +++ b/extensions/sql-migration/src/dialog/retryMigration/retryMigrationDialog.ts @@ -6,7 +6,7 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; import * as mssql from 'mssql'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; import { getLocations, getResourceGroupFromId, getBlobContainerId, getFullResourceGroupFromId, getResourceName, DatabaseMigration, getMigrationTargetInstance } from '../../api/azure'; import { MigrationMode, MigrationStateModel, NetworkContainerType, SavedInfo } from '../../models/stateMachine'; import { MigrationServiceContext } from '../../models/migrationLocalStorage'; diff --git a/extensions/sql-migration/src/dialog/selectMigrationService/selectMigrationServiceDialog.ts b/extensions/sql-migration/src/dialog/selectMigrationService/selectMigrationServiceDialog.ts index f7a20d3e33..955d6e6532 100644 --- a/extensions/sql-migration/src/dialog/selectMigrationService/selectMigrationServiceDialog.ts +++ b/extensions/sql-migration/src/dialog/selectMigrationService/selectMigrationServiceDialog.ts @@ -7,7 +7,6 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; import * as azurecore from 'azurecore'; import { MigrationLocalStorage, MigrationServiceContext } from '../../models/migrationLocalStorage'; -import { azureResource } from 'azureResource'; import * as styles from '../../constants/styles'; import * as constants from '../../constants/strings'; import { findDropDownItemIndex, selectDefaultDropdownValue, deepClone } from '../../api/utils'; @@ -42,9 +41,9 @@ export class SelectMigrationServiceDialog { private _serviceContext!: MigrationServiceContext; private _azureAccounts!: azdata.Account[]; private _accountTenants!: azurecore.Tenant[]; - private _subscriptions!: azureResource.AzureResourceSubscription[]; - private _locations!: azureResource.AzureLocation[]; - private _resourceGroups!: azureResource.AzureResourceResourceGroup[]; + private _subscriptions!: azurecore.azureResource.AzureResourceSubscription[]; + private _locations!: azurecore.azureResource.AzureLocation[]; + private _resourceGroups!: azurecore.azureResource.AzureResourceResourceGroup[]; private _sqlMigrationServices!: SqlMigrationService[]; private _azureAccountsDropdown!: azdata.DropDownComponent; private _accountTenantDropdown!: azdata.DropDownComponent; @@ -521,8 +520,8 @@ export class SelectMigrationServiceDialog { private async _getAzureLocationDropdownValues( account?: azdata.Account, - subscription?: azureResource.AzureResourceSubscription): Promise { - let locations: azureResource.AzureLocation[] = []; + subscription?: azurecore.azureResource.AzureResourceSubscription): Promise { + let locations: azurecore.azureResource.AzureLocation[] = []; if (account && subscription) { // get all available locations locations = await getLocations(account, subscription); @@ -546,7 +545,7 @@ export class SelectMigrationServiceDialog { }); } - private async _getAzureResourceGroupDropdownValues(location?: azureResource.AzureLocation): Promise { + private async _getAzureResourceGroupDropdownValues(location?: azurecore.azureResource.AzureLocation): Promise { this._resourceGroups = location ? this._getMigrationServicesResourceGroups(location) : []; @@ -559,7 +558,7 @@ export class SelectMigrationServiceDialog { }); } - private _getMigrationServicesResourceGroups(location?: azureResource.AzureLocation): azureResource.AzureResourceResourceGroup[] { + private _getMigrationServicesResourceGroups(location?: azurecore.azureResource.AzureLocation): azurecore.azureResource.AzureResourceResourceGroup[] { const resourceGroups = this._sqlMigrationServices .filter(service => service.location === location?.name) .map(service => service.properties.resourceGroup); @@ -567,7 +566,7 @@ export class SelectMigrationServiceDialog { return resourceGroups .filter((rg, i, arr) => arr.indexOf(rg) === i) .map(rg => { - return { + return { id: getFullResourceGroupFromId(rg), name: rg, }; @@ -576,9 +575,9 @@ export class SelectMigrationServiceDialog { private async _getMigrationServiceDropdownValues( account?: azdata.Account, - subscription?: azureResource.AzureResourceSubscription, - location?: azureResource.AzureLocation, - resourceGroup?: azureResource.AzureResourceResourceGroup): Promise { + subscription?: azurecore.azureResource.AzureResourceSubscription, + location?: azurecore.azureResource.AzureLocation, + resourceGroup?: azurecore.azureResource.AzureResourceResourceGroup): Promise { const locationName = location?.name?.toLowerCase(); const resourceGroupName = resourceGroup?.name?.toLowerCase(); diff --git a/extensions/sql-migration/src/models/migrationLocalStorage.ts b/extensions/sql-migration/src/models/migrationLocalStorage.ts index 90003501a8..f05c938002 100644 --- a/extensions/sql-migration/src/models/migrationLocalStorage.ts +++ b/extensions/sql-migration/src/models/migrationLocalStorage.ts @@ -5,7 +5,6 @@ import * as azdata from 'azdata'; import * as vscode from 'vscode'; import * as azurecore from 'azurecore'; -import { azureResource } from 'azureResource'; import { DatabaseMigration, SqlMigrationService, getSubscriptions, getServiceMigrations } from '../api/azure'; import { deepClone } from '../api/utils'; import * as loc from '../constants/strings'; @@ -83,9 +82,9 @@ export async function getCurrentMigrations(): Promise { export interface MigrationServiceContext { azureAccount?: azdata.Account, tenant?: azurecore.Tenant, - subscription?: azureResource.AzureResourceSubscription, - location?: azureResource.AzureLocation, - resourceGroup?: azureResource.AzureResourceResourceGroup, + subscription?: azurecore.azureResource.AzureResourceSubscription, + location?: azurecore.azureResource.AzureLocation, + resourceGroup?: azurecore.azureResource.AzureResourceResourceGroup, migrationService?: SqlMigrationService, } diff --git a/extensions/sql-migration/src/models/stateMachine.ts b/extensions/sql-migration/src/models/stateMachine.ts index 985cc71e66..738da022a0 100644 --- a/extensions/sql-migration/src/models/stateMachine.ts +++ b/extensions/sql-migration/src/models/stateMachine.ts @@ -4,7 +4,6 @@ *--------------------------------------------------------------------------------------------*/ import * as azdata from 'azdata'; -import { azureResource } from 'azureResource'; import * as azurecore from 'azurecore'; import * as vscode from 'vscode'; import * as mssql from 'mssql'; @@ -88,7 +87,7 @@ export interface DatabaseBackupModel { migrationMode: MigrationMode; networkContainerType: NetworkContainerType; networkShares: NetworkShare[]; - subscription: azureResource.AzureResourceSubscription; + subscription: azurecore.azureResource.AzureResourceSubscription; blobs: Blob[]; } @@ -96,15 +95,15 @@ export interface NetworkShare { networkShareLocation: string; windowsUser: string; password: string; - resourceGroup: azureResource.AzureResourceResourceGroup; + resourceGroup: azurecore.azureResource.AzureResourceResourceGroup; storageAccount: StorageAccount; storageKey: string; } export interface Blob { - resourceGroup: azureResource.AzureResourceResourceGroup; + resourceGroup: azurecore.azureResource.AzureResourceResourceGroup; storageAccount: StorageAccount; - blobContainer: azureResource.BlobContainer; + blobContainer: azurecore.azureResource.BlobContainer; storageKey: string; lastBackupFile?: string; // _todo: does it make sense to store the last backup file here? } @@ -129,10 +128,10 @@ export interface SavedInfo { migrationTargetType: MigrationTargetType | null; azureAccount: azdata.Account | null; azureTenant: azurecore.Tenant | null; - subscription: azureResource.AzureResourceSubscription | null; - location: azureResource.AzureLocation | null; - resourceGroup: azureResource.AzureResourceResourceGroup | null; - targetServerInstance: azureResource.AzureSqlManagedInstance | SqlVMServer | null; + subscription: azurecore.azureResource.AzureResourceSubscription | null; + location: azurecore.azureResource.AzureLocation | null; + resourceGroup: azurecore.azureResource.AzureResourceResourceGroup | null; + targetServerInstance: azurecore.azureResource.AzureSqlManagedInstance | SqlVMServer | null; migrationMode: MigrationMode | null; networkContainerType: NetworkContainerType | null; networkShares: NetworkShare[]; @@ -164,20 +163,20 @@ export class MigrationStateModel implements Model, vscode.Disposable { public _sqlServerUsername!: string; public _sqlServerPassword!: string; - public _subscriptions!: azureResource.AzureResourceSubscription[]; - public _targetSubscription!: azureResource.AzureResourceSubscription; - public _locations!: azureResource.AzureLocation[]; - public _location!: azureResource.AzureLocation; - public _resourceGroups!: azureResource.AzureResourceResourceGroup[]; - public _resourceGroup!: azureResource.AzureResourceResourceGroup; + public _subscriptions!: azurecore.azureResource.AzureResourceSubscription[]; + public _targetSubscription!: azurecore.azureResource.AzureResourceSubscription; + public _locations!: azurecore.azureResource.AzureLocation[]; + public _location!: azurecore.azureResource.AzureLocation; + public _resourceGroups!: azurecore.azureResource.AzureResourceResourceGroup[]; + public _resourceGroup!: azurecore.azureResource.AzureResourceResourceGroup; public _targetManagedInstances!: SqlManagedInstance[]; public _targetSqlVirtualMachines!: SqlVMServer[]; public _targetServerInstance!: SqlManagedInstance | SqlVMServer; public _databaseBackup!: DatabaseBackupModel; public _storageAccounts!: StorageAccount[]; - public _fileShares!: azureResource.FileShare[]; - public _blobContainers!: azureResource.BlobContainer[]; - public _lastFileNames!: azureResource.Blob[]; + public _fileShares!: azurecore.azureResource.FileShare[]; + public _blobContainers!: azurecore.azureResource.BlobContainer[]; + public _lastFileNames!: azurecore.azureResource.Blob[]; public _sourceDatabaseNames!: string[]; public _targetDatabaseNames!: string[]; @@ -912,11 +911,11 @@ export class MigrationStateModel implements Model, vscode.Disposable { return subscriptionsValues; } - public getSubscription(index: number): azureResource.AzureResourceSubscription { + public getSubscription(index: number): azurecore.azureResource.AzureResourceSubscription { return this._subscriptions[index]; } - public async getAzureLocationDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureLocationDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let locationValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { @@ -953,7 +952,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { return locationValues; } - public getLocation(index: number): azureResource.AzureLocation { + public getLocation(index: number): azurecore.azureResource.AzureLocation { return this._locations[index]; } @@ -961,7 +960,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { return getLocationDisplayName(location); } - public async getAzureResourceGroupDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureResourceGroupDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let resourceGroupValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { @@ -995,13 +994,13 @@ export class MigrationStateModel implements Model, vscode.Disposable { return resourceGroupValues; } - public async getAzureResourceGroupForManagedInstancesDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureResourceGroupForManagedInstancesDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let resourceGroupValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { let managedInstances = await getAvailableManagedInstanceProducts(this._azureAccount, subscription); this._resourceGroups = managedInstances.map((mi) => { - return { + return { id: getFullResourceGroupFromId(mi.id), name: getResourceGroupFromId(mi.id), subscription: { @@ -1045,13 +1044,13 @@ export class MigrationStateModel implements Model, vscode.Disposable { return resourceGroupValues; } - public async getAzureResourceGroupForVirtualMachinesDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureResourceGroupForVirtualMachinesDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let resourceGroupValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { let virtualMachines = await getAvailableSqlVMs(this._azureAccount, subscription); this._resourceGroups = virtualMachines.map((vm) => { - return { + return { id: getFullResourceGroupFromId(vm.id), name: getResourceGroupFromId(vm.id), subscription: { @@ -1095,13 +1094,13 @@ export class MigrationStateModel implements Model, vscode.Disposable { return resourceGroupValues; } - public async getAzureResourceGroupForStorageAccountsDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureResourceGroupForStorageAccountsDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let resourceGroupValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { let storageAccounts = await getAvailableStorageAccounts(this._azureAccount, subscription); this._resourceGroups = storageAccounts.map((sa) => { - return { + return { id: getFullResourceGroupFromId(sa.id), name: getResourceGroupFromId(sa.id), subscription: { @@ -1145,13 +1144,13 @@ export class MigrationStateModel implements Model, vscode.Disposable { return resourceGroupValues; } - public async getAzureResourceGroupForSqlMigrationServicesDropdownValues(subscription: azureResource.AzureResourceSubscription): Promise { + public async getAzureResourceGroupForSqlMigrationServicesDropdownValues(subscription: azurecore.azureResource.AzureResourceSubscription): Promise { let resourceGroupValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription) { let dmsInstances = await getSqlMigrationServices(this._azureAccount, subscription); this._resourceGroups = dmsInstances.map((dms) => { - return { + return { id: getFullResourceGroupFromId(dms.id), name: getResourceGroupFromId(dms.id), subscription: { @@ -1194,11 +1193,11 @@ export class MigrationStateModel implements Model, vscode.Disposable { return resourceGroupValues; } - public getAzureResourceGroup(index: number): azureResource.AzureResourceResourceGroup { + public getAzureResourceGroup(index: number): azurecore.azureResource.AzureResourceResourceGroup { return this._resourceGroups[index]; } - public async getManagedInstanceValues(subscription: azureResource.AzureResourceSubscription, location: azureResource.AzureLocation, resourceGroup: azureResource.AzureResourceResourceGroup): Promise { + public async getManagedInstanceValues(subscription: azurecore.azureResource.AzureResourceSubscription, location: azurecore.azureResource.AzureLocation, resourceGroup: azurecore.azureResource.AzureResourceResourceGroup): Promise { let managedInstanceValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && location && resourceGroup) { @@ -1260,7 +1259,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { this._targetServerInstance)).map(t => t.name); } - public async getSqlVirtualMachineValues(subscription: azureResource.AzureResourceSubscription, location: azureResource.AzureLocation, resourceGroup: azureResource.AzureResourceResourceGroup): Promise { + public async getSqlVirtualMachineValues(subscription: azurecore.azureResource.AzureResourceSubscription, location: azurecore.azureResource.AzureLocation, resourceGroup: azurecore.azureResource.AzureResourceResourceGroup): Promise { let virtualMachineValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && location && resourceGroup) { @@ -1308,7 +1307,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { return this._targetSqlVirtualMachines[index]; } - public async getStorageAccountValues(subscription: azureResource.AzureResourceSubscription, resourceGroup: azureResource.AzureResourceResourceGroup): Promise { + public async getStorageAccountValues(subscription: azurecore.azureResource.AzureResourceSubscription, resourceGroup: azurecore.azureResource.AzureResourceResourceGroup): Promise { let storageAccountValues: azdata.CategoryValue[] = []; if (!resourceGroup) { return storageAccountValues; @@ -1354,7 +1353,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { return this._storageAccounts[index]; } - public async getFileShareValues(subscription: azureResource.AzureResourceSubscription, storageAccount: StorageAccount): Promise { + public async getFileShareValues(subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: StorageAccount): Promise { let fileShareValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && storageAccount) { @@ -1390,11 +1389,11 @@ export class MigrationStateModel implements Model, vscode.Disposable { return fileShareValues; } - public getFileShare(index: number): azureResource.FileShare { + public getFileShare(index: number): azurecore.azureResource.FileShare { return this._fileShares[index]; } - public async getBlobContainerValues(subscription: azureResource.AzureResourceSubscription, storageAccount: StorageAccount): Promise { + public async getBlobContainerValues(subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: StorageAccount): Promise { let blobContainerValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && storageAccount) { @@ -1430,11 +1429,11 @@ export class MigrationStateModel implements Model, vscode.Disposable { return blobContainerValues; } - public getBlobContainer(index: number): azureResource.BlobContainer { + public getBlobContainer(index: number): azurecore.azureResource.BlobContainer { return this._blobContainers[index]; } - public async getBlobLastBackupFileNameValues(subscription: azureResource.AzureResourceSubscription, storageAccount: StorageAccount, blobContainer: azureResource.BlobContainer): Promise { + public async getBlobLastBackupFileNameValues(subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: StorageAccount, blobContainer: azurecore.azureResource.BlobContainer): Promise { let blobLastBackupFileValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && storageAccount && blobContainer) { @@ -1474,7 +1473,7 @@ export class MigrationStateModel implements Model, vscode.Disposable { return this._lastFileNames[index]?.name; } - public async getSqlMigrationServiceValues(subscription: azureResource.AzureResourceSubscription, resourceGroupName: string): Promise { + public async getSqlMigrationServiceValues(subscription: azurecore.azureResource.AzureResourceSubscription, resourceGroupName: string): Promise { let sqlMigrationServiceValues: azdata.CategoryValue[] = []; try { if (this._azureAccount && subscription && resourceGroupName && this._targetServerInstance) { diff --git a/extensions/sql-migration/src/typings/ref.d.ts b/extensions/sql-migration/src/typings/ref.d.ts index 2b35c0bf9f..82467fb3d1 100644 --- a/extensions/sql-migration/src/typings/ref.d.ts +++ b/extensions/sql-migration/src/typings/ref.d.ts @@ -7,6 +7,5 @@ /// /// /// -/// /// /// diff --git a/extensions/sql-migration/src/wizard/targetSelectionPage.ts b/extensions/sql-migration/src/wizard/targetSelectionPage.ts index f5a73a59a9..49fefd006c 100644 --- a/extensions/sql-migration/src/wizard/targetSelectionPage.ts +++ b/extensions/sql-migration/src/wizard/targetSelectionPage.ts @@ -12,7 +12,7 @@ import * as constants from '../constants/strings'; import * as styles from '../constants/styles'; import { WIZARD_INPUT_COMPONENT_WIDTH } from './wizardController'; import { deepClone, findDropDownItemIndex, selectDropDownIndex, selectDefaultDropdownValue } from '../api/utils'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; export class TargetSelectionPage extends MigrationWizardPage { private _view!: azdata.ModelView; diff --git a/extensions/sql-migration/src/wizard/wizardController.ts b/extensions/sql-migration/src/wizard/wizardController.ts index a251a18f5a..eff34c0a58 100644 --- a/extensions/sql-migration/src/wizard/wizardController.ts +++ b/extensions/sql-migration/src/wizard/wizardController.ts @@ -18,7 +18,7 @@ import { DatabaseSelectorPage } from './databaseSelectorPage'; import { sendSqlMigrationActionEvent, TelemetryAction, TelemetryViews, logError } from '../telemtery'; import * as styles from '../constants/styles'; import { MigrationLocalStorage, MigrationServiceContext } from '../models/migrationLocalStorage'; -import { azureResource } from 'azureResource'; +import { azureResource } from 'azurecore'; export const WIZARD_INPUT_COMPONENT_WIDTH = '600px'; export class WizardController {