mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add subscription ID to all graph query items (#12133)
* Add subscription ID to all graph query items * fix machine-learning
This commit is contained in:
@@ -24,6 +24,7 @@ declare module 'azureResource' {
|
||||
export interface AzureResource {
|
||||
name: string;
|
||||
id: string;
|
||||
subscriptionId: string;
|
||||
tenant?: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ export class AzureResourceDatabaseService implements IAzureResourceService<azure
|
||||
serverName: server.name,
|
||||
serverFullName: server.properties.fullyQualifiedDomainName,
|
||||
loginName: server.properties.administratorLogin,
|
||||
subscriptionId: db.subscriptionId,
|
||||
tenant: db.tenantId
|
||||
});
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ export class AzureResourceDatabaseServerService extends ResourceServiceBase<DbSe
|
||||
fullName: resource.properties.fullyQualifiedDomainName,
|
||||
loginName: resource.properties.administratorLogin,
|
||||
defaultDatabaseName: 'master',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,9 @@ export class KustoResourceService extends ResourceServiceBase<KustoGraphData, az
|
||||
name: resource.name,
|
||||
fullName: resource.properties.uri.replace('https://', ''),
|
||||
loginName: '',
|
||||
defaultDatabaseName: ''
|
||||
defaultDatabaseName: '',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export class PostgresServerArcService extends ResourceServiceBase<PostgresArcSer
|
||||
fullName: resource.name,
|
||||
loginName: resource.properties.admin,
|
||||
defaultDatabaseName: 'postgres',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ export class PostgresServerService extends ResourceServiceBase<DbServerGraphData
|
||||
fullName: resource.properties.fullyQualifiedDomainName,
|
||||
loginName: resource.properties.administratorLogin,
|
||||
defaultDatabaseName: 'postgres',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -16,7 +16,9 @@ export class AzureResourceGroupService extends ResourceServiceBase<DbServerGraph
|
||||
protected convertResource(resource: DbServerGraphData): azureResource.AzureResourceResourceGroup {
|
||||
return {
|
||||
id: resource.id,
|
||||
name: resource.name
|
||||
name: resource.name,
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ export abstract class ResourceTreeDataProviderBase<T extends azureResource.Azure
|
||||
}
|
||||
|
||||
export interface GraphData {
|
||||
subscriptionId: string,
|
||||
tenantId: string;
|
||||
id: string;
|
||||
name: string;
|
||||
|
||||
@@ -28,6 +28,7 @@ export class SqlInstanceResourceService extends ResourceServiceBase<SqlInstanceG
|
||||
fullName: resource.properties.fullyQualifiedDomainName,
|
||||
loginName: resource.properties.administratorLogin,
|
||||
defaultDatabaseName: 'master',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ export class SqlInstanceArcResourceService extends ResourceServiceBase<SqlInstan
|
||||
fullName: resource.name,
|
||||
loginName: resource.properties.admin,
|
||||
defaultDatabaseName: 'master',
|
||||
subscriptionId: resource.subscriptionId,
|
||||
tenant: resource.tenantId
|
||||
};
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ export class AzureResourceSubscriptionService implements IAzureResourceSubscript
|
||||
subs.forEach((sub) => subscriptions.push({
|
||||
id: sub.subscriptionId,
|
||||
name: sub.displayName,
|
||||
subscriptionId: sub.subscriptionId,
|
||||
tenant: tenantId
|
||||
}));
|
||||
|
||||
|
||||
@@ -42,11 +42,12 @@ const mockAccount: AzureAccount = {
|
||||
};
|
||||
|
||||
const mockTenantId: string = 'mock_tenant';
|
||||
|
||||
const mockSubscriptionId = 'mock_subscription';
|
||||
|
||||
const mockSubscription: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription',
|
||||
id: mockSubscriptionId,
|
||||
name: 'mock subscription',
|
||||
subscriptionId: mockSubscriptionId,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
@@ -75,14 +76,16 @@ const mockDatabases: azureResource.AzureResourceDatabase[] = [
|
||||
id: 'mock-id-1',
|
||||
serverName: 'mock database server 1',
|
||||
serverFullName: 'mock database server full name 1',
|
||||
loginName: 'mock login'
|
||||
loginName: 'mock login',
|
||||
subscriptionId: 'mock_subscription'
|
||||
},
|
||||
{
|
||||
name: 'mock database 2',
|
||||
id: 'mock-id-2',
|
||||
serverName: 'mock database server 2',
|
||||
serverFullName: 'mock database server full name 2',
|
||||
loginName: 'mock login'
|
||||
loginName: 'mock login',
|
||||
subscriptionId: 'mock_subscription'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -42,10 +42,11 @@ const mockAccount: AzureAccount = {
|
||||
};
|
||||
|
||||
const mockTenantId: string = 'mock_tenant';
|
||||
|
||||
const mockSubscriptionId = 'mock_subscription';
|
||||
const mockSubscription: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription',
|
||||
id: mockSubscriptionId,
|
||||
name: 'mock subscription',
|
||||
subscriptionId: mockSubscriptionId,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
@@ -74,14 +75,16 @@ const mockDatabaseServers: azureResource.AzureResourceDatabaseServer[] = [
|
||||
id: 'mock-id-1',
|
||||
fullName: 'mock database server full name 1',
|
||||
loginName: 'mock login',
|
||||
defaultDatabaseName: 'master'
|
||||
defaultDatabaseName: 'master',
|
||||
subscriptionId: 'mock_subscription'
|
||||
},
|
||||
{
|
||||
name: 'mock database server 2',
|
||||
id: 'mock-id-2',
|
||||
fullName: 'mock database server full name 2',
|
||||
loginName: 'mock login',
|
||||
defaultDatabaseName: 'master'
|
||||
defaultDatabaseName: 'master',
|
||||
subscriptionId: 'mock_subscription'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -34,10 +34,12 @@ const mockAccount: AzureAccount = {
|
||||
};
|
||||
|
||||
const mockTenantId: string = 'mock_tenant';
|
||||
const mockSubscriptionId ='mock_subscription';
|
||||
|
||||
const mockSubscription: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription',
|
||||
id: mockSubscriptionId,
|
||||
name: 'mock subscription',
|
||||
subscriptionId: mockSubscriptionId,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
|
||||
@@ -37,10 +37,12 @@ const mockAccount: AzureAccount = {
|
||||
};
|
||||
|
||||
const mockTenantId: string = 'mock_tenant';
|
||||
const mockSubscriptionId = 'mock_subscription';
|
||||
|
||||
const mockSubscription: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription',
|
||||
id: mockSubscriptionId,
|
||||
name: 'mock subscription',
|
||||
subscriptionId: mockSubscriptionId,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
|
||||
@@ -59,15 +59,19 @@ const mockAccount: azdata.Account = {
|
||||
isStale: false
|
||||
};
|
||||
|
||||
const mock_subscription_id_1 = 'mock_subscription_1';
|
||||
const mockSubscription1: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription_1',
|
||||
id: mock_subscription_id_1,
|
||||
name: 'mock subscription 1',
|
||||
subscriptionId: mock_subscription_id_1,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
const mock_subscription_id_2 = 'mock_subscription_2';
|
||||
const mockSubscription2: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription_2',
|
||||
id: mock_subscription_id_2,
|
||||
name: 'mock subscription 2',
|
||||
subscriptionId: mock_subscription_id_2,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
|
||||
@@ -44,10 +44,12 @@ const mockAccount: azdata.Account = {
|
||||
};
|
||||
|
||||
const mockTenantId: string = 'mock_tenant';
|
||||
const mockSubscriptionId: string = 'mock_subscription';
|
||||
|
||||
const mockSubscription: azureResource.AzureResourceSubscription = {
|
||||
id: 'mock_subscription',
|
||||
id: mockSubscriptionId,
|
||||
name: 'mock subscription',
|
||||
subscriptionId: mockSubscriptionId,
|
||||
tenant: mockTenantId
|
||||
};
|
||||
|
||||
|
||||
@@ -5,9 +5,10 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azurecore from 'azurecore';
|
||||
import { ApiWrapper } from '../common/apiWrapper';
|
||||
import * as constants from '../common/constants';
|
||||
import { azureResource } from '../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { AzureMachineLearningWorkspaces } from '@azure/arm-machinelearningservices';
|
||||
import { TokenCredentials } from '@azure/ms-rest-js';
|
||||
import { WorkspaceModels } from './workspacesModels';
|
||||
@@ -52,7 +53,7 @@ export class AzureModelRegistryService {
|
||||
* @param account azure account
|
||||
*/
|
||||
public async getSubscriptions(account: azdata.Account | undefined): Promise<azureResource.AzureResourceSubscription[] | undefined> {
|
||||
const data: azureResource.GetSubscriptionsResult = await (await this._apiWrapper.getAzurecoreApi()).getSubscriptions(account, true);
|
||||
const data: azurecore.GetSubscriptionsResult = await (await this._apiWrapper.getAzurecoreApi()).getSubscriptions(account, true);
|
||||
return data?.subscriptions;
|
||||
}
|
||||
|
||||
@@ -64,7 +65,7 @@ export class AzureModelRegistryService {
|
||||
public async getGroups(
|
||||
account: azdata.Account | undefined,
|
||||
subscription: azureResource.AzureResourceSubscription | undefined): Promise<azureResource.AzureResource[] | undefined> {
|
||||
const data: azureResource.GetResourceGroupsResult = await (await this._apiWrapper.getAzurecoreApi()).getResourceGroups(account, subscription, true);
|
||||
const data: azurecore.GetResourceGroupsResult = await (await this._apiWrapper.getAzurecoreApi()).getResourceGroups(account, subscription, true);
|
||||
return data?.resourceGroups;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 '../../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
|
||||
import * as utils from '../utils';
|
||||
import { Workspace, WorkspacesListByResourceGroupResponse } from '@azure/arm-machinelearningservices/esm/models';
|
||||
@@ -81,13 +81,15 @@ function createContext(): TestContext {
|
||||
subscriptions: [
|
||||
{
|
||||
name: 's1',
|
||||
id: 's1'
|
||||
id: 's1',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
],
|
||||
groups: [
|
||||
{
|
||||
name: 'g1',
|
||||
id: 'g1'
|
||||
id: 'g1',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
],
|
||||
workspaces: [{
|
||||
|
||||
@@ -8,10 +8,9 @@ import * as should from 'should';
|
||||
import * as TypeMoq from 'typemoq';
|
||||
import 'mocha';
|
||||
import { createContext } from './utils';
|
||||
import { ImportedModel, ModelParameters } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from '../../../typings/azure-resource';
|
||||
import { ImportedModel, ModelParameters, WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import { WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { ModelManagementController } from '../../../views/models/modelManagementController';
|
||||
import { DatabaseTable, TableColumn } from '../../../prediction/interfaces';
|
||||
import { DeleteModelEventName, UpdateModelEventName } from '../../../views/models/modelViewBase';
|
||||
@@ -36,13 +35,15 @@ const accounts: azdata.Account[] = [
|
||||
const subscriptions: azureResource.AzureResourceSubscription[] = [
|
||||
{
|
||||
name: 'subscription',
|
||||
id: '2'
|
||||
id: '2',
|
||||
subscriptionId: 'subscription'
|
||||
}
|
||||
];
|
||||
const groups: azureResource.AzureResourceResourceGroup[] = [
|
||||
{
|
||||
name: 'group',
|
||||
id: '3'
|
||||
id: '3',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
];
|
||||
const workspaces: Workspace[] = [
|
||||
|
||||
@@ -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 '../../../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import { ViewBase } from '../../../views/viewBase';
|
||||
import { WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
@@ -50,13 +50,15 @@ describe('Azure Models Component', () => {
|
||||
let subscriptions: azureResource.AzureResourceSubscription[] = [
|
||||
{
|
||||
name: 'subscription',
|
||||
id: '2'
|
||||
id: '2',
|
||||
subscriptionId: 'subscription'
|
||||
}
|
||||
];
|
||||
let groups: azureResource.AzureResourceResourceGroup[] = [
|
||||
{
|
||||
name: 'group',
|
||||
id: '3'
|
||||
id: '3',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
];
|
||||
let workspaces: Workspace[] = [
|
||||
|
||||
@@ -12,11 +12,10 @@ import {
|
||||
ListAzureModelsEventName, ListDatabaseNamesEventName, ListTableNamesEventName, ListColumnNamesEventName, LoadModelParametersEventName, DownloadAzureModelEventName, DownloadRegisteredModelEventName, ModelSourceType, VerifyImportTableEventName
|
||||
}
|
||||
from '../../../views/models/modelViewBase';
|
||||
import { ImportedModel, ModelParameters } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from '../../../typings/azure-resource';
|
||||
import { ImportedModel, ModelParameters, WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import { ViewBase } from '../../../views/viewBase';
|
||||
import { WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { PredictWizard } from '../../../views/models/prediction/predictWizard';
|
||||
import { DatabaseTable, TableColumn } from '../../../prediction/interfaces';
|
||||
|
||||
@@ -59,13 +58,15 @@ describe('Predict Wizard', () => {
|
||||
let subscriptions: azureResource.AzureResourceSubscription[] = [
|
||||
{
|
||||
name: 'subscription',
|
||||
id: '2'
|
||||
id: '2',
|
||||
subscriptionId: 'subscription'
|
||||
}
|
||||
];
|
||||
let groups: azureResource.AzureResourceResourceGroup[] = [
|
||||
{
|
||||
name: 'group',
|
||||
id: '3'
|
||||
id: '3',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
];
|
||||
let workspaces: Workspace[] = [
|
||||
|
||||
@@ -8,11 +8,10 @@ import * as should from 'should';
|
||||
import 'mocha';
|
||||
import { createContext } from './utils';
|
||||
import { ListModelsEventName, ListAccountsEventName, ListSubscriptionsEventName, ListGroupsEventName, ListWorkspacesEventName, ListAzureModelsEventName, ModelSourceType, ListDatabaseNamesEventName, ListTableNamesEventName, VerifyImportTableEventName } from '../../../views/models/modelViewBase';
|
||||
import { ImportedModel } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from '../../../typings/azure-resource';
|
||||
import { ImportedModel, WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import { ViewBase } from '../../../views/viewBase';
|
||||
import { WorkspaceModel } from '../../../modelManagement/interfaces';
|
||||
import { ImportModelWizard } from '../../../views/models/manageModels/importModelWizard';
|
||||
import { DatabaseTable } from '../../../prediction/interfaces';
|
||||
|
||||
@@ -35,13 +34,15 @@ let accounts: azdata.Account[] = [
|
||||
let subscriptions: azureResource.AzureResourceSubscription[] = [
|
||||
{
|
||||
name: 'subscription',
|
||||
id: '2'
|
||||
id: '2',
|
||||
subscriptionId: 'subscription'
|
||||
}
|
||||
];
|
||||
let groups: azureResource.AzureResourceResourceGroup[] = [
|
||||
{
|
||||
name: 'group',
|
||||
id: '3'
|
||||
id: '3',
|
||||
subscriptionId: 's1'
|
||||
}
|
||||
];
|
||||
let workspaces: Workspace[] = [
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Account } from 'azdata';
|
||||
import * as msRest from '@azure/ms-rest-js';
|
||||
|
||||
export namespace azureResource {
|
||||
|
||||
export interface AzureResource {
|
||||
name: string;
|
||||
id: string;
|
||||
}
|
||||
|
||||
export interface AzureResourceSubscription extends AzureResource {
|
||||
}
|
||||
|
||||
export interface AzureResourceResourceGroup extends AzureResource {
|
||||
}
|
||||
|
||||
export interface IAzureResourceService<T extends AzureResource> {
|
||||
getResources(subscription: AzureResourceSubscription, credential: msRest.ServiceClientCredentials): Promise<T[]>;
|
||||
}
|
||||
|
||||
export type GetSubscriptionsResult = { subscriptions: AzureResourceSubscription[], errors: Error[] };
|
||||
export type GetResourceGroupsResult = { resourceGroups: AzureResourceResourceGroup[], errors: Error[] };
|
||||
}
|
||||
@@ -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 '../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import { WorkspaceModel } from '../modelManagement/interfaces';
|
||||
|
||||
|
||||
@@ -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 '../../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
import * as constants from '../../common/constants';
|
||||
import { AzureWorkspaceResource, IDataComponent } from '../interfaces';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { azureResource } from '../../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { ApiWrapper } from '../../common/apiWrapper';
|
||||
import { AzureModelRegistryService } from '../../modelManagement/azureModelRegistryService';
|
||||
import { Workspace } from '@azure/arm-machinelearningservices/esm/models';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { azureResource } from '../../typings/azure-resource';
|
||||
import { azureResource } from 'azureResource';
|
||||
import { ApiWrapper } from '../../common/apiWrapper';
|
||||
import { ViewBase } from '../viewBase';
|
||||
import { ImportedModel, WorkspaceModel, ImportedModelDetails, ModelParameters } from '../../modelManagement/interfaces';
|
||||
|
||||
Reference in New Issue
Block a user