diff --git a/sdk/storage/storage-file-share/.vscode/launch.json b/sdk/storage/storage-file-share/.vscode/launch.json index 24dbfc9d74c4..3eb92e74ef9e 100644 --- a/sdk/storage/storage-file-share/.vscode/launch.json +++ b/sdk/storage/storage-file-share/.vscode/launch.json @@ -34,7 +34,7 @@ "${workspaceFolder}/test/node/*.spec.ts" ], "env": { "TS_NODE_COMPILER_OPTIONS": "{\"module\": \"commonjs\"}" }, - "envFile": "${workspaceFolder}/../.env", + "envFile": "${workspaceFolder}/.env", "console": "integratedTerminal", "internalConsoleOptions": "neverOpen", "protocol": "inspector" diff --git a/sdk/storage/storage-file-share/CHANGELOG.md b/sdk/storage/storage-file-share/CHANGELOG.md index f6f3c7f1b115..68d901050f0a 100644 --- a/sdk/storage/storage-file-share/CHANGELOG.md +++ b/sdk/storage/storage-file-share/CHANGELOG.md @@ -1,5 +1,10 @@ # Release History +## 12.2.0 (Unreleased) + +- Updated Azure Storage Service API version to 2019-12-12. +- Support 4 TB files. + ## 12.1.2 (2020.05) - Fix data corruption failure error [issue #6411](https://github.com/Azure/azure-sdk-for-js/issues/6411) when downloading compressed files. [PR #7993](https://github.com/Azure/azure-sdk-for-js/pull/7993) diff --git a/sdk/storage/storage-file-share/karma.conf.js b/sdk/storage/storage-file-share/karma.conf.js index e6896228e2ea..85932fd1d037 100644 --- a/sdk/storage/storage-file-share/karma.conf.js +++ b/sdk/storage/storage-file-share/karma.conf.js @@ -1,6 +1,6 @@ // https://github.com/karma-runner/karma-chrome-launcher process.env.CHROME_BIN = require("puppeteer").executablePath(); -require("dotenv").config({ path: "../.env" }); +require("dotenv").config({ path: "./.env" }); const { jsonRecordingFilterFunction, isPlaybackMode, diff --git a/sdk/storage/storage-file-share/package.json b/sdk/storage/storage-file-share/package.json index 5b5318726dcf..38f86477c828 100644 --- a/sdk/storage/storage-file-share/package.json +++ b/sdk/storage/storage-file-share/package.json @@ -1,7 +1,7 @@ { "name": "@azure/storage-file-share", "sdk-type": "client", - "version": "12.1.2", + "version": "12.2.0", "description": "Microsoft Azure Storage SDK for JavaScript - File", "main": "./dist/index.js", "module": "./dist-esm/src/index.js", @@ -28,7 +28,7 @@ }, "scripts": { "audit": "node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit", - "build:autorest": "autorest ./swagger/README.md --typescript --package-version=12.1.2 --use=@microsoft.azure/autorest.typescript@5.0.1", + "build:autorest": "autorest ./swagger/README.md --typescript --package-version=12.2.0 --use=@microsoft.azure/autorest.typescript@5.0.1", "build:es6": "tsc -p tsconfig.json", "build:nodebrowser": "rollup -c 2>&1", "build:samples": "npm run clean && npm run build:es6 && cross-env ONLY_NODE=true rollup -c 2>&1 && npm run build:prep-samples", diff --git a/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_create_largest_file.json b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_create_largest_file.json new file mode 100644 index 000000000000..2a386dbc13ab --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_create_largest_file.json @@ -0,0 +1,184 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:39 GMT", + "etag": "\"0x8D8143D35B3FBFC\"", + "last-modified": "Fri, 19 Jun 2020 10:40:39 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "32aeb514-7625-4bf8-85ea-85f5a263b56b", + "x-ms-request-id": "9e66eb6e-c01a-005a-2526-4650ab000000", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555/dir159256324113807688", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:39 GMT", + "etag": "\"0x8D8143D360D452D\"", + "last-modified": "Fri, 19 Jun 2020 10:40:40 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "10f055e2-f719-4cac-ae61-85f7c99ba156", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-06-19T10:40:40.5325101Z", + "x-ms-file-creation-time": "2020-06-19T10:40:40.5325101Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-06-19T10:40:40.5325101Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "4512302258392269635*6216600178912236746", + "x-ms-request-id": "9e66eb74-c01a-005a-2826-4650ab000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555", + "query": { + "restype": "share", + "comp": "properties" + }, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:40 GMT", + "etag": "\"0x8D8143D366545AA\"", + "last-modified": "Fri, 19 Jun 2020 10:40:41 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "f843f3cb-bffd-4686-93da-0bd1ba0f2a2e", + "x-ms-request-id": "9e66eb79-c01a-005a-2a26-4650ab000000", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555/dir159256324113807688/file159256324170602662", + "query": {}, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:40 GMT", + "etag": "\"0x8D8143D36B872F5\"", + "last-modified": "Fri, 19 Jun 2020 10:40:41 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "b99bc137-8f20-4420-b168-cd8937f3c786", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-creation-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "18367126982671236164*6216600178912236746", + "x-ms-request-id": "9e66eb7c-c01a-005a-2c26-4650ab000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555/dir159256324113807688/file159256324170602662", + "query": { + "comp": "properties" + }, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:41 GMT", + "etag": "\"0x8D8143D370CBD98\"", + "last-modified": "Fri, 19 Jun 2020 10:40:42 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "4cc77f7f-8c50-424a-b4c4-9ce6eeb502b7", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-06-19T10:40:42.2067608Z", + "x-ms-file-creation-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "18367126982671236164*6216600178912236746", + "x-ms-request-id": "9e66eb7f-c01a-005a-2e26-4650ab000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "HEAD", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555/dir159256324113807688/file159256324170602662", + "query": {}, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "4398046511104", + "content-type": "application/octet-stream", + "date": "Fri, 19 Jun 2020 10:40:41 GMT", + "etag": "\"0x8D8143D370CBD98\"", + "last-modified": "Fri, 19 Jun 2020 10:40:42 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "48f83eee-52d2-49da-b594-499f4736696f", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-06-19T10:40:42.2067608Z", + "x-ms-file-creation-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-06-19T10:40:41.6543477Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "18367126982671236164*6216600178912236746", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-request-id": "9e66eb8f-c01a-005a-3d26-4650ab000000", + "x-ms-server-encrypted": "true", + "x-ms-type": "File", + "x-ms-version": "2019-12-12" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share159256323960404555", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "date": "Fri, 19 Jun 2020 10:40:43 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "71ed7150-6223-4657-93d6-f34ecb6979ac", + "x-ms-request-id": "9e66eb9d-c01a-005a-4b26-4650ab000000", + "x-ms-version": "2019-12-12" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share159256323960404555", + "dir": "dir159256324113807688", + "file": "file159256324170602662" + }, + "newDate": {} + }, + "hash": "c8a45c43f12bee2b017a2fbdf77e5125" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/node/fileclient/recording_create_largest_file.js b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_create_largest_file.js new file mode 100644 index 000000000000..37fedbe25ad3 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_create_largest_file.js @@ -0,0 +1,225 @@ +let nock = require('nock'); + +module.exports.hash = "60b311a9da34394d5deb32f8e27a78eb"; + +module.exports.testInfo = {"uniqueName":{"share":"share159256179930406953","dir":"dir159256180063107425","file":"file159256180107703922"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share159256179930406953') + .query(true) + .reply(201, "", [ + 'Transfer-Encoding', + 'chunked', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:39 GMT', + 'ETag', + '"0x8D81439DB0EA7D6"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba8a-601a-001e-5e22-46da94000000', + 'x-ms-client-request-id', + '142546bf-2119-4a2f-aa72-df26a9de8fb4', + 'x-ms-version', + '2019-12-12', + 'Date', + 'Fri, 19 Jun 2020 10:16:39 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share159256179930406953/dir159256180063107425') + .query(true) + .reply(201, "", [ + 'Transfer-Encoding', + 'chunked', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:39 GMT', + 'ETag', + '"0x8D81439DB572DB3"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba8e-601a-001e-5f22-46da94000000', + 'x-ms-client-request-id', + '7aa26ff4-af76-4308-84c4-e89df4977ab6', + 'x-ms-version', + '2019-12-12', + 'x-ms-file-change-time', + '2020-06-19T10:16:39.8540211Z', + 'x-ms-file-last-write-time', + '2020-06-19T10:16:39.8540211Z', + 'x-ms-file-creation-time', + '2020-06-19T10:16:39.8540211Z', + 'x-ms-file-permission-key', + '4512302258392269635*6216600178912236746', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Fri, 19 Jun 2020 10:16:39 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share159256179930406953') + .query(true) + .reply(200, "", [ + 'Transfer-Encoding', + 'chunked', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:40 GMT', + 'ETag', + '"0x8D81439DB8A677D"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba8f-601a-001e-6022-46da94000000', + 'x-ms-client-request-id', + 'bffc2cb5-6d3c-438b-8667-6164c474d3e1', + 'x-ms-version', + '2019-12-12', + 'Date', + 'Fri, 19 Jun 2020 10:16:39 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share159256179930406953/dir159256180063107425/file159256180107703922') + .reply(201, "", [ + 'Transfer-Encoding', + 'chunked', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:40 GMT', + 'ETag', + '"0x8D81439DBECAC66"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba91-601a-001e-6122-46da94000000', + 'x-ms-client-request-id', + '02f5d8e0-a1d3-4fa5-bd94-9f0d66f6c8cb', + 'x-ms-version', + '2019-12-12', + 'x-ms-file-change-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-last-write-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-creation-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-permission-key', + '18367126982671236164*6216600178912236746', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Fri, 19 Jun 2020 10:16:40 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share159256179930406953/dir159256180063107425/file159256180107703922') + .query(true) + .reply(200, "", [ + 'Transfer-Encoding', + 'chunked', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:41 GMT', + 'ETag', + '"0x8D81439DC521155"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba9c-601a-001e-6222-46da94000000', + 'x-ms-client-request-id', + 'a7100e5a-efea-477c-9245-10d9ea199980', + 'x-ms-version', + '2019-12-12', + 'x-ms-file-change-time', + '2020-06-19T10:16:41.4982485Z', + 'x-ms-file-last-write-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-creation-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-permission-key', + '18367126982671236164*6216600178912236746', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Fri, 19 Jun 2020 10:16:40 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .head('/share159256179930406953/dir159256180063107425/file159256180107703922') + .reply(200, "", [ + 'Content-Length', + '4398046511104', + 'Content-Type', + 'application/octet-stream', + 'Last-Modified', + 'Fri, 19 Jun 2020 10:16:41 GMT', + 'ETag', + '"0x8D81439DC521155"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba9d-601a-001e-6322-46da94000000', + 'x-ms-client-request-id', + '4ddc70bb-8b55-4416-b05d-e7235b377ce7', + 'x-ms-version', + '2019-12-12', + 'x-ms-type', + 'File', + 'x-ms-server-encrypted', + 'true', + 'x-ms-lease-status', + 'unlocked', + 'x-ms-lease-state', + 'available', + 'x-ms-file-change-time', + '2020-06-19T10:16:41.4982485Z', + 'x-ms-file-last-write-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-creation-time', + '2020-06-19T10:16:40.8337510Z', + 'x-ms-file-permission-key', + '18367126982671236164*6216600178912236746', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'Date', + 'Fri, 19 Jun 2020 10:16:42 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share159256179930406953') + .query(true) + .reply(202, "", [ + 'Transfer-Encoding', + 'chunked', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '61abba9e-601a-001e-6422-46da94000000', + 'x-ms-client-request-id', + 'fdd48eba-1b54-4aba-8f28-900a3a7747e0', + 'x-ms-version', + '2019-12-12', + 'Date', + 'Fri, 19 Jun 2020 10:16:42 GMT' +]); diff --git a/sdk/storage/storage-file-share/src/generated/src/storageClientContext.ts b/sdk/storage/storage-file-share/src/generated/src/storageClientContext.ts index 8992aa042d4b..2a2c313712c2 100644 --- a/sdk/storage/storage-file-share/src/generated/src/storageClientContext.ts +++ b/sdk/storage/storage-file-share/src/generated/src/storageClientContext.ts @@ -11,7 +11,7 @@ import * as coreHttp from "@azure/core-http"; const packageName = "azure-storage-file-share"; -const packageVersion = "12.1.2"; +const packageVersion = "12.2.0"; export class StorageClientContext extends coreHttp.ServiceClient { version: string; diff --git a/sdk/storage/storage-file-share/src/utils/constants.ts b/sdk/storage/storage-file-share/src/utils/constants.ts index 101e9b506655..510f5498478c 100644 --- a/sdk/storage/storage-file-share/src/utils/constants.ts +++ b/sdk/storage/storage-file-share/src/utils/constants.ts @@ -1,10 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -export const SDK_VERSION: string = "12.1.2"; -export const SERVICE_VERSION: string = "2019-07-07"; +export const SDK_VERSION: string = "12.2.0"; +export const SERVICE_VERSION: string = "2019-12-12"; -export const FILE_MAX_SIZE_BYTES: number = 1024 * 1024 * 1024 * 1024; // 1TB +export const FILE_MAX_SIZE_BYTES: number = 4 * 1024 * 1024 * 1024 * 1024; // 4TB export const FILE_RANGE_MAX_SIZE_BYTES: number = 4 * 1024 * 1024; // 4MB export const DEFAULT_MAX_DOWNLOAD_RETRY_REQUESTS: number = 5; export const DEFAULT_HIGH_LEVEL_CONCURRENCY: number = 5; diff --git a/sdk/storage/storage-file-share/test/fileclient.spec.ts b/sdk/storage/storage-file-share/test/fileclient.spec.ts index f81b20af17ba..bec68d1d78a9 100644 --- a/sdk/storage/storage-file-share/test/fileclient.spec.ts +++ b/sdk/storage/storage-file-share/test/fileclient.spec.ts @@ -13,6 +13,7 @@ import { Pipeline } from "../src/Pipeline"; import { truncatedISO8061Date } from "../src/utils/utils.common"; import { bodyToString, getBSU, recorderEnvSetup } from "./utils"; import { MockPolicyFactory } from "./utils/MockPolicyFactory"; +import { FILE_MAX_SIZE_BYTES } from "../src/utils/constants"; dotenv.config(); @@ -147,6 +148,18 @@ describe("FileClient", () => { assert.ok(properties.fileParentId!); }); + // need to skip this test in live as it requires Premium_LRS SKU for 2019-12-12. + it.skip("create largest file", async () => { + const GB = 1024 * 1024 * 1024; + await shareClient.setQuota(FILE_MAX_SIZE_BYTES / GB); + const cResp = await fileClient.create(FILE_MAX_SIZE_BYTES); + assert.equal(cResp.errorCode, undefined); + + await fileClient.resize(FILE_MAX_SIZE_BYTES); + const updatedProperties = await fileClient.getProperties(); + assert.deepStrictEqual(updatedProperties.contentLength, FILE_MAX_SIZE_BYTES); + }); + it("setProperties with default parameters", async () => { await fileClient.create(content.length); await fileClient.setProperties();