mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
* Added monitor log-analytics workspace list to az api * Made resource group and subscription optional for logs analytics workspace list * Added dynamic fields for workspace names, id, primary key, based on value of auto-logs checkbox * Hooked up the newly created source provider for log analytics workspaces. Dropdown now populates all workspace names. * Added workspaceUtils.ts for a valueprovider. Now workspace name maps to id automatically. * Replaced promise.all with promise.resolve * Added workspace id and primary key as env variables in the notebook * Removed extra space in package.json * Made getOptions more concise and put azApi definition in function. * Changed notebook to handle new Azure CLI command with param --clustername
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as azExt from 'az-ext';
|
|
import * as rd from 'resource-deployment';
|
|
import * as vscode from 'vscode';
|
|
import { errorListingLogAnalyticsWorkspaces } from '../localizedConstants';
|
|
|
|
/**
|
|
* Class that provides options sources for Log Analytics workspace names
|
|
*/
|
|
export class LogAnalyticsWorkspaceOptionsSourceProvider implements rd.IOptionsSourceProvider {
|
|
readonly id = 'arc.logAnalyticsWorkspaceNames';
|
|
private readonly _azApi: azExt.IExtension;
|
|
|
|
constructor() {
|
|
this._azApi = <azExt.IExtension>vscode.extensions.getExtension(azExt.extension.name)?.exports;
|
|
}
|
|
|
|
public async getOptions(): Promise<string[]> {
|
|
try {
|
|
const workspacesListResult = await this._azApi.az.monitor.logAnalytics.workspace.list();
|
|
return workspacesListResult.stdout.map(workspace => workspace.name);
|
|
} catch (err) {
|
|
vscode.window.showErrorMessage(errorListingLogAnalyticsWorkspaces(err));
|
|
throw err;
|
|
}
|
|
}
|
|
}
|