diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py index 2913e6ad887d..92c70b4d5f87 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/aio/operations/_blob_operations.py @@ -202,6 +202,9 @@ async def download( response_headers = {} if response.status_code == 200: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -280,6 +283,9 @@ async def download( if response.status_code == 206: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py index 3fafd3d77736..bbe2f1427b0e 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_generated/operations/_blob_operations.py @@ -1603,6 +1603,9 @@ def download( response_headers = {} if response.status_code == 200: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) @@ -1681,6 +1684,9 @@ def download( if response.status_code == 206: response_headers["Last-Modified"] = self._deserialize("rfc-1123", response.headers.get("Last-Modified")) + response_headers["x-ms-creation-time"] = self._deserialize( + "rfc-1123", response.headers.get("x-ms-creation-time") + ) response_headers["x-ms-meta"] = self._deserialize("{str}", response.headers.get("x-ms-meta")) response_headers["x-ms-or-policy-id"] = self._deserialize("str", response.headers.get("x-ms-or-policy-id")) response_headers["x-ms-or"] = self._deserialize("{str}", response.headers.get("x-ms-or")) diff --git a/sdk/storage/azure-storage-blob/swagger/README.md b/sdk/storage/azure-storage-blob/swagger/README.md index af133f0f5a44..c3dfebfb826b 100644 --- a/sdk/storage/azure-storage-blob/swagger/README.md +++ b/sdk/storage/azure-storage-blob/swagger/README.md @@ -26,6 +26,8 @@ vanilla: true clear-output-folder: true python: true version-tolerant: false +modelerfour: + seal-single-value-enum-by-default: true ``` ### Remove x-ms-pageable diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json index 1d7b3144778c..8306c5b95b4d 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_create_blob_with_question_mark.json @@ -8,22 +8,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:16:21 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA412737768\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31A2EEC1\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -35,22 +35,22 @@ "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA4127D8805\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31B38F29\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -64,26 +64,26 @@ "Content-Length": "3", "Content-Type": "application/octet-stream", "If-None-Match": "*", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", - "x-ms-version": "2021-08-06" + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 12 Aug 2022 20:48:54 GMT", - "ETag": "\u00220x8DA7CA412883577\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31C34670\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], "x-ms-content-crc64": "VtoDJyOMw/A=", "x-ms-request-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -94,10 +94,10 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Connection": "keep-alive", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 20:48:55 GMT", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:16:22 GMT", "x-ms-range": "bytes=0-33554431", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 206, @@ -106,9 +106,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 12 Aug 2022 20:48:55 GMT", - "ETag": "\u00220x8DA7CA412883577\u0022", - "Last-Modified": "Fri, 12 Aug 2022 20:48:55 GMT", + "Date": "Fri, 17 Feb 2023 00:16:19 GMT", + "ETag": "\u00220x8DB107C31C34670\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:16:19 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -116,11 +116,11 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 12 Aug 2022 20:48:55 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:16:19 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": "Pz8/" } diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json new file mode 100644 index 000000000000..2bc60ceea621 --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob.pyTestStorageCommonBlobtest_download_properties.json @@ -0,0 +1,129 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e?restype=container\u0026timeout=5", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:26 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E70E48ABB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:24 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainersourcea3942b6e?restype=container\u0026timeout=5", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E70F440E1\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e/utcontainera3942b6e", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "Content-Length": "3", + "Content-Type": "application/octet-stream", + "If-None-Match": "*", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-blob-type": "BlockBlob", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": "YWJj", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Content-MD5": "kAFQmDzST7DWlj99KOF/cg==", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E710645CB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-content-crc64": "6/rBP7vK5QU=", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainera3942b6e/utcontainera3942b6e", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Connection": "keep-alive", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:32:27 GMT", + "x-ms-range": "bytes=0-33554431", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 206, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "3", + "Content-Range": "bytes 0-2/3", + "Content-Type": "application/octet-stream", + "Date": "Fri, 17 Feb 2023 00:32:24 GMT", + "ETag": "\u00220x8DB107E710645CB\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:32:25 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-blob-content-md5": "kAFQmDzST7DWlj99KOF/cg==", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:32:25 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": "YWJj" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json index 44d62b475031..d2dbd0bc6427 100644 --- a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_create_blob_with_question_mark.json @@ -7,22 +7,22 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:15:55 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54A33CD6\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C22508DD9\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -33,24 +33,28 @@ "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", "Content-Length": "0", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": null, - "StatusCode": 201, + "StatusCode": 409, "ResponseHeaders": { - "Content-Length": "0", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54B4033B\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Content-Length": "252", + "Content-Type": "application/xml", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], - "x-ms-version": "2021-08-06" + "x-ms-error-code": "ContainerBeingDeleted", + "x-ms-version": "2021-12-02" }, - "ResponseBody": null + "ResponseBody": [ + "\uFEFF\u003C?xml version=\u00221.0\u0022 encoding=\u0022utf-8\u0022?\u003E\u003CError\u003E\u003CCode\u003EContainerBeingDeleted\u003C/Code\u003E\u003CMessage\u003EThe specified container is being deleted. Try operation later.\n", + "RequestId:d6e02e0e-a01e-00b6-4464-428457000000\n", + "Time:2023-02-17T00:15:54.1990411Z\u003C/Message\u003E\u003C/Error\u003E" + ] }, { "RequestUri": "https://storagename.blob.core.windows.net/utcontainerd8ce3453/%3Fques%3Ftion%3F", @@ -61,26 +65,26 @@ "Content-Length": "3", "Content-Type": "application/octet-stream", "If-None-Match": "*", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", "x-ms-blob-type": "BlockBlob", - "x-ms-date": "Fri, 12 Aug 2022 23:35:24 GMT", - "x-ms-version": "2021-08-06" + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", + "x-ms-version": "2021-12-02" }, "RequestBody": "Pz8/", "StatusCode": 201, "ResponseHeaders": { "Content-Length": "0", "Content-MD5": "DRsIw0hYkhvHxmKyKKy3ug==", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54BFFF62\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C2275EECD\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" ], "x-ms-content-crc64": "VtoDJyOMw/A=", "x-ms-request-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": null }, @@ -90,10 +94,10 @@ "RequestHeaders": { "Accept": "application/xml", "Accept-Encoding": "gzip, deflate", - "User-Agent": "azsdk-python-storage-blob/12.14.0b1 Python/3.10.5 (Windows-10-10.0.22000-SP0)", - "x-ms-date": "Fri, 12 Aug 2022 23:35:25 GMT", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:15:56 GMT", "x-ms-range": "bytes=0-33554431", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "RequestBody": null, "StatusCode": 206, @@ -102,9 +106,9 @@ "Content-Length": "3", "Content-Range": "bytes 0-2/3", "Content-Type": "application/octet-stream", - "Date": "Fri, 12 Aug 2022 23:35:24 GMT", - "ETag": "\u00220x8DA7CBB54BFFF62\u0022", - "Last-Modified": "Fri, 12 Aug 2022 23:35:24 GMT", + "Date": "Fri, 17 Feb 2023 00:15:54 GMT", + "ETag": "\u00220x8DB107C2275EECD\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:15:54 GMT", "Server": [ "Windows-Azure-Blob/1.0", "Microsoft-HTTPAPI/2.0" @@ -112,11 +116,11 @@ "Vary": "Origin", "x-ms-blob-content-md5": "DRsIw0hYkhvHxmKyKKy3ug==", "x-ms-blob-type": "BlockBlob", - "x-ms-creation-time": "Fri, 12 Aug 2022 23:35:24 GMT", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:15:54 GMT", "x-ms-lease-state": "available", "x-ms-lease-status": "unlocked", "x-ms-server-encrypted": "true", - "x-ms-version": "2021-08-06" + "x-ms-version": "2021-12-02" }, "ResponseBody": "Pz8/" } diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json new file mode 100644 index 000000000000..a21b82b66eed --- /dev/null +++ b/sdk/storage/azure-storage-blob/tests/recordings/test_common_blob_async.pyTestStorageCommonBlobAsynctest_download_properties.json @@ -0,0 +1,125 @@ +{ + "Entries": [ + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9?restype=container", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:53 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:33:50 GMT", + "ETag": "\u00220x8DB107EA47292C6\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontainersourceaa3e2fe9?restype=container", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "0", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:53 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Date": "Fri, 17 Feb 2023 00:33:50 GMT", + "ETag": "\u00220x8DB107EA491B0DF\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9/utcontaineraa3e2fe9", + "RequestMethod": "PUT", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "Content-Length": "3", + "Content-Type": "application/octet-stream", + "If-None-Match": "*", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-blob-type": "BlockBlob", + "x-ms-date": "Fri, 17 Feb 2023 00:33:54 GMT", + "x-ms-version": "2021-12-02" + }, + "RequestBody": "YWJj", + "StatusCode": 201, + "ResponseHeaders": { + "Content-Length": "0", + "Content-MD5": "kAFQmDzST7DWlj99KOF/cg==", + "Date": "Fri, 17 Feb 2023 00:33:51 GMT", + "ETag": "\u00220x8DB107EA4A5730C\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "x-ms-content-crc64": "6/rBP7vK5QU=", + "x-ms-request-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": null + }, + { + "RequestUri": "https://storagename.blob.core.windows.net/utcontaineraa3e2fe9/utcontaineraa3e2fe9", + "RequestMethod": "GET", + "RequestHeaders": { + "Accept": "application/xml", + "Accept-Encoding": "gzip, deflate", + "User-Agent": "azsdk-python-storage-blob/12.15.0 Python/3.11.1 (Windows-10-10.0.22621-SP0)", + "x-ms-date": "Fri, 17 Feb 2023 00:33:54 GMT", + "x-ms-range": "bytes=0-33554431", + "x-ms-version": "2021-12-02" + }, + "RequestBody": null, + "StatusCode": 206, + "ResponseHeaders": { + "Accept-Ranges": "bytes", + "Content-Length": "3", + "Content-Range": "bytes 0-2/3", + "Content-Type": "application/octet-stream", + "Date": "Fri, 17 Feb 2023 00:33:51 GMT", + "ETag": "\u00220x8DB107EA4A5730C\u0022", + "Last-Modified": "Fri, 17 Feb 2023 00:33:51 GMT", + "Server": [ + "Windows-Azure-Blob/1.0", + "Microsoft-HTTPAPI/2.0" + ], + "Vary": "Origin", + "x-ms-blob-content-md5": "kAFQmDzST7DWlj99KOF/cg==", + "x-ms-blob-type": "BlockBlob", + "x-ms-creation-time": "Fri, 17 Feb 2023 00:33:51 GMT", + "x-ms-lease-state": "available", + "x-ms-lease-status": "unlocked", + "x-ms-server-encrypted": "true", + "x-ms-version": "2021-12-02" + }, + "ResponseBody": "YWJj" + } + ], + "Variables": {} +} diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob.py b/sdk/storage/azure-storage-blob/tests/test_common_blob.py index 8f7aac93f256..6efee9014da8 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob.py @@ -3257,4 +3257,30 @@ def test_validate_empty_blob(self, **kwargs): assert blob_client.exists() assert blob_client.get_blob_properties().size == 0 -# ------------------------------------------------------------------------------ + @BlobPreparer() + @recorded_by_proxy + def test_download_properties(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + self._setup(storage_account_name, storage_account_key) + + blob_name = self.get_resource_name("utcontainer") + blob_data = 'abc' + + # Act + blob = self.bsc.get_blob_client(self.container_name, blob_name) + blob.upload_blob(blob_data) + + # Assert + data = blob.download_blob(encoding='utf-8') + props = data.properties + + assert data is not None + assert data.readall() == blob_data + assert props['name'] == blob_name + assert props['creation_time'] is not None + assert props['content_settings'] is not None + assert props['size'] == len(blob_data) + + # ------------------------------------------------------------------------------ diff --git a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py index a4665ad35731..4b1596f0c499 100644 --- a/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py +++ b/sdk/storage/azure-storage-blob/tests/test_common_blob_async.py @@ -3182,4 +3182,30 @@ async def test_validate_empty_blob(self, **kwargs): assert await blob_client.exists() assert (await blob_client.get_blob_properties()).size == 0 + @BlobPreparer() + @recorded_by_proxy_async + async def test_download_properties(self, **kwargs): + storage_account_name = kwargs.pop("storage_account_name") + storage_account_key = kwargs.pop("storage_account_key") + + await self._setup(storage_account_name, storage_account_key) + + blob_name = self.get_resource_name("utcontainer") + blob_data = 'abc' + + # Act + blob = self.bsc.get_blob_client(self.container_name, blob_name) + await blob.upload_blob(blob_data) + + # Assert + stream = await blob.download_blob(encoding='utf-8') + props = stream.properties + data = await stream.readall() + + assert data is not None + assert data == blob_data + assert props['creation_time'] is not None + assert props['content_settings'] is not None + assert props['size'] == len(blob_data) + # ------------------------------------------------------------------------------