diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
index 8d3e6bdd086c..73f732992fff 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_client.py
@@ -659,3 +659,18 @@ def create_directory(self, directory_name, **kwargs):
kwargs.setdefault('merge_span', True)
directory.create_directory(**kwargs)
return directory # type: ignore
+
+ @distributed_trace
+ def delete_directory(self, directory_name, **kwargs):
+ # type: (str, Any) -> None
+ """Marks the directory for deletion. The directory is
+ later deleted during garbage collection.
+
+ :param str directory_name:
+ The name of the directory.
+ :keyword int timeout:
+ The timeout parameter is expressed in seconds.
+ :rtype: None
+ """
+ directory = self.get_directory_client(directory_name)
+ directory.delete_directory(**kwargs)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
index dfa218fc7868..e6008f050c19 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_client_async.py
@@ -538,3 +538,18 @@ async def create_directory(self, directory_name, **kwargs):
kwargs.setdefault('merge_span', True)
await directory.create_directory(**kwargs)
return directory # type: ignore
+
+ @distributed_trace_async
+ async def delete_directory(self, directory_name, **kwargs):
+ # type: (str, Any) -> None
+ """Marks the directory for deletion. The directory is
+ later deleted during garbage collection.
+
+ :param str directory_name:
+ The name of the directory.
+ :keyword int timeout:
+ The timeout parameter is expressed in seconds.
+ :rtype: None
+ """
+ directory = self.get_directory_client(directory_name)
+ await directory.delete_directory(**kwargs)
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_delete_directory_from_share.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_delete_directory_from_share.yaml
new file mode 100644
index 000000000000..8db08638c7bd
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_delete_directory_from_share.yaml
@@ -0,0 +1,450 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06018d5c-0bfa-11ea-8f70-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:25 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share834f11ac?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:25 GMT
+ ETag:
+ - '"0x8D76E1DEA52FBB6"'
+ Last-Modified:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-id:
+ - ea102d89-201a-00d1-6406-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 063ee452-0bfa-11ea-a517-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share834f11ac/dir1?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:25 GMT
+ ETag:
+ - '"0x8D76E1DEA67B2E1"'
+ Last-Modified:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes:
+ - Directory
+ x-ms-file-change-time:
+ - '2019-11-21T00:58:26.1986017Z'
+ x-ms-file-creation-time:
+ - '2019-11-21T00:58:26.1986017Z'
+ x-ms-file-id:
+ - '13835128424026341376'
+ x-ms-file-last-write-time:
+ - '2019-11-21T00:58:26.1986017Z'
+ x-ms-file-parent-id:
+ - '0'
+ x-ms-file-permission-key:
+ - 17360570244679638438*10967959146200238639
+ x-ms-request-id:
+ - ea102d8c-201a-00d1-6506-a0d95f000000
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 0652aca8-0bfa-11ea-aacd-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share834f11ac/dir2?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ ETag:
+ - '"0x8D76E1DEA78098F"'
+ Last-Modified:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes:
+ - Directory
+ x-ms-file-change-time:
+ - '2019-11-21T00:58:26.3056783Z'
+ x-ms-file-creation-time:
+ - '2019-11-21T00:58:26.3056783Z'
+ x-ms-file-id:
+ - '11529285414812647424'
+ x-ms-file-last-write-time:
+ - '2019-11-21T00:58:26.3056783Z'
+ x-ms-file-parent-id:
+ - '0'
+ x-ms-file-permission-key:
+ - 17360570244679638438*10967959146200238639
+ x-ms-request-id:
+ - ea102d8d-201a-00d1-6606-a0d95f000000
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06627fd2-0bfa-11ea-863d-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share834f11ac/dir3?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ ETag:
+ - '"0x8D76E1DEA8615DA"'
+ Last-Modified:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes:
+ - Directory
+ x-ms-file-change-time:
+ - '2019-11-21T00:58:26.3977434Z'
+ x-ms-file-creation-time:
+ - '2019-11-21T00:58:26.3977434Z'
+ x-ms-file-id:
+ - '16140971433240035328'
+ x-ms-file-last-write-time:
+ - '2019-11-21T00:58:26.3977434Z'
+ x-ms-file-parent-id:
+ - '0'
+ x-ms-file-permission-key:
+ - 17360570244679638438*10967959146200238639
+ x-ms-request-id:
+ - ea102d8e-201a-00d1-6706-a0d95f000000
+ x-ms-request-server-encrypted:
+ - 'true'
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06749c28-0bfa-11ea-981a-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://storagename.file.core.windows.net/share834f11ac?restype=directory&comp=list
+ response:
+ body:
+ string: "\uFEFFdir1dir2dir3"
+ headers:
+ Content-Type:
+ - application/xml
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ Transfer-Encoding:
+ - chunked
+ Vary:
+ - Origin
+ x-ms-request-id:
+ - ea102d8f-201a-00d1-6806-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 200
+ message: OK
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 068816e2-0bfa-11ea-845f-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/share834f11ac/dir3?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-id:
+ - ea102d90-201a-00d1-6906-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 202
+ message: Accepted
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 069b421c-0bfa-11ea-8778-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://storagename.file.core.windows.net/share834f11ac?restype=directory&comp=list
+ response:
+ body:
+ string: "\uFEFFdir1dir2"
+ headers:
+ Content-Type:
+ - application/xml
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ Transfer-Encoding:
+ - chunked
+ Vary:
+ - Origin
+ x-ms-request-id:
+ - ea102d91-201a-00d1-6a06-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 200
+ message: OK
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06a68638-0bfa-11ea-9292-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://storagename.file.core.windows.net/?include=snapshots&comp=list
+ response:
+ body:
+ string: "\uFEFFshare834f11acThu,
+ 21 Nov 2019 00:58:26 GMT\"0x8D76E1DEA52FBB6\"5120"
+ headers:
+ Content-Type:
+ - application/xml
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ Transfer-Encoding:
+ - chunked
+ Vary:
+ - Origin
+ x-ms-request-id:
+ - ea102d92-201a-00d1-6b06-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 200
+ message: OK
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06b4866e-0bfa-11ea-bbd2-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-delete-snapshots:
+ - include
+ x-ms-version:
+ - '2019-02-02'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/share834f11ac?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ Content-Length:
+ - '0'
+ Date:
+ - Thu, 21 Nov 2019 00:58:26 GMT
+ Server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-id:
+ - ea102d93-201a-00d1-6c06-a0d95f000000
+ x-ms-version:
+ - '2019-02-02'
+ status:
+ code: 202
+ message: Accepted
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_delete_directory_from_share_async.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_delete_directory_from_share_async.yaml
new file mode 100644
index 000000000000..7e2e4485696b
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_delete_directory_from_share_async.yaml
@@ -0,0 +1,370 @@
+interactions:
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 06fddf26-0bfa-11ea-9b53-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share78cd16a6?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Length
+ : '0'
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Etag
+ : '"0x8D76E1DEB2DED96"'
+ ? !!python/object/new:multidict._istr.istr
+ - Last-Modified
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-id: b34038a3-301a-00c5-4806-a01a3b000000
+ x-ms-version: '2019-02-02'
+ status:
+ code: 201
+ message: Created
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6
+ - restype=share
+ - ''
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 07199186-0bfa-11ea-8175-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share78cd16a6/dir1?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Length
+ : '0'
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Etag
+ : '"0x8D76E1DEB3736A7"'
+ ? !!python/object/new:multidict._istr.istr
+ - Last-Modified
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes: Directory
+ x-ms-file-change-time: '2019-11-21T00:58:27.5585703Z'
+ x-ms-file-creation-time: '2019-11-21T00:58:27.5585703Z'
+ x-ms-file-id: '13835128424026341376'
+ x-ms-file-last-write-time: '2019-11-21T00:58:27.5585703Z'
+ x-ms-file-parent-id: '0'
+ x-ms-file-permission-key: 17360570244679638438*10967959146200238639
+ x-ms-request-id: b34038a7-301a-00c5-4906-a01a3b000000
+ x-ms-request-server-encrypted: 'true'
+ x-ms-version: '2019-02-02'
+ status:
+ code: 201
+ message: Created
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6/dir1
+ - restype=directory
+ - ''
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 072300f4-0bfa-11ea-834f-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share78cd16a6/dir2?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Length
+ : '0'
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Etag
+ : '"0x8D76E1DEB4011DB"'
+ ? !!python/object/new:multidict._istr.istr
+ - Last-Modified
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes: Directory
+ x-ms-file-change-time: '2019-11-21T00:58:27.6166107Z'
+ x-ms-file-creation-time: '2019-11-21T00:58:27.6166107Z'
+ x-ms-file-id: '11529285414812647424'
+ x-ms-file-last-write-time: '2019-11-21T00:58:27.6166107Z'
+ x-ms-file-parent-id: '0'
+ x-ms-file-permission-key: 17360570244679638438*10967959146200238639
+ x-ms-request-id: b34038a8-301a-00c5-4a06-a01a3b000000
+ x-ms-request-server-encrypted: 'true'
+ x-ms-version: '2019-02-02'
+ status:
+ code: 201
+ message: Created
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6/dir2
+ - restype=directory
+ - ''
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 072b6150-0bfa-11ea-be41-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-file-attributes:
+ - none
+ x-ms-file-creation-time:
+ - now
+ x-ms-file-last-write-time:
+ - now
+ x-ms-file-permission:
+ - inherit
+ x-ms-version:
+ - '2019-02-02'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share78cd16a6/dir3?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Length
+ : '0'
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Etag
+ : '"0x8D76E1DEB4877D3"'
+ ? !!python/object/new:multidict._istr.istr
+ - Last-Modified
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-file-attributes: Directory
+ x-ms-file-change-time: '2019-11-21T00:58:27.6716499Z'
+ x-ms-file-creation-time: '2019-11-21T00:58:27.6716499Z'
+ x-ms-file-id: '16140971433240035328'
+ x-ms-file-last-write-time: '2019-11-21T00:58:27.6716499Z'
+ x-ms-file-parent-id: '0'
+ x-ms-file-permission-key: 17360570244679638438*10967959146200238639
+ x-ms-request-id: b34038a9-301a-00c5-4b06-a01a3b000000
+ x-ms-request-server-encrypted: 'true'
+ x-ms-version: '2019-02-02'
+ status:
+ code: 201
+ message: Created
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6/dir3
+ - restype=directory
+ - ''
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 0733e67e-0bfa-11ea-b29e-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://storagename.file.core.windows.net/share78cd16a6?restype=directory&comp=list
+ response:
+ body:
+ string: "\uFEFFdir1dir2dir3"
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Type
+ : application/xml
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ ? !!python/object/new:multidict._istr.istr
+ - Transfer-Encoding
+ : chunked
+ ? !!python/object/new:multidict._istr.istr
+ - Vary
+ : Origin
+ x-ms-request-id: b34038aa-301a-00c5-4c06-a01a3b000000
+ x-ms-version: '2019-02-02'
+ status:
+ code: 200
+ message: OK
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6
+ - restype=directory&comp=list
+ - ''
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 073c1d2c-0bfa-11ea-bfb0-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:27 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/share78cd16a6/dir3?restype=directory
+ response:
+ body:
+ string: ''
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Length
+ : '0'
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-request-id: b34038ab-301a-00c5-4d06-a01a3b000000
+ x-ms-version: '2019-02-02'
+ status:
+ code: 202
+ message: Accepted
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6/dir3
+ - restype=directory
+ - ''
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ User-Agent:
+ - azsdk-python-storage-file-share/12.0.0b5 Python/3.7.3 (Windows-10-10.0.17763-SP0)
+ x-ms-client-request-id:
+ - 074cdc48-0bfa-11ea-aa1a-2816a845e8c6
+ x-ms-date:
+ - Thu, 21 Nov 2019 00:58:28 GMT
+ x-ms-version:
+ - '2019-02-02'
+ method: GET
+ uri: https://storagename.file.core.windows.net/share78cd16a6?restype=directory&comp=list
+ response:
+ body:
+ string: "\uFEFFdir1dir2"
+ headers:
+ ? !!python/object/new:multidict._istr.istr
+ - Content-Type
+ : application/xml
+ ? !!python/object/new:multidict._istr.istr
+ - Date
+ : Thu, 21 Nov 2019 00:58:27 GMT
+ ? !!python/object/new:multidict._istr.istr
+ - Server
+ : Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ ? !!python/object/new:multidict._istr.istr
+ - Transfer-Encoding
+ : chunked
+ ? !!python/object/new:multidict._istr.istr
+ - Vary
+ : Origin
+ x-ms-request-id: b34038ac-301a-00c5-4e06-a01a3b000000
+ x-ms-version: '2019-02-02'
+ status:
+ code: 200
+ message: OK
+ url: !!python/object/new:yarl.URL
+ state: !!python/tuple
+ - !!python/object/new:urllib.parse.SplitResult
+ - https
+ - amqptest.file.core.windows.net
+ - /share78cd16a6
+ - restype=directory&comp=list
+ - ''
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/test_share.py b/sdk/storage/azure-storage-file-share/tests/test_share.py
index 0a2bea5a4a8d..1030348f0d4d 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_share.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_share.py
@@ -787,6 +787,26 @@ def test_transport_closed_only_once(self):
fsc.get_service_properties()
assert transport.session is not None
+ @record
+ def test_delete_directory_from_share(self):
+ # Arrange
+ share = self._create_share()
+ dir1 = share.create_directory('dir1')
+ share.create_directory('dir2')
+ share.create_directory('dir3')
+
+ # Act
+ resp = list(share.list_directories_and_files())
+ self.assertEqual(len(resp), 3)
+
+ share.delete_directory('dir3')
+
+ # Assert
+ resp = list(share.list_directories_and_files())
+ self.assertEqual(len(resp), 2)
+
+ self._delete_shares()
+
# ------------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()
diff --git a/sdk/storage/azure-storage-file-share/tests/test_share_async.py b/sdk/storage/azure-storage-file-share/tests/test_share_async.py
index 5ae151ea2744..af6b3d35f4e9 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_share_async.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_share_async.py
@@ -944,6 +944,31 @@ def test_transport_closed_only_once_async(self):
loop = asyncio.get_event_loop()
loop.run_until_complete(self._test_transport_closed_only_once_async())
+ async def _test_delete_directory_from_share_async(self):
+ # Arrange
+ share = await self._create_share()
+ await share.create_directory('dir1')
+ await share.create_directory('dir2')
+ await share.create_directory('dir3')
+
+ # Act
+ resp = []
+ async for d in share.list_directories_and_files():
+ resp.append(d)
+ self.assertEqual(len(resp), 3)
+
+ await share.delete_directory('dir3')
+
+ # Assert
+ resp = []
+ async for d in share.list_directories_and_files():
+ resp.append(d)
+ self.assertEqual(len(resp), 2)
+
+ @record
+ def test_delete_directory_from_share_async(self):
+ loop = asyncio.get_event_loop()
+ loop.run_until_complete(self._test_delete_directory_from_share_async())
# ------------------------------------------------------------------------------
if __name__ == '__main__':
unittest.main()