diff --git a/sdk/storage/storage-blob/CHANGELOG.md b/sdk/storage/storage-blob/CHANGELOG.md index 88ab22f6117e..5aa89d2fd7d6 100644 --- a/sdk/storage/storage-blob/CHANGELOG.md +++ b/sdk/storage/storage-blob/CHANGELOG.md @@ -1,5 +1,10 @@ # Release History +## 12.2.0 (unreleased) + +- Added convenience method `createIfNotExists` for `ContainerClient`, `AppendBlobClient` and `PageBlobClient`. +- Added convenience method `deleteIfExists` for `ContainerClient` and `BlobClients`. + ## 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-blob/recordings/browsers/appendblobclient/recording_createifnotexists.json b/sdk/storage/storage-blob/recordings/browsers/appendblobclient/recording_createifnotexists.json new file mode 100644 index 000000000000..ee44d46262b4 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/browsers/appendblobclient/recording_createifnotexists.json @@ -0,0 +1,87 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977219399200016", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:13 GMT", + "etag": "\"0x8D7FADACC557D8C\"", + "last-modified": "Mon, 18 May 2020 03:23:13 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "55cb7f47-55ad-402c-9783-7ccdfb46a8d4", + "x-ms-request-id": "d0a58ed4-e01e-0069-40c3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977219399200016/blob158977219548204940", + "query": {}, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:13 GMT", + "etag": "\"0x8D7FADACCB1CC38\"", + "last-modified": "Mon, 18 May 2020 03:23:14 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "6aafb862-c55b-43b4-bbf4-875835fbc220", + "x-ms-request-id": "d0a590f8-e01e-0069-40c3-2c9b43000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977219399200016/blob158977219548204940", + "query": {}, + "requestBody": null, + "status": 409, + "response": "BlobAlreadyExistsThe specified blob already exists.\nRequestId:d0a591db-e01e-0069-07c3-2c9b43000000\nTime:2020-05-18T03:23:14.3239981Z", + "responseHeaders": { + "content-length": "220", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 03:23:14 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "afa45086-11ad-43e2-b6cf-11e070fba3e0", + "x-ms-error-code": "BlobAlreadyExists", + "x-ms-request-id": "d0a591db-e01e-0069-07c3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977219399200016", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:14 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "3244ac67-6d9f-44be-931a-3d5a97b600c7", + "x-ms-request-id": "d0a5938c-e01e-0069-02c3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "container": "container158977219399200016", + "blob": "blob158977219548204940" + }, + "newDate": {} + }, + "hash": "e6efd2486db5d337378f976ca1aec73d" +} \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_delete_snapshot.json b/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_delete_snapshot.json index ec622fc511d2..4d3f2f19971f 100644 --- a/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_delete_snapshot.json +++ b/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_delete_snapshot.json @@ -2,7 +2,7 @@ "recordings": [ { "method": "PUT", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180", "query": { "restype": "container" }, @@ -10,40 +10,40 @@ "status": 201, "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", - "last-modified": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:43 GMT", + "etag": "\"0x8D81C006DAF336B\"", + "last-modified": "Mon, 29 Jun 2020 07:45:43 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "etag": "\"0x8D747578428C6E9\"", - "x-ms-request-id": "215f0cd7-201e-0080-6040-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "74a25bd4-2326-42a6-a9bd-edc41ece2156", - "content-length": "0" + "x-ms-client-request-id": "f58173cf-373d-49d9-8287-d9d8ac77245c", + "x-ms-request-id": "c6ab1622-301e-006a-6fe9-4d7a27000000", + "x-ms-version": "2019-07-07" } }, { "method": "PUT", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943/blob157003455048300515", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", "query": {}, "requestBody": "Hello World", "status": 201, "response": "", "responseHeaders": { - "x-ms-content-crc64": "YeJLfssylmU=", - "date": "Wed, 02 Oct 2019 16:42:30 GMT", - "last-modified": "Wed, 02 Oct 2019 16:42:30 GMT", - "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "content-length": "0", "content-md5": "sQqNsWTgdUEFt6mb5y4/5Q==", - "etag": "\"0x8D747578433A58C\"", - "x-ms-request-id": "215f0d14-201e-0080-1340-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "4a7171ac-62e6-43ad-9287-9ad39bf9e588", + "date": "Mon, 29 Jun 2020 07:45:43 GMT", + "etag": "\"0x8D81C006E0805EE\"", + "last-modified": "Mon, 29 Jun 2020 07:45:44 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "d67412d0-a8c0-45ec-b238-008a41bf5a56", + "x-ms-content-crc64": "YeJLfssylmU=", + "x-ms-request-id": "c6ab17f4-301e-006a-22e9-4d7a27000000", "x-ms-request-server-encrypted": "true", - "content-length": "0" + "x-ms-version": "2019-07-07" } }, { "method": "PUT", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943/blob157003455048300515", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", "query": { "comp": "snapshot" }, @@ -51,108 +51,126 @@ "status": 201, "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", - "last-modified": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:44 GMT", + "etag": "\"0x8D81C006E0805EE\"", + "last-modified": "Mon, 29 Jun 2020 07:45:44 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "etag": "\"0x8D747578433A58C\"", - "x-ms-request-id": "215f0d65-201e-0080-5940-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "58c5b2f1-c327-43f3-9f7c-a1b7a7d50612", + "x-ms-client-request-id": "5691bbd0-d002-4b5a-8fa6-0a59e7cc59a7", + "x-ms-request-id": "c6ab19bd-301e-006a-4ce9-4d7a27000000", "x-ms-request-server-encrypted": "false", - "content-length": "0", - "x-ms-snapshot": "2019-10-02T16:42:30.2779406Z" + "x-ms-snapshot": "2020-06-29T07:45:45.0286530Z", + "x-ms-version": "2019-07-07" } }, { "method": "HEAD", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943/blob157003455048300515", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", "query": { - "snapshot": "2019-10-02T16:42:30.2779406Z" + "snapshot": "2020-06-29T07:45:45.0286530Z" }, "requestBody": null, "status": 200, "response": "", "responseHeaders": { - "x-ms-blob-type": "BlockBlob", - "date": "Wed, 02 Oct 2019 16:42:30 GMT", - "content-md5": "sQqNsWTgdUEFt6mb5y4/5Q==", - "x-ms-tag-count": "0", - "x-ms-server-encrypted": "true", - "x-ms-client-request-id": "209a2e06-f911-4147-984c-d17017aea291", + "accept-ranges": "bytes", "content-length": "11", - "x-ms-access-tier": "Cool", - "x-ms-creation-time": "Wed, 02 Oct 2019 16:42:30 GMT", - "last-modified": "Wed, 02 Oct 2019 16:42:30 GMT", - "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "etag": "\"0x8D747578433A58C\"", + "content-md5": "sQqNsWTgdUEFt6mb5y4/5Q==", "content-type": "application/octet-stream", + "date": "Mon, 29 Jun 2020 07:45:44 GMT", + "etag": "\"0x8D81C006E0805EE\"", + "last-modified": "Mon, 29 Jun 2020 07:45:44 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-access-tier": "Hot", "x-ms-access-tier-inferred": "true", - "x-ms-version": "2019-02-02", - "accept-ranges": "bytes", - "x-ms-request-id": "215f0dac-201e-0080-1f40-7993dc000000", - "x-ms-snapshot": "2019-10-02T16:42:30.2779406Z" + "x-ms-blob-type": "BlockBlob", + "x-ms-client-request-id": "8d8b2309-e260-4f73-8934-2c99b3643452", + "x-ms-creation-time": "Mon, 29 Jun 2020 07:45:44 GMT", + "x-ms-request-id": "c6ab1bbd-301e-006a-05e9-4d7a27000000", + "x-ms-server-encrypted": "true", + "x-ms-version": "2019-07-07" } }, { "method": "DELETE", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943/blob157003455048300515", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", "query": { - "snapshot": "2019-10-02T16:42:30.2779406Z" + "snapshot": "2020-06-29T07:45:45.0286530Z" }, "requestBody": null, "status": 202, "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:45 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "5c4e0c91-900a-4461-942a-6724cc9c8521", "x-ms-delete-type-permanent": "false", - "x-ms-request-id": "215f0dfa-201e-0080-6940-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "8c2537b9-6491-48b4-9e65-ea01efc3d151", - "content-length": "0" + "x-ms-request-id": "c6ab1dee-301e-006a-5ee9-4d7a27000000", + "x-ms-version": "2019-07-07" } }, { "method": "DELETE", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943/blob157003455048300515", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", + "query": { + "snapshot": "2020-06-29T07:45:45.0286530Z" + }, + "requestBody": null, + "status": 404, + "response": "BlobNotFoundThe specified blob does not exist.\nRequestId:c6ab1ef9-301e-006a-4be9-4d7a27000000\nTime:2020-06-29T07:45:46.4689001Z", + "responseHeaders": { + "content-length": "215", + "content-type": "application/xml", + "date": "Mon, 29 Jun 2020 07:45:45 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "df013535-c7a6-4d30-b481-ad906122e016", + "x-ms-error-code": "BlobNotFound", + "x-ms-request-id": "c6ab1ef9-301e-006a-4be9-4d7a27000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180/blob159341674565700412", "query": {}, "requestBody": null, "status": 202, "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:46 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "144ce0fe-6287-4011-8e0d-d2059f9ad5d1", "x-ms-delete-type-permanent": "false", - "x-ms-request-id": "215f0e24-201e-0080-1040-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "cfb3d783-4983-4256-85bb-c0d76ad6f3a2", - "content-length": "0" + "x-ms-request-id": "c6ab20e8-301e-006a-10e9-4d7a27000000", + "x-ms-version": "2019-07-07" } }, { "method": "GET", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180", "query": { - "comp": "list", "include": "snapshots", - "restype": "container" + "restype": "container", + "comp": "list" }, "requestBody": null, "status": 200, - "response": "", + "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-type": "application/xml", + "date": "Mon, 29 Jun 2020 07:45:46 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", "transfer-encoding": "chunked", - "content-type": "application/xml", - "x-ms-request-id": "215f0e54-201e-0080-3b40-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "13d1af9b-7858-4c92-b184-fa608ca6fd61" + "x-ms-client-request-id": "5011540c-1afb-4534-aa6b-b70f30fb9ef8", + "x-ms-request-id": "c6ab22a0-301e-006a-16e9-4d7a27000000", + "x-ms-version": "2019-07-07" } }, { "method": "DELETE", - "url": "https://fakestorageaccount.blob.core.windows.net/container157003455041202943", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674506509180", "query": { "restype": "container" }, @@ -160,17 +178,21 @@ "status": 202, "response": "", "responseHeaders": { - "date": "Wed, 02 Oct 2019 16:42:30 GMT", + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:47 GMT", "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", - "x-ms-request-id": "215f0e87-201e-0080-6940-7993dc000000", - "x-ms-version": "2019-02-02", - "x-ms-client-request-id": "c40b2079-a9ba-4a03-abdb-89239209e244", - "content-length": "0" + "x-ms-client-request-id": "ac220f94-5a37-4d70-9d65-970bf6f893ce", + "x-ms-request-id": "c6ab245e-301e-006a-2ee9-4d7a27000000", + "x-ms-version": "2019-07-07" } } ], "uniqueTestInfo": { - "container": "container157003455041202943", - "blob": "blob157003455048300515" - } + "uniqueName": { + "container": "container159341674506509180", + "blob": "blob159341674565700412" + }, + "newDate": {} + }, + "hash": "5449bf4c6b366054c628261ba260927e" } \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_deleteifexists.json b/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_deleteifexists.json new file mode 100644 index 000000000000..be55cba03ce8 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/browsers/blobclient/recording_deleteifexists.json @@ -0,0 +1,107 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674112908273", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:40 GMT", + "etag": "\"0x8D81C006BE65948\"", + "last-modified": "Mon, 29 Jun 2020 07:45:40 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a3491ce8-2635-4d25-abd0-3293f9946b5c", + "x-ms-request-id": "c6ab0c14-301e-006a-1be9-4d7a27000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674112908273/blob159341674267205962", + "query": {}, + "requestBody": "Hello World", + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "content-md5": "sQqNsWTgdUEFt6mb5y4/5Q==", + "date": "Mon, 29 Jun 2020 07:45:40 GMT", + "etag": "\"0x8D81C006C4320EF\"", + "last-modified": "Mon, 29 Jun 2020 07:45:41 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4847a0e4-18cf-4970-81dd-3e4c315ea36b", + "x-ms-content-crc64": "YeJLfssylmU=", + "x-ms-request-id": "c6ab0e2a-301e-006a-07e9-4d7a27000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674112908273/blob159341674267205962", + "query": {}, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:41 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "c29ef75e-d5ec-41f2-8940-40dc8aeb4788", + "x-ms-delete-type-permanent": "false", + "x-ms-request-id": "c6ab1002-301e-006a-37e9-4d7a27000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674112908273/blob2159341674385306397", + "query": {}, + "requestBody": null, + "status": 404, + "response": "BlobNotFoundThe specified blob does not exist.\nRequestId:c6ab1204-301e-006a-14e9-4d7a27000000\nTime:2020-06-29T07:45:42.6483145Z", + "responseHeaders": { + "content-length": "215", + "content-type": "application/xml", + "date": "Mon, 29 Jun 2020 07:45:41 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "6fd6d947-b1bb-46c4-ad7e-d2e81c5abe59", + "x-ms-error-code": "BlobNotFound", + "x-ms-request-id": "c6ab1204-301e-006a-14e9-4d7a27000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container159341674112908273", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 07:45:42 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "442d9096-dbe2-41dd-a4f1-d971dc3eb021", + "x-ms-request-id": "c6ab13ff-301e-006a-66e9-4d7a27000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "container": "container159341674112908273", + "blob": "blob159341674267205962", + "blob2": "blob2159341674385306397" + }, + "newDate": {} + }, + "hash": "8cfb9a4cc56ebf355235df977184be08" +} \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_createifnotexists.json b/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_createifnotexists.json new file mode 100644 index 000000000000..f9d5e76cded0 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_createifnotexists.json @@ -0,0 +1,108 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977898953304407", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:28 GMT", + "etag": "\"0x8D7FAEA9ED18633\"", + "last-modified": "Mon, 18 May 2020 05:16:29 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a706b535-f439-4b10-9f4f-fc96535e9610", + "x-ms-request-id": "315c5623-301e-0045-09d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977898953304407", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 409, + "response": "ContainerAlreadyExistsThe specified container already exists.\nRequestId:315c56be-301e-0045-11d3-2c77ec000000\nTime:2020-05-18T05:16:29.3239574Z", + "responseHeaders": { + "content-length": "230", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:16:29 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "0de123b2-34c3-4720-9a7c-74ac181526c6", + "x-ms-error-code": "ContainerAlreadyExists", + "x-ms-request-id": "315c56be-301e-0045-11d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container2158977899137404377", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:29 GMT", + "etag": "\"0x8D7FAEA9F5D8BF8\"", + "last-modified": "Mon, 18 May 2020 05:16:29 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "595f2b25-40b5-472e-b245-7574856ecb12", + "x-ms-request-id": "315c57a9-301e-0045-63d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container2158977899137404377", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:30 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "c3e3bd3a-c92a-4a7c-bc62-969cd7f61f6c", + "x-ms-request-id": "315c58ca-301e-0045-64d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977898953304407", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:30 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "14a99ed8-8cef-45c4-b66a-d39c3be248b2", + "x-ms-request-id": "315c5993-301e-0045-21d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "container": "container158977898953304407", + "container2": "container2158977899137404377" + }, + "newDate": {} + }, + "hash": "d9c7dc1b415f156c20d632e9cdd9c598" +} \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_deleteifexists.json b/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_deleteifexists.json new file mode 100644 index 000000000000..50c47c6caee5 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/browsers/containerclient/recording_deleteifexists.json @@ -0,0 +1,109 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977899316704540", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:31 GMT", + "etag": "\"0x8D7FAEAA06FA2BF\"", + "last-modified": "Mon, 18 May 2020 05:16:31 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "81e9dcd5-18b0-481a-a0cb-1c07caeb915d", + "x-ms-request-id": "315c5a4b-301e-0045-49d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container2158977899375807936", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:32 GMT", + "etag": "\"0x8D7FAEAA0CA2F44\"", + "last-modified": "Mon, 18 May 2020 05:16:32 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "636b04c7-a232-4bc9-87ec-8e9fc163c257", + "x-ms-request-id": "315c5b82-301e-0045-64d3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container2158977899375807936", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:32 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "945a5bf4-20b4-4b02-a49f-98f2215b45ac", + "x-ms-request-id": "315c5c96-301e-0045-5ed3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container3158977899499501634", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 404, + "response": "ContainerNotFoundThe specified container does not exist.\nRequestId:315c5d93-301e-0045-4ed3-2c77ec000000\nTime:2020-05-18T05:16:33.5409468Z", + "responseHeaders": { + "content-length": "225", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:16:33 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "00780ca7-79db-4c13-8ae0-057d5c604892", + "x-ms-error-code": "ContainerNotFound", + "x-ms-request-id": "315c5d93-301e-0045-4ed3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977899316704540", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:16:33 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "0bab51cb-5375-4e4d-8156-269aac8cc241", + "x-ms-request-id": "315c5e90-301e-0045-3dd3-2c77ec000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "container": "container158977899316704540", + "container2": "container2158977899375807936", + "container3": "container3158977899499501634" + }, + "newDate": {} + }, + "hash": "7fe5c2ec7e849c7c67cd500d20d7936f" +} \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/browsers/pageblobclient/recording_createifnotexists.json b/sdk/storage/storage-blob/recordings/browsers/pageblobclient/recording_createifnotexists.json new file mode 100644 index 000000000000..ca1e49cb5f29 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/browsers/pageblobclient/recording_createifnotexists.json @@ -0,0 +1,87 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977220378104726", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:22 GMT", + "etag": "\"0x8D7FADAD1A29D4B\"", + "last-modified": "Mon, 18 May 2020 03:23:22 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "0302bcdd-b732-4e4f-ba46-8f9ecece2041", + "x-ms-request-id": "d0a5ab5d-e01e-0069-5ac3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977220378104726/blob158977220436307580", + "query": {}, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:22 GMT", + "etag": "\"0x8D7FADAD1FC51B6\"", + "last-modified": "Mon, 18 May 2020 03:23:22 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7a1d4ac4-d5a7-48cd-aed5-e3978ab9b46f", + "x-ms-request-id": "d0a5ad4f-e01e-0069-76c3-2c9b43000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977220378104726/blob158977220436307580", + "query": {}, + "requestBody": null, + "status": 409, + "response": "BlobAlreadyExistsThe specified blob already exists.\nRequestId:d0a5ae8f-e01e-0069-0ac3-2c9b43000000\nTime:2020-05-18T03:23:23.1980329Z", + "responseHeaders": { + "content-length": "220", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 03:23:23 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a8ba571b-bc7e-4fb3-ad2f-f51bd8172d16", + "x-ms-error-code": "BlobAlreadyExists", + "x-ms-request-id": "d0a5ae8f-e01e-0069-0ac3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/container158977220378104726", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 03:23:23 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "371dd386-28eb-49da-adc8-0243fab17ed2", + "x-ms-request-id": "d0a5b0ce-e01e-0069-1bc3-2c9b43000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "container": "container158977220378104726", + "blob": "blob158977220436307580" + }, + "newDate": {} + }, + "hash": "ca54c170e36521285331b748fac5742d" +} \ No newline at end of file diff --git a/sdk/storage/storage-blob/recordings/node/appendblobclient/recording_createifnotexists.js b/sdk/storage/storage-blob/recordings/node/appendblobclient/recording_createifnotexists.js new file mode 100644 index 000000000000..fe60dbc7a632 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/appendblobclient/recording_createifnotexists.js @@ -0,0 +1,89 @@ +let nock = require('nock'); + +module.exports.hash = "182afcbcd051964f01dd6aa10ef0860b"; + +module.exports.testInfo = {"uniqueName":{"container":"container158977214749307469","blob":"blob158977214884105113"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977214749307469') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 03:22:26 GMT', + 'ETag', + '"0x8D7FADAB0876854"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed205b1-701e-006b-26c3-2c25fb000000', + 'x-ms-client-request-id', + '0d50f179-961f-49ca-b81f-df1963fa169b', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 03:22:26 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977214749307469/blob158977214884105113') + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 03:22:27 GMT', + 'ETag', + '"0x8D7FADAB0B95B93"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed20642-701e-006b-2bc3-2c25fb000000', + 'x-ms-client-request-id', + 'c1ef56ec-7bc1-42e2-b234-2e69e3acd3e5', + 'x-ms-version', + '2019-07-07', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 03:22:26 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977214749307469/blob158977214884105113') + .reply(409, "BlobAlreadyExistsThe specified blob already exists.\nRequestId:eed206d9-701e-006b-39c3-2c25fb000000\nTime:2020-05-18T03:22:27.3887334Z", [ + 'Content-Length', + '220', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed206d9-701e-006b-39c3-2c25fb000000', + 'x-ms-client-request-id', + 'f8e303d9-7164-4e8e-81b0-b9f76badc938', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'BlobAlreadyExists', + 'Date', + 'Mon, 18 May 2020 03:22:26 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container158977214749307469') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed2074d-701e-006b-24c3-2c25fb000000', + 'x-ms-client-request-id', + '8dc0e559-e40c-49d7-a639-0dd9db5ec42c', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 03:22:27 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/blobclient/recording_delete_snapshot.js b/sdk/storage/storage-blob/recordings/node/blobclient/recording_delete_snapshot.js index c0db836b9a53..bdf97a817daa 100644 --- a/sdk/storage/storage-blob/recordings/node/blobclient/recording_delete_snapshot.js +++ b/sdk/storage/storage-blob/recordings/node/blobclient/recording_delete_snapshot.js @@ -1,197 +1,225 @@ let nock = require('nock'); -module.exports.testInfo = {"container":"container156816830699007626","blob":"blob156816830740709825"} +module.exports.hash = "afa85391c0cc900675990e5afe772e0c"; + +module.exports.testInfo = {"uniqueName":{"container":"container159341668720405141","blob":"blob159341668750408325"},"newDate":{}} nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/container156816830699007626') + .put('/container159341668720405141') .query(true) - .reply(201, "", [ 'Content-Length', + .reply(201, "", [ + 'Content-Length', '0', 'Last-Modified', - 'Wed, 11 Sep 2019 02:18:27 GMT', + 'Mon, 29 Jun 2020 07:44:45 GMT', 'ETag', - '"0x8D7365E54C73878"', + '"0x8D81C004B058141"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '1ab468b1-a01e-003f-7147-68d120000000', + '148ba47e-f01e-0065-1de9-4d0c4b000000', 'x-ms-client-request-id', - 'd37ce78a-f261-435a-8fc9-eacecd99eb19', + '8a525b0f-0d53-4c22-adeb-b5d77a0525ec', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'Date', - 'Wed, 11 Sep 2019 02:18:26 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:44 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/container156816830699007626/blob156816830740709825', "Hello World") - .reply(201, "", [ 'Content-Length', + .put('/container159341668720405141/blob159341668750408325', "Hello World") + .reply(201, "", [ + 'Content-Length', '0', 'Content-MD5', 'sQqNsWTgdUEFt6mb5y4/5Q==', 'Last-Modified', - 'Wed, 11 Sep 2019 02:18:27 GMT', + 'Mon, 29 Jun 2020 07:44:46 GMT', 'ETag', - '"0x8D7365E550842C4"', + '"0x8D81C004B3338A7"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '5b62e85c-801e-0001-6747-686701000000', + '148ba540-f01e-0065-3ce9-4d0c4b000000', 'x-ms-client-request-id', - '3b57baa3-ac09-4781-a04b-2f7f04ae4fe4', + 'c0348608-e0c6-4d84-b1b5-6f7317396a54', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'x-ms-content-crc64', 'YeJLfssylmU=', 'x-ms-request-server-encrypted', 'true', 'Date', - 'Wed, 11 Sep 2019 02:18:26 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:45 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .put('/container156816830699007626/blob156816830740709825') + .put('/container159341668720405141/blob159341668750408325') .query(true) - .reply(201, "", [ 'Content-Length', + .reply(201, "", [ + 'Content-Length', '0', 'Last-Modified', - 'Wed, 11 Sep 2019 02:18:27 GMT', + 'Mon, 29 Jun 2020 07:44:46 GMT', 'ETag', - '"0x8D7365E550842C4"', + '"0x8D81C004B3338A7"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '49227429-901e-0015-7a47-68a465000000', + '148ba620-f01e-0065-7be9-4d0c4b000000', 'x-ms-client-request-id', - 'a158121c-1f31-4c3c-8419-a0ca4c3ab217', + '9c3d9229-9ff4-4268-9b2c-4bcdaabb4ad1', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'x-ms-snapshot', - '2019-09-11T02:18:28.1807935Z', + '2020-06-29T07:44:46.3113040Z', 'x-ms-request-server-encrypted', 'false', 'Date', - 'Wed, 11 Sep 2019 02:18:27 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:45 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .head('/container156816830699007626/blob156816830740709825') + .head('/container159341668720405141/blob159341668750408325') .query(true) - .reply(200, "", [ 'Content-Length', + .reply(200, "", [ + 'Content-Length', '11', 'Content-Type', 'application/octet-stream', 'Content-MD5', 'sQqNsWTgdUEFt6mb5y4/5Q==', 'Last-Modified', - 'Wed, 11 Sep 2019 02:18:27 GMT', + 'Mon, 29 Jun 2020 07:44:46 GMT', 'Accept-Ranges', 'bytes', 'ETag', - '"0x8D7365E550842C4"', + '"0x8D81C004B3338A7"', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - 'f194ba7e-301e-0057-0847-688f71000000', + '148ba6d0-f01e-0065-17e9-4d0c4b000000', 'x-ms-client-request-id', - 'dc46702b-ea94-4517-b9a4-c2a02983fa74', + '6ee873d9-8f11-4e4c-8afe-db6646f93400', 'x-ms-version', - '2019-02-02', - 'x-ms-snapshot', - '2019-09-11T02:18:28.1807935Z', - 'x-ms-tag-count', - '0', + '2019-07-07', 'x-ms-creation-time', - 'Wed, 11 Sep 2019 02:18:27 GMT', + 'Mon, 29 Jun 2020 07:44:46 GMT', 'x-ms-blob-type', 'BlockBlob', 'x-ms-server-encrypted', 'true', 'x-ms-access-tier', - 'Cool', + 'Hot', 'x-ms-access-tier-inferred', 'true', 'Access-Control-Expose-Headers', - 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-snapshot,x-ms-tag-count,Content-Type,Last-Modified,ETag,x-ms-creation-time,Content-MD5,x-ms-blob-type,x-ms-server-encrypted,x-ms-access-tier,x-ms-access-tier-inferred,Accept-Ranges,Content-Length,Date,Transfer-Encoding', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Content-Type,Last-Modified,ETag,x-ms-creation-time,Content-MD5,x-ms-blob-type,x-ms-server-encrypted,x-ms-access-tier,x-ms-access-tier-inferred,Accept-Ranges,Content-Length,Date,Transfer-Encoding', 'Access-Control-Allow-Origin', '*', 'Date', - 'Wed, 11 Sep 2019 02:18:27 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:45 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/container156816830699007626/blob156816830740709825') + .delete('/container159341668720405141/blob159341668750408325') .query(true) - .reply(202, "", [ 'Content-Length', + .reply(202, "", [ + 'Content-Length', '0', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '0188a6d2-d01e-0019-6d47-684a94000000', + '148ba764-f01e-0065-19e9-4d0c4b000000', 'x-ms-client-request-id', - '52744197-7462-47bc-84d9-f2d1599c5545', + '51cdc4c9-4e36-4833-ab02-365350c8f6c5', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'x-ms-delete-type-permanent', 'false', 'Date', - 'Wed, 11 Sep 2019 02:18:28 GMT' ]); + 'Mon, 29 Jun 2020 07:44:46 GMT' +]); +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container159341668720405141/blob159341668750408325') + .query(true) + .reply(404, "BlobNotFoundThe specified blob does not exist.\nRequestId:148ba85b-f01e-0065-77e9-4d0c4b000000\nTime:2020-06-29T07:44:47.2845453Z", [ + 'Content-Length', + '215', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148ba85b-f01e-0065-77e9-4d0c4b000000', + 'x-ms-client-request-id', + 'feede690-2f09-4ef5-9db9-2af18c4d3705', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'BlobNotFound', + 'Date', + 'Mon, 29 Jun 2020 07:44:46 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/container156816830699007626/blob156816830740709825') - .reply(202, "", [ 'Content-Length', + .delete('/container159341668720405141/blob159341668750408325') + .reply(202, "", [ + 'Content-Length', '0', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '66b0912f-f01e-004a-7847-68569b000000', + '148ba91b-f01e-0065-21e9-4d0c4b000000', 'x-ms-client-request-id', - 'fd836213-9ac3-463b-9257-c0d0099ac627', + 'b3bf741f-2d57-4812-a610-79316ed2929d', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'x-ms-delete-type-permanent', 'false', 'Date', - 'Wed, 11 Sep 2019 02:18:28 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:46 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .get('/container156816830699007626') + .get('/container159341668720405141') .query(true) - .reply(200, "", [ 'Transfer-Encoding', + .reply(200, "", [ + 'Transfer-Encoding', 'chunked', 'Content-Type', 'application/xml', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - 'be43ac1d-201e-0007-3c47-689079000000', + '148ba9c5-f01e-0065-3de9-4d0c4b000000', 'x-ms-client-request-id', - '9da5858c-1cf8-4898-8310-622d0eef5358', + '92e8186a-6091-4216-ae21-1a3fec576f8f', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'Access-Control-Expose-Headers', 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Content-Type,Content-Length,Date,Transfer-Encoding', 'Access-Control-Allow-Origin', '*', 'Date', - 'Wed, 11 Sep 2019 02:18:29 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:47 GMT' +]); nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) - .delete('/container156816830699007626') + .delete('/container159341668720405141') .query(true) - .reply(202, "", [ 'Content-Length', + .reply(202, "", [ + 'Content-Length', '0', 'Server', 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', 'x-ms-request-id', - '9bf7f967-501e-0047-0847-68b997000000', + '148baab9-f01e-0065-17e9-4d0c4b000000', 'x-ms-client-request-id', - '06627d00-2545-4771-bb56-55500fea4663', + '490a55e5-67a5-4ba7-abe9-4bd305bfad19', 'x-ms-version', - '2019-02-02', + '2019-07-07', 'Date', - 'Wed, 11 Sep 2019 02:18:30 GMT' ]); - + 'Mon, 29 Jun 2020 07:44:47 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/blobclient/recording_deleteifexists.js b/sdk/storage/storage-blob/recordings/node/blobclient/recording_deleteifexists.js new file mode 100644 index 000000000000..b83c73b85a1c --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/blobclient/recording_deleteifexists.js @@ -0,0 +1,112 @@ +let nock = require('nock'); + +module.exports.hash = "ad00623b96703abd10479eb1162a588d"; + +module.exports.testInfo = {"uniqueName":{"container":"container159341668458503751","blob":"blob159341668595804648","blob2":"blob2159341668657509953"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container159341668458503751') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 29 Jun 2020 07:44:44 GMT', + 'ETag', + '"0x8D81C004A16B216"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148b9fd5-f01e-0065-7be9-4d0c4b000000', + 'x-ms-client-request-id', + '21f0d4a8-4c28-4367-99f1-6ccf9e0b63d4', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 07:44:43 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container159341668458503751/blob159341668595804648', "Hello World") + .reply(201, "", [ + 'Content-Length', + '0', + 'Content-MD5', + 'sQqNsWTgdUEFt6mb5y4/5Q==', + 'Last-Modified', + 'Mon, 29 Jun 2020 07:44:44 GMT', + 'ETag', + '"0x8D81C004A4971E1"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148ba0d9-f01e-0065-63e9-4d0c4b000000', + 'x-ms-client-request-id', + '8ec90cab-945f-4fa4-95ae-6057d8510080', + 'x-ms-version', + '2019-07-07', + 'x-ms-content-crc64', + 'YeJLfssylmU=', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 29 Jun 2020 07:44:43 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container159341668458503751/blob159341668595804648') + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148ba1a8-f01e-0065-1ae9-4d0c4b000000', + 'x-ms-client-request-id', + 'f99aee2f-7027-4de5-953a-fbc1a90d5e8e', + 'x-ms-version', + '2019-07-07', + 'x-ms-delete-type-permanent', + 'false', + 'Date', + 'Mon, 29 Jun 2020 07:44:44 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container159341668458503751/blob2159341668657509953') + .reply(404, "BlobNotFoundThe specified blob does not exist.\nRequestId:148ba281-f01e-0065-5de9-4d0c4b000000\nTime:2020-06-29T07:44:45.0880620Z", [ + 'Content-Length', + '215', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148ba281-f01e-0065-5de9-4d0c4b000000', + 'x-ms-client-request-id', + '54d4dd87-b16e-4571-8fb9-50076e3832db', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'BlobNotFound', + 'Date', + 'Mon, 29 Jun 2020 07:44:44 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container159341668458503751') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '148ba38a-f01e-0065-45e9-4d0c4b000000', + 'x-ms-client-request-id', + '5d53fb8e-d717-44e5-8736-a2cbfd079655', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 07:44:44 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/containerclient/recording_createifnotexists.js b/sdk/storage/storage-blob/recordings/node/containerclient/recording_createifnotexists.js new file mode 100644 index 000000000000..2524cdd62ec4 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/containerclient/recording_createifnotexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "8f96742aa7f5f2c3fbf2ae2881ac6ebc"; + +module.exports.testInfo = {"uniqueName":{"container":"container158977895191804446","container2":"container2158977895359500682"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977895191804446') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:15:51 GMT', + 'ETag', + '"0x8D7FAEA884EF299"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '809198b4-101e-0052-37d3-2cdee7000000', + 'x-ms-client-request-id', + 'a0621908-73be-4777-8916-8053776f29ed', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:51 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977895191804446') + .query(true) + .reply(409, "ContainerAlreadyExistsThe specified container already exists.\nRequestId:8091998e-101e-0052-7cd3-2cdee7000000\nTime:2020-05-18T05:15:51.5483295Z", [ + 'Content-Length', + '230', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '8091998e-101e-0052-7cd3-2cdee7000000', + 'x-ms-client-request-id', + 'e684fde9-78bf-4850-a7f2-6bdd3d7b44b5', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ContainerAlreadyExists', + 'Date', + 'Mon, 18 May 2020 05:15:51 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container2158977895359500682') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:15:51 GMT', + 'ETag', + '"0x8D7FAEA88AD506A"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919a5f-101e-0052-3bd3-2cdee7000000', + 'x-ms-client-request-id', + '6acd8757-a34e-47c9-ac2e-cac79ed3a581', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:51 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container2158977895359500682') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919b5a-101e-0052-1fd3-2cdee7000000', + 'x-ms-client-request-id', + 'c809a7d3-468e-4b85-8420-f27265beb7a1', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:52 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container158977895191804446') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919c1f-101e-0052-44d3-2cdee7000000', + 'x-ms-client-request-id', + '7a566973-d4dc-4802-87f5-e8d7fe6511d1', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:52 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/containerclient/recording_deleteifexists.js b/sdk/storage/storage-blob/recordings/node/containerclient/recording_deleteifexists.js new file mode 100644 index 000000000000..d3e2498bda73 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/containerclient/recording_deleteifexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "b0e0629f46595c8ad0ac3aa52f63d434"; + +module.exports.testInfo = {"uniqueName":{"container":"container158977895451106039","container2":"container2158977895481308612","container3":"container3158977895541909286"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977895451106039') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:15:52 GMT', + 'ETag', + '"0x8D7FAEA893907F1"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919cf0-101e-0052-6cd3-2cdee7000000', + 'x-ms-client-request-id', + '9cce3650-a136-4f46-91d6-c41ed703acb5', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:52 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container2158977895481308612') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:15:53 GMT', + 'ETag', + '"0x8D7FAEA8967734C"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919daf-101e-0052-03d3-2cdee7000000', + 'x-ms-client-request-id', + '4f37487f-1488-47d4-8eaa-435c93fe22a9', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:53 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container2158977895481308612') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919e6f-101e-0052-1bd3-2cdee7000000', + 'x-ms-client-request-id', + 'b4d54db2-0264-4f17-afc1-1e733eca8987', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:53 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container3158977895541909286') + .query(true) + .reply(404, "ContainerNotFoundThe specified container does not exist.\nRequestId:80919f4e-101e-0052-57d3-2cdee7000000\nTime:2020-05-18T05:15:53.6808389Z", [ + 'Content-Length', + '225', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '80919f4e-101e-0052-57d3-2cdee7000000', + 'x-ms-client-request-id', + '5d8eaac9-b24b-43d3-8380-73d9c7d06711', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ContainerNotFound', + 'Date', + 'Mon, 18 May 2020 05:15:53 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container158977895451106039') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '8091a048-101e-0052-37d3-2cdee7000000', + 'x-ms-client-request-id', + '2f6a7c3c-2a7a-486a-b204-e54d8addfbe8', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:15:53 GMT' +]); diff --git a/sdk/storage/storage-blob/recordings/node/pageblobclient/recording_createifnotexists.js b/sdk/storage/storage-blob/recordings/node/pageblobclient/recording_createifnotexists.js new file mode 100644 index 000000000000..a99aa73e0ee0 --- /dev/null +++ b/sdk/storage/storage-blob/recordings/node/pageblobclient/recording_createifnotexists.js @@ -0,0 +1,89 @@ +let nock = require('nock'); + +module.exports.hash = "fbf6feac48348943de323529a76f3f2f"; + +module.exports.testInfo = {"uniqueName":{"container":"container158977215391405044","blob":"blob158977215420602835"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977215391405044') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 03:22:32 GMT', + 'ETag', + '"0x8D7FADAB3BD57B0"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed2111d-701e-006b-28c3-2c25fb000000', + 'x-ms-client-request-id', + '265a89bd-236b-42ee-8cb0-a0a7512ee5d3', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 03:22:31 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977215391405044/blob158977215420602835') + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 03:22:32 GMT', + 'ETag', + '"0x8D7FADAB3EA4124"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed211a2-701e-006b-20c3-2c25fb000000', + 'x-ms-client-request-id', + '5b7bd94e-7988-4280-8b38-f57bfd3c6b42', + 'x-ms-version', + '2019-07-07', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 03:22:31 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/container158977215391405044/blob158977215420602835') + .reply(409, "BlobAlreadyExistsThe specified blob already exists.\nRequestId:eed21257-701e-006b-46c3-2c25fb000000\nTime:2020-05-18T03:22:32.7423460Z", [ + 'Content-Length', + '220', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed21257-701e-006b-46c3-2c25fb000000', + 'x-ms-client-request-id', + '2b1114b5-0a8a-46e1-bbe6-8d408935ea0d', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'BlobAlreadyExists', + 'Date', + 'Mon, 18 May 2020 03:22:32 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/container158977215391405044') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'eed21374-701e-006b-55c3-2c25fb000000', + 'x-ms-client-request-id', + '6471de5c-8a27-4cdd-9aec-023a1fe5322e', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 03:22:32 GMT' +]); diff --git a/sdk/storage/storage-blob/review/storage-blob.api.md b/sdk/storage/storage-blob/review/storage-blob.api.md index 10c05ece2200..81c38ee35dd7 100644 --- a/sdk/storage/storage-blob/review/storage-blob.api.md +++ b/sdk/storage/storage-blob/review/storage-blob.api.md @@ -179,6 +179,7 @@ export class AppendBlobClient extends BlobClient { appendBlock(body: HttpRequestBody, contentLength: number, options?: AppendBlobAppendBlockOptions): Promise; appendBlockFromURL(sourceURL: string, sourceOffset: number, count: number, options?: AppendBlobAppendBlockFromURLOptions): Promise; create(options?: AppendBlobCreateOptions): Promise; + createIfNotExists(options?: AppendBlobCreateIfNotExistsOptions): Promise; withSnapshot(snapshot: string): AppendBlobClient; } @@ -198,6 +199,20 @@ export interface AppendBlobCreateHeaders { version?: string; } +// @public +export interface AppendBlobCreateIfNotExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; + blobHTTPHeaders?: BlobHTTPHeaders; + customerProvidedKey?: CpkInfo; + encryptionScope?: string; + metadata?: Metadata; +} + +// @public +export interface AppendBlobCreateIfNotExistsResponse extends AppendBlobCreateResponse { + succeeded: boolean; +} + // @public export interface AppendBlobCreateOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -361,6 +376,7 @@ export class BlobClient extends StorageClient { get containerName(): string; createSnapshot(options?: BlobCreateSnapshotOptions): Promise; delete(options?: BlobDeleteOptions): Promise; + deleteIfExists(options?: BlobDeleteOptions): Promise; download(offset?: number, count?: number, options?: BlobDownloadOptions): Promise; downloadToBuffer(offset?: number, count?: number, options?: BlobDownloadToBufferOptions): Promise; downloadToBuffer(buffer: Buffer, offset?: number, count?: number, options?: BlobDownloadToBufferOptions): Promise; @@ -443,6 +459,11 @@ export interface BlobDeleteHeaders { version?: string; } +// @public +export interface BlobDeleteIfExistsResponse extends BlobDeleteResponse { + succeeded: boolean; +} + // @public export interface BlobDeleteOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -1236,8 +1257,10 @@ export class ContainerClient extends StorageClient { constructor(url: string, pipeline: Pipeline); get containerName(): string; create(options?: ContainerCreateOptions): Promise; + createIfNotExists(options?: ContainerCreateOptions): Promise; delete(options?: ContainerDeleteMethodOptions): Promise; deleteBlob(blobName: string, options?: BlobDeleteOptions): Promise; + deleteIfExists(options?: ContainerDeleteMethodOptions): Promise; exists(options?: ContainerExistsOptions): Promise; getAccessPolicy(options?: ContainerGetAccessPolicyOptions): Promise; getAppendBlobClient(blobName: string): AppendBlobClient; @@ -1272,6 +1295,11 @@ export interface ContainerCreateHeaders { version?: string; } +// @public +export interface ContainerCreateIfNotExistsResponse extends ContainerCreateResponse { + succeeded: boolean; +} + // @public export interface ContainerCreateOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -1297,6 +1325,11 @@ export interface ContainerDeleteHeaders { version?: string; } +// @public +export interface ContainerDeleteIfExistsResponse extends ContainerDeleteResponse { + succeeded: boolean; +} + // @public export interface ContainerDeleteMethodOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -1791,6 +1824,7 @@ export class PageBlobClient extends BlobClient { constructor(url: string, pipeline: Pipeline); clearPages(offset?: number, count?: number, options?: PageBlobClearPagesOptions): Promise; create(size: number, options?: PageBlobCreateOptions): Promise; + createIfNotExists(size: number, options?: PageBlobCreateIfNotExistsOptions): Promise; getPageRanges(offset?: number, count?: number, options?: PageBlobGetPageRangesOptions): Promise; getPageRangesDiff(offset: number, count: number, prevSnapshot: string, options?: PageBlobGetPageRangesDiffOptions): Promise; getPageRangesDiffForManagedDisks(offset: number, count: number, prevSnapshotUrl: string, options?: PageBlobGetPageRangesDiffOptions): Promise; @@ -1839,6 +1873,22 @@ export interface PageBlobCreateHeaders { version?: string; } +// @public +export interface PageBlobCreateIfNotExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; + blobHTTPHeaders?: BlobHTTPHeaders; + blobSequenceNumber?: number; + customerProvidedKey?: CpkInfo; + encryptionScope?: string; + metadata?: Metadata; + tier?: PremiumPageBlobTier | string; +} + +// @public +export interface PageBlobCreateIfNotExistsResponse extends PageBlobCreateResponse { + succeeded: boolean; +} + // @public export interface PageBlobCreateOptions extends CommonOptions { abortSignal?: AbortSignalLike; diff --git a/sdk/storage/storage-blob/src/Clients.ts b/sdk/storage/storage-blob/src/Clients.ts index 54ffcdb2bf6f..d70c67d2401e 100644 --- a/sdk/storage/storage-blob/src/Clients.ts +++ b/sdk/storage/storage-blob/src/Clients.ts @@ -86,7 +86,8 @@ import { generateBlockID } from "./utils/utils.common"; import { BLOCK_BLOB_MAX_STAGE_BLOCK_BYTES, BLOCK_BLOB_MAX_UPLOAD_BLOB_BYTES, - BLOCK_BLOB_MAX_BLOCKS + BLOCK_BLOB_MAX_BLOCKS, + ETagAny } from "./utils/constants"; import { BufferScheduler } from "./utils/BufferScheduler"; import { Readable } from "stream"; @@ -846,6 +847,22 @@ export interface BlobDownloadToBufferOptions extends CommonOptions { concurrency?: number; } +/** + * Contains response data for the {@link BlobClient.deleteIfExists} operation. + * + * @export + * @interface BlobDeleteIfExistsResponse + */ +export interface BlobDeleteIfExistsResponse extends BlobDeleteResponse { + /** + * Indicate whether the blob is successfully deleted. Is false if the blob does not exist in the first place. + * + * @type {boolean} + * @memberof BlobDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A BlobClient represents a URL to an Azure Storage blob; the blob may be a block blob, * append blob, or page blob. @@ -1350,6 +1367,52 @@ export class BlobClient extends StorageClient { } } + /** + * Marks the specified blob or snapshot for deletion if it exists. The blob is later deleted + * during garbage collection. Note that in order to delete a blob, you must delete + * all of its snapshots. You can delete both at the same time with the Delete + * Blob operation. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-blob + * + * @param {BlobDeleteOptions} [options] Optional options to Blob Delete operation. + * @returns {Promise} + * @memberof BlobClient + */ + public async deleteIfExists( + options: BlobDeleteOptions = {} + ): Promise { + const { span, spanOptions } = createSpan("BlobClient-deleteIfExists", options.tracingOptions); + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "BlobNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a blob or snapshot only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Restores the contents and metadata of soft deleted blob and any associated * soft deleted snapshots. Undelete Blob is supported only on version 2017-07-29 @@ -2091,6 +2154,54 @@ export interface AppendBlobCreateOptions extends CommonOptions { encryptionScope?: string; } +/** + * Options to configure {@link AppendBlobClient.createIfNotExists} operation. + * + * @export + * @interface AppendBlobCreateIfNotExistsOptions + */ +export interface AppendBlobCreateIfNotExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof AppendBlobCreateIfNotExistsOptions + */ + abortSignal?: AbortSignalLike; + /** + * HTTP headers to set when creating append blobs. + * + * @type {BlobHTTPHeaders} + * @memberof AppendBlobCreateIfNotExistsOptions + */ + blobHTTPHeaders?: BlobHTTPHeaders; + /** + * A collection of key-value string pair to associate with the blob when creating append blobs. + * + * @type {Metadata} + * @memberof AppendBlobCreateIfNotExistsOptions + */ + metadata?: Metadata; + /** + * Customer Provided Key Info. + * + * @type {CpkInfo} + * @memberof AppendBlobCreateIfNotExistsOptions + */ + customerProvidedKey?: CpkInfo; + /** + * Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to + * encrypt the data provided in the request. If not specified, encryption is performed with the + * default account encryption scope. For more information, see Encryption at Rest for Azure + * Storage Services. + * + * @type {string} + * @memberof AppendBlobCreateIfNotExistsOptions + */ + encryptionScope?: string; +} + /** * Options to configure the {@link AppendBlobClient.appendBlock} operation. * @@ -2229,6 +2340,22 @@ export interface AppendBlobAppendBlockFromURLOptions extends CommonOptions { encryptionScope?: string; } +/** + * Contains response data for the {@link appendBlobClient.createIfNotExists} operation. + * + * @export + * @interface AppendBlobCreateIfNotExistsResponse + */ +export interface AppendBlobCreateIfNotExistsResponse extends AppendBlobCreateResponse { + /** + * Indicate whether the blob is successfully created. Is false when the blob is not changed as it already exists. + * + * @type {boolean} + * @memberof AppendBlobCreateIfNotExistsResponse + */ + succeeded: boolean; +} + /** * AppendBlobClient defines a set of operations applicable to append blobs. * @@ -2455,6 +2582,56 @@ export class AppendBlobClient extends BlobClient { } } + /** + * Creates a 0-length append blob. Call AppendBlock to append data to an append blob. + * If the blob with the same name already exists, the content of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {AppendBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof AppendBlobClient + */ + public async createIfNotExists( + options: AppendBlobCreateIfNotExistsOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "AppendBlobClient-createIfNotExists", + options.tracingOptions + ); + const conditions = { ifNoneMatch: ETagAny }; + try { + const res = await this.create({ + ...options, + conditions, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "BlobAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Commits a new block of data to the end of the existing append blob. * @see https://docs.microsoft.com/rest/api/storageservices/append-block @@ -3980,6 +4157,70 @@ export interface PageBlobCreateOptions extends CommonOptions { tier?: PremiumPageBlobTier | string; } +/** + * Options to configure the {@link PageBlobClient.createIfNotExists} operation. + * + * @export + * @interface PageBlobCreateIfNotExistsOptions + */ +export interface PageBlobCreateIfNotExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof PageBlobCreateIfNotExistsOptions + */ + abortSignal?: AbortSignalLike; + /** + * A user-controlled value that can be used to track requests. + * The value must be between 0 and 2^63 - 1. The default value is 0. + * + * @type {number} + * @memberof PageBlobCreateIfNotExistsOptions + */ + blobSequenceNumber?: number; + /** + * HTTP headers to set when creating a page blob. + * + * @type {BlobHTTPHeaders} + * @memberof PageBlobCreateIfNotExistsOptions + */ + blobHTTPHeaders?: BlobHTTPHeaders; + /** + * A collection of key-value string pair to associate with the blob when creating append blobs. + * + * @type {Metadata} + * @memberof PageBlobCreateIfNotExistsOptions + */ + metadata?: Metadata; + /** + * Customer Provided Key Info. + * + * @type {CpkInfo} + * @memberof PageBlobCreateIfNotExistsOptions + */ + customerProvidedKey?: CpkInfo; + /** + * Optional. Version 2019-07-07 and later. Specifies the name of the encryption scope to use to + * encrypt the data provided in the request. If not specified, encryption is performed with the + * default account encryption scope. For more information, see Encryption at Rest for Azure + * Storage Services. + * + * @type {string} + * @memberof PageBlobCreateIfNotExistsOptions + */ + encryptionScope?: string; + /** + * Access tier. + * More Details - https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-storage-tiers + * + * @type {PremiumPageBlobTier | string} + * @memberof PageBlobCreateIfNotExistsOptions + */ + tier?: PremiumPageBlobTier | string; +} + /** * Options to configure the {@link PageBlobClient.uploadPages} operation. * @@ -4296,6 +4537,22 @@ export interface PageBlobUploadPagesFromURLOptions extends CommonOptions { encryptionScope?: string; } +/** + * Contains response data for the {@link PageBlobClient.createIfNotExists} operation. + * + * @export + * @interface PageBlobCreateIfNotExistsResponse + */ +export interface PageBlobCreateIfNotExistsResponse extends PageBlobCreateResponse { + /** + * Indicate whether the blob is successfully created. Is false when the blob is not changed as it already exists. + * + * @type {boolean} + * @memberof PageBlobCreateIfNotExistsResponse + */ + succeeded: boolean; +} + /** * PageBlobClient defines a set of operations applicable to page blobs. * @@ -4513,6 +4770,59 @@ export class PageBlobClient extends BlobClient { } } + /** + * Creates a page blob of the specified length. Call uploadPages to upload data + * data to a page blob. If the blob with the same name already exists, the content + * of the existing blob will remain unchanged. + * @see https://docs.microsoft.com/rest/api/storageservices/put-blob + * + * @param {number} size size of the page blob. + * @param {PageBlobCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof PageBlobClient + */ + public async createIfNotExists( + size: number, + options: PageBlobCreateIfNotExistsOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "PageBlobClient-createIfNotExists", + options.tracingOptions + ); + try { + const conditions = { ifNoneMatch: ETagAny }; + const res = await this.create(size, { + ...options, + conditions, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "BlobAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Writes 1 or more pages to the page blob. The start and end offsets must be a multiple of 512. * @see https://docs.microsoft.com/rest/api/storageservices/put-page @@ -5676,6 +5986,38 @@ export interface ContainerListBlobsOptions extends CommonOptions { includeUncommitedBlobs?: boolean; } +/** + * Contains response data for the {@link ContainerClient.createIfNotExists} operation. + * + * @export + * @interface ContainerCreateIfNotExistsResponse + */ +export interface ContainerCreateIfNotExistsResponse extends ContainerCreateResponse { + /** + * Indicate whether the container is successfully created. Is false when the container is not changed as it already exists. + * + * @type {boolean} + * @memberof ContainerCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link ContainerClient.deleteIfExists} operation. + * + * @export + * @interface ContainerDeleteIfExistsResponse + */ +export interface ContainerDeleteIfExistsResponse extends ContainerDeleteResponse { + /** + * Indicate whether the container is successfully deleted. Is false if the container does not exist in the first place. + * + * @type {boolean} + * @memberof ContainerDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A ContainerClient represents a URL to the Azure Storage container allowing you to manipulate its blobs. * @@ -5867,6 +6209,54 @@ export class ContainerClient extends StorageClient { } } + /** + * Creates a new container under the specified account. If the container with + * the same name already exists, it is not changed. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container + * + * @param {ContainerCreateOptions} [options] + * @returns {Promise} + * @memberof ContainerClient + */ + public async createIfNotExists( + options: ContainerCreateOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ContainerClient-createIfNotExists", + options.tracingOptions + ); + try { + const res = await this.create({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ContainerAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a container only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns true if the Azure container resource represented by this client exists; false otherwise. * @@ -6054,6 +6444,54 @@ export class ContainerClient extends StorageClient { } } + /** + * Marks the specified container for deletion if it exists. The container and any blobs + * contained within it are later deleted during garbage collection. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container + * + * @param {ContainerDeleteMethodOptions} [options] Options to Container Delete operation. + * @returns {Promise} + * @memberof ContainerClient + */ + public async deleteIfExists( + options: ContainerDeleteMethodOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ContainerClient-deleteIfExists", + options.tracingOptions + ); + + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ContainerNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a container only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Sets one or more user-defined name-value pairs for the specified container. * diff --git a/sdk/storage/storage-blob/test/appendblobclient.spec.ts b/sdk/storage/storage-blob/test/appendblobclient.spec.ts index 0c7ea31b632c..eb740182d732 100644 --- a/sdk/storage/storage-blob/test/appendblobclient.spec.ts +++ b/sdk/storage/storage-blob/test/appendblobclient.spec.ts @@ -64,6 +64,16 @@ describe("AppendBlobClient", () => { assert.equal(properties.metadata!.key2, options.metadata.key2); }); + it("createIfNotExists", async () => { + const res = await appendBlobClient.createIfNotExists(); + assert.ok(res.succeeded); + assert.ok(res.etag); + + const res2 = await appendBlobClient.createIfNotExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "BlobAlreadyExists"); + }); + it("appendBlock", async () => { await appendBlobClient.create(); diff --git a/sdk/storage/storage-blob/test/blobclient.spec.ts b/sdk/storage/storage-blob/test/blobclient.spec.ts index 0ba700f1af4c..2aec1943cfb0 100644 --- a/sdk/storage/storage-blob/test/blobclient.spec.ts +++ b/sdk/storage/storage-blob/test/blobclient.spec.ts @@ -173,6 +173,18 @@ describe("BlobClient", () => { await blobClient.delete(); }); + it("deleteIfExists", async () => { + const res = await blobClient.deleteIfExists(); + assert.ok(res.succeeded); + + const blobName2 = recorder.getUniqueName("blob2"); + const blobClient2 = containerClient.getBlobClient(blobName2); + // delete a non-existent blob + const res2 = await blobClient2.deleteIfExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "BlobNotFound"); + }); + // The following code illustrates deleting a snapshot after creating one it("delete snapshot", async () => { const result = await blobClient.createSnapshot(); @@ -182,6 +194,10 @@ describe("BlobClient", () => { await blobSnapshotClient.getProperties(); await blobSnapshotClient.delete(); + const res = await blobSnapshotClient.deleteIfExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "BlobNotFound"); + await blobClient.delete(); const result2 = ( diff --git a/sdk/storage/storage-blob/test/containerclient.spec.ts b/sdk/storage/storage-blob/test/containerclient.spec.ts index 6311258395dd..3a5896a589af 100644 --- a/sdk/storage/storage-blob/test/containerclient.spec.ts +++ b/sdk/storage/storage-blob/test/containerclient.spec.ts @@ -65,6 +65,34 @@ describe("ContainerClient", () => { assert.ok(result.clientRequestId); // As default pipeline involves UniqueRequestIDPolicy }); + it("createIfNotExists", async () => { + const res = await containerClient.createIfNotExists(); + assert.equal(res.succeeded, false); + assert.equal(res.errorCode, "ContainerAlreadyExists"); + + const containerName2 = recorder.getUniqueName("container2"); + const containerClient2 = blobServiceClient.getContainerClient(containerName2); + const res2 = await containerClient2.createIfNotExists(); + assert.equal(res2.succeeded, true); + assert.ok(res2.etag); + + await containerClient2.delete(); + }); + + it("deleteIfExists", async () => { + const containerName2 = recorder.getUniqueName("container2"); + const containerClient2 = blobServiceClient.getContainerClient(containerName2); + await containerClient2.create(); + const res = await containerClient2.deleteIfExists(); + assert.ok(res.succeeded); + + const containerName3 = recorder.getUniqueName("container3"); + const containerClient3 = blobServiceClient.getContainerClient(containerName3); + const res2 = await containerClient3.deleteIfExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "ContainerNotFound"); + }); + it("create with default parameters", (done) => { // create() with default parameters has been tested in beforeEach done(); diff --git a/sdk/storage/storage-blob/test/pageblobclient.spec.ts b/sdk/storage/storage-blob/test/pageblobclient.spec.ts index 043c83f0c9c5..9281abdc7f96 100644 --- a/sdk/storage/storage-blob/test/pageblobclient.spec.ts +++ b/sdk/storage/storage-blob/test/pageblobclient.spec.ts @@ -98,6 +98,16 @@ describe("PageBlobClient", () => { } }); + it("createIfNotExists", async () => { + const res = await pageBlobClient.createIfNotExists(512); + assert.ok(res.succeeded); + assert.ok(res.etag); + + const res2 = await pageBlobClient.createIfNotExists(512); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "BlobAlreadyExists"); + }); + it("uploadPages", async () => { await pageBlobClient.create(1024); diff --git a/sdk/storage/storage-file-datalake/CHANGELOG.md b/sdk/storage/storage-file-datalake/CHANGELOG.md index 6e753ac3f0e1..9008fb2429f1 100644 --- a/sdk/storage/storage-file-datalake/CHANGELOG.md +++ b/sdk/storage/storage-file-datalake/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 12.1.0 (unreleased) + +- Added convenience methods `createIfNotExists`, `deleteIfExists` to `DataLakeFileSystemClient`, `DataLakePathClient`, `DataLakeDirectoryClient`, and `DataLakeFileClient`. + ## 12.0.1 (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-datalake/recordings/browsers/datalakefilesystemclient/recording_createifnotexists.json b/sdk/storage/storage-file-datalake/recordings/browsers/datalakefilesystemclient/recording_createifnotexists.json new file mode 100644 index 000000000000..2e11b02947e3 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/browsers/datalakefilesystemclient/recording_createifnotexists.json @@ -0,0 +1,108 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978056950202862", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:48 GMT", + "etag": "\"0x8D7FAEE4C936B54\"", + "last-modified": "Mon, 18 May 2020 05:42:49 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b9ca1b09-f5c4-4aef-aa3b-673e9bc3c0df", + "x-ms-request-id": "15dabaa9-001e-00a5-54d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978056950202862158978057106306412", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:49 GMT", + "etag": "\"0x8D7FAEE4CEFF6E1\"", + "last-modified": "Mon, 18 May 2020 05:42:49 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "40b1f17b-f279-42a8-800c-82d2005fde14", + "x-ms-request-id": "15dabb85-001e-00a5-24d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978056950202862158978057106306412", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 409, + "response": "ContainerAlreadyExistsThe specified container already exists.\nRequestId:15dabbe7-001e-00a5-76d7-2c7e87000000\nTime:2020-05-18T05:42:49.9282287Z", + "responseHeaders": { + "content-length": "230", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:42:49 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "6d810382-9f01-4528-9ac2-6bc312c6c5a8", + "x-ms-error-code": "ContainerAlreadyExists", + "x-ms-request-id": "15dabbe7-001e-00a5-76d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978056950202862158978057106306412", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:50 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4a80f9c4-54ec-4368-abb3-e6a744bcb837", + "x-ms-request-id": "15dabca0-001e-00a5-1ed7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978056950202862", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:50 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "f3b831a8-dfff-43df-8f01-c5d87da43cc9", + "x-ms-request-id": "15dabd8d-001e-00a5-67d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "filesystem": "filesystem158978056950202862", + "filesystem158978056950202862": "filesystem158978056950202862158978057106306412" + }, + "newDate": {} + }, + "hash": "d2c1dddb7afb8e7cda0f3df363449343" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-datalake/recordings/browsers/datalakefilesystemclient/recording_deleteifexists.json b/sdk/storage/storage-file-datalake/recordings/browsers/datalakefilesystemclient/recording_deleteifexists.json new file mode 100644 index 000000000000..c3294e4332db --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/browsers/datalakefilesystemclient/recording_deleteifexists.json @@ -0,0 +1,108 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057319505927", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:51 GMT", + "etag": "\"0x8D7FAEE4E33DF4C\"", + "last-modified": "Mon, 18 May 2020 05:42:51 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "9ee1136d-2c18-430f-82e5-6a25e95786ae", + "x-ms-request-id": "15dabe91-001e-00a5-6bd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057319505927158978057377701071", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 404, + "response": "ContainerNotFoundThe specified container does not exist.\nRequestId:15dac006-001e-00a5-1dd7-2c7e87000000\nTime:2020-05-18T05:42:52.3242191Z", + "responseHeaders": { + "content-length": "225", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:42:52 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b16ad610-63c2-443f-a5eb-e230e032bb0d", + "x-ms-error-code": "ContainerNotFound", + "x-ms-request-id": "15dac006-001e-00a5-1dd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057319505927158978057377701071", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:52 GMT", + "etag": "\"0x8D7FAEE4EE33057\"", + "last-modified": "Mon, 18 May 2020 05:42:52 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fd36e9a3-be56-424f-a92e-25ff040219ee", + "x-ms-request-id": "15dac126-001e-00a5-1ed7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057319505927158978057377701071", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:53 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "835b0d77-99fd-4e6f-955c-bdd8e10be154", + "x-ms-request-id": "15dac265-001e-00a5-74d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057319505927", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:53 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "92a91c39-3fa1-4d4b-bc19-d6b99dfae527", + "x-ms-request-id": "15dac357-001e-00a5-4fd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "filesystem": "filesystem158978057319505927", + "filesystem158978057319505927": "filesystem158978057319505927158978057377701071" + }, + "newDate": {} + }, + "hash": "fbb56cb4c4e266e407f6137fade18987" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.json b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.json new file mode 100644 index 000000000000..ce2fe7ad7593 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.json @@ -0,0 +1,153 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057610606087", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:54 GMT", + "etag": "\"0x8D7FAEE4FEFF779\"", + "last-modified": "Mon, 18 May 2020 05:42:54 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4cc8f9c4-aa0a-4d4e-8645-1b293df8347e", + "x-ms-request-id": "15dac458-001e-00a5-2cd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978057610606087/file158978057668701341", + "query": { + "resource": "file" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:55 GMT", + "etag": "\"0x8D7FAEE50E59DD8\"", + "last-modified": "Mon, 18 May 2020 05:42:56 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "29d57229-0f87-4e6a-b26c-08dc4aa61287", + "x-ms-request-id": "bdcbc679-101f-005f-01d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978057610606087/file158978057668701341", + "query": { + "position": "0", + "action": "append" + }, + "requestBody": "Hello World", + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:56 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fbae98a8-ccc4-4805-89d5-250799a1031d", + "x-ms-request-id": "bdcbc6a5-101f-005f-2dd7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978057610606087/file158978057668701341", + "query": { + "position": "11", + "action": "flush" + }, + "requestBody": "", + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:56 GMT", + "etag": "\"0x8D7FAEE519600BB\"", + "last-modified": "Mon, 18 May 2020 05:42:57 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "992185fd-5d73-4e00-9ff3-abf6795e8fa8", + "x-ms-request-id": "bdcbc6cd-101f-005f-55d7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978057610606087/dir158978057944601135", + "query": { + "resource": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:57 GMT", + "etag": "\"0x8D7FAEE51EDEF7C\"", + "last-modified": "Mon, 18 May 2020 05:42:57 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4ca7fa54-1b2e-4387-b0d8-ef39737019ec", + "x-ms-request-id": "bdcbc6f1-101f-005f-79d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978057610606087/dir158978057944601135", + "query": { + "resource": "directory" + }, + "requestBody": null, + "status": 409, + "response": "{\"error\":{\"code\":\"PathAlreadyExists\",\"message\":\"The specified path already exists.\\nRequestId:bdcbc702-101f-005f-0ad7-2cb760000000\\nTime:2020-05-18T05:42:58.2793770Z\"}}", + "responseHeaders": { + "content-length": "168", + "content-type": "application/json;charset=utf-8", + "date": "Mon, 18 May 2020 05:42:57 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "e9688972-709e-4d09-9fbb-7243827bf36d", + "x-ms-error-code": "PathAlreadyExists", + "x-ms-request-id": "bdcbc702-101f-005f-0ad7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978057610606087", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:58 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "89c67459-4247-436a-a306-05cec273a122", + "x-ms-request-id": "15dacb75-001e-00a5-0dd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "filesystem": "filesystem158978057610606087", + "file": "file158978057668701341", + "dir": "dir158978057944601135" + }, + "newDate": {} + }, + "hash": "334989a3215fedac66110333330bc920" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakefileclientcreateifnotexists.json b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakefileclientcreateifnotexists.json new file mode 100644 index 000000000000..81a25715c3e3 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakefileclientcreateifnotexists.json @@ -0,0 +1,132 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978058090909990", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:59 GMT", + "etag": "\"0x8D7FAEE52CCFF55\"", + "last-modified": "Mon, 18 May 2020 05:42:59 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "f2b928a0-2f16-4c9f-bac7-6bf32f0b47bf", + "x-ms-request-id": "15dacc48-001e-00a5-47d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058090909990/file158978058149204991", + "query": { + "resource": "file" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:59 GMT", + "etag": "\"0x8D7FAEE532B89BB\"", + "last-modified": "Mon, 18 May 2020 05:43:00 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "da84be6d-3585-4fa0-bad0-3f43064e3525", + "x-ms-request-id": "bdcbc765-101f-005f-6cd7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058090909990/file158978058149204991", + "query": { + "position": "0", + "action": "append" + }, + "requestBody": "Hello World", + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:42:59 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "61c134c2-a100-4c76-abb5-52c5d781eb86", + "x-ms-request-id": "bdcbc788-101f-005f-0fd7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058090909990/file158978058149204991", + "query": { + "position": "11", + "action": "flush" + }, + "requestBody": "", + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:00 GMT", + "etag": "\"0x8D7FAEE53DBF591\"", + "last-modified": "Mon, 18 May 2020 05:43:01 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4e5f1fa7-cc81-4229-9384-6c6b3034309b", + "x-ms-request-id": "bdcbc7ac-101f-005f-32d7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058090909990/file158978058149204991", + "query": { + "resource": "file" + }, + "requestBody": null, + "status": 409, + "response": "{\"error\":{\"code\":\"PathAlreadyExists\",\"message\":\"The specified path already exists.\\nRequestId:bdcbc7cd-101f-005f-53d7-2cb760000000\\nTime:2020-05-18T05:43:01.8033083Z\"}}", + "responseHeaders": { + "content-length": "168", + "content-type": "application/json;charset=utf-8", + "date": "Mon, 18 May 2020 05:43:01 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "41ed0375-b693-458c-90d3-024b5b3b87a1", + "x-ms-error-code": "PathAlreadyExists", + "x-ms-request-id": "bdcbc7cd-101f-005f-53d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978058090909990", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:02 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "31ed2f6b-8d84-4f06-b092-df630075b49e", + "x-ms-request-id": "15dad038-001e-00a5-4fd7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "filesystem": "filesystem158978058090909990", + "file": "file158978058149204991" + }, + "newDate": {} + }, + "hash": "f7176b5fa4ce66198ec0eed42335ec53" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakepathclientdeleteifexists.json b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakepathclientdeleteifexists.json new file mode 100644 index 000000000000..0c659dd6d461 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/browsers/datalakepathclient/recording_datalakepathclientdeleteifexists.json @@ -0,0 +1,167 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978058443504810", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:02 GMT", + "etag": "\"0x8D7FAEE54E7511A\"", + "last-modified": "Mon, 18 May 2020 05:43:02 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "dff23c05-a5ec-4373-90ee-30e207a5e3ff", + "x-ms-request-id": "15dad0e5-001e-00a5-70d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/file158978058502300502", + "query": { + "resource": "file" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:02 GMT", + "etag": "\"0x8D7FAEE554309AF\"", + "last-modified": "Mon, 18 May 2020 05:43:03 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "203b47a0-8987-4a74-b5f3-7a83236a3a4f", + "x-ms-request-id": "bdcbc82a-101f-005f-30d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/file158978058502300502", + "query": { + "position": "0", + "action": "append" + }, + "requestBody": "Hello World", + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:03 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "8244c175-e24c-480e-babc-7213c46ce574", + "x-ms-request-id": "bdcbc83d-101f-005f-42d7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PATCH", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/file158978058502300502", + "query": { + "position": "11", + "action": "flush" + }, + "requestBody": "", + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:04 GMT", + "etag": "\"0x8D7FAEE55F4D69E\"", + "last-modified": "Mon, 18 May 2020 05:43:04 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "1549c622-bf11-4591-adef-30f6b379e336", + "x-ms-request-id": "bdcbc843-101f-005f-48d7-2cb760000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/dir158978058677805985", + "query": {}, + "requestBody": null, + "status": 404, + "response": "{\"error\":{\"code\":\"PathNotFound\",\"message\":\"The specified path does not exist.\\nRequestId:bdcbc849-101f-005f-4ed7-2cb760000000\\nTime:2020-05-18T05:43:05.3252343Z\"}}", + "responseHeaders": { + "content-length": "163", + "content-type": "application/json;charset=utf-8", + "date": "Mon, 18 May 2020 05:43:04 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "6161d563-bed7-4640-bc99-354f2619cfe1", + "x-ms-error-code": "PathNotFound", + "x-ms-request-id": "bdcbc849-101f-005f-4ed7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/dir158978058677805985", + "query": { + "resource": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:05 GMT", + "etag": "\"0x8D7FAEE56A451B4\"", + "last-modified": "Mon, 18 May 2020 05:43:05 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "4953c250-19ee-4956-98ab-ed4c0325a14a", + "x-ms-request-id": "bdcbc84b-101f-005f-50d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.dfs.core.windows.net/filesystem158978058443504810/dir158978058677805985", + "query": {}, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:05 GMT", + "server": "Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fb996841-b205-4a4c-8d8d-49cb304aea74", + "x-ms-request-id": "bdcbc84c-101f-005f-51d7-2cb760000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.blob.core.windows.net/filesystem158978058443504810", + "query": { + "restype": "container" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:43:06 GMT", + "server": "Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "e1f124b9-d414-403d-959d-34422f6fd935", + "x-ms-request-id": "15dad5b7-001e-00a5-52d7-2c7e87000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "filesystem": "filesystem158978058443504810", + "file": "file158978058502300502", + "dir": "dir158978058677805985" + }, + "newDate": {} + }, + "hash": "e6fccfcc91f368ed4b5bddba0212ceb0" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_createifnotexists.js b/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_createifnotexists.js new file mode 100644 index 000000000000..69c2b8cc70f6 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_createifnotexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "20dbc14eb779c9620f4adbba78aa35ca"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem158977960418708486","filesystem158977960418708486":"filesystem158977960418708486158977960748306575"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977960418708486') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:45 GMT', + 'ETag', + '"0x8D7FAEC0E0BABF5"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bd6f8-a01e-002b-2dd4-2c3126000000', + 'x-ms-client-request-id', + '35e3dc14-51eb-48df-9027-262f222639a4', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:44 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977960418708486158977960748306575') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:45 GMT', + 'ETag', + '"0x8D7FAEC0E6EC870"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bd83c-a01e-002b-56d4-2c3126000000', + 'x-ms-client-request-id', + 'c0647c84-ab76-40ab-83af-7d601e52a85f', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:45 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977960418708486158977960748306575') + .query(true) + .reply(409, "ContainerAlreadyExistsThe specified container already exists.\nRequestId:dc4bd8f2-a01e-002b-7cd4-2c3126000000\nTime:2020-05-18T05:26:46.1284743Z", [ + 'Content-Length', + '230', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bd8f2-a01e-002b-7cd4-2c3126000000', + 'x-ms-client-request-id', + 'ee8432a2-2585-473d-aaa0-ee45e4902544', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ContainerAlreadyExists', + 'Date', + 'Mon, 18 May 2020 05:26:45 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977960418708486158977960748306575') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bd9a9-a01e-002b-1fd4-2c3126000000', + 'x-ms-client-request-id', + '9940ef89-f0f5-4695-a1e3-e52f2fd40fd3', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:46 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977960418708486') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdaa1-a01e-002b-08d4-2c3126000000', + 'x-ms-client-request-id', + 'bab87cc5-fa72-416d-92dc-6e7ace950c85', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:46 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_deleteifexists.js b/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_deleteifexists.js new file mode 100644 index 000000000000..f38856042504 --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/datalakefilesystemclient/recording_deleteifexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "89c02adcefa8cfbd0c30ffd7ecf1b9bd"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem158977960906408084","filesystem158977960906408084":"filesystem158977960906408084158977960937306987"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977960906408084') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:47 GMT', + 'ETag', + '"0x8D7FAEC0F5CDD31"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdb84-a01e-002b-60d4-2c3126000000', + 'x-ms-client-request-id', + '4ff67a02-50ad-47e1-8130-cf405eb5ed88', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:46 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977960906408084158977960937306987') + .query(true) + .reply(404, "ContainerNotFoundThe specified container does not exist.\nRequestId:dc4bdc35-a01e-002b-02d4-2c3126000000\nTime:2020-05-18T05:26:47.6287116Z", [ + 'Content-Length', + '225', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdc35-a01e-002b-02d4-2c3126000000', + 'x-ms-client-request-id', + '6efbbfbb-6911-4ee1-877e-5b5e9b0671f9', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ContainerNotFound', + 'Date', + 'Mon, 18 May 2020 05:26:47 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977960906408084158977960937306987') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:47 GMT', + 'ETag', + '"0x8D7FAEC0FB82FD2"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdcbd-a01e-002b-7cd4-2c3126000000', + 'x-ms-client-request-id', + '885c5736-4127-4782-964c-5afc78f653bb', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:47 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977960906408084158977960937306987') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdd75-a01e-002b-24d4-2c3126000000', + 'x-ms-client-request-id', + '6dbd449c-804c-4518-99b6-05554e219398', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:47 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977960906408084') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bde30-a01e-002b-4bd4-2c3126000000', + 'x-ms-client-request-id', + 'f1043536-e432-4db0-ab4b-8eceb05c3375', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:48 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.js b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.js new file mode 100644 index 000000000000..eaa18644ca4b --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakedirectoryclientcreateifnotexists.js @@ -0,0 +1,155 @@ +let nock = require('nock'); + +module.exports.hash = "720d743ded24f582eadd4ae8659a2dac"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem158977961057503329","file":"file158977961087608276","dir":"dir158977961287500504"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961057503329') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:48 GMT', + 'ETag', + '"0x8D7FAEC1043EB89"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bdec0-a01e-002b-55d4-2c3126000000', + 'x-ms-client-request-id', + '00321166-23da-4020-933d-48e55bea3769', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:48 GMT' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961057503329/file158977961087608276') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:50 GMT', + 'ETag', + '"0x8D7FAEC111932E9"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4c4-b01f-0070-34d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '40831bcb-20fe-4ac8-86ac-37c5114c8a58', + 'Date', + 'Mon, 18 May 2020 05:26:49 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961057503329/file158977961087608276', "Hello World") + .query(true) + .reply(202, "", [ + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4c5-b01f-0070-35d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'c6847254-86cc-45cf-a643-9f2809ffc38b', + 'Date', + 'Mon, 18 May 2020 05:26:49 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961057503329/file158977961087608276') + .query(true) + .reply(200, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:50 GMT', + 'ETag', + '"0x8D7FAEC1176AF33"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4c6-b01f-0070-36d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'c94ddeea-b53d-42d7-8cf2-99cc40847db2', + 'Date', + 'Mon, 18 May 2020 05:26:50 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961057503329/dir158977961287500504') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:51 GMT', + 'ETag', + '"0x8D7FAEC11A5403D"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4c7-b01f-0070-37d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'b59ba02f-cd21-4ac7-a31e-03ff0a9dd896', + 'Date', + 'Mon, 18 May 2020 05:26:50 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961057503329/dir158977961287500504') + .query(true) + .reply(409, {"error":{"code":"PathAlreadyExists","message":"The specified path already exists.\nRequestId:2823e4c8-b01f-0070-38d4-2c365a000000\nTime:2020-05-18T05:26:51.4395475Z"}}, [ + 'Content-Length', + '168', + 'Content-Type', + 'application/json;charset=utf-8', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-error-code', + 'PathAlreadyExists', + 'x-ms-request-id', + '2823e4c8-b01f-0070-38d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'd8f499fe-b4f6-4ffa-95ca-9e5f4f4dcbd9', + 'Date', + 'Mon, 18 May 2020 05:26:50 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977961057503329') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4be47a-a01e-002b-1ad4-2c3126000000', + 'x-ms-client-request-id', + '334ae9bc-1126-4104-857a-7a8b8475a696', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:51 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakefileclientcreateifnotexists.js b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakefileclientcreateifnotexists.js new file mode 100644 index 000000000000..eb75056a2dbe --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakefileclientcreateifnotexists.js @@ -0,0 +1,133 @@ +let nock = require('nock'); + +module.exports.hash = "1811b46713226bbde364c95d60a8ea4e"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem158977961377602903","file":"file158977961409907239"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961377602903') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:52 GMT', + 'ETag', + '"0x8D7FAEC122C2572"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4be52f-a01e-002b-41d4-2c3126000000', + 'x-ms-client-request-id', + 'a6024aa2-65f7-462d-943c-8c4e9b66d7b7', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:51 GMT' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961377602903/file158977961409907239') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:52 GMT', + 'ETag', + '"0x8D7FAEC12608474"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4c9-b01f-0070-39d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '3eb0261a-53de-401f-b7bd-a1f56115bd5d', + 'Date', + 'Mon, 18 May 2020 05:26:51 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961377602903/file158977961409907239', "Hello World") + .query(true) + .reply(202, "", [ + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4ca-b01f-0070-3ad4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'e7b78740-0a29-4920-b6a3-20b7fcfe4617', + 'Date', + 'Mon, 18 May 2020 05:26:51 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961377602903/file158977961409907239') + .query(true) + .reply(200, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:52 GMT', + 'ETag', + '"0x8D7FAEC12BD0C71"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4cb-b01f-0070-3bd4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '4c1d3f4c-d135-417a-bcff-598df8be3f99', + 'Date', + 'Mon, 18 May 2020 05:26:52 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961377602903/file158977961409907239') + .query(true) + .reply(409, {"error":{"code":"PathAlreadyExists","message":"The specified path already exists.\nRequestId:2823e4cc-b01f-0070-3cd4-2c365a000000\nTime:2020-05-18T05:26:53.2810660Z"}}, [ + 'Content-Length', + '168', + 'Content-Type', + 'application/json;charset=utf-8', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-error-code', + 'PathAlreadyExists', + 'x-ms-request-id', + '2823e4cc-b01f-0070-3cd4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '6ccdf7be-52c6-4fa4-a3f8-8053c55146c6', + 'Date', + 'Mon, 18 May 2020 05:26:52 GMT' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977961377602903') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4be885-a01e-002b-4ad4-2c3126000000', + 'x-ms-client-request-id', + 'b2fd7748-868c-491a-9452-071f5fd652d3', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:53 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakepathclientdeleteifexists.js b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakepathclientdeleteifexists.js new file mode 100644 index 000000000000..8f09f2ce2f3d --- /dev/null +++ b/sdk/storage/storage-file-datalake/recordings/node/datalakepathclient/recording_datalakepathclientdeleteifexists.js @@ -0,0 +1,171 @@ +let nock = require('nock'); + +module.exports.hash = "17316020828266734478147489dea269"; + +module.exports.testInfo = {"uniqueName":{"filesystem":"filesystem158977961561501572","file":"file158977961591704183","dir":"dir158977961681406305"},"newDate":{}} + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961561501572') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:26:53 GMT', + 'ETag', + '"0x8D7FAEC1344D59F"', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4be8fe-a01e-002b-3dd4-2c3126000000', + 'x-ms-client-request-id', + 'f1176dc0-3ffd-4118-9b61-164c76a56860', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:53 GMT' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961561501572/file158977961591704183') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:54 GMT', + 'ETag', + '"0x8D7FAEC1375B2EC"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4cd-b01f-0070-3dd4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'eee57c09-aea5-46d0-aff0-aaa15e70f68f', + 'Date', + 'Mon, 18 May 2020 05:26:53 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961561501572/file158977961591704183', "Hello World") + .query(true) + .reply(202, "", [ + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4ce-b01f-0070-3ed4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '775db9f4-4231-48e3-a5ae-d45f2ff2a9ff', + 'Date', + 'Mon, 18 May 2020 05:26:53 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .patch('/filesystem158977961561501572/file158977961591704183') + .query(true) + .reply(200, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:54 GMT', + 'ETag', + '"0x8D7FAEC13CFFE23"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-server-encrypted', + 'true', + 'x-ms-request-id', + '2823e4d1-b01f-0070-41d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '03756e83-5941-4605-8a82-9a8c20c4f0f9', + 'Date', + 'Mon, 18 May 2020 05:26:54 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977961561501572/dir158977961681406305') + .reply(404, {"error":{"code":"PathNotFound","message":"The specified path does not exist.\nRequestId:2823e4d8-b01f-0070-48d4-2c365a000000\nTime:2020-05-18T05:26:55.0795499Z"}}, [ + 'Content-Length', + '163', + 'Content-Type', + 'application/json;charset=utf-8', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-error-code', + 'PathNotFound', + 'x-ms-request-id', + '2823e4d8-b01f-0070-48d4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '86eeec30-ee07-4e10-8706-1e07424755b2', + 'Date', + 'Mon, 18 May 2020 05:26:54 GMT' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .put('/filesystem158977961561501572/dir158977961681406305') + .query(true) + .reply(201, "", [ + 'Last-Modified', + 'Mon, 18 May 2020 05:26:55 GMT', + 'ETag', + '"0x8D7FAEC1429C71F"', + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4dd-b01f-0070-4cd4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + '76f58d30-797e-4cf0-8fe4-f4b783b9f5a3', + 'Date', + 'Mon, 18 May 2020 05:26:54 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.dfs.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977961561501572/dir158977961681406305') + .reply(200, "", [ + 'Server', + 'Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + '2823e4e0-b01f-0070-4fd4-2c365a000000', + 'x-ms-version', + '2019-07-07', + 'x-ms-client-request-id', + 'f3557731-2ac0-4591-8099-e4690aed2662', + 'Date', + 'Mon, 18 May 2020 05:26:54 GMT', + 'Content-Length', + '0' +]); + +nock('https://fakestorageaccount.blob.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/filesystem158977961561501572') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'dc4bed2c-a01e-002b-25d4-2c3126000000', + 'x-ms-client-request-id', + '3ddc4336-029d-484f-a62d-6935bc1ccd54', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:26:55 GMT' +]); diff --git a/sdk/storage/storage-file-datalake/review/storage-file-datalake.api.md b/sdk/storage/storage-file-datalake/review/storage-file-datalake.api.md index 063b97d97cd8..88c213ae9301 100644 --- a/sdk/storage/storage-file-datalake/review/storage-file-datalake.api.md +++ b/sdk/storage/storage-file-datalake/review/storage-file-datalake.api.md @@ -133,6 +133,8 @@ export type CredentialPolicyCreator = (nextPolicy: RequestPolicy, options: Reque export class DataLakeDirectoryClient extends DataLakePathClient { create(resourceType: PathResourceType, options?: PathCreateOptions): Promise; create(options?: DirectoryCreateOptions): Promise; + createIfNotExists(resourceType: PathResourceType, options?: PathCreateIfNotExistsOptions): Promise; + createIfNotExists(options?: DirectoryCreateIfNotExistsOptions): Promise; getFileClient(fileName: string): DataLakeFileClient; getSubdirectoryClient(subdirectoryName: string): DataLakeDirectoryClient; } @@ -144,6 +146,8 @@ export class DataLakeFileClient extends DataLakePathClient { append(body: HttpRequestBody, offset: number, length: number, options?: FileAppendOptions): Promise; create(resourceType: PathResourceType, options?: PathCreateOptions): Promise; create(options?: FileCreateOptions): Promise; + createIfNotExists(resourceType: PathResourceType, options?: PathCreateIfNotExistsOptions): Promise; + createIfNotExists(options?: FileCreateIfNotExistsOptions): Promise; flush(position: number, options?: FileFlushOptions): Promise; read(offset?: number, count?: number, options?: FileReadOptions): Promise; readToBuffer(buffer: Buffer, offset?: number, count?: number, options?: FileReadToBufferOptions): Promise; @@ -161,7 +165,9 @@ export class DataLakeFileSystemClient extends StorageClient { constructor(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions); constructor(url: string, pipeline: Pipeline); create(options?: FileSystemCreateOptions): Promise; + createIfNotExists(options?: FileSystemCreateOptions): Promise; delete(options?: FileSystemDeleteOptions): Promise; + deleteIfExists(options?: FileSystemDeleteOptions): Promise; exists(options?: FileSystemExistsOptions): Promise; getAccessPolicy(options?: FileSystemGetAccessPolicyOptions): Promise; getDataLakeLeaseClient(proposeLeaseId?: string): DataLakeLeaseClient; @@ -198,7 +204,9 @@ export class DataLakePathClient extends StorageClient { constructor(url: string, credential?: StorageSharedKeyCredential | AnonymousCredential | TokenCredential, options?: StoragePipelineOptions); constructor(url: string, pipeline: Pipeline); create(resourceType: PathResourceType, options?: PathCreateOptions): Promise; + createIfNotExists(resourceType: PathResourceType, options?: PathCreateIfNotExistsOptions): Promise; delete(recursive?: boolean, options?: PathDeleteOptions): Promise; + deleteIfExists(recursive?: boolean, options?: PathDeleteOptions): Promise; exists(options?: PathExistsOptions): Promise; get fileSystemName(): string; getAccessControl(options?: PathGetAccessControlOptions): Promise; @@ -260,6 +268,14 @@ export class DataLakeServiceClient extends StorageClient { export { deserializationPolicy } +// @public (undocumented) +export interface DirectoryCreateIfNotExistsOptions extends PathCreateIfNotExistsOptions { +} + +// @public (undocumented) +export interface DirectoryCreateIfNotExistsResponse extends PathCreateIfNotExistsResponse { +} + // @public export interface DirectoryCreateOptions extends PathCreateOptions { } @@ -280,6 +296,14 @@ export interface FileAppendOptions extends CommonOptions { transactionalContentMD5?: Uint8Array; } +// @public (undocumented) +export interface FileCreateIfNotExistsOptions extends PathCreateIfNotExistsOptions { +} + +// @public (undocumented) +export interface FileCreateIfNotExistsResponse extends PathCreateIfNotExistsResponse { +} + // @public (undocumented) export interface FileCreateOptions extends PathCreateOptions { } @@ -430,6 +454,11 @@ export interface FileSystemCreateHeaders { version?: string; } +// @public +export interface FileSystemCreateIfNotExistsResponse extends FileSystemCreateResponse { + succeeded: boolean; +} + // @public export interface FileSystemCreateOptions extends CommonOptions { // (undocumented) @@ -459,6 +488,11 @@ export interface FileSystemDeleteHeaders { version?: string; } +// @public +export interface FileSystemDeleteIfExistsResponse extends FileSystemDeleteResponse { + succeeded: boolean; +} + // @public (undocumented) export interface FileSystemDeleteOptions extends CommonOptions { // (undocumented) @@ -846,6 +880,25 @@ export interface PathCreateHttpHeaders { contentType?: string; } +// @public (undocumented) +export interface PathCreateIfNotExistsOptions extends CommonOptions { + // (undocumented) + abortSignal?: AbortSignalLike; + // (undocumented) + metadata?: Metadata; + // (undocumented) + pathHttpHeaders?: PathCreateHttpHeaders; + // (undocumented) + permissions?: string; + // (undocumented) + umask?: string; +} + +// @public +export interface PathCreateIfNotExistsResponse extends PathCreateResponse { + succeeded: boolean; +} + // @public (undocumented) export interface PathCreateOptions extends CommonOptions { // (undocumented) @@ -879,6 +932,11 @@ export interface PathDeleteHeaders { version?: string; } +// @public +export interface PathDeleteIfExistsResponse extends PathDeleteResponse { + succeeded: boolean; +} + // @public (undocumented) export interface PathDeleteOptions extends CommonOptions { // (undocumented) diff --git a/sdk/storage/storage-file-datalake/src/DataLakeFileSystemClient.ts b/sdk/storage/storage-file-datalake/src/DataLakeFileSystemClient.ts index ea06d5be6eb0..0593bfa0886e 100644 --- a/sdk/storage/storage-file-datalake/src/DataLakeFileSystemClient.ts +++ b/sdk/storage/storage-file-datalake/src/DataLakeFileSystemClient.ts @@ -30,7 +30,9 @@ import { Path, PublicAccessType, SignedIdentifier, - FileSystemListPathsResponse + FileSystemListPathsResponse, + FileSystemCreateIfNotExistsResponse, + FileSystemDeleteIfExistsResponse } from "./models"; import { newPipeline, Pipeline, StoragePipelineOptions } from "./Pipeline"; import { StorageClient } from "./StorageClient"; @@ -203,6 +205,40 @@ export class DataLakeFileSystemClient extends StorageClient { } } + /** + * Creates a new file system under the specified account. If the file system with + * the same name already exists, it is not changed. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-container + * + * @param {FileSystemCreateOptions} [options={}] + * @returns {Promise} + * @memberof DataLakeFileSystemClient + */ + public async createIfNotExists( + options: FileSystemCreateOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "DataLakeFileSystemClient-createIfNotExists", + options.tracingOptions + ); + try { + return await this.blobContainerClient.createIfNotExists({ + ...options, + access: toContainerPublicAccessType(options.access), + tracingOptions: { ...options.tracingOptions, spanOptions } + }); + } catch (e) { + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns true if the File system represented by this client exists; false otherwise. * @@ -265,6 +301,38 @@ export class DataLakeFileSystemClient extends StorageClient { } } + /** + * Delete current file system if it exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-container + * + * @param {FileSystemDeleteOptions} [options={}] + * @returns {Promise} + * @memberof DataLakeFileSystemClient + */ + public async deleteIfExists( + options: FileSystemDeleteOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "DataLakeFileSystemClient-deleteIfExists", + options.tracingOptions + ); + try { + return await this.blobContainerClient.deleteIfExists({ + ...options, + tracingOptions: { ...options.tracingOptions, spanOptions } + }); + } catch (e) { + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns all user-defined metadata and system properties for the specified * file system. diff --git a/sdk/storage/storage-file-datalake/src/clients.ts b/sdk/storage/storage-file-datalake/src/clients.ts index 3d15bb942803..df8801e7dbd9 100644 --- a/sdk/storage/storage-file-datalake/src/clients.ts +++ b/sdk/storage/storage-file-datalake/src/clients.ts @@ -10,9 +10,11 @@ import { DataLakeLeaseClient } from "./DataLakeLeaseClient"; import { PathOperations } from "./generated/src/operations"; import { DirectoryCreateOptions, + DirectoryCreateIfNotExistsOptions, DirectoryCreateResponse, FileAppendOptions, FileAppendResponse, + FileCreateIfNotExistsOptions, FileCreateOptions, FileCreateResponse, FileFlushOptions, @@ -25,6 +27,7 @@ import { Metadata, PathAccessControlItem, PathCreateOptions, + PathCreateIfNotExistsOptions, PathCreateResponse, PathDeleteOptions, PathDeleteResponse, @@ -47,7 +50,11 @@ import { PathSetMetadataOptions, PathSetMetadataResponse, PathSetPermissionsOptions, - PathSetPermissionsResponse + PathSetPermissionsResponse, + PathCreateIfNotExistsResponse, + PathDeleteIfExistsResponse, + DirectoryCreateIfNotExistsResponse, + FileCreateIfNotExistsResponse } from "./models"; import { newPipeline, Pipeline, StoragePipelineOptions } from "./Pipeline"; import { StorageClient } from "./StorageClient"; @@ -66,7 +73,8 @@ import { FILE_UPLOAD_MAX_CHUNK_SIZE, FILE_MAX_SIZE_BYTES, FILE_UPLOAD_DEFAULT_CHUNK_SIZE, - BLOCK_BLOB_MAX_BLOCKS + BLOCK_BLOB_MAX_BLOCKS, + ETagAny } from "./utils/constants"; import { BufferScheduler } from "./utils/BufferScheduler"; import { Batch } from "./utils/Batch"; @@ -243,6 +251,57 @@ export class DataLakePathClient extends StorageClient { } } + /** + * Create a directory or file. If the resource already exists, it is not changed. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create + * + * @param {PathResourceType} resourceType Resource type, "directory" or "file". + * @param {PathCreateOptions} [options={}] + * @returns {Promise} + * @memberof DataLakePathClient + */ + public async createIfNotExists( + resourceType: PathResourceType, + options: PathCreateIfNotExistsOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "DataLakePathClient-createIfNotExists", + options.tracingOptions + ); + try { + const conditions = { ifNoneMatch: ETagAny }; + const res = await this.create(resourceType, { + ...options, + conditions, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "PathAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a blob only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns true if the Data Lake file represented by this client exists; false otherwise. * @@ -316,6 +375,56 @@ export class DataLakePathClient extends StorageClient { } } + /** + * Delete current path (directory or file) if it exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/delete + * + * @param {boolean} [recursive] Required and valid only when the resource is a directory. If "true", all paths beneath the directory will be deleted. + * @param {PathDeleteOptions} [options={}] + * @returns {Promise} + * @memberof DataLakePathClient + */ + public async deleteIfExists( + recursive?: boolean, + options: PathDeleteOptions = {} + ): Promise { + options.conditions = options.conditions || {}; + const { span, spanOptions } = createSpan( + "DataLakePathClient-deleteIfExists", + options.tracingOptions + ); + try { + const res = await this.delete(recursive, { + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "PathNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a directory or file only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns the access control data for a path (directory of file). * @@ -710,6 +819,71 @@ export class DataLakeDirectoryClient extends DataLakePathClient { } } + /** + * Create a directory if it doesn't already exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create + * + * @param {PathResourceType} resourceType Resource type, must be "directory" for DataLakeDirectoryClient. + * @param {PathCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof DataLakeDirectoryClient + */ + public async createIfNotExists( + resourceType: PathResourceType, + options?: PathCreateIfNotExistsOptions + ): Promise; + + /** + * Create a directory if it doesn't already exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create + * + * @param {DirectoryCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof DataLakeDirectoryClient + */ + public async createIfNotExists( + options?: DirectoryCreateIfNotExistsOptions + ): Promise; + + public async createIfNotExists( + resourceTypeOrOptions?: PathResourceType | PathCreateIfNotExistsOptions, + options: PathCreateIfNotExistsOptions = {} + ): Promise { + if (resourceTypeOrOptions === PathResourceType.File) { + throw TypeError( + `DataLakeDirectoryClient:createIfNotExists() resourceType cannot be ${PathResourceType.File}. Refer to DataLakeFileClient for file creation.` + ); + } + + if (resourceTypeOrOptions !== PathResourceType.Directory) { + options = resourceTypeOrOptions || {}; + } + + const { span, spanOptions } = createSpan( + "DataLakeDirectoryClient-createIfNotExists", + options.tracingOptions + ); + try { + return await super.createIfNotExists(PathResourceType.Directory, { + ...options, + tracingOptions: { + ...options.tracingOptions, + spanOptions + } + }); + } catch (e) { + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Creates a {@link DataLakeDirectoryClient} object under current directory. * @@ -882,6 +1056,71 @@ export class DataLakeFileClient extends DataLakePathClient { } } + /** + * Create a file if it doesn't already exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create + * + * @param {PathResourceType} resourceType Resource type, must be "file" for DataLakeFileClient. + * @param {PathCreateIfNotExistsOptions} [options] + * @returns {Promise} + * @memberof DataLakeFileClient + */ + public async createIfNotExists( + resourceType: PathResourceType, + options?: PathCreateIfNotExistsOptions + ): Promise; + + /** + * Create a file if it doesn't already exists. + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/datalakestoragegen2/path/create + * + * @param {FileCreateIfNotExistsOptions} [options] Optional. Options when creating file. + * @returns {Promise} + * @memberof DataLakeFileClient + */ + public async createIfNotExists( + options?: FileCreateIfNotExistsOptions + ): Promise; + + public async createIfNotExists( + resourceTypeOrOptions?: PathResourceType | PathCreateOptions, + options: PathCreateIfNotExistsOptions = {} + ): Promise { + if (resourceTypeOrOptions === PathResourceType.Directory) { + throw TypeError( + `DataLakeFileClient:createIfNotExists() resourceType cannot be ${PathResourceType.Directory}. Refer to DataLakeDirectoryClient for directory creation.` + ); + } + + if (resourceTypeOrOptions !== PathResourceType.File) { + options = resourceTypeOrOptions || {}; + } + + const { span, spanOptions } = createSpan( + "DataLakeFileClient-createIfNotExists", + options.tracingOptions + ); + try { + return await super.createIfNotExists(PathResourceType.File, { + ...options, + tracingOptions: { + ...options.tracingOptions, + spanOptions + } + }); + } catch (e) { + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Downloads a file from the service, including its metadata and properties. * diff --git a/sdk/storage/storage-file-datalake/src/models.ts b/sdk/storage/storage-file-datalake/src/models.ts index a00b82ccadd7..3f7cabfaa32d 100644 --- a/sdk/storage/storage-file-datalake/src/models.ts +++ b/sdk/storage/storage-file-datalake/src/models.ts @@ -12,7 +12,8 @@ import { PathCreateResponse, PathGetPropertiesHeaders as PathGetPropertiesHeadersModel, FileSystemListPathsHeaders, - PathList as PathListModel + PathList as PathListModel, + PathDeleteResponse } from "./generated/src/models"; import { CommonOptions } from "./StorageClient"; @@ -342,6 +343,38 @@ export interface FileSystemExistsOptions extends CommonOptions { abortSignal?: AbortSignalLike; } +/** + * Contains response data for the {@link DataLakeFileSystemClient.createIfNotExists} operation. + * + * @export + * @interface FileSystemCreateIfNotExistsResponse + */ +export interface FileSystemCreateIfNotExistsResponse extends FileSystemCreateResponse { + /** + * Indicate whether the file system is successfully created. Is false when the file system is not changed as it already exists. + * + * @type {boolean} + * @memberof FileSystemCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link DataLakeFileSystemClient.deleteIfExists} operation. + * + * @export + * @interface FileSystemDeleteIfExistsResponse + */ +export interface FileSystemDeleteIfExistsResponse extends FileSystemDeleteResponse { + /** + * Indicate whether the file system is successfully deleted. Is false if the file system doesn't exist in the first place. + * + * @type {boolean} + * @memberof FileSystemDeleteIfExistsResponse + */ + succeeded: boolean; +} + /**********************************************************/ /** DataLakePathClient option and response related models */ /**********************************************************/ @@ -394,6 +427,14 @@ export interface PathCreateOptions extends CommonOptions { pathHttpHeaders?: PathCreateHttpHeaders; } +export interface PathCreateIfNotExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; + metadata?: Metadata; + permissions?: string; + umask?: string; + pathHttpHeaders?: PathCreateHttpHeaders; +} + export interface PathDeleteOptions extends CommonOptions { abortSignal?: AbortSignalLike; conditions?: DataLakeRequestConditions; @@ -587,14 +628,50 @@ export interface PathExistsOptions extends CommonOptions { // customerProvidedKey?: CpkInfo; not supported yet } +/** + * Contains response data for the {@link DataLakePathClient.createIfNotExists} operation. + * + * @export + * @interface PathCreateIfNotExistsResponse + */ +export interface PathCreateIfNotExistsResponse extends PathCreateResponse { + /** + * Indicate whether the directory/file is successfully created. Is false when the directory/file is not changed as it already exists. + * + * @type {boolean} + * @memberof PathCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link DataLakePathClient.deleteIfExists} operation. + * + * @export + * @interface PathDeleteIfExistsResponse + */ +export interface PathDeleteIfExistsResponse extends PathDeleteResponse { + /** + * Indicate whether the directory/file is successfully deleted. Is false if the directory/file doesn't exist in the first place. + * + * @type {boolean} + * @memberof PathDeleteIfExistsResponse + */ + succeeded: boolean; +} + /****************************************************************/ /** DataLakeDirectoryClient option and response related models **/ /****************************************************************/ export interface DirectoryCreateOptions extends PathCreateOptions {} +export interface DirectoryCreateIfNotExistsOptions extends PathCreateIfNotExistsOptions {} + export interface DirectoryCreateResponse extends PathCreateResponse {} +export interface DirectoryCreateIfNotExistsResponse extends PathCreateIfNotExistsResponse {} + /***********************************************************/ /** DataLakeFileClient option and response related models **/ /***********************************************************/ @@ -667,8 +744,12 @@ export interface FileFlushOptions extends CommonOptions { export interface FileCreateOptions extends PathCreateOptions {} +export interface FileCreateIfNotExistsOptions extends PathCreateIfNotExistsOptions {} + export interface FileCreateResponse extends PathCreateResponse {} +export interface FileCreateIfNotExistsResponse extends PathCreateIfNotExistsResponse {} + /** * Option interface for Data Lake file - Upload operations * diff --git a/sdk/storage/storage-file-datalake/src/utils/constants.ts b/sdk/storage/storage-file-datalake/src/utils/constants.ts index dcceca94a1b4..0a8f2982ef60 100644 --- a/sdk/storage/storage-file-datalake/src/utils/constants.ts +++ b/sdk/storage/storage-file-datalake/src/utils/constants.ts @@ -201,3 +201,5 @@ export const ToBlobEndpointHostMappings = [["dfs.core.windows.net", "blob.core.w // Mapping pairs to transform url from blob endpoint to dfs endpoint // Customize this value to add more mapping patterns export const ToDfsEndpointHostMappings = [["blob.core.windows.net", "dfs.core.windows.net"]]; + +export const ETagAny = "*"; diff --git a/sdk/storage/storage-file-datalake/test/filesystemclient.spec.ts b/sdk/storage/storage-file-datalake/test/filesystemclient.spec.ts index ddb4b6b705ed..00e370a7952f 100644 --- a/sdk/storage/storage-file-datalake/test/filesystemclient.spec.ts +++ b/sdk/storage/storage-file-datalake/test/filesystemclient.spec.ts @@ -122,6 +122,30 @@ describe("DataLakeFileSystemClient", () => { assert.deepEqual(result.metadata, metadata); }); + it("createIfNotExists", async () => { + const cClient = serviceClient.getFileSystemClient(recorder.getUniqueName(fileSystemName)); + const metadata = { key: "value" }; + const access = "filesystem"; + const createRes = await cClient.createIfNotExists({ metadata, access }); + assert.ok(createRes.succeeded); + assert.ok(createRes.etag); + + const createRes2 = await cClient.createIfNotExists({ metadata, access }); + assert.ok(!createRes2.succeeded); + + await cClient.delete(); + }); + + it("deleteIfExists", async () => { + const cClient = serviceClient.getFileSystemClient(recorder.getUniqueName(fileSystemName)); + const res = await cClient.deleteIfExists(); + assert.ok(!res.succeeded); + + await cClient.create(); + const res2 = await cClient.deleteIfExists(); + assert.ok(res2.succeeded); + }); + it("delete", (done) => { // delete() with default parameters has been tested in afterEach done(); diff --git a/sdk/storage/storage-file-datalake/test/pathclient.spec.ts b/sdk/storage/storage-file-datalake/test/pathclient.spec.ts index 0fbc917c0b8f..bf84cb084fe7 100644 --- a/sdk/storage/storage-file-datalake/test/pathclient.spec.ts +++ b/sdk/storage/storage-file-datalake/test/pathclient.spec.ts @@ -332,4 +332,33 @@ describe("DataLakePathClient", () => { const dirResult = await newDirectoryClient.exists(); assert.ok(dirResult === false, "exists() should return false for a non-existing directory"); }); + + it("DataLakeDirectoryClient-createIfNotExists", async () => { + const directoryName = recorder.getUniqueName("dir"); + const directoryClient = fileSystemClient.getDirectoryClient(directoryName); + const res = await directoryClient.createIfNotExists(); + assert.ok(res.succeeded); + + const res2 = await directoryClient.createIfNotExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "PathAlreadyExists"); + }); + + it("DataLakeFileClient-createIfNotExists", async () => { + const res = await fileClient.createIfNotExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "PathAlreadyExists"); + }); + + it("DataLakePathClient-deleteIfExists", async () => { + const directoryName = recorder.getUniqueName("dir"); + const directoryClient = fileSystemClient.getDirectoryClient(directoryName); + const res = await directoryClient.deleteIfExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "PathNotFound"); + + await directoryClient.create(); + const res2 = await directoryClient.deleteIfExists(); + assert.ok(res2.succeeded); + }); }); diff --git a/sdk/storage/storage-file-share/CHANGELOG.md b/sdk/storage/storage-file-share/CHANGELOG.md index f6f3c7f1b115..4f0836c5ac19 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) + +- Added `exists` and `deleteIfExists()` to `ShareClient`, `ShareDirectoryClient`, and `ShareFileClient`. +- Added `createIfNotExists()` to `ShareClient` and `ShareDirectoryClient`. + ## 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/recordings/browsers/directoryclient/recording_createifnotexists.json b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_createifnotexists.json new file mode 100644 index 000000000000..7a6f1089b962 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_createifnotexists.json @@ -0,0 +1,145 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:51:58 GMT", + "etag": "\"0x8D7FAEF94AAB0B6\"", + "last-modified": "Mon, 18 May 2020 05:51:59 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "2b715a5e-99ac-4a96-87a1-6ee8ea2855a3", + "x-ms-request-id": "a9f6a5c8-601a-0048-71d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930/dir158978112149802377", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:51:59 GMT", + "etag": "\"0x8D7FAEF9505A7CC\"", + "last-modified": "Mon, 18 May 2020 05:52:00 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "67eb0636-6886-4de5-86f9-c13a6adae9ec", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:00.0518092Z", + "x-ms-file-creation-time": "2020-05-18T05:52:00.0518092Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:00.0518092Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5cc-601a-0048-74d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930/dir158978112149802377", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 409, + "response": "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:a9f6a5cd-601a-0048-75d8-2cbf38000000\nTime:2020-05-18T05:52:00.3482887Z", + "responseHeaders": { + "content-length": "228", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:51:59 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "15cac587-9e6a-4c34-b646-f4415d3fb1b4", + "x-ms-error-code": "ResourceAlreadyExists", + "x-ms-request-id": "a9f6a5cd-601a-0048-75d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930/dir158978112149802377158978112238709606", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:00 GMT", + "etag": "\"0x8D7FAEF958CF0E5\"", + "last-modified": "Mon, 18 May 2020 05:52:00 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7b5c2bc7-ee97-44b7-82d6-fb650c00dc5a", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:00.9384165Z", + "x-ms-file-creation-time": "2020-05-18T05:52:00.9384165Z", + "x-ms-file-id": "16140971433240035328", + "x-ms-file-last-write-time": "2020-05-18T05:52:00.9384165Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5d0-601a-0048-77d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930/dir158978112149802377158978112238709606", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:00 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b22848a8-82e9-4369-b225-58622c54ce66", + "x-ms-request-id": "a9f6a5d3-601a-0048-79d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112004901930", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:01 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fd510c33-9df7-40e3-9972-b2a968ee4400", + "x-ms-request-id": "a9f6a5d6-601a-0048-7bd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978112004901930", + "dir": "dir158978112149802377", + "dir158978112149802377": "dir158978112149802377158978112238709606" + }, + "newDate": {} + }, + "hash": "44f320098f57e5f1787fd83ab90a12bc" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_deleteifexists.json b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_deleteifexists.json new file mode 100644 index 000000000000..0cb8187516f9 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_deleteifexists.json @@ -0,0 +1,145 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:01 GMT", + "etag": "\"0x8D7FAEF9697225F\"", + "last-modified": "Mon, 18 May 2020 05:52:02 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b4d5657d-504f-4c0b-834c-0085e1571895", + "x-ms-request-id": "a9f6a5d9-601a-0048-7dd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930/dir158978112471809255", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:02 GMT", + "etag": "\"0x8D7FAEF96F08FDD\"", + "last-modified": "Mon, 18 May 2020 05:52:03 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "8996ecdc-3fd1-4710-88fe-edcac0a93adc", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:03.2690141Z", + "x-ms-file-creation-time": "2020-05-18T05:52:03.2690141Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:03.2690141Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5dc-601a-0048-7fd8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930/dir158978112471809255158978112530103895", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 404, + "response": "ResourceNotFoundThe specified resource does not exist.\nRequestId:a9f6a5de-601a-0048-01d8-2cbf38000000\nTime:2020-05-18T05:52:03.8447627Z", + "responseHeaders": { + "content-length": "223", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:02 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "d81332d2-963d-4e25-b5c6-d44fa1210376", + "x-ms-error-code": "ResourceNotFound", + "x-ms-request-id": "a9f6a5de-601a-0048-01d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930/dir158978112471809255158978112530103895", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:03 GMT", + "etag": "\"0x8D7FAEF979FDA5E\"", + "last-modified": "Mon, 18 May 2020 05:52:04 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "8c215a39-f38d-46f3-b949-ff5095219d56", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:04.4178014Z", + "x-ms-file-creation-time": "2020-05-18T05:52:04.4178014Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-05-18T05:52:04.4178014Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5e2-601a-0048-03d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930/dir158978112471809255158978112530103895", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:04 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "71ca6580-1691-4302-8b55-85d0267f5716", + "x-ms-request-id": "a9f6a5e4-601a-0048-05d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112412800930", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:04 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fdffcbcb-6321-4f30-b132-0685be2ad035", + "x-ms-request-id": "a9f6a5e7-601a-0048-07d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978112412800930", + "dir": "dir158978112471809255", + "dir158978112471809255": "dir158978112471809255158978112530103895" + }, + "newDate": {} + }, + "hash": "dec25781899b6294b96ed0ad9313628a" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_exists.json b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_exists.json new file mode 100644 index 000000000000..51491af36967 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/directoryclient/recording_exists.json @@ -0,0 +1,127 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112763200734", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:05 GMT", + "etag": "\"0x8D7FAEF98ABBCA7\"", + "last-modified": "Mon, 18 May 2020 05:52:06 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "3184ab5a-c2fe-4379-bcbd-5de9335e85ec", + "x-ms-request-id": "a9f6a5e9-601a-0048-09d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112763200734/dir158978112820509613", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:05 GMT", + "etag": "\"0x8D7FAEF99046415\"", + "last-modified": "Mon, 18 May 2020 05:52:06 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b7646bcd-195d-4147-aaa2-6bedd208bb01", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-creation-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5ed-601a-0048-0bd8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112763200734/dir158978112820509613", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:06 GMT", + "etag": "\"0x8D7FAEF99046415\"", + "last-modified": "Mon, 18 May 2020 05:52:06 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "2e5d5098-144f-4906-8a95-1fac48a25b82", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-creation-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:06.7544085Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5ef-601a-0048-0dd8-2cbf38000000", + "x-ms-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112763200734/dir158978112820509613158978112936208676", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 404, + "response": "ResourceNotFoundThe specified resource does not exist.\nRequestId:a9f6a5f3-601a-0048-10d8-2cbf38000000\nTime:2020-05-18T05:52:07.9136362Z", + "responseHeaders": { + "content-length": "223", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:07 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "1d56bf0e-c139-4387-92dc-0beb2aa68ddb", + "x-ms-error-code": "ResourceNotFound", + "x-ms-request-id": "a9f6a5f3-601a-0048-10d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978112763200734", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:07 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "c449059b-914d-4b72-ae01-2b0ed8236eb3", + "x-ms-request-id": "a9f6a5f6-601a-0048-12d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978112763200734", + "dir": "dir158978112820509613", + "dir158978112820509613": "dir158978112820509613158978112936208676" + }, + "newDate": {} + }, + "hash": "b8a79749eb645a2f892fbec5c54ff311" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_deleteifexists.json b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_deleteifexists.json new file mode 100644 index 000000000000..8e4dbb86f3d9 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_deleteifexists.json @@ -0,0 +1,139 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:08 GMT", + "etag": "\"0x8D7FAEF9A683BF3\"", + "last-modified": "Mon, 18 May 2020 05:52:09 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "9402a792-34a7-432d-b68f-30c77a83df3d", + "x-ms-request-id": "a9f6a5fa-601a-0048-15d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763/dir158978113112008111", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:08 GMT", + "etag": "\"0x8D7FAEF9AC0E112\"", + "last-modified": "Mon, 18 May 2020 05:52:09 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "d1b1bc4d-0da6-448c-9ae5-5b4180786dce", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:09.6674066Z", + "x-ms-file-creation-time": "2020-05-18T05:52:09.6674066Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:09.6674066Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a5fd-601a-0048-17d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763/dir158978113112008111/file158978113169901410", + "query": {}, + "requestBody": null, + "status": 404, + "response": "ResourceNotFoundThe specified resource does not exist.\nRequestId:a9f6a5ff-601a-0048-19d8-2cbf38000000\nTime:2020-05-18T05:52:10.2452831Z", + "responseHeaders": { + "content-length": "223", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:09 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7cfdb98d-7d2d-4071-bbac-f70049bb6cf5", + "x-ms-error-code": "ResourceNotFound", + "x-ms-request-id": "a9f6a5ff-601a-0048-19d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763/dir158978113112008111/file158978113169901410", + "query": {}, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:09 GMT", + "etag": "\"0x8D7FAEF9B70C7E2\"", + "last-modified": "Mon, 18 May 2020 05:52:10 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "f2669caf-bfbb-4c42-b614-c8bf08134e76", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-05-18T05:52:10.8201954Z", + "x-ms-file-creation-time": "2020-05-18T05:52:10.8201954Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-05-18T05:52:10.8201954Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "1978041915872117222*12957844477200427368", + "x-ms-request-id": "a9f6a601-601a-0048-1bd8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763/dir158978113112008111/file158978113169901410", + "query": {}, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:10 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "22256165-6c67-4c03-8aa9-2a97f9f2cb2d", + "x-ms-request-id": "a9f6a603-601a-0048-1dd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113053702763", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:11 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "8c7e07bf-64f0-47b1-af79-30820214744d", + "x-ms-request-id": "a9f6a606-601a-0048-1fd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978113053702763", + "dir": "dir158978113112008111", + "file": "file158978113169901410" + }, + "newDate": {} + }, + "hash": "c4251098f40ea448eb84b3a0b939eb6b" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_exists.json b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_exists.json new file mode 100644 index 000000000000..d9d705b81d03 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/fileclient/recording_exists.json @@ -0,0 +1,152 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:11 GMT", + "etag": "\"0x8D7FAEF9C7ADA23\"", + "last-modified": "Mon, 18 May 2020 05:52:12 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "1d4bc071-10c9-4840-b6c2-cac3f4f157b6", + "x-ms-request-id": "a9f6a609-601a-0048-21d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379/dir158978113459700504", + "query": { + "restype": "directory" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:12 GMT", + "etag": "\"0x8D7FAEF9CD3553C\"", + "last-modified": "Mon, 18 May 2020 05:52:13 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a2781f8f-e667-4078-b78e-17c1b0eedfaa", + "x-ms-file-attributes": "Directory", + "x-ms-file-change-time": "2020-05-18T05:52:13.1437884Z", + "x-ms-file-creation-time": "2020-05-18T05:52:13.1437884Z", + "x-ms-file-id": "13835128424026341376", + "x-ms-file-last-write-time": "2020-05-18T05:52:13.1437884Z", + "x-ms-file-parent-id": "0", + "x-ms-file-permission-key": "15783046271365971681*12957844477200427368", + "x-ms-request-id": "a9f6a60c-601a-0048-23d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "HEAD", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379/dir158978113459700504/file158978113517502681", + "query": {}, + "requestBody": null, + "status": 404, + "response": "", + "responseHeaders": { + "date": "Mon, 18 May 2020 05:52:12 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "transfer-encoding": "chunked", + "x-ms-client-request-id": "e54c34d7-4708-4172-9357-0f0a09d27c5c", + "x-ms-error-code": "ResourceNotFound", + "x-ms-request-id": "a9f6a60e-601a-0048-25d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379/dir158978113459700504/file158978113517502681", + "query": {}, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:13 GMT", + "etag": "\"0x8D7FAEF9D833C1A\"", + "last-modified": "Mon, 18 May 2020 05:52:14 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "e2c419c9-b5fa-4d2f-bdc0-d0d97e338243", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-creation-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "1978041915872117222*12957844477200427368", + "x-ms-request-id": "a9f6a611-601a-0048-27d8-2cbf38000000", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "HEAD", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379/dir158978113459700504/file158978113517502681", + "query": {}, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "11", + "content-type": "application/octet-stream", + "date": "Mon, 18 May 2020 05:52:13 GMT", + "etag": "\"0x8D7FAEF9D833C1A\"", + "last-modified": "Mon, 18 May 2020 05:52:14 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "dba1de30-408b-4837-9c09-05a725fa2f15", + "x-ms-file-attributes": "Archive", + "x-ms-file-change-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-creation-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-id": "11529285414812647424", + "x-ms-file-last-write-time": "2020-05-18T05:52:14.2965786Z", + "x-ms-file-parent-id": "13835128424026341376", + "x-ms-file-permission-key": "1978041915872117222*12957844477200427368", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-request-id": "a9f6a613-601a-0048-29d8-2cbf38000000", + "x-ms-server-encrypted": "true", + "x-ms-type": "File", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113402108379", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:14 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "d4a5da1e-4cc2-4703-8924-d39ce74a0c12", + "x-ms-request-id": "a9f6a615-601a-0048-2bd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978113402108379", + "dir": "dir158978113459700504", + "file": "file158978113517502681" + }, + "newDate": {} + }, + "hash": "5c254c3d7520a6dafeb3cd746396176b" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_createifnotexists.json b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_createifnotexists.json new file mode 100644 index 000000000000..b5aeb7e76b74 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_createifnotexists.json @@ -0,0 +1,108 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113981605831", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:17 GMT", + "etag": "\"0x8D7FAEF9FEF6B40\"", + "last-modified": "Mon, 18 May 2020 05:52:18 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "62575038-2b36-4c43-ab4d-e8b7f6b02f82", + "x-ms-request-id": "a9f6a626-601a-0048-37d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113981605831158978114039400925", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:18 GMT", + "etag": "\"0x8D7FAEFA0475F39\"", + "last-modified": "Mon, 18 May 2020 05:52:18 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "51688ada-5dff-4694-b619-c5ad7cfa28b8", + "x-ms-request-id": "a9f6a62a-601a-0048-39d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113981605831158978114039400925", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 409, + "response": "ShareAlreadyExistsThe specified share already exists.\nRequestId:a9f6a62d-601a-0048-3ad8-2cbf38000000\nTime:2020-05-18T05:52:19.2336358Z", + "responseHeaders": { + "content-length": "222", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:18 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "1fc8d7a8-f2e3-4824-80d7-a7eb230a1a75", + "x-ms-error-code": "ShareAlreadyExists", + "x-ms-request-id": "a9f6a62d-601a-0048-3ad8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113981605831158978114039400925", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:18 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a07789c5-e59e-415b-afbd-4e1747766246", + "x-ms-request-id": "a9f6a630-601a-0048-3cd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113981605831", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:19 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "37144726-b6e1-475a-b2e9-6fe11a31da75", + "x-ms-request-id": "a9f6a633-601a-0048-3ed8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978113981605831", + "share158978113981605831": "share158978113981605831158978114039400925" + }, + "newDate": {} + }, + "hash": "1d5ed99d3f822200dacdcfac7f67f5fa" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_deleteifexists.json b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_deleteifexists.json new file mode 100644 index 000000000000..1a4a54f6d61a --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_deleteifexists.json @@ -0,0 +1,109 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978114242308721", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:20 GMT", + "etag": "\"0x8D7FAEFA17DCD4E\"", + "last-modified": "Mon, 18 May 2020 05:52:20 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "51f88630-c302-43b5-be82-5e1448fdeeb3", + "x-ms-request-id": "a9f6a637-601a-0048-40d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978114242308721158978114300508815", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:20 GMT", + "etag": "\"0x8D7FAEFA1D5E847\"", + "last-modified": "Mon, 18 May 2020 05:52:21 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "be6c73f2-0ab6-4978-8c5a-5c473db49b39", + "x-ms-request-id": "a9f6a63b-601a-0048-42d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978114242308721158978114300508815", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:21 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "e02eeb72-be21-4cdb-b537-4c66f757dbd7", + "x-ms-request-id": "a9f6a63f-601a-0048-44d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share1589781142423087213158978114415803871", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 404, + "response": "ShareNotFoundThe specified share does not exist.\nRequestId:a9f6a642-601a-0048-46d8-2cbf38000000\nTime:2020-05-18T05:52:22.7020860Z", + "responseHeaders": { + "content-length": "217", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:21 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fdf1072c-71a6-405e-9dbe-4824b6fd59b4", + "x-ms-error-code": "ShareNotFound", + "x-ms-request-id": "a9f6a642-601a-0048-46d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978114242308721", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:22 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "b14ba131-ddc4-4ba4-bed1-645d82fa91ad", + "x-ms-request-id": "a9f6a645-601a-0048-48d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978114242308721", + "share158978114242308721": "share158978114242308721158978114300508815", + "share1589781142423087213": "share1589781142423087213158978114415803871" + }, + "newDate": {} + }, + "hash": "27fb753ff4c53facca241255df04cd2c" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_exists.json b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_exists.json new file mode 100644 index 000000000000..954956fd61ee --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/browsers/shareclient/recording_exists.json @@ -0,0 +1,93 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113750506578", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:15 GMT", + "etag": "\"0x8D7FAEF9E8EFF3B\"", + "last-modified": "Mon, 18 May 2020 05:52:16 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7d170480-afa2-46c7-9367-3ef90c81e699", + "x-ms-request-id": "a9f6a617-601a-0048-2dd8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113750506578", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:15 GMT", + "etag": "\"0x8D7FAEF9E8EFF3B\"", + "last-modified": "Mon, 18 May 2020 05:52:16 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "74ce1c17-bce9-429a-91f9-df373304c8f4", + "x-ms-has-immutability-policy": "false", + "x-ms-has-legal-hold": "false", + "x-ms-request-id": "a9f6a61c-601a-0048-30d8-2cbf38000000", + "x-ms-share-quota": "5120", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113750506578158978113865604206", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 404, + "response": "ShareNotFoundThe specified share does not exist.\nRequestId:a9f6a61e-601a-0048-32d8-2cbf38000000\nTime:2020-05-18T05:52:17.2001946Z", + "responseHeaders": { + "content-length": "217", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:52:16 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "9a860e0a-90b9-4637-ac0c-d35a9cf3226a", + "x-ms-error-code": "ShareNotFound", + "x-ms-request-id": "a9f6a61e-601a-0048-32d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.file.core.windows.net/share158978113750506578", + "query": { + "restype": "share" + }, + "requestBody": null, + "status": 202, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:52:16 GMT", + "server": "Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "3303b283-07ed-46d5-8c23-e0584a8b1a3c", + "x-ms-request-id": "a9f6a623-601a-0048-35d8-2cbf38000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "share": "share158978113750506578", + "share158978113750506578": "share158978113750506578158978113865604206" + }, + "newDate": {} + }, + "hash": "af6a0e2cc9ade6366722f18ab328d4be" +} \ No newline at end of file diff --git a/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_createifnotexists.js b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_createifnotexists.js new file mode 100644 index 000000000000..22368c142289 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_createifnotexists.js @@ -0,0 +1,161 @@ +let nock = require('nock'); + +module.exports.hash = "8efaa05b167dfd91d7eb2869d74482bf"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978107550705372","dir":"dir158978107688705269","dir158978107688705269":"dir158978107688705269158978107751909767"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107550705372') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:14 GMT', + 'ETag', + '"0x8D7FAEF7A118948"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2631-401a-0012-0dd8-2cd9df000000', + 'x-ms-client-request-id', + '6404a1f5-4c3a-4802-b00b-7280f1a4927d', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:14 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107550705372/dir158978107688705269') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:15 GMT', + 'ETag', + '"0x8D7FAEF7A4564D3"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2634-401a-0012-0ed8-2cd9df000000', + 'x-ms-client-request-id', + 'c75fd2f1-d619-4c83-8480-4680de9dfd87', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:15.1710419Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:15.1710419Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:15.1710419Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:14 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107550705372/dir158978107688705269') + .query(true) + .reply(409, "ResourceAlreadyExistsThe specified resource already exists.\nRequestId:b2da2635-401a-0012-0fd8-2cd9df000000\nTime:2020-05-18T05:51:15.4766432Z", [ + 'Content-Length', + '228', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2635-401a-0012-0fd8-2cd9df000000', + 'x-ms-client-request-id', + 'c826c54b-9e80-4f9c-b92c-c5c02e901f6d', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ResourceAlreadyExists', + 'Date', + 'Mon, 18 May 2020 05:51:15 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107550705372/dir158978107688705269158978107751909767') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:15 GMT', + 'ETag', + '"0x8D7FAEF7AA2894B"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2637-401a-0012-10d8-2cd9df000000', + 'x-ms-client-request-id', + '8c6cf1da-52ca-4f6b-ab7f-c8201865edae', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:15.7814603Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:15.7814603Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:15.7814603Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '16140971433240035328', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:15 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978107550705372/dir158978107688705269158978107751909767') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2638-401a-0012-11d8-2cd9df000000', + 'x-ms-client-request-id', + 'bac363a4-2225-41c4-9c55-2d1e45517b08', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:15 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978107550705372') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2639-401a-0012-12d8-2cd9df000000', + 'x-ms-client-request-id', + '1b352fec-5233-4a4c-97cd-a0e53822303b', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:16 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_deleteifexists.js b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_deleteifexists.js new file mode 100644 index 000000000000..9f3c84060e7d --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_deleteifexists.js @@ -0,0 +1,161 @@ +let nock = require('nock'); + +module.exports.hash = "1049ebc97f564d93f265d8c9f984849e"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978107842601513","dir":"dir158978107872208254","dir158978107872208254":"dir158978107872208254158978107908607949"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107842601513') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:16 GMT', + 'ETag', + '"0x8D7FAEF7B2CF0A7"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da263a-401a-0012-13d8-2cd9df000000', + 'x-ms-client-request-id', + '200a9e33-01f3-436d-9f7f-c10551c38385', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:16 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107842601513/dir158978107872208254') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:17 GMT', + 'ETag', + '"0x8D7FAEF7B644D98"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da263c-401a-0012-14d8-2cd9df000000', + 'x-ms-client-request-id', + 'a2836029-5f8f-4cbd-911b-90bb05c6f6de', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:17.0513304Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:17.0513304Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:17.0513304Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:16 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978107842601513/dir158978107872208254158978107908607949') + .query(true) + .reply(404, "ResourceNotFoundThe specified resource does not exist.\nRequestId:b2da263f-401a-0012-15d8-2cd9df000000\nTime:2020-05-18T05:51:17.3529760Z", [ + 'Content-Length', + '223', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da263f-401a-0012-15d8-2cd9df000000', + 'x-ms-client-request-id', + '84fa0ba6-abbd-4111-8da3-1b9d4d906acc', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ResourceNotFound', + 'Date', + 'Mon, 18 May 2020 05:51:16 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978107842601513/dir158978107872208254158978107908607949') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:17 GMT', + 'ETag', + '"0x8D7FAEF7BBF009E"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2641-401a-0012-17d8-2cd9df000000', + 'x-ms-client-request-id', + '6422d90a-444f-4afd-9de6-156688a8df16', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:17.6457374Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:17.6457374Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:17.6457374Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:17 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978107842601513/dir158978107872208254158978107908607949') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2642-401a-0012-18d8-2cd9df000000', + 'x-ms-client-request-id', + '47281c29-a266-4485-9270-bfccd47f85ed', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:17 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978107842601513') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2644-401a-0012-19d8-2cd9df000000', + 'x-ms-client-request-id', + '15ef2946-7047-4c03-8533-15b80456486b', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:17 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_exists.js b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_exists.js new file mode 100644 index 000000000000..f87e507226d8 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/directoryclient/recording_exists.js @@ -0,0 +1,151 @@ +let nock = require('nock'); + +module.exports.hash = "76ab00b4ac39f66a41605dd37adec5e3"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108027809479","dir":"dir158978108058109414","dir158978108058109414":"dir158978108058109414158978108118100008"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108027809479') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:18 GMT', + 'ETag', + '"0x8D7FAEF7C48582C"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2645-401a-0012-1ad8-2cd9df000000', + 'x-ms-client-request-id', + 'ec84b59b-61ca-4474-9444-b907b8fb24ce', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:18 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108027809479/dir158978108058109414') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:18 GMT', + 'ETag', + '"0x8D7FAEF7C763BC9"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2647-401a-0012-1bd8-2cd9df000000', + 'x-ms-client-request-id', + '144b5fa8-6b19-465c-98f3-2b484bf4d37c', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:18 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .get('/share158978108027809479/dir158978108058109414') + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:18 GMT', + 'ETag', + '"0x8D7FAEF7C763BC9"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2648-401a-0012-1cd8-2cd9df000000', + 'x-ms-client-request-id', + '18f964a3-bbf1-4613-b8e3-3469f3ebbf10', + 'x-ms-version', + '2019-07-07', + 'x-ms-server-encrypted', + 'true', + 'x-ms-file-change-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:18.8465609Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Last-Modified,ETag,x-ms-server-encrypted,x-ms-file-change-time,x-ms-file-last-write-time,x-ms-file-creation-time,x-ms-file-permission-key,x-ms-file-attributes,x-ms-file-id,x-ms-file-parent-id,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:18 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .get('/share158978108027809479/dir158978108058109414158978108118100008') + .query(true) + .reply(404, "ResourceNotFoundThe specified resource does not exist.\nRequestId:b2da2649-401a-0012-1dd8-2cd9df000000\nTime:2020-05-18T05:51:19.4484607Z", [ + 'Content-Length', + '223', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2649-401a-0012-1dd8-2cd9df000000', + 'x-ms-client-request-id', + 'd734061e-9d17-4007-a447-e4c0c8c7867b', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ResourceNotFound', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-error-code,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:19 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108027809479') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da264a-401a-0012-1ed8-2cd9df000000', + 'x-ms-client-request-id', + 'ebbd0dbc-0e6a-4bbe-91ea-47c71e60e832', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:19 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/fileclient/recording_deleteifexists.js b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_deleteifexists.js new file mode 100644 index 000000000000..f7e2071316c2 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_deleteifexists.js @@ -0,0 +1,158 @@ +let nock = require('nock'); + +module.exports.hash = "3cd044cf62a7627d4095071099982981"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108193707360","dir":"dir158978108223407005","file":"file158978108253102790"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108193707360') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:20 GMT', + 'ETag', + '"0x8D7FAEF7D44C05A"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da264b-401a-0012-1fd8-2cd9df000000', + 'x-ms-client-request-id', + '54bf16e2-c3d5-458e-8226-a019278efe2b', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:19 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108193707360/dir158978108223407005') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:20 GMT', + 'ETag', + '"0x8D7FAEF7D725432"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da264d-401a-0012-20d8-2cd9df000000', + 'x-ms-client-request-id', + 'e5c7370e-8ce6-4ca2-85d8-586332da8800', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:20.4986930Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:20.4986930Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:20.4986930Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:20 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108193707360/dir158978108223407005/file158978108253102790') + .reply(404, "ResourceNotFoundThe specified resource does not exist.\nRequestId:b2da264f-401a-0012-21d8-2cd9df000000\nTime:2020-05-18T05:51:20.7944189Z", [ + 'Content-Length', + '223', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da264f-401a-0012-21d8-2cd9df000000', + 'x-ms-client-request-id', + '29097611-39e0-4049-978e-4abd8343d90b', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ResourceNotFound', + 'Date', + 'Mon, 18 May 2020 05:51:20 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108193707360/dir158978108223407005/file158978108253102790') + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:21 GMT', + 'ETag', + '"0x8D7FAEF7DCC43D0"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2650-401a-0012-22d8-2cd9df000000', + 'x-ms-client-request-id', + '2b617c12-89f0-4af0-ba05-a9b28b43ad85', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:21.0880976Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:21.0880976Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:21.0880976Z', + 'x-ms-file-permission-key', + '1978041915872117222*12957844477200427368', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:20 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108193707360/dir158978108223407005/file158978108253102790') + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2651-401a-0012-23d8-2cd9df000000', + 'x-ms-client-request-id', + '6dc42b3f-9023-48c2-b128-a9cb8c90a25c', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:21 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108193707360') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2652-401a-0012-24d8-2cd9df000000', + 'x-ms-client-request-id', + '264f64c5-66b1-46a2-8a65-176b977ee4a0', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:21 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/fileclient/recording_exists.js b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_exists.js new file mode 100644 index 000000000000..24525dbf9b7c --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/fileclient/recording_exists.js @@ -0,0 +1,192 @@ +let nock = require('nock'); + +module.exports.hash = "9d35b839f8787ab888e77eb6d4ce6c08"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108371900572","dir":"dir158978108401803708","file":"file158978108431706300"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108371900572') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:21 GMT', + 'ETag', + '"0x8D7FAEF7E552973"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2653-401a-0012-25d8-2cd9df000000', + 'x-ms-client-request-id', + 'd24a9bbc-3e4e-4683-b62a-520501705ca1', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:21 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108371900572/dir158978108401803708') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:22 GMT', + 'ETag', + '"0x8D7FAEF7E826D55"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2656-401a-0012-26d8-2cd9df000000', + 'x-ms-client-request-id', + '8853c31d-dbf0-42b9-93c5-547efcd2883b', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:22.2819157Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:22.2819157Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:22.2819157Z', + 'x-ms-file-permission-key', + '15783046271365971681*12957844477200427368', + 'x-ms-file-attributes', + 'Directory', + 'x-ms-file-id', + '13835128424026341376', + 'x-ms-file-parent-id', + '0', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:21 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .head('/share158978108371900572/dir158978108401803708/file158978108431706300') + .reply(404, "", [ + 'Transfer-Encoding', + 'chunked', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2658-401a-0012-28d8-2cd9df000000', + 'x-ms-client-request-id', + 'aeca4849-acf4-444f-be33-12061be7f0eb', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ResourceNotFound', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-error-code,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:22 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108371900572/dir158978108401803708/file158978108431706300') + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:22 GMT', + 'ETag', + '"0x8D7FAEF7EDD4778"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2659-401a-0012-29d8-2cd9df000000', + 'x-ms-client-request-id', + '4fee2dc2-d702-4738-a6fc-e8d8b8cc9d8c', + 'x-ms-version', + '2019-07-07', + 'x-ms-file-change-time', + '2020-05-18T05:51:22.8773240Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:22.8773240Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:22.8773240Z', + 'x-ms-file-permission-key', + '1978041915872117222*12957844477200427368', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'x-ms-request-server-encrypted', + 'true', + 'Date', + 'Mon, 18 May 2020 05:51:22 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .head('/share158978108371900572/dir158978108401803708/file158978108431706300') + .reply(200, "", [ + 'Content-Length', + '11', + 'Content-Type', + 'application/octet-stream', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:22 GMT', + 'ETag', + '"0x8D7FAEF7EDD4778"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da265b-401a-0012-2ad8-2cd9df000000', + 'x-ms-client-request-id', + '263ba5e7-f47c-43fc-ba21-ef446e4d8c96', + 'x-ms-version', + '2019-07-07', + '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-05-18T05:51:22.8773240Z', + 'x-ms-file-last-write-time', + '2020-05-18T05:51:22.8773240Z', + 'x-ms-file-creation-time', + '2020-05-18T05:51:22.8773240Z', + 'x-ms-file-permission-key', + '1978041915872117222*12957844477200427368', + 'x-ms-file-attributes', + 'Archive', + 'x-ms-file-id', + '11529285414812647424', + 'x-ms-file-parent-id', + '13835128424026341376', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Content-Type,Last-Modified,ETag,x-ms-type,x-ms-server-encrypted,x-ms-lease-status,x-ms-lease-state,x-ms-file-change-time,x-ms-file-last-write-time,x-ms-file-creation-time,x-ms-file-permission-key,x-ms-file-attributes,x-ms-file-id,x-ms-file-parent-id,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:22 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108371900572') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da265d-401a-0012-2bd8-2cd9df000000', + 'x-ms-client-request-id', + '07ecb2b0-62ab-458c-a83e-22fcc20b5376', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:23 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/shareclient/recording_createifnotexists.js b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_createifnotexists.js new file mode 100644 index 000000000000..aec0ab714d07 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_createifnotexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "22482e1dd1c751c45cc4c4047970c845"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108669701515","share158978108669701515":"share158978108669701515158978108699400572"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108669701515') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:24 GMT', + 'ETag', + '"0x8D7FAEF801AF9A4"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da266f-401a-0012-30d8-2cd9df000000', + 'x-ms-client-request-id', + 'a6b025ec-c745-4c58-9d45-dd0a3696a79a', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:24 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108669701515158978108699400572') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:25 GMT', + 'ETag', + '"0x8D7FAEF80487A8E"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2671-401a-0012-31d8-2cd9df000000', + 'x-ms-client-request-id', + '5dbe7c10-39f8-47d1-8c2b-ba11df145182', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:24 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108669701515158978108699400572') + .query(true) + .reply(409, "ShareAlreadyExistsThe specified share already exists.\nRequestId:b2da2673-401a-0012-32d8-2cd9df000000\nTime:2020-05-18T05:51:25.5537999Z", [ + 'Content-Length', + '222', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2673-401a-0012-32d8-2cd9df000000', + 'x-ms-client-request-id', + 'f9a13168-6513-48e8-80b3-f0e2c0a68f36', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ShareAlreadyExists', + 'Date', + 'Mon, 18 May 2020 05:51:25 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108669701515158978108699400572') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2675-401a-0012-33d8-2cd9df000000', + 'x-ms-client-request-id', + '20401e55-ebd4-494c-88ee-be585955beb8', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:25 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108669701515') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2676-401a-0012-34d8-2cd9df000000', + 'x-ms-client-request-id', + '07d6b264-8e4c-4478-b02e-acdd70c58935', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:25 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/shareclient/recording_deleteifexists.js b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_deleteifexists.js new file mode 100644 index 000000000000..83d8cfb6ba11 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_deleteifexists.js @@ -0,0 +1,107 @@ +let nock = require('nock'); + +module.exports.hash = "e97179d82a50d9d87f011bdafbd816d3"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108818205267","share158978108818205267":"share158978108818205267158978108847803646","share1589781088182052673":"share1589781088182052673158978108907107388"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108818205267') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:26 GMT', + 'ETag', + '"0x8D7FAEF80FD9396"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2677-401a-0012-35d8-2cd9df000000', + 'x-ms-client-request-id', + '50c45b56-e31d-403a-9225-abe367d527e7', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:26 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108818205267158978108847803646') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:26 GMT', + 'ETag', + '"0x8D7FAEF812B1472"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da267a-401a-0012-37d8-2cd9df000000', + 'x-ms-client-request-id', + '65306e07-9751-4a86-9400-cc9ecd8d9a26', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:26 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108818205267158978108847803646') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da267c-401a-0012-38d8-2cd9df000000', + 'x-ms-client-request-id', + '5dac858c-28ee-475b-ba7d-d7dfc6b5c32d', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:26 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share1589781088182052673158978108907107388') + .query(true) + .reply(404, "ShareNotFoundThe specified share does not exist.\nRequestId:b2da267e-401a-0012-39d8-2cd9df000000\nTime:2020-05-18T05:51:27.3350614Z", [ + 'Content-Length', + '217', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da267e-401a-0012-39d8-2cd9df000000', + 'x-ms-client-request-id', + 'a3c80b81-8ca9-46e3-b221-f88c8750c8a2', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ShareNotFound', + 'Date', + 'Mon, 18 May 2020 05:51:26 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108818205267') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da267f-401a-0012-3ad8-2cd9df000000', + 'x-ms-client-request-id', + '702686cb-608a-418e-8ea1-e3fb0808adc8', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:27 GMT' +]); diff --git a/sdk/storage/storage-file-share/recordings/node/shareclient/recording_exists.js b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_exists.js new file mode 100644 index 000000000000..9cfceacdd117 --- /dev/null +++ b/sdk/storage/storage-file-share/recordings/node/shareclient/recording_exists.js @@ -0,0 +1,103 @@ +let nock = require('nock'); + +module.exports.hash = "e795b67a4f961b23b646fb0f8c21444d"; + +module.exports.testInfo = {"uniqueName":{"share":"share158978108551204482","share158978108551204482":"share158978108551204482158978108609708713"},"newDate":{}} + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .put('/share158978108551204482') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:23 GMT', + 'ETag', + '"0x8D7FAEF7F65B975"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2666-401a-0012-2cd8-2cd9df000000', + 'x-ms-client-request-id', + '2bde80ff-3265-4fba-92dc-5d3dbed518fb', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:23 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .get('/share158978108551204482') + .query(true) + .reply(200, "", [ + 'Content-Length', + '0', + 'Last-Modified', + 'Mon, 18 May 2020 05:51:23 GMT', + 'ETag', + '"0x8D7FAEF7F65B975"', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da2669-401a-0012-2dd8-2cd9df000000', + 'x-ms-client-request-id', + '5c766a9b-37d8-4f97-b65f-a835d0e46de4', + 'x-ms-version', + '2019-07-07', + 'x-ms-has-immutability-policy', + 'false', + 'x-ms-has-legal-hold', + 'false', + 'x-ms-share-quota', + '5120', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,Last-Modified,ETag,x-ms-has-immutability-policy,x-ms-has-legal-hold,x-ms-share-quota,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:23 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .get('/share158978108551204482158978108609708713') + .query(true) + .reply(404, "ShareNotFoundThe specified share does not exist.\nRequestId:b2da266c-401a-0012-2ed8-2cd9df000000\nTime:2020-05-18T05:51:24.3649542Z", [ + 'Content-Length', + '217', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da266c-401a-0012-2ed8-2cd9df000000', + 'x-ms-client-request-id', + '6acc5f58-83c4-42a6-a45d-f0f54d215a0e', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'ShareNotFound', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-error-code,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:51:23 GMT' +]); + +nock('https://fakestorageaccount.file.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/share158978108551204482') + .query(true) + .reply(202, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b2da266e-401a-0012-2fd8-2cd9df000000', + 'x-ms-client-request-id', + 'c968185d-87d4-49bb-a6b5-5ee222b73423', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:51:24 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 fa73a6f94ae3..72b4bd5eb1f5 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 @@ -173,6 +173,11 @@ export interface DirectoryCreateHeaders { version?: string; } +// @public +export interface DirectoryCreateIfNotExistsResponse extends DirectoryCreateResponse { + succeeded: boolean; +} + // @public export interface DirectoryCreateOptions extends FileAndDirectoryCreateCommonOptions, CommonOptions { abortSignal?: AbortSignalLike; @@ -195,6 +200,11 @@ export interface DirectoryDeleteHeaders { version?: string; } +// @public +export interface DirectoryDeleteIfExistsResponse extends DirectoryDeleteResponse { + succeeded: boolean; +} + // @public export interface DirectoryDeleteOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -207,6 +217,11 @@ export type DirectoryDeleteResponse = DirectoryDeleteHeaders & { }; }; +// @public +export interface DirectoryExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; +} + // @public export interface DirectoryForceCloseHandlesHeaders { date?: Date; @@ -489,6 +504,11 @@ export interface FileDeleteHeaders { version?: string; } +// @public +export interface FileDeleteIfExistsResponse extends FileDeleteResponse { + succeeded: boolean; +} + // @public export interface FileDeleteOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -580,6 +600,11 @@ export interface FileDownloadToBufferOptions extends CommonOptions { rangeSize?: number; } +// @public +export interface FileExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; +} + // @public export interface FileForceCloseHandlesHeaders { date?: Date; @@ -1286,11 +1311,14 @@ export class ShareClient extends StorageClient { fileClient: ShareFileClient; fileCreateResponse: FileCreateResponse; }>; + createIfNotExists(options?: ShareCreateOptions): Promise; createPermission(filePermission: string, options?: ShareCreatePermissionOptions): Promise; createSnapshot(options?: ShareCreateSnapshotOptions): Promise; delete(options?: ShareDeleteMethodOptions): Promise; deleteDirectory(directoryName: string, options?: DirectoryDeleteOptions): Promise; deleteFile(fileName: string, options?: FileDeleteOptions): Promise; + deleteIfExists(options?: ShareDeleteMethodOptions): Promise; + exists(options?: ShareExistsOptions): Promise; getAccessPolicy(options?: ShareGetAccessPolicyOptions): Promise; getDirectoryClient(directoryName: string): ShareDirectoryClient; getPermission(filePermissionKey: string, options?: ShareGetPermissionOptions): Promise; @@ -1315,6 +1343,11 @@ export interface ShareCreateHeaders { version?: string; } +// @public +export interface ShareCreateIfNotExistsResponse extends ShareCreateResponse { + succeeded: boolean; +} + // @public export interface ShareCreateOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -1389,6 +1422,11 @@ export interface ShareDeleteHeaders { version?: string; } +// @public +export interface ShareDeleteIfExistsResponse extends ShareDeleteResponse { + succeeded: boolean; +} + // @public export interface ShareDeleteMethodOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -1411,13 +1449,16 @@ export class ShareDirectoryClient extends StorageClient { fileClient: ShareFileClient; fileCreateResponse: FileCreateResponse; }>; + createIfNotExists(options?: DirectoryCreateOptions): Promise; createSubdirectory(directoryName: string, options?: DirectoryCreateOptions): Promise<{ directoryClient: ShareDirectoryClient; directoryCreateResponse: DirectoryCreateResponse; }>; delete(options?: DirectoryDeleteOptions): Promise; deleteFile(fileName: string, options?: FileDeleteOptions): Promise; + deleteIfExists(options?: DirectoryDeleteOptions): Promise; deleteSubdirectory(directoryName: string, options?: DirectoryDeleteOptions): Promise; + exists(options?: DirectoryExistsOptions): Promise; forceCloseAllHandles(options?: DirectoryForceCloseHandlesSegmentOptions): Promise; forceCloseHandle(handleId: string, options?: DirectoryForceCloseHandlesOptions): Promise; getDirectoryClient(subDirectoryName: string): ShareDirectoryClient; @@ -1436,6 +1477,11 @@ export class ShareDirectoryClient extends StorageClient { get shareName(): string; } +// @public +export interface ShareExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; +} + // @public export class ShareFileClient extends StorageClient { constructor(url: string, credential?: Credential, options?: StoragePipelineOptions); @@ -1444,10 +1490,12 @@ export class ShareFileClient extends StorageClient { clearRange(offset: number, contentLength: number, options?: FileClearRangeOptions): Promise; create(size: number, options?: FileCreateOptions): Promise; delete(options?: FileDeleteOptions): Promise; + deleteIfExists(options?: FileDeleteOptions): Promise; download(offset?: number, count?: number, options?: FileDownloadOptions): Promise; downloadToBuffer(buffer: Buffer, offset?: number, count?: number, options?: FileDownloadToBufferOptions): Promise; downloadToBuffer(offset?: number, count?: number, options?: FileDownloadToBufferOptions): Promise; downloadToFile(filePath: string, offset?: number, count?: number, options?: FileDownloadOptions): Promise; + exists(options?: FileExistsOptions): Promise; forceCloseAllHandles(options?: FileForceCloseHandlesOptions): Promise; forceCloseHandle(handleId: string, options?: FileForceCloseHandlesOptions): Promise; getProperties(options?: FileGetPropertiesOptions): Promise; diff --git a/sdk/storage/storage-file-share/src/ShareClient.ts b/sdk/storage/storage-file-share/src/ShareClient.ts index 80fe5d1eb1bf..e64e532ae62c 100644 --- a/sdk/storage/storage-file-share/src/ShareClient.ts +++ b/sdk/storage/storage-file-share/src/ShareClient.ts @@ -156,6 +156,23 @@ export interface ShareGetAccessPolicyOptions extends CommonOptions { abortSignal?: AbortSignalLike; } +/** + * Options to configure the {@link ShareClient.exists} operation. + * + * @export + * @interface ShareExistsOptions + */ +export interface ShareExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof ShareExistsOptions + */ + abortSignal?: AbortSignalLike; +} + /** * Options to configure the {@link ShareClient.getProperties} operation. * @@ -336,6 +353,38 @@ export type ShareGetStatisticsResponse = ShareGetStatisticsResponseModel & { shareUsage: number; }; +/** + * Contains response data for the {@link ShareClient.createIfNotExists} operation. + * + * @export + * @interface ShareCreateIfNotExistsResponse + */ +export interface ShareCreateIfNotExistsResponse extends ShareCreateResponse { + /** + * Indicate whether the share is successfully created. Is false when the share is not changed as it already exists. + * + * @type {boolean} + * @memberof ShareCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link ShareClient.deleteIfExists} operation. + * + * @export + * @interface ShareDeleteIfExistsResponse + */ +export interface ShareDeleteIfExistsResponse extends ShareDeleteResponse { + /** + * Indicate whether the share is successfully deleted. Is false if the share does not exist in the first place. + * + * @type {boolean} + * @memberof ShareDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A ShareClient represents a URL to the Azure Storage share allowing you to manipulate its directories and files. * @@ -504,6 +553,53 @@ export class ShareClient extends StorageClient { } } + /** + * Creates a new share under the specified account. If the share with + * the same name already exists, it is not changed. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-share + * + * @param {ShareCreateOptions} [options] + * @returns {Promise} + * @memberof ShareClient + */ + public async createIfNotExists( + options: ShareCreateOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ShareClient-createIfNotExists", + options.tracingOptions + ); + try { + const res = await this.create({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ShareAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a share only if it doesn't already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Creates a {@link ShareDirectoryClient} object. * @@ -683,6 +779,43 @@ export class ShareClient extends StorageClient { } } + /** + * Returns true if the Azrue share resource represented by this client exists; false otherwise. + * + * NOTE: use this function with care since an existing share might be deleted by other clients or + * applications. Vice versa new shares might be added by other clients or applications after this + * function completes. + * + * @param {ShareExistsOptions} [options] options to Exists operation. + * @returns {Promise} + * @memberof ShareClient + */ + public async exists(options: ShareExistsOptions = {}): Promise { + const { span, spanOptions } = createSpan("ShareClient-exists", options.tracingOptions); + try { + await this.getProperties({ + abortSignal: options.abortSignal, + tracingOptions: { ...options.tracingOptions, spanOptions } + }); + return true; + } catch (e) { + if (e.statusCode === 404) { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when checking share existence" + }); + return false; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns all user-defined metadata and system properties for the specified * share. @@ -743,6 +876,50 @@ export class ShareClient extends StorageClient { } } + /** + * Marks the specified share for deletion if it exists. The share and any directories or files + * contained within it are later deleted during garbage collection. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-share + * + * @param {ShareDeleteMethodOptions} [options] + * @returns {Promise} + * @memberof ShareClient + */ + public async deleteIfExists( + options: ShareDeleteMethodOptions = {} + ): Promise { + const { span, spanOptions } = createSpan("ShareClient-deleteIfExists", options.tracingOptions); + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ShareNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a share only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Sets one or more user-defined name-value pairs for the specified share. * diff --git a/sdk/storage/storage-file-share/src/ShareDirectoryClient.ts b/sdk/storage/storage-file-share/src/ShareDirectoryClient.ts index a774b2c61afd..ca018b60e0e3 100644 --- a/sdk/storage/storage-file-share/src/ShareDirectoryClient.ts +++ b/sdk/storage/storage-file-share/src/ShareDirectoryClient.ts @@ -54,7 +54,7 @@ export interface DirectoryCreateOptions extends FileAndDirectoryCreateCommonOpti * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof DirectoryCreateOptions */ abortSignal?: AbortSignalLike; /** @@ -95,7 +95,7 @@ interface DirectoryListFilesAndDirectoriesSegmentOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof DirectoryListFilesAndDirectoriesSegmentOptions */ abortSignal?: AbortSignalLike; /** @@ -155,7 +155,24 @@ export interface DirectoryDeleteOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof DirectoryDeleteOptions + */ + abortSignal?: AbortSignalLike; +} + +/** + * Options to configure the {@link ShareDirectoryClient.exists} operation. + * + * @export + * @interface DirectoryExistsOptions + */ +export interface DirectoryExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof DirectoryExistsOptions */ abortSignal?: AbortSignalLike; } @@ -172,7 +189,7 @@ export interface DirectoryGetPropertiesOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof DirectoryGetPropertiesOptions */ abortSignal?: AbortSignalLike; } @@ -189,7 +206,7 @@ export interface DirectorySetMetadataOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof DirectorySetMetadataOptions */ abortSignal?: AbortSignalLike; } @@ -345,6 +362,38 @@ export interface DirectoryForceCloseHandlesOptions extends CommonOptions { abortSignal?: AbortSignalLike; } +/** + * Contains response data for the {@link DirectoryClient.createIfNotExists} operation. + * + * @export + * @interface DirectoryCreateIfNotExistsResponse + */ +export interface DirectoryCreateIfNotExistsResponse extends DirectoryCreateResponse { + /** + * Indicate whether the directory is successfully created. Is false when the directory is not changed as it already exists. + * + * @type {boolean} + * @memberof DirectoryCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link DirectoryClient.deleteIfExists} operation. + * + * @export + * @interface DirectoryDeleteIfExistsResponse + */ +export interface DirectoryDeleteIfExistsResponse extends DirectoryDeleteResponse { + /** + * Indicate whether the directory is successfully deleted. Is false if the directory does not exist in the first place. + * + * @type {boolean} + * @memberof DirectoryDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A ShareDirectoryClient represents a URL to the Azure Storage directory allowing you to manipulate its files and directories. * @@ -494,6 +543,53 @@ export class ShareDirectoryClient extends StorageClient { } } + /** + * Creates a new directory under the specified share or parent directory if it does not already exists. + * If the directory already exists, it is not modified. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-directory + * + * @param {DirectoryCreateOptions} [options] + * @returns {Promise} + * @memberof ShareDirectoryClient + */ + public async createIfNotExists( + options: DirectoryCreateOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ShareDirectoryClient-createIfNotExists", + options.tracingOptions + ); + try { + const res = await this.create({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ResourceAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a directory only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Sets properties on the directory. * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-directory-properties @@ -745,6 +841,46 @@ export class ShareDirectoryClient extends StorageClient { ); } + /** + * Returns true if the specified directory exists; false otherwise. + * + * NOTE: use this function with care since an existing directory might be deleted by other clients or + * applications. Vice versa new directories might be added by other clients or applications after this + * function completes. + * + * @param {DirectoryExistsOptions} [options] options to Exists operation. + * @returns {Promise} + * @memberof ShareDirectoryClient + */ + public async exists(options: DirectoryExistsOptions = {}): Promise { + const { span, spanOptions } = createSpan("ShareDirectoryClient-exists", options.tracingOptions); + try { + await this.getProperties({ + abortSignal: options.abortSignal, + tracingOptions: { + ...options.tracingOptions, + spanOptions + } + }); + return true; + } catch (e) { + if (e.statusCode === 404) { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when checking directory existence" + }); + return false; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns all system properties for the specified directory, and can also be used to check the * existence of a directory. The data returned does not include the files in the directory or any @@ -805,6 +941,53 @@ export class ShareDirectoryClient extends StorageClient { } } + /** + * Removes the specified empty directory if it exists. Note that the directory must be empty before it can be + * deleted. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-directory + * + * @param {DirectoryDeleteOptions} [options] + * @returns {Promise} + * @memberof ShareDirectoryClient + */ + public async deleteIfExists( + options: DirectoryDeleteOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ShareDirectoryClient-deleteIfExists", + options.tracingOptions + ); + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ResourceNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a directory only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Updates user defined metadata for the specified directory. * @see https://docs.microsoft.com/en-us/rest/api/storageservices/set-directory-metadata diff --git a/sdk/storage/storage-file-share/src/ShareFileClient.ts b/sdk/storage/storage-file-share/src/ShareFileClient.ts index 7bd59daabe4a..fc62dee30d0a 100644 --- a/sdk/storage/storage-file-share/src/ShareFileClient.ts +++ b/sdk/storage/storage-file-share/src/ShareFileClient.ts @@ -76,7 +76,7 @@ export interface FileCreateOptions extends FileAndDirectoryCreateCommonOptions, * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof FileCreateOptions */ abortSignal?: AbortSignalLike; /** @@ -170,7 +170,7 @@ export interface FileDownloadOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof FileDownloadOptions */ abortSignal?: AbortSignalLike; /** @@ -227,7 +227,7 @@ export interface FileUploadRangeOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof FileUploadRangeOptions */ abortSignal?: AbortSignalLike; /** @@ -331,7 +331,7 @@ export interface FileGetRangeListOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof FileGetRangeListOptions */ abortSignal?: AbortSignalLike; /** @@ -350,6 +350,23 @@ export interface FileGetRangeListOptions extends CommonOptions { leaseAccessConditions?: LeaseAccessConditions; } +/** + * Options to configure the {@link ShareFileClient.exists} operation. + * + * @export + * @interface FileExistsOptions + */ +export interface FileExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof FileExistsOptions + */ + abortSignal?: AbortSignalLike; +} + /** * Options to configure the {@link ShareFileClient.getProperties} operation. * @@ -362,7 +379,7 @@ export interface FileGetPropertiesOptions extends CommonOptions { * For example, use the @azure/abort-controller to create an `AbortSignal`. * * @type {AbortSignalLike} - * @memberof AppendBlobCreateOptions + * @memberof FileGetPropertiesOptions */ abortSignal?: AbortSignalLike; /** @@ -871,6 +888,22 @@ export interface FileDownloadToBufferOptions extends CommonOptions { leaseAccessConditions?: LeaseAccessConditions; } +/** + * Contains response data for the {@link ShareFileClient.deleteIfExists} operation. + * + * @export + * @interface FileDeleteIfExistsResponse + */ +export interface FileDeleteIfExistsResponse extends FileDeleteResponse { + /** + * Indicate whether the file is successfully deleted. Is false if the file does not exist in the first place. + * + * @type {boolean} + * @memberof FileDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A ShareFileClient represents a URL to an Azure Storage file. * @@ -1191,6 +1224,46 @@ export class ShareFileClient extends StorageClient { } } + /** + * Returns true if the specified file exists; false otherwise. + * + * NOTE: use this function with care since an existing file might be deleted by other clients or + * applications. Vice versa new files might be added by other clients or applications after this + * function completes. + * + * @param {FileExistsOptions} [options] options to Exists operation. + * @returns {Promise} + * @memberof ShareFileClient + */ + public async exists(options: FileExistsOptions = {}): Promise { + const { span, spanOptions } = createSpan("ShareFileClient-exists", options.tracingOptions); + try { + await this.getProperties({ + abortSignal: options.abortSignal, + tracingOptions: { + ...options.tracingOptions, + spanOptions + } + }); + return true; + } catch (e) { + if (e.statusCode === 404) { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when checking file existence" + }); + return false; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Returns all user-defined metadata, standard HTTP properties, and system properties * for the file. It does not return the content of the file. @@ -1306,6 +1379,62 @@ export class ShareFileClient extends StorageClient { } } + /** + * Removes the file from the storage account if it exists. + * When a file is successfully deleted, it is immediately removed from the storage + * account's index and is no longer accessible to clients. The file's data is later + * removed from the service during garbage collection. + * + * Delete File will fail with status code 409 (Conflict) and error code SharingViolation + * if the file is open on an SMB client. + * + * Delete File is not supported on a share snapshot, which is a read-only copy of + * a share. An attempt to perform this operation on a share snapshot will fail with 400 (InvalidQueryParameterValue) + * + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-file2 + * + * @param {FileDeleteOptions} [options] + * @returns {Promise} + * @memberof ShareFileClient + */ + public async deleteIfExists( + options: FileDeleteOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "ShareFileClient-deleteIfExists", + options.tracingOptions + ); + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "ResourceNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a file only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Sets HTTP headers on the file. * diff --git a/sdk/storage/storage-file-share/test/directoryclient.spec.ts b/sdk/storage/storage-file-share/test/directoryclient.spec.ts index ab64c27d6de8..827509d99849 100644 --- a/sdk/storage/storage-file-share/test/directoryclient.spec.ts +++ b/sdk/storage/storage-file-share/test/directoryclient.spec.ts @@ -152,6 +152,35 @@ describe("DirectoryClient", () => { assert.ok(result.fileParentId!); }); + it("createIfNotExists", async () => { + const res = await dirClient.createIfNotExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "ResourceAlreadyExists"); + + const dirClient2 = shareClient.getDirectoryClient(recorder.getUniqueName(dirName)); + const res2 = await dirClient2.createIfNotExists(); + assert.ok(res2.succeeded); + + await dirClient2.delete(); + }); + + it("deleteIfExists", async () => { + const dirClient2 = shareClient.getDirectoryClient(recorder.getUniqueName(dirName)); + const res = await dirClient2.deleteIfExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "ResourceNotFound"); + + await dirClient2.create(); + const res2 = await dirClient2.deleteIfExists(); + assert.ok(res2.succeeded); + }); + + it("exists", async () => { + assert.ok(await dirClient.exists()); + const dirClient2 = shareClient.getDirectoryClient(recorder.getUniqueName(dirName)); + assert.ok(!(await dirClient2.exists())); + }); + it("setProperties with default parameters", async () => { await dirClient.setProperties(); diff --git a/sdk/storage/storage-file-share/test/fileclient.spec.ts b/sdk/storage/storage-file-share/test/fileclient.spec.ts index f81b20af17ba..fddd84646f4c 100644 --- a/sdk/storage/storage-file-share/test/fileclient.spec.ts +++ b/sdk/storage/storage-file-share/test/fileclient.spec.ts @@ -288,6 +288,22 @@ describe("FileClient", () => { await fileClient.delete(); }); + it("deleteIfExists", async () => { + const res = await fileClient.deleteIfExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "ResourceNotFound"); + + await fileClient.create(content.length); + const res2 = await fileClient.deleteIfExists(); + assert.ok(res2.succeeded); + }); + + it("exists", async () => { + assert.ok(!(await fileClient.exists())); + await fileClient.create(content.length); + assert.ok(await fileClient.exists()); + }); + it("startCopyFromURL", async () => { recorder.skip("browser"); await fileClient.create(1024); diff --git a/sdk/storage/storage-file-share/test/shareclient.spec.ts b/sdk/storage/storage-file-share/test/shareclient.spec.ts index a8d2c6577f16..0b32922940ba 100644 --- a/sdk/storage/storage-file-share/test/shareclient.spec.ts +++ b/sdk/storage/storage-file-share/test/shareclient.spec.ts @@ -37,6 +37,13 @@ describe("ShareClient", () => { assert.deepEqual(result.metadata, metadata); }); + it("exists", async () => { + assert.ok(await shareClient.exists()); + + const shareClient2 = serviceClient.getShareClient(recorder.getUniqueName(shareName)); + assert.ok(!(await shareClient2.exists())); + }); + it("getProperties", async () => { const result = await shareClient.getProperties(); assert.ok(result.etag!.length > 0); @@ -59,11 +66,35 @@ describe("ShareClient", () => { assert.deepEqual(result.metadata, metadata); }); + it("createIfNotExists", async () => { + const shareClient2 = serviceClient.getShareClient(recorder.getUniqueName(shareName)); + const res = await shareClient2.createIfNotExists(); + assert.ok(res.succeeded); + + const res2 = await shareClient2.createIfNotExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "ShareAlreadyExists"); + + await shareClient2.delete(); + }); + it("delete", (done) => { // delete() with default parameters has been tested in afterEach done(); }); + it("deleteIfExists", async () => { + const shareClient2 = serviceClient.getShareClient(recorder.getUniqueName(shareName)); + await shareClient2.create(); + const res = await shareClient2.deleteIfExists(); + assert.ok(res.succeeded); + + const shareClient3 = serviceClient.getShareClient(recorder.getUniqueName(shareName + "3")); + const res2 = await shareClient3.deleteIfExists(); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "ShareNotFound"); + }); + it("setQuota", async () => { const quotaInGB = 20; await shareClient.setQuota(quotaInGB); diff --git a/sdk/storage/storage-queue/CHANGELOG.md b/sdk/storage/storage-queue/CHANGELOG.md index 2461684c430f..0e916b50126d 100644 --- a/sdk/storage/storage-queue/CHANGELOG.md +++ b/sdk/storage/storage-queue/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 12.1.0 (unreleased) + +- Added `exists`, `createIfNotExists` and `deleteIfExists` to `QueueClient`. + ## 12.0.5 (2020.05) - Fix un-handled TypeError [issue #8499](https://github.com/Azure/azure-sdk-for-js/issues/8499) in Electron applications. [PR #8568](https://github.com/Azure/azure-sdk-for-js/pull/8568) diff --git a/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_createifnotexists.json b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_createifnotexists.json new file mode 100644 index 000000000000..a67c07c8305f --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_createifnotexists.json @@ -0,0 +1,104 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577431909488", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:13 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "be9b39d5-c3a5-42e4-b449-e71f048b74a8", + "x-ms-request-id": "70214e7f-e003-0056-1ffe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577431909488", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:14 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "a2689949-2795-48e9-b819-df52d9141a9f", + "x-ms-request-id": "70214f19-e003-0056-2dfe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577431909488", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 409, + "response": "QueueAlreadyExistsThe specified queue already exists.\nRequestId:70214fe5-e003-0056-70fe-4d53e0000000\nTime:2020-06-29T10:16:14.8719699Z", + "responseHeaders": { + "content-length": "222", + "content-type": "application/xml", + "date": "Mon, 29 Jun 2020 10:16:14 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "10a4138e-8f79-4c20-bb51-eda3a103b852", + "x-ms-error-code": "QueueAlreadyExists", + "x-ms-request-id": "70214fe5-e003-0056-70fe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue2159342577667204259", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:15 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7fbcf3f1-3fd3-4287-9aef-e5885a24ffd2", + "x-ms-request-id": "702150c7-e003-0056-41fe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.queue.core.windows.net/queue2159342577667204259", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:15 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "883cb114-d954-4df1-89a4-af8bda6177e7", + "x-ms-request-id": "702151b2-e003-0056-0cfe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "queue": "queue159342577431909488", + "queue2": "queue2159342577667204259" + }, + "newDate": {} + }, + "hash": "a03546c79508e1fb32e3ed422a9ed14b" +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_deleteifexists.json b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_deleteifexists.json new file mode 100644 index 000000000000..c0a102dee134 --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_deleteifexists.json @@ -0,0 +1,104 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577785407667", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:16 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "1dc86cb2-5a55-4c6e-aba6-d6773a40a26b", + "x-ms-request-id": "70215285-e003-0056-43fe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577785407667159342577843803140", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 404, + "response": "QueueNotFoundThe specified queue does not exist.\nRequestId:7021536a-e003-0056-0bfe-4d53e0000000\nTime:2020-06-29T10:16:17.2616685Z", + "responseHeaders": { + "content-length": "217", + "content-type": "application/xml", + "date": "Mon, 29 Jun 2020 10:16:16 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "568f0f16-1dff-4368-b7de-2a4041397071", + "x-ms-error-code": "QueueNotFound", + "x-ms-request-id": "7021536a-e003-0056-0bfe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577785407667159342577843803140", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:17 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "85ad7e4b-51e3-4ade-b647-4025281847a9", + "x-ms-request-id": "7021545f-e003-0056-6dfe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577785407667159342577843803140", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:18 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "68e7f866-fa15-4890-816b-66b84e5d9df6", + "x-ms-request-id": "70215558-e003-0056-4ffe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.queue.core.windows.net/queue159342577785407667", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 29 Jun 2020 10:16:18 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "fcc348bd-2382-4cdf-b72e-6abc54ec9eb8", + "x-ms-request-id": "702155fa-e003-0056-63fe-4d53e0000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "queue": "queue159342577785407667", + "queue159342577785407667": "queue159342577785407667159342577843803140" + }, + "newDate": {} + }, + "hash": "ff6b00b1231848e190fff196dcfe94df" +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_exists.json b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_exists.json new file mode 100644 index 000000000000..06783932f659 --- /dev/null +++ b/sdk/storage/storage-queue/recordings/browsers/queueclient/recording_exists.json @@ -0,0 +1,90 @@ +{ + "recordings": [ + { + "method": "PUT", + "url": "https://fakestorageaccount.queue.core.windows.net/queue158978152108502408", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 201, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:58:40 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "793552df-6525-4732-b9de-d14d683a111a", + "x-ms-request-id": "3d8b668d-5003-001e-53d9-2c4ed7000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.queue.core.windows.net/queue158978152108502408", + "query": { + "comp": "metadata", + "timeout": "30" + }, + "requestBody": null, + "status": 200, + "response": "", + "responseHeaders": { + "cache-control": "no-cache", + "content-length": "0", + "date": "Mon, 18 May 2020 05:58:40 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-approximate-messages-count": "0", + "x-ms-client-request-id": "5908d4f5-f42d-4adc-a27b-c25ded6aa59c", + "x-ms-request-id": "3d8b6aec-5003-001e-18d9-2c4ed7000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "GET", + "url": "https://fakestorageaccount.queue.core.windows.net/queue158978152108502408158978152313603258", + "query": { + "comp": "metadata", + "timeout": "30" + }, + "requestBody": null, + "status": 404, + "response": "QueueNotFoundThe specified queue does not exist.\nRequestId:3d8b6f17-5003-001e-22d9-2c4ed7000000\nTime:2020-05-18T05:58:41.7027617Z", + "responseHeaders": { + "content-length": "217", + "content-type": "application/xml", + "date": "Mon, 18 May 2020 05:58:41 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "12cf103f-f6c1-4a4d-bc46-d435e3b4981f", + "x-ms-error-code": "QueueNotFound", + "x-ms-request-id": "3d8b6f17-5003-001e-22d9-2c4ed7000000", + "x-ms-version": "2019-07-07" + } + }, + { + "method": "DELETE", + "url": "https://fakestorageaccount.queue.core.windows.net/queue158978152108502408", + "query": { + "timeout": "30" + }, + "requestBody": null, + "status": 204, + "response": "", + "responseHeaders": { + "content-length": "0", + "date": "Mon, 18 May 2020 05:58:41 GMT", + "server": "Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0", + "x-ms-client-request-id": "7529fb45-f9eb-45a9-a082-fcf9f77436db", + "x-ms-request-id": "3d8b74f5-5003-001e-64d9-2c4ed7000000", + "x-ms-version": "2019-07-07" + } + } + ], + "uniqueTestInfo": { + "uniqueName": { + "queue": "queue158978152108502408", + "queue158978152108502408": "queue158978152108502408158978152313603258" + }, + "newDate": {} + }, + "hash": "b378eed67d5e32bad7a662a0828b1601" +} \ No newline at end of file diff --git a/sdk/storage/storage-queue/recordings/node/queueclient/recording_createifnotexists.js b/sdk/storage/storage-queue/recordings/node/queueclient/recording_createifnotexists.js new file mode 100644 index 000000000000..5c93f93b371e --- /dev/null +++ b/sdk/storage/storage-queue/recordings/node/queueclient/recording_createifnotexists.js @@ -0,0 +1,99 @@ +let nock = require('nock'); + +module.exports.hash = "92bb428ef916f02881e1e1e65360e11c"; + +module.exports.testInfo = {"uniqueName":{"queue":"queue159342573372108514","queue2":"queue2159342573572002007"},"newDate":{}} + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue159342573372108514') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4018d72-b003-0006-80fe-4d91b0000000', + 'x-ms-client-request-id', + '45162f72-d550-4a1d-a568-55c8edff79bb', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:32 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue159342573372108514') + .query(true) + .reply(204, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4018e84-b003-0006-80fe-4d91b0000000', + 'x-ms-client-request-id', + '5db6d0d1-40d6-4f3e-a210-dd0ab54a45b7', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:32 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue159342573372108514') + .query(true) + .reply(409, "QueueAlreadyExistsThe specified queue already exists.\nRequestId:b4018fad-b003-0006-22fe-4d91b0000000\nTime:2020-06-29T10:15:33.9408867Z", [ + 'Content-Length', + '222', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4018fad-b003-0006-22fe-4d91b0000000', + 'x-ms-client-request-id', + '6f861410-8cd7-408d-91db-16772fdab949', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'QueueAlreadyExists', + 'Date', + 'Mon, 29 Jun 2020 10:15:33 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue2159342573572002007') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b401912f-b003-0006-14fe-4d91b0000000', + 'x-ms-client-request-id', + '8335994f-950a-4ccf-8a81-55f3fbf17b92', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:33 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/queue2159342573572002007') + .query(true) + .reply(204, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4019261-b003-0006-3dfe-4d91b0000000', + 'x-ms-client-request-id', + '6984a66e-60e3-479a-b355-f560742c5ecd', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:33 GMT' +]); diff --git a/sdk/storage/storage-queue/recordings/node/queueclient/recording_deleteifexists.js b/sdk/storage/storage-queue/recordings/node/queueclient/recording_deleteifexists.js new file mode 100644 index 000000000000..5bdd47db6eda --- /dev/null +++ b/sdk/storage/storage-queue/recordings/node/queueclient/recording_deleteifexists.js @@ -0,0 +1,99 @@ +let nock = require('nock'); + +module.exports.hash = "0fe0ca4b1f953636dbf73ff0a3b3e6c1"; + +module.exports.testInfo = {"uniqueName":{"queue":"queue159342573634603293","queue159342573634603293":"queue159342573634603293159342573664608502"},"newDate":{}} + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue159342573634603293') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b401936b-b003-0006-40fe-4d91b0000000', + 'x-ms-client-request-id', + 'aa162b01-9a15-48ab-a0bc-1e4e7c004136', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:34 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/queue159342573634603293159342573664608502') + .query(true) + .reply(404, "QueueNotFoundThe specified queue does not exist.\nRequestId:b4019487-b003-0006-4cfe-4d91b0000000\nTime:2020-06-29T10:15:35.1767529Z", [ + 'Content-Length', + '217', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4019487-b003-0006-4cfe-4d91b0000000', + 'x-ms-client-request-id', + 'acf75a5a-3726-4b29-89e3-befc555c4b2b', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'QueueNotFound', + 'Date', + 'Mon, 29 Jun 2020 10:15:34 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue159342573634603293159342573664608502') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b401955c-b003-0006-1cfe-4d91b0000000', + 'x-ms-client-request-id', + '106f8138-0c66-475d-b1e6-6c1d518e1cd8', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:34 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/queue159342573634603293159342573664608502') + .query(true) + .reply(204, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4019653-b003-0006-03fe-4d91b0000000', + 'x-ms-client-request-id', + '8e671c7b-3eda-4e77-930e-90009cc08c58', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:35 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/queue159342573634603293') + .query(true) + .reply(204, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'b4019771-b003-0006-1dfe-4d91b0000000', + 'x-ms-client-request-id', + '9cf65e2e-d43c-41fa-b154-64d4879ae7e0', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 29 Jun 2020 10:15:35 GMT' +]); diff --git a/sdk/storage/storage-queue/recordings/node/queueclient/recording_exists.js b/sdk/storage/storage-queue/recordings/node/queueclient/recording_exists.js new file mode 100644 index 000000000000..58d04b489b17 --- /dev/null +++ b/sdk/storage/storage-queue/recordings/node/queueclient/recording_exists.js @@ -0,0 +1,93 @@ +let nock = require('nock'); + +module.exports.hash = "ef71ed1d7a755db09faa585b94f68a33"; + +module.exports.testInfo = {"uniqueName":{"queue":"queue158978149318207514","queue158978149318207514":"queue158978149318207514158978149486703820"},"newDate":{}} + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .put('/queue158978149318207514') + .query(true) + .reply(201, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'f46fa64d-8003-0050-68d9-2c605f000000', + 'x-ms-client-request-id', + 'a25183a1-affc-48dc-96b5-33a26535f00d', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:58:12 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .get('/queue158978149318207514') + .query(true) + .reply(200, "", [ + 'Cache-Control', + 'no-cache', + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'f46fa72f-8003-0050-3dd9-2c605f000000', + 'x-ms-client-request-id', + '7ed17f4e-0dcc-4e43-9493-75f5ce167a08', + 'x-ms-version', + '2019-07-07', + 'x-ms-approximate-messages-count', + '0', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-approximate-messages-count,Cache-Control,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:58:12 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .get('/queue158978149318207514158978149486703820') + .query(true) + .reply(404, "QueueNotFoundThe specified queue does not exist.\nRequestId:f46fa838-8003-0050-39d9-2c605f000000\nTime:2020-05-18T05:58:13.1343246Z", [ + 'Content-Length', + '217', + 'Content-Type', + 'application/xml', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'f46fa838-8003-0050-39d9-2c605f000000', + 'x-ms-client-request-id', + '4bdcd298-4f43-4226-84b3-a0fa348d650b', + 'x-ms-version', + '2019-07-07', + 'x-ms-error-code', + 'QueueNotFound', + 'Access-Control-Expose-Headers', + 'x-ms-request-id,x-ms-client-request-id,Server,x-ms-version,x-ms-error-code,Content-Length,Date,Transfer-Encoding', + 'Access-Control-Allow-Origin', + '*', + 'Date', + 'Mon, 18 May 2020 05:58:12 GMT' +]); + +nock('https://fakestorageaccount.queue.core.windows.net:443', {"encodedQueryParams":true}) + .delete('/queue158978149318207514') + .query(true) + .reply(204, "", [ + 'Content-Length', + '0', + 'Server', + 'Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0', + 'x-ms-request-id', + 'f46fa938-8003-0050-29d9-2c605f000000', + 'x-ms-client-request-id', + '21ec402a-eb02-441f-a8be-fa104430e8ed', + 'x-ms-version', + '2019-07-07', + 'Date', + 'Mon, 18 May 2020 05:58:13 GMT' +]); diff --git a/sdk/storage/storage-queue/review/storage-queue.api.md b/sdk/storage/storage-queue/review/storage-queue.api.md index 2802b01534ab..9ae7358f0acb 100644 --- a/sdk/storage/storage-queue/review/storage-queue.api.md +++ b/sdk/storage/storage-queue/review/storage-queue.api.md @@ -357,8 +357,11 @@ export class QueueClient extends StorageClient { constructor(url: string, pipeline: Pipeline); clearMessages(options?: QueueClearMessagesOptions): Promise; create(options?: QueueCreateOptions): Promise; + createIfNotExists(options?: QueueCreateOptions): Promise; delete(options?: QueueDeleteOptions): Promise; + deleteIfExists(options?: QueueDeleteOptions): Promise; deleteMessage(messageId: string, popReceipt: string, options?: QueueDeleteMessageOptions): Promise; + exists(options?: QueueExistsOptions): Promise; getAccessPolicy(options?: QueueGetAccessPolicyOptions): Promise; getProperties(options?: QueueGetPropertiesOptions): Promise; get name(): string; @@ -380,6 +383,11 @@ export interface QueueCreateHeaders { version?: string; } +// @public +export interface QueueCreateIfNotExistsResponse extends QueueCreateResponse { + succeeded: boolean; +} + // @public export interface QueueCreateOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -403,6 +411,11 @@ export interface QueueDeleteHeaders { version?: string; } +// @public +export interface QueueDeleteIfExistsResponse extends QueueDeleteResponse { + succeeded: boolean; +} + // @public export interface QueueDeleteMessageOptions extends CommonOptions { abortSignal?: AbortSignalLike; @@ -423,6 +436,11 @@ export type QueueDeleteResponse = QueueDeleteHeaders & { }; }; +// @public +export interface QueueExistsOptions extends CommonOptions { + abortSignal?: AbortSignalLike; +} + // @public export interface QueueGetAccessPolicyHeaders { clientRequestId?: string; diff --git a/sdk/storage/storage-queue/src/QueueClient.ts b/sdk/storage/storage-queue/src/QueueClient.ts index 16afad4189b4..dddcfe982cfa 100644 --- a/sdk/storage/storage-queue/src/QueueClient.ts +++ b/sdk/storage/storage-queue/src/QueueClient.ts @@ -71,6 +71,23 @@ export interface QueueCreateOptions extends CommonOptions { metadata?: Metadata; } +/** + * Options to configure {@link QueueClient.exists} operation + * + * @export + * @interface QueueExistsOptions + */ +export interface QueueExistsOptions extends CommonOptions { + /** + * An implementation of the `AbortSignalLike` interface to signal the request to cancel the operation. + * For example, use the @azure/abort-controller to create an `AbortSignal`. + * + * @type {AbortSignalLike} + * @memberof QueueExistsOptions + */ + abortSignal?: AbortSignalLike; +} + /** * Options to configure {@link QueueClient.getProperties} operation * @@ -411,6 +428,38 @@ export interface QueueUpdateMessageOptions extends CommonOptions { abortSignal?: AbortSignalLike; } +/** + * Contains response data for the {@link QueueClient.createIfNotExists} operation. + * + * @export + * @interface QueueCreateIfNotExistsResponse + */ +export interface QueueCreateIfNotExistsResponse extends QueueCreateResponse { + /** + * Indicate whether the queue is successfully created. Is false when the queue is not changed as it already exists. + * + * @type {boolean} + * @memberof QueueCreateIfNotExistsResponse + */ + succeeded: boolean; +} + +/** + * Contains response data for the {@link QueueClient.deleteIfExists} operation. + * + * @export + * @interface QueueDeleteIfExistsResponse + */ +export interface QueueDeleteIfExistsResponse extends QueueDeleteResponse { + /** + * Indicate whether the queue is successfully deleted. Is false if the queue does not exist in the first place. + * + * @type {boolean} + * @memberof QueueDeleteIfExistsResponse + */ + succeeded: boolean; +} + /** * A QueueClient represents a URL to an Azure Storage Queue's messages allowing you to manipulate its messages. * @@ -608,6 +657,107 @@ export class QueueClient extends StorageClient { } } + /** + * Creates a new queue under the specified account if it doesn't already exist. + * If the queue already exists, it is not changed. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/create-queue4 + * + * @param {QueueCreateOptions} [options] + * @returns {Promise} + * @memberof QueueClient + */ + public async createIfNotExists( + options: QueueCreateOptions = {} + ): Promise { + const { span, spanOptions } = createSpan( + "QueueClient-createIfNotExists", + options.tracingOptions + ); + try { + const response = await this.create({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + + // When a queue with the specified name already exists, the Queue service checks the metadata associated with the existing queue. + // If the existing metadata is identical to the metadata specified on the Create Queue request, status code 204 (No Content) is returned. + // If the existing metadata does not match, the operation fails and status code 409 (Conflict) is returned. + if (response._response.status == 204) { + return { + succeeded: false, + ...response + }; + } + return { + succeeded: true, + ...response + }; + } catch (e) { + if (e.details?.errorCode === "QueueAlreadyExists") { + span.setStatus({ + code: CanonicalCode.ALREADY_EXISTS, + message: "Expected exception when creating a queue only if it does not already exist." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + + /** + * Deletes the specified queue permanently if it exists. + * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-queue3 + * + * @param {QueueDeleteOptions} [options] + * @returns {Promise} + * @memberof QueueClient + */ + public async deleteIfExists( + options: QueueDeleteOptions = {} + ): Promise { + const { span, spanOptions } = createSpan("QueueClient-deleteIfExists", options.tracingOptions); + try { + const res = await this.delete({ + ...options, + tracingOptions: { ...options!.tracingOptions, spanOptions } + }); + return { + succeeded: true, + ...res + }; + } catch (e) { + if (e.details?.errorCode === "QueueNotFound") { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when deleting a queue only if it exists." + }); + return { + succeeded: false, + ...e.response?.parsedHeaders, + _response: e.response + }; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Deletes the specified queue permanently. * @see https://docs.microsoft.com/en-us/rest/api/storageservices/delete-queue3 @@ -643,6 +793,43 @@ export class QueueClient extends StorageClient { } } + /** + * Returns true if the specified queue exists; false otherwise. + * + * NOTE: use this function with care since an existing queue might be deleted by other clients or + * applications. Vice versa new queues might be added by other clients or applications after this + * function completes. + * + * @param {QueueExistsOptions} [options] options to Exists operation. + * @returns {Promise} + * @memberof QueueClient + */ + public async exists(options: QueueExistsOptions = {}): Promise { + const { span, spanOptions } = createSpan("QueueClient-exists", options.tracingOptions); + try { + await this.getProperties({ + abortSignal: options.abortSignal, + tracingOptions: { ...options.tracingOptions, spanOptions } + }); + return true; + } catch (e) { + if (e.statusCode === 404) { + span.setStatus({ + code: CanonicalCode.NOT_FOUND, + message: "Expected exception when checking queue existence" + }); + return false; + } + span.setStatus({ + code: CanonicalCode.UNKNOWN, + message: e.message + }); + throw e; + } finally { + span.end(); + } + } + /** * Gets all user-defined metadata and system properties for the specified * queue. Metadata is associated with the queue as name-values pairs. diff --git a/sdk/storage/storage-queue/test/queueclient.spec.ts b/sdk/storage/storage-queue/test/queueclient.spec.ts index b4c39aa6f3de..0d1d850cbfdd 100644 --- a/sdk/storage/storage-queue/test/queueclient.spec.ts +++ b/sdk/storage/storage-queue/test/queueclient.spec.ts @@ -96,6 +96,38 @@ describe("QueueClient", () => { ); }); + it("exists", async () => { + assert.ok(await queueClient.exists()); + + const qClient = queueServiceClient.getQueueClient(recorder.getUniqueName(queueName)); + assert.ok(!(await qClient.exists())); + }); + + it("createIfNotExists", async () => { + const res = await queueClient.createIfNotExists(); + assert.ok(!res.succeeded); + + const metadata = { key: "value" }; + const res2 = await queueClient.createIfNotExists({ metadata }); + assert.ok(!res2.succeeded); + assert.equal(res2.errorCode, "QueueAlreadyExists"); + + queueClient = queueServiceClient.getQueueClient(recorder.getUniqueName("queue2")); + const res3 = await queueClient.createIfNotExists(); + assert.ok(res3.succeeded); + }); + + it("deleteIfExists", async () => { + const qClient = queueServiceClient.getQueueClient(recorder.getUniqueName(queueName)); + const res = await qClient.deleteIfExists(); + assert.ok(!res.succeeded); + assert.equal(res.errorCode, "QueueNotFound"); + + await qClient.create(); + const res2 = await qClient.deleteIfExists(); + assert.ok(res2.succeeded); + }); + it("delete", (done) => { // delete() with default parameters has been tested in afterEach done();