mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-16 17:22:29 -05:00
Add AzureAccount service (#18502)
This commit is contained in:
22
src/sql/workbench/api/common/extHostAzureAccount.ts
Normal file
22
src/sql/workbench/api/common/extHostAzureAccount.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azurecore from 'azurecore';
|
||||
import { ExtHostAzureAccountShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
|
||||
import { ExtensionIdentifier } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
|
||||
export class ExtHostAzureAccount extends ExtHostAzureAccountShape {
|
||||
|
||||
constructor(@IExtHostExtensionService private _extHostExtensionService: IExtHostExtensionService,) {
|
||||
super();
|
||||
}
|
||||
|
||||
public override $getSubscriptions(account: azurecore.AzureAccount, ignoreErrors?: boolean, selectedOnly?: boolean): Thenable<azurecore.GetSubscriptionsResult> {
|
||||
const api = this._extHostExtensionService.getExtensionExports(new ExtensionIdentifier(azurecore.extension.name)) as azurecore.IExtension;
|
||||
return api.getSubscriptions(account, ignoreErrors, selectedOnly);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ import { ExtHostWorkspace } from 'sql/workbench/api/common/extHostWorkspace';
|
||||
import { IExtHostInitDataService } from 'vs/workbench/api/common/extHostInitDataService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ExtHostAzureAccount } from 'sql/workbench/api/common/extHostAzureAccount';
|
||||
import { IExtHostExtensionService } from 'vs/workbench/api/common/extHostExtensionService';
|
||||
|
||||
export interface IAzdataExtensionApiFactory {
|
||||
(extension: IExtensionDescription): typeof azdata;
|
||||
@@ -77,6 +79,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
||||
|
||||
// Addressable instances
|
||||
const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol));
|
||||
rpcProtocol.set(SqlExtHostContext.ExtHostAzureAccount, new ExtHostAzureAccount(accessor.get(IExtHostExtensionService)));
|
||||
const extHostConnectionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(rpcProtocol));
|
||||
const extHostCredentialManagement = rpcProtocol.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(rpcProtocol));
|
||||
const extHostDataProvider = rpcProtocol.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(rpcProtocol, uriTransformer));
|
||||
|
||||
@@ -13,6 +13,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
import type * as azdata from 'azdata';
|
||||
import type * as vscode from 'vscode';
|
||||
import type * as azurecore from 'azurecore';
|
||||
|
||||
import { ITreeComponentItem } from 'sql/workbench/common/views';
|
||||
import { ITaskHandlerDescription } from 'sql/workbench/services/tasks/common/tasks';
|
||||
@@ -30,6 +31,10 @@ import { EditorViewColumn } from 'vs/workbench/api/common/shared/editor';
|
||||
import { TreeDataTransferDTO } from 'vs/workbench/api/common/shared/treeDataTransfer';
|
||||
import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
export abstract class ExtHostAzureAccountShape {
|
||||
public $getSubscriptions(account: azurecore.AzureAccount, ignoreErrors?: boolean, selectedOnly?: boolean): Thenable<azurecore.GetSubscriptionsResult> { throw ni(); }
|
||||
}
|
||||
|
||||
export abstract class ExtHostAccountManagementShape {
|
||||
$autoOAuthCancelled(handle: number): Thenable<void> { throw ni(); }
|
||||
$clear(handle: number, accountKey: azdata.AccountKey): Thenable<void> { throw ni(); }
|
||||
@@ -603,6 +608,10 @@ export interface MainThreadAccountManagementShape extends IDisposable {
|
||||
$getAccountsForProvider(providerId: string): Thenable<azdata.Account[]>;
|
||||
}
|
||||
|
||||
export interface MainThreadAzureAccountShape extends IDisposable {
|
||||
|
||||
}
|
||||
|
||||
export interface MainThreadResourceProviderShape extends IDisposable {
|
||||
$registerResourceProvider(providerMetadata: azdata.ResourceProviderMetadata, handle: number): Thenable<any>;
|
||||
$unregisterResourceProvider(handle: number): Thenable<any>;
|
||||
@@ -688,6 +697,7 @@ function ni() { return new Error('Not implemented'); }
|
||||
export const SqlMainContext = {
|
||||
// SQL entries
|
||||
MainThreadAccountManagement: createMainId<MainThreadAccountManagementShape>('MainThreadAccountManagement'),
|
||||
MainThreadAzureAccount: createMainId<MainThreadAzureAccountShape>('MainThreadAzureAccount'),
|
||||
MainThreadConnectionManagement: createMainId<MainThreadConnectionManagementShape>('MainThreadConnectionManagement'),
|
||||
MainThreadCredentialManagement: createMainId<MainThreadCredentialManagementShape>('MainThreadCredentialManagement'),
|
||||
MainThreadDataProtocol: createMainId<MainThreadDataProtocolShape>('MainThreadDataProtocol'),
|
||||
@@ -709,6 +719,7 @@ export const SqlMainContext = {
|
||||
|
||||
export const SqlExtHostContext = {
|
||||
ExtHostAccountManagement: createExtId<ExtHostAccountManagementShape>('ExtHostAccountManagement'),
|
||||
ExtHostAzureAccount: createExtId<ExtHostAzureAccountShape>('ExtHostAzureAccount'),
|
||||
ExtHostConnectionManagement: createExtId<ExtHostConnectionManagementShape>('ExtHostConnectionManagement'),
|
||||
ExtHostCredentialManagement: createExtId<ExtHostCredentialManagementShape>('ExtHostCredentialManagement'),
|
||||
ExtHostDataProtocol: createExtId<ExtHostDataProtocolShape>('ExtHostDataProtocol'),
|
||||
|
||||
Reference in New Issue
Block a user