diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py
index a8b48b7b70f2..159e0e676c84 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_deserialize.py
@@ -144,6 +144,7 @@ def get_blob_properties_from_generated_code(generated):
blob.tag_count = generated.properties.tag_count
blob.tags = parse_tags(generated.blob_tags) # pylint: disable=protected-access
blob.object_replication_source_properties = deserialize_ors_policies(generated.object_replication_metadata)
+ blob.last_accessed_on = generated.properties.last_accessed_on
return blob
diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
index 9324664eda68..2fb963d3894b 100644
--- a/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
+++ b/sdk/storage/azure-storage-blob/azure/storage/blob/_models.py
@@ -502,6 +502,11 @@ class BlobProperties(DictMixin):
.. versionadded:: 12.4.0
+ :ivar ~datetime.datetime last_accessed_on:
+ Indicates when the last Read/Write operation was performed on a Blob.
+
+ .. versionadded:: 12.6.0
+
:ivar int tag_count:
Tags count on this blob.
@@ -548,6 +553,7 @@ def __init__(self, **kwargs):
self.request_server_encrypted = kwargs.get('x-ms-server-encrypted')
self.object_replication_source_properties = kwargs.get('object_replication_source_properties')
self.object_replication_destination_policy = kwargs.get('x-ms-or-policy-id')
+ self.last_accessed_on = kwargs.get('x-ms-last-access-time')
self.tag_count = kwargs.get('x-ms-tag-count')
self.tags = None
diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_get_properties_last_access_time.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_get_properties_last_access_time.yaml
new file mode 100644
index 000000000000..26eb62595223
--- /dev/null
+++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_get_properties_last_access_time.yaml
@@ -0,0 +1,346 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54?restype=container
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ etag:
+ - '"0x8D8510E11772436"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: hello world
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '11'
+ Content-Type:
+ - application/octet-stream
+ If-None-Match:
+ - '*'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:06:54 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ content-md5:
+ - XrY7u+Ae7tCTyyK7j1rNww==
+ date:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ etag:
+ - '"0x8D8510E118A992E"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - vo7q9sPVKY0=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:06:54 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: HEAD
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1
+ response:
+ body:
+ string: ''
+ headers:
+ accept-ranges:
+ - bytes
+ content-length:
+ - '11'
+ content-md5:
+ - XrY7u+Ae7tCTyyK7j1rNww==
+ content-type:
+ - application/octet-stream
+ date:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ etag:
+ - '"0x8D8510E118A992E"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-access-tier:
+ - Hot
+ x-ms-access-tier-inferred:
+ - 'true'
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-creation-time:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ x-ms-last-access-time:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ x-ms-lease-state:
+ - available
+ x-ms-lease-status:
+ - unlocked
+ x-ms-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 200
+ message: OK
+- request:
+ body: this is test content
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '20'
+ Content-Type:
+ - application/octet-stream
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:08:03 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1?blockid=MQ%3D%3D&comp=block
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Fri, 04 Sep 2020 20:08:02 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - wae/Ns62JRA=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: '
+
+ MQ=='
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '83'
+ Content-Type:
+ - application/xml; charset=utf-8
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1?comp=blocklist
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Fri, 04 Sep 2020 20:08:03 GMT
+ etag:
+ - '"0x8D8510E3B9B72BB"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - iEgKfcNWGmY=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:08:08 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: HEAD
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1
+ response:
+ body:
+ string: ''
+ headers:
+ accept-ranges:
+ - bytes
+ content-length:
+ - '20'
+ content-type:
+ - application/octet-stream
+ date:
+ - Fri, 04 Sep 2020 20:08:07 GMT
+ etag:
+ - '"0x8D8510E3B9B72BB"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-access-tier:
+ - Hot
+ x-ms-access-tier-inferred:
+ - 'true'
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-creation-time:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ x-ms-last-access-time:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ x-ms-lease-state:
+ - available
+ x-ms-lease-status:
+ - unlocked
+ x-ms-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 200
+ message: OK
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Fri, 04 Sep 2020 20:08:20 GMT
+ x-ms-range:
+ - bytes=0-33554431
+ x-ms-version:
+ - '2020-02-10'
+ method: GET
+ uri: https://storagename.blob.core.windows.net/utcontainer56131a54/blob1
+ response:
+ body:
+ string: this is test content
+ headers:
+ accept-ranges:
+ - bytes
+ content-length:
+ - '20'
+ content-range:
+ - bytes 0-19/20
+ content-type:
+ - application/octet-stream
+ date:
+ - Fri, 04 Sep 2020 20:08:19 GMT
+ etag:
+ - '"0x8D8510E3B9B72BB"'
+ last-modified:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-creation-time:
+ - Fri, 04 Sep 2020 20:06:53 GMT
+ x-ms-last-access-time:
+ - Fri, 04 Sep 2020 20:08:04 GMT
+ x-ms-lease-state:
+ - available
+ x-ms-lease-status:
+ - unlocked
+ x-ms-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 206
+ message: Partial Content
+version: 1
diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_set_blob_properties_with_if_unmodified.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_set_blob_properties_with_if_unmodified.yaml
index 7f76e0fe9600..da1bce3afdb2 100644
--- a/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_set_blob_properties_with_if_unmodified.yaml
+++ b/sdk/storage/azure-storage-blob/tests/recordings/test_blob_access_conditions.test_set_blob_properties_with_if_unmodified.yaml
@@ -11,11 +11,11 @@ interactions:
Content-Length:
- '0'
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-date:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:53 GMT
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer1a461d38?restype=container
response:
@@ -25,15 +25,15 @@ interactions:
content-length:
- '0'
date:
- - Fri, 25 Oct 2019 17:22:42 GMT
+ - Mon, 31 Aug 2020 19:33:53 GMT
etag:
- - '"0x8D7596FF1D3E313"'
+ - '"0x8D84DE4CBC260A7"'
last-modified:
- - Fri, 25 Oct 2019 17:22:42 GMT
+ - Mon, 31 Aug 2020 19:33:53 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
status:
code: 201
message: Created
@@ -53,13 +53,13 @@ interactions:
If-None-Match:
- '*'
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-blob-type:
- BlockBlob
x-ms-date:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer1a461d38/blob1
response:
@@ -71,11 +71,11 @@ interactions:
content-md5:
- XrY7u+Ae7tCTyyK7j1rNww==
date:
- - Fri, 25 Oct 2019 17:22:42 GMT
+ - Mon, 31 Aug 2020 19:33:53 GMT
etag:
- - '"0x8D7596FF1DC92CD"'
+ - '"0x8D84DE4CBEC5B60"'
last-modified:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-content-crc64:
@@ -83,7 +83,9 @@ interactions:
x-ms-request-server-encrypted:
- 'true'
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
+ x-ms-version-id:
+ - '2020-08-31T19:33:54.2072160Z'
status:
code: 201
message: Created
@@ -99,17 +101,17 @@ interactions:
Content-Length:
- '0'
If-Unmodified-Since:
- - Fri, 25 Oct 2019 17:37:43 GMT
+ - Mon, 31 Aug 2020 19:48:54 GMT
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-blob-content-disposition:
- inline
x-ms-blob-content-language:
- spanish
x-ms-date:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
method: PUT
uri: https://storagename.blob.core.windows.net/utcontainer1a461d38/blob1?comp=properties
response:
@@ -119,15 +121,15 @@ interactions:
content-length:
- '0'
date:
- - Fri, 25 Oct 2019 17:22:42 GMT
+ - Mon, 31 Aug 2020 19:33:53 GMT
etag:
- - '"0x8D7596FF1E7DF78"'
+ - '"0x8D84DE4CC0AE569"'
last-modified:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
status:
code: 200
message: OK
@@ -141,11 +143,11 @@ interactions:
Connection:
- keep-alive
User-Agent:
- - azsdk-python-storage-blob/12.0.0b5 Python/3.6.3 (Windows-10-10.0.18362-SP0)
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
x-ms-date:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
method: HEAD
uri: https://storagename.blob.core.windows.net/utcontainer1a461d38/blob1
response:
@@ -161,11 +163,11 @@ interactions:
content-length:
- '11'
date:
- - Fri, 25 Oct 2019 17:22:42 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
etag:
- - '"0x8D7596FF1E7DF78"'
+ - '"0x8D84DE4CC0AE569"'
last-modified:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
server:
- Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
x-ms-access-tier:
@@ -175,7 +177,9 @@ interactions:
x-ms-blob-type:
- BlockBlob
x-ms-creation-time:
- - Fri, 25 Oct 2019 17:22:43 GMT
+ - Mon, 31 Aug 2020 19:33:54 GMT
+ x-ms-is-current-version:
+ - 'true'
x-ms-lease-state:
- available
x-ms-lease-status:
@@ -183,7 +187,9 @@ interactions:
x-ms-server-encrypted:
- 'true'
x-ms-version:
- - '2019-02-02'
+ - '2020-02-10'
+ x-ms-version-id:
+ - '2020-08-31T19:33:54.2072160Z'
status:
code: 200
message: OK
diff --git a/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_contains_last_access_time.yaml b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_contains_last_access_time.yaml
new file mode 100644
index 000000000000..bca836b9628f
--- /dev/null
+++ b/sdk/storage/azure-storage-blob/tests/recordings/test_container.test_list_blobs_contains_last_access_time.yaml
@@ -0,0 +1,214 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Mon, 31 Aug 2020 05:13:55 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container91b0170d?restype=container
+ response:
+ body:
+ string: "\uFEFFServerBusy
The
+ server is busy.\nRequestId:3ce0d6d6-101e-0091-5d55-7fbf70000000\nTime:2020-08-31T05:13:56.1643333Z"
+ headers:
+ content-length:
+ - '198'
+ content-type:
+ - application/xml
+ date:
+ - Mon, 31 Aug 2020 05:13:55 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ServerBusy
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 503
+ message: The server is busy.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Mon, 31 Aug 2020 05:13:55 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container91b0170d?restype=container
+ response:
+ body:
+ string: "\uFEFFOperationTimedOut
Operation
+ could not be completed within the specified time.\nRequestId:3ce0eb1c-101e-0091-2c55-7fbf70000000\nTime:2020-08-31T05:14:42.5822263Z"
+ headers:
+ connection:
+ - close
+ content-length:
+ - '245'
+ content-type:
+ - application/xml
+ date:
+ - Mon, 31 Aug 2020 05:14:42 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - OperationTimedOut
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 500
+ message: Operation could not be completed within the specified time.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Mon, 31 Aug 2020 05:13:55 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container91b0170d?restype=container
+ response:
+ body:
+ string: "\uFEFFContainerAlreadyExists
The
+ specified container already exists.\nRequestId:afaf1e48-d01e-0037-8055-7f086e000000\nTime:2020-08-31T05:15:08.9654305Z"
+ headers:
+ content-length:
+ - '230'
+ content-type:
+ - application/xml
+ date:
+ - Mon, 31 Aug 2020 05:15:08 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ContainerAlreadyExists
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 409
+ message: The specified container already exists.
+- request:
+ body: hello world
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '11'
+ Content-Type:
+ - application/octet-stream
+ If-None-Match:
+ - '*'
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-access-tier:
+ - Archive
+ x-ms-blob-type:
+ - BlockBlob
+ x-ms-date:
+ - Mon, 31 Aug 2020 05:15:09 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: PUT
+ uri: https://storagename.blob.core.windows.net/container91b0170d/blob1
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ content-md5:
+ - XrY7u+Ae7tCTyyK7j1rNww==
+ date:
+ - Mon, 31 Aug 2020 05:15:09 GMT
+ etag:
+ - '"0x8D84D6CD4A59A6D"'
+ last-modified:
+ - Mon, 31 Aug 2020 05:15:09 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-content-crc64:
+ - vo7q9sPVKY0=
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-blob/12.4.0 Python/3.8.5 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Mon, 31 Aug 2020 05:15:09 GMT
+ x-ms-version:
+ - '2020-02-10'
+ method: GET
+ uri: https://storagename.blob.core.windows.net/container91b0170d?restype=container&comp=list
+ response:
+ body:
+ string: "\uFEFFblob1Mon,
+ 31 Aug 2020 05:15:09 GMTMon, 31 Aug 2020 05:15:09
+ GMT0x8D84D6CD4A59A6D11application/octet-streamXrY7u+Ae7tCTyyK7j1rNww==Mon, 31 Aug 2020 05:15:09 GMTBlockBlobArchiveMon,
+ 31 Aug 2020 05:15:09 GMTunlockedavailabletrue"
+ headers:
+ content-type:
+ - application/xml
+ date:
+ - Mon, 31 Aug 2020 05:15:09 GMT
+ server:
+ - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding:
+ - chunked
+ x-ms-version:
+ - '2020-02-10'
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py
index 876c8bb55849..8389b44bd7aa 100644
--- a/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py
+++ b/sdk/storage/azure-storage-blob/tests/test_blob_access_conditions.py
@@ -621,6 +621,23 @@ def test_set_blob_properties_with_if_unmodified_fail(self, resource_group, locat
# Assert
self.assertEqual(StorageErrorCode.condition_not_met, e.exception.error_code)
+ @GlobalStorageAccountPreparer()
+ def test_get_properties_last_access_time(self, resource_group, location, storage_account, storage_account_key):
+ bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key,
+ connection_data_block_size=4 * 1024)
+ self._setup()
+ self._create_container_and_block_blob(self.container_name, 'blob1', b'hello world', bsc)
+ blob = bsc.get_blob_client(self.container_name, 'blob1')
+ # Assert
+ lat = blob.get_blob_properties().last_accessed_on
+ blob.stage_block(block_id='1', data="this is test content")
+ blob.commit_block_list(['1'])
+ new_lat = blob.get_blob_properties().last_accessed_on
+ self.assertIsInstance(lat, datetime)
+ self.assertIsInstance(new_lat, datetime)
+ self.assertGreater(new_lat, lat)
+ self.assertIsInstance(blob.download_blob().properties.last_accessed_on, datetime)
+
@GlobalStorageAccountPreparer()
def test_set_blob_properties_with_if_match(self, resource_group, location, storage_account, storage_account_key):
bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key, connection_data_block_size=4 * 1024)
diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py
index f5a4ff21a747..8c4b53f2d0a1 100644
--- a/sdk/storage/azure-storage-blob/tests/test_container.py
+++ b/sdk/storage/azure-storage-blob/tests/test_container.py
@@ -827,6 +827,19 @@ def test_list_names(self, resource_group, location, storage_account, storage_acc
self.assertEqual(blobs, ['blob1', 'blob2'])
+ @GlobalStorageAccountPreparer()
+ def test_list_blobs_contains_last_access_time(self, resource_group, location, storage_account, storage_account_key):
+ bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key)
+ container = self._create_container(bsc)
+ data = b'hello world'
+
+ blob_client = container.get_blob_client('blob1')
+ blob_client.upload_blob(data, standard_blob_tier=StandardBlobTier.Archive)
+
+ # Act
+ for blob_properties in container.list_blobs():
+ self.assertIsInstance(blob_properties.last_accessed_on, datetime)
+
@GlobalStorageAccountPreparer()
def test_list_blobs_returns_rehydrate_priority(self, resource_group, location, storage_account, storage_account_key):
bsc = BlobServiceClient(self.account_url(storage_account, "blob"), storage_account_key)