mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 09:35:37 -05:00
Create shared access signature RPC (#18823)
* Rebase from main branch * Made mssql a module * remove rpc specific stuff * Added create sas RPC call * Backup to url works now * Moved createSas RPC to the BlobService * Relocated createSas RPC from sql-dataprotocolclient to the mssql * After rebase * Removed duplicate symbol * Renamed Blob to AzureBlob and relocated CreateSasResponse to mssql extension * Removed AzureBlobProvider, removed AzureBlobService feature * renamed blob to azureblob, converted thenable to promise * Simplify API * fixes * docs update, blob to azureblob update * bumped sts version * Fix config Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
e9fefd2487
commit
1cf905a7b8
@@ -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 * as mssql from 'mssql';
|
||||
import { IAzureBlobService } from 'sql/platform/azureBlob/common/azureBlobService';
|
||||
import { MainThreadAzureBlob } from 'sql/workbench/api/browser/mainThreadAzureBlob';
|
||||
|
||||
export class AzureBlobService implements IAzureBlobService {
|
||||
|
||||
public _serviceBrand: undefined;
|
||||
private _proxy: MainThreadAzureBlob;
|
||||
|
||||
/**
|
||||
* Internal use only, do not call! This is called once on startup by the proxy object used
|
||||
* to communicate with the extension host once it's been created.
|
||||
* @param proxy The proxy to use to communicate with the mssql extension
|
||||
*/
|
||||
public registerProxy(proxy: MainThreadAzureBlob) {
|
||||
this._proxy = proxy;
|
||||
}
|
||||
|
||||
public createSas(connectionUri: string, blobContainerUri: string, blobContainerKey: string, storageAccountName: string, expirationDate: string): Promise<mssql.CreateSasResponse> {
|
||||
this.checkProxy();
|
||||
return Promise.resolve(this._proxy.createSas(connectionUri, blobContainerUri, blobContainerKey, storageAccountName, expirationDate));
|
||||
}
|
||||
|
||||
private checkProxy(): void {
|
||||
if (!this._proxy) {
|
||||
throw new Error('Azure Blob proxy not initialized');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user