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:
Charles Gagnon
2020-09-04 13:08:10 -07:00
committed by GitHub
parent 1d12823f09
commit c2320831f7
28 changed files with 80 additions and 71 deletions

View File

@@ -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;
}

View File

@@ -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: [{

View File

@@ -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[] = [

View File

@@ -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[] = [

View File

@@ -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[] = [

View File

@@ -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[] = [

View File

@@ -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[] };
}

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';

View File

@@ -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';