diff --git a/sdk/storage/storage-file-share/karma.conf.js b/sdk/storage/storage-file-share/karma.conf.js index 59b4dbd6b38a..c3b516d8bb0b 100644 --- a/sdk/storage/storage-file-share/karma.conf.js +++ b/sdk/storage/storage-file-share/karma.conf.js @@ -62,6 +62,8 @@ module.exports = function(config) { "ACCOUNT_SAS", "SOFT_DELETE_ACCOUNT_NAME", "SOFT_DELETE_ACCOUNT_SAS", + "PREMIUM_FILE_ACCOUNT_NAME", + "PREMIUM_FILE_ACCOUNT_SAS", "TEST_MODE" ], diff --git a/sdk/storage/storage-file-share/recordings/browsers/fileserviceclient_premium/recording_smb_multichannel.json b/sdk/storage/storage-file-share/recordings/browsers/fileserviceclient_premium/recording_smb_multichannel.json new file mode 100644 index 000000000000..bbe95845bb91 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/fileserviceclient_premium/recording_smb_multichannel.json @@ -0,0 +1,48 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://pf-fakestorageaccount.file.core.windows.net/", + "query": { + "restype": "service", + "comp": "properties" + }, + "requestBody": "true", + "status": 202, + "response": "", + "responseHeaders": { + "date": "Thu, 10 Sep 2020 14:03:06 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "934f892e-3e9b-44c9-8407-a50a3c40a43d", + "x-ms-request-id": "8db70106-201a-0042-1b7b-878fcc000000", + "x-ms-version": "2020-02-10" + } + }, + { + "method": "GET", + "url": "https://pf-fakestorageaccount.file.core.windows.net/", + "query": { + "restype": "service", + "comp": "properties" + }, + "requestBody": null, + "status": 200, + "response": "1.0truefalsetrue31.0truefalsetrue3DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT,PATCH***86400DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT,PATCH***86400true", + "responseHeaders": { + "content-type": "application/xml", + "date": "Thu, 10 Sep 2020 14:03:07 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "d7ce9946-4739-4100-a4f5-8f31e13ebdc9", + "x-ms-request-id": "8db70110-201a-0042-1f7b-878fcc000000", + "x-ms-version": "2020-02-10" + } + } + ], + "uniqueTestInfo": { + "uniqueName": {}, + "newDate": {} + }, + "hash": "0239648c88b551390876f693c87cb2ae" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/node/fileserviceclient_premium/recording_smb_multichannel.js b/sdk/storage/storage-file-share/recordings/node/fileserviceclient_premium/recording_smb_multichannel.js new file mode 100644 index 000000000000..21ae2d494a92 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/fileserviceclient_premium/recording_smb_multichannel.js @@ -0,0 +1,27 @@ +let nock = require('nock'); + +module.exports.hash = "eb5c28f68ec1b06f5b0af59f04f201a8"; + +module.exports.testInfo = {"uniqueName":{},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/', "true") + .query(true) + .reply(400, "FeatureNotSupportedOnStorageAccountFeature cannot be enabled on this storage account.\nRequestId:5e6a9f92-601a-000e-355f-911ffc000000\nTime:2020-09-23T04:11:54.0486223Z", [ + 'Content-Length', + '254', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '5e6a9f92-601a-000e-355f-911ffc000000', + 'x-ms-client-request-id', + '103ea686-cedd-49f9-8146-c0acc382f9dc', + 'x-ms-version', + '2020-02-10', + 'x-ms-error-code', + 'FeatureNotSupportedOnStorageAccount', + 'Date', + 'Wed, 23 Sep 2020 04:11:53 GMT' +]); diff --git a/sdk/storage/storage-file-share/review/storage-file-share.api.md b/sdk/storage/storage-file-share/review/storage-file-share.api.md index d2faf5be84ec..558fe7117de3 100644 --- a/sdk/storage/storage-file-share/review/storage-file-share.api.md +++ b/sdk/storage/storage-file-share/review/storage-file-share.api.md @@ -835,7 +835,7 @@ export interface FileServiceProperties { cors?: CorsRule[]; hourMetrics?: Metrics; minuteMetrics?: Metrics; - protocolSettings?: ProtocolSettings; + protocol?: ShareProtocolSettings; } // @public @@ -1165,11 +1165,6 @@ export interface PipelineOptions { httpClient?: IHttpClient; } -// @public -export interface ProtocolSettings { - smbSettings?: SmbSettings; -} - // @public export interface Range { count?: number; @@ -1705,6 +1700,11 @@ export interface ShareProperties { remainingRetentionDays?: number; } +// @public +export interface ShareProtocolSettings { + smb?: ShareSmbSettings; +} + // @public export class ShareSASPermissions { create: boolean; @@ -1802,6 +1802,11 @@ export type ShareSetQuotaResponse = ShareSetQuotaHeaders & { }; }; +// @public +export interface ShareSmbSettings { + multichannel?: SmbMultichannel; +} + // @public export interface ShareStats { shareUsageBytes: number; @@ -1828,11 +1833,6 @@ export interface SmbMultichannel { enabled?: boolean; } -// @public -export interface SmbSettings { - multichannel?: SmbMultichannel; -} - // @public export interface SourceModifiedAccessConditions { sourceIfMatchCrc64?: Uint8Array; diff --git a/sdk/storage/storage-file-share/sample.env b/sdk/storage/storage-file-share/sample.env index 5eabd1722fed..fa2a131c708c 100644 --- a/sdk/storage/storage-file-share/sample.env +++ b/sdk/storage/storage-file-share/sample.env @@ -19,8 +19,14 @@ DIR_NAME= # change it to "record" to generate new recordings, or "live" to bypass the recorder entirely. # TEST_MODE=playback -# Used for share soft delete. +# Optional, used for share soft delete. SOFT_DELETE_ACCOUNT_NAME= SOFT_DELETE_ACCOUNT_KEY= SOFT_DELETE_STORAGE_CONNECTION_STRING= -SOFT_DELETE_ACCOUNT_SAS= \ No newline at end of file +SOFT_DELETE_ACCOUNT_SAS= + +# Optional, used for tests on premium file accounts. +PREMIUM_FILE_ACCOUNT_NAME= +PREMIUM_FILE_ACCOUNT_KEY= +PREMIUM_FILE_STORAGE_CONNECTION_STRING= +PREMIUM_FILE_ACCOUNT_SAS= diff --git a/sdk/storage/storage-file-share/src/generatedModels.ts b/sdk/storage/storage-file-share/src/generatedModels.ts index 0e943bd1d533..c3acb04c9f8e 100644 --- a/sdk/storage/storage-file-share/src/generatedModels.ts +++ b/sdk/storage/storage-file-share/src/generatedModels.ts @@ -101,7 +101,7 @@ export { LeaseStateType, LeaseStatusType, CopyFileSmbInfo, - ProtocolSettings, - SmbSettings, + ShareProtocolSettings, + ShareSmbSettings, SmbMultichannel } from "./generated/src/models"; diff --git a/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts b/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts index 685ad6ac56d6..5653287e2a8e 100644 --- a/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts +++ b/sdk/storage/storage-file-share/test/fileserviceclient.spec.ts @@ -4,7 +4,8 @@ import { getBSU, getSASConnectionStringFromEnvironment, recorderEnvSetup, - getSoftDeleteBSU + getSoftDeleteBSU, + getGenericBSU } from "./utils"; import { record, delay, Recorder } from "@azure/test-utils-recorder"; import * as dotenv from "dotenv"; @@ -466,3 +467,29 @@ describe("FileServiceClient", () => { } }); }); + +describe("FileServiceClient Premium", () => { + let recorder: Recorder; + let serviceClient: ShareServiceClient; + + beforeEach(function() { + recorder = record(this, recorderEnvSetup); + try { + serviceClient = getGenericBSU("PREMIUM_FILE_"); + } catch (error) { + this.skip(); + } + }); + + afterEach(async function() { + await recorder.stop(); + }); + + it("SMB Multichannel", async () => { + await serviceClient.setProperties({ + protocol: { smb: { multichannel: { enabled: true } } } + }); + const propertiesSet = await serviceClient.getProperties(); + assert.ok(propertiesSet.protocol?.smb?.multichannel); + }); +}); diff --git a/sdk/storage/storage-file-share/test/utils/testutils.common.ts b/sdk/storage/storage-file-share/test/utils/testutils.common.ts index 2df6e9465eb3..756bca1ff301 100644 --- a/sdk/storage/storage-file-share/test/utils/testutils.common.ts +++ b/sdk/storage/storage-file-share/test/utils/testutils.common.ts @@ -8,6 +8,7 @@ export function isBrowser(): boolean { const mockAccountName = "fakestorageaccount"; const mockAccountKey = "aaaaa"; const mockSDAccountName = "sd-fakestorageaccount"; +const mockPFAccountName = "pf-fakestorageaccount"; export const recorderEnvSetup: RecorderEnvironmentSetup = { replaceableVariables: { // Used in record and playback modes @@ -23,7 +24,11 @@ export const recorderEnvSetup: RecorderEnvironmentSetup = { SOFT_DELETE_ACCOUNT_NAME: `${mockSDAccountName}`, SOFT_DELETE_ACCOUNT_KEY: `${mockAccountKey}`, SOFT_DELETE_ACCOUNT_SAS: `${mockAccountKey}`, - SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockSDAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net` + SOFT_DELETE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockSDAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net`, + PREMIUM_FILE_ACCOUNT_NAME: `${mockPFAccountName}`, + PREMIUM_FILE_ACCOUNT_KEY: `${mockAccountKey}`, + PREMIUM_FILE_ACCOUNT_SAS: `${mockAccountKey}`, + PREMIUM_FILE_STORAGE_CONNECTION_STRING: `DefaultEndpointsProtocol=https;AccountName=${mockSDAccountName};AccountKey=${mockAccountKey};EndpointSuffix=core.windows.net` }, customizationsOnRecordings: [ // Used in record mode