Kusto - AzureCore changes (#11751)

* AzureCore changes

* Removed connectazuredataexplorer command from command.ts, package.json, and package.nls.json (#11844)

Co-authored-by: Monica Gupta <mogupt@microsoft.com>
Co-authored-by: Justin M <63619224+JustinMDotNet@users.noreply.github.com>
This commit is contained in:
Shafiq Ur Rahman
2020-08-18 16:56:17 -07:00
committed by GitHub
parent 2bfba53e21
commit 62d60f62f3
9 changed files with 153 additions and 1 deletions

View File

@@ -261,6 +261,11 @@
"when": "viewItem == azure.resource.itemType.account",
"group": "inline"
},
{
"command": "azure.resource.connectsqlserver",
"when": "viewItem == azure.resource.itemType.azureDataExplorer",
"group": "inline"
},
{
"command": "azure.resource.startterminal",
"when": "viewItem == azure.resource.itemType.account",

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M14.9844 0C15.1198 0 15.237 0.0494792 15.3359 0.148438C15.4349 0.247396 15.4844 0.364583 15.4844 0.5V14.4453C15.4844 14.5807 15.4349 14.6979 15.3359 14.7969C15.237 14.8958 15.1198 14.9453 14.9844 14.9453C14.849 14.9453 14.7318 14.8958 14.6328 14.7969L0.6875 0.851562C0.588542 0.752604 0.539062 0.635417 0.539062 0.5C0.539062 0.364583 0.588542 0.247396 0.6875 0.148438C0.786458 0.0494792 0.903646 0 1.03906 0H14.9844ZM14.4844 5.42969V1H10.2578L6.25 5.00781L10.5781 9.32812L14.4844 5.42969ZM8.84375 1H2.25L5.54688 4.29688L8.84375 1ZM11.2891 10.0391L14.4844 13.2344V6.84375L11.2891 10.0391ZM6.125 8.64844L6.82812 9.35156L0.828125 15.3516L0.125 14.6484L6.125 8.64844ZM4.24219 14.7656L8.24219 10.7656L8.95312 11.4766L4.95312 15.4766L4.24219 14.7656ZM4.71094 7.23438L0.710938 11.2344L0 10.5234L4 6.52344L4.71094 7.23438ZM9.60938 3.17188L10.4922 2.28125L11.375 3.17188L10.4922 4.05469L9.60938 3.17188ZM13.2031 4.97656L12.3203 5.85938L11.4297 4.97656L12.3203 4.09375L13.2031 4.97656ZM7.65625 5.10938L8.53906 4.22656L9.42188 5.10938L8.53906 5.99219L7.65625 5.10938ZM9.48438 6.92188L10.3672 6.03906L11.25 6.92188L10.3672 7.80469L9.48438 6.92188Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M15.5 0C15.6354 0 15.7526 0.0494792 15.8516 0.148438C15.9505 0.247396 16 0.364583 16 0.5V14.4453C16 14.5807 15.9505 14.6979 15.8516 14.7969C15.7526 14.8958 15.6354 14.9453 15.5 14.9453C15.3646 14.9453 15.2474 14.8958 15.1484 14.7969L1.20312 0.851562C1.10417 0.752604 1.05469 0.635417 1.05469 0.5C1.05469 0.364583 1.10417 0.247396 1.20312 0.148438C1.30208 0.0494792 1.41927 0 1.55469 0H15.5ZM15 5.42969V1H10.7734L6.76562 5.00781L11.0938 9.32812L15 5.42969ZM9.35938 1H2.76562L6.0625 4.29688L9.35938 1ZM11.8047 10.0391L15 13.2344V6.84375L11.8047 10.0391ZM6.64062 8.64844L7.34375 9.35156L1.34375 15.3516L0.640625 14.6484L6.64062 8.64844ZM4.75781 14.7656L8.75781 10.7656L9.46875 11.4766L5.46875 15.4766L4.75781 14.7656ZM5.22656 7.23438L1.22656 11.2344L0.515625 10.5234L4.51562 6.52344L5.22656 7.23438ZM10.125 3.17188L11.0078 2.28125L11.8906 3.17188L11.0078 4.05469L10.125 3.17188ZM13.7188 4.97656L12.8359 5.85938L11.9453 4.97656L12.8359 4.09375L13.7188 4.97656ZM8.17188 5.10938L9.05469 4.22656L9.9375 5.10938L9.05469 5.99219L8.17188 5.10938ZM10 6.92188L10.8828 6.03906L11.7656 6.92188L10.8828 7.80469L10 6.92188Z" fill="#323130"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -167,7 +167,6 @@ export function registerAzureResourceCommands(appContext: AppContext, tree: Azur
});
vscode.commands.registerCommand('azure.resource.openInAzurePortal', async (connectionProfile: azdata.IConnectionProfile) => {
if (
!connectionProfile.azureResourceId ||
!connectionProfile.azurePortalEndpoint ||

View File

@@ -10,6 +10,8 @@ export enum AzureResourceItemType {
database = 'azure.resource.itemType.database',
databaseServerContainer = 'azure.resource.itemType.databaseServerContainer',
databaseServer = 'azure.resource.itemType.databaseServer',
azureDataExplorerContainer = 'azure.resource.itemType.azureDataExplorerContainer',
azureDataExplorer = 'azure.resource.itemType.azureDataExplorer',
sqlInstance = 'azure.resource.itemType.sqlInstance',
message = 'azure.resource.itemType.message'
}

View File

@@ -0,0 +1,26 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionContext } from 'vscode';
import { azureResource } from '../../azure-resource';
import { IAzureResourceService } from '../../interfaces';
import { KustoTreeDataProvider as KustoTreeDataProvider } from './kustoTreeDataProvider';
export class KustoProvider implements azureResource.IAzureResourceProvider {
public constructor(
private _service: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
private _extensionContext: ExtensionContext
) {
}
public getTreeDataProvider(): azureResource.IAzureResourceTreeDataProvider {
return new KustoTreeDataProvider(this._service, this._extensionContext);
}
public get providerId(): string {
return 'azure.resource.providers.azureDataExplorer';
}
}

View File

@@ -0,0 +1,34 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { azureResource } from '../../azure-resource';
import { ResourceServiceBase, GraphData } from '../resourceTreeDataProviderBase';
export interface KustoGraphData extends GraphData {
properties: {
fullyQualifiedDomainName: string;
administratorLogin: string;
uri: string;
};
}
const instanceQuery = 'where type == "microsoft.kusto/clusters"';
export class KustoResourceService extends ResourceServiceBase<KustoGraphData, azureResource.AzureResourceDatabaseServer> {
protected get query(): string {
return instanceQuery;
}
protected convertResource(resource: KustoGraphData): azureResource.AzureResourceDatabaseServer {
return {
id: resource.id,
name: resource.name,
fullName: resource.properties.uri.replace('https://', ''),
loginName: '',
defaultDatabaseName: ''
};
}
}

View File

@@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ExtensionNodeType, TreeItem, Account } from 'azdata';
import { TreeItemCollapsibleState, ExtensionContext } from 'vscode';
import * as nls from 'vscode-nls';
const localize = nls.loadMessageBundle();
import { AzureResourceItemType } from '../../constants';
import { generateGuid } from '../../utils';
import { IAzureResourceService } from '../../interfaces';
import { ResourceTreeDataProviderBase } from '../resourceTreeDataProviderBase';
import { azureResource } from '../../azure-resource';
export class KustoTreeDataProvider extends ResourceTreeDataProviderBase<azureResource.AzureResourceDatabaseServer> {
private static readonly containerId = 'azure.resource.providers.KustoContainer';
private static readonly containerLabel = localize('azure.resource.providers.KustoContainerLabel', "Azure Data Explorer Clusters");
public constructor(
databaseServerService: IAzureResourceService<azureResource.AzureResourceDatabaseServer>,
private _extensionContext: ExtensionContext
) {
super(databaseServerService);
}
protected getTreeItemForResource(databaseServer: azureResource.AzureResourceDatabaseServer, account: Account): TreeItem {
return {
id: `Kusto_${databaseServer.id ? databaseServer.id : databaseServer.name}`,
label: databaseServer.name,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/azureDE_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/azureDE.svg')
},
collapsibleState: TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.azureDataExplorer,
payload: {
id: generateGuid(),
connectionName: undefined,
serverName: databaseServer.fullName,
databaseName: databaseServer.defaultDatabaseName,
userName: databaseServer.loginName,
password: '',
authenticationType: 'AzureMFA',
savePassword: true,
groupFullName: '',
groupId: '',
providerName: 'KUSTO',
saveProfile: false,
options: {},
azureAccount: account.key.accountId
},
childProvider: 'KUSTO',
type: ExtensionNodeType.Server
};
}
protected createContainerNode(): azureResource.IAzureResourceNode {
return {
account: undefined,
subscription: undefined,
tenantId: undefined,
treeItem: {
id: KustoTreeDataProvider.containerId,
label: KustoTreeDataProvider.containerLabel,
iconPath: {
dark: this._extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
light: this._extensionContext.asAbsolutePath('resources/light/folder.svg')
},
collapsibleState: TreeItemCollapsibleState.Collapsed,
contextValue: AzureResourceItemType.databaseServerContainer
}
};
}
}

View File

@@ -26,6 +26,8 @@ import { registerAzureResourceCommands } from './azureResource/commands';
import { AzureResourceTreeProvider } from './azureResource/tree/treeProvider';
import { SqlInstanceResourceService } from './azureResource/providers/sqlinstance/sqlInstanceService';
import { SqlInstanceProvider } from './azureResource/providers/sqlinstance/sqlInstanceProvider';
import { KustoResourceService } from './azureResource/providers/kusto/kustoService';
import { KustoProvider } from './azureResource/providers/kusto/kustoProvider';
import { PostgresServerProvider } from './azureResource/providers/postgresServer/postgresServerProvider';
import { PostgresServerService } from './azureResource/providers/postgresServer/postgresServerService';
import { AzureTerminalService } from './azureResource/services/terminalService';
@@ -92,6 +94,7 @@ export async function activate(context: vscode.ExtensionContext): Promise<azurec
provideResources(): azureResource.IAzureResourceProvider[] {
const arcFeaturedEnabled = vscode.workspace.getConfiguration(constants.extensionConfigSectionName).get('enableArcFeatures');
const providers: azureResource.IAzureResourceProvider[] = [
new KustoProvider(new KustoResourceService(), extensionContext),
new AzureResourceDatabaseServerProvider(new AzureResourceDatabaseServerService(), extensionContext),
new AzureResourceDatabaseProvider(new AzureResourceDatabaseService(), extensionContext),
new SqlInstanceProvider(new SqlInstanceResourceService(), extensionContext),