diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
index eab87a148630..e3dd92caceb2 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/_azure_file_storage.py
@@ -49,7 +49,7 @@ def __init__(self, version, url, **kwargs):
self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2019-07-07'
+ self.api_version = '2019-12-12'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py
index 003b5c552ddf..39cf463c46a9 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/_azure_file_storage_async.py
@@ -50,7 +50,7 @@ def __init__(
self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs)
client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)}
- self.api_version = '2019-07-07'
+ self.api_version = '2019-12-12'
self._serialize = Serializer(client_models)
self._deserialize = Deserializer(client_models)
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py
index b012e527e56a..30056251d4ed 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/aio/operations_async/_share_operations_async.py
@@ -749,3 +749,77 @@ async def get_statistics(self, timeout=None, *, cls=None, **kwargs):
return deserialized
get_statistics.metadata = {'url': '/{shareName}'}
+
+ async def restore(self, timeout=None, request_id=None, deleted_share_name=None, deleted_share_version=None, *, cls=None, **kwargs):
+ """Restores a previously deleted Share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For
+ more information, see Setting
+ Timeouts for File Service Operations.
+ :type timeout: int
+ :param request_id: Provides a client-generated, opaque value with a 1
+ KB character limit that is recorded in the analytics logs when storage
+ analytics logging is enabled.
+ :type request_id: str
+ :param deleted_share_name: Specifies the name of the
+ preivously-deleted share.
+ :type deleted_share_name: str
+ :param deleted_share_version: Specifies the version of the
+ preivously-deleted share.
+ :type deleted_share_version: str
+ :param callable cls: A custom type or function that will be passed the
+ direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises:
+ :class:`StorageErrorException`
+ """
+ error_map = kwargs.pop('error_map', None)
+ comp = "undelete"
+
+ # Construct URL
+ url = self.restore.metadata['url']
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {}
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+
+ # Construct headers
+ header_parameters = {}
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if deleted_share_name is not None:
+ header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str')
+ if deleted_share_version is not None:
+ header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str')
+
+ # Construct and send request
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise models.StorageErrorException(response, self._deserialize)
+
+ if cls:
+ response_headers = {
+ 'ETag': self._deserialize('str', response.headers.get('ETag')),
+ 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
+ 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
+ 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
+ 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
+ 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
+ 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
+ }
+ return cls(response, None, response_headers)
+ restore.metadata = {'url': '/{shareName}'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
index b22476bb4948..66f39fbb3b10 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_azure_file_storage_enums.py
@@ -97,6 +97,7 @@ class ListSharesIncludeType(str, Enum):
snapshots = "snapshots"
metadata = "metadata"
+ deleted = "deleted"
class CopyStatusType(str, Enum):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
index fd60a837e22e..f5cc1fabb382 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models.py
@@ -636,6 +636,10 @@ class ShareItem(Model):
:type name: str
:param snapshot:
:type snapshot: str
+ :param deleted:
+ :type deleted: bool
+ :param version:
+ :type version: str
:param properties: Required.
:type properties: ~azure.storage.fileshare.models.ShareProperties
:param metadata:
@@ -650,6 +654,8 @@ class ShareItem(Model):
_attribute_map = {
'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
+ 'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
+ 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'properties': {'key': 'Properties', 'type': 'ShareProperties', 'xml': {'name': 'Properties'}},
'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
}
@@ -661,6 +667,8 @@ def __init__(self, **kwargs):
super(ShareItem, self).__init__(**kwargs)
self.name = kwargs.get('name', None)
self.snapshot = kwargs.get('snapshot', None)
+ self.deleted = kwargs.get('deleted', None)
+ self.version = kwargs.get('version', None)
self.properties = kwargs.get('properties', None)
self.metadata = kwargs.get('metadata', None)
@@ -709,6 +717,10 @@ class ShareProperties(Model):
:type provisioned_egress_mbps: int
:param next_allowed_quota_downgrade_time:
:type next_allowed_quota_downgrade_time: datetime
+ :param deleted_time:
+ :type deleted_time: datetime
+ :param remaining_retention_days:
+ :type remaining_retention_days: int
"""
_validation = {
@@ -725,6 +737,8 @@ class ShareProperties(Model):
'provisioned_ingress_mbps': {'key': 'ProvisionedIngressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedIngressMBps'}},
'provisioned_egress_mbps': {'key': 'ProvisionedEgressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedEgressMBps'}},
'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123', 'xml': {'name': 'NextAllowedQuotaDowngradeTime'}},
+ 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123', 'xml': {'name': 'DeletedTime'}},
+ 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int', 'xml': {'name': 'RemainingRetentionDays'}},
}
_xml_map = {
}
@@ -738,6 +752,8 @@ def __init__(self, **kwargs):
self.provisioned_ingress_mbps = kwargs.get('provisioned_ingress_mbps', None)
self.provisioned_egress_mbps = kwargs.get('provisioned_egress_mbps', None)
self.next_allowed_quota_downgrade_time = kwargs.get('next_allowed_quota_downgrade_time', None)
+ self.deleted_time = kwargs.get('deleted_time', None)
+ self.remaining_retention_days = kwargs.get('remaining_retention_days', None)
class ShareStats(Model):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
index a1a9013e1eb6..0be5dca813d3 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/models/_models_py3.py
@@ -636,6 +636,10 @@ class ShareItem(Model):
:type name: str
:param snapshot:
:type snapshot: str
+ :param deleted:
+ :type deleted: bool
+ :param version:
+ :type version: str
:param properties: Required.
:type properties: ~azure.storage.fileshare.models.ShareProperties
:param metadata:
@@ -650,6 +654,8 @@ class ShareItem(Model):
_attribute_map = {
'name': {'key': 'Name', 'type': 'str', 'xml': {'name': 'Name'}},
'snapshot': {'key': 'Snapshot', 'type': 'str', 'xml': {'name': 'Snapshot'}},
+ 'deleted': {'key': 'Deleted', 'type': 'bool', 'xml': {'name': 'Deleted'}},
+ 'version': {'key': 'Version', 'type': 'str', 'xml': {'name': 'Version'}},
'properties': {'key': 'Properties', 'type': 'ShareProperties', 'xml': {'name': 'Properties'}},
'metadata': {'key': 'Metadata', 'type': '{str}', 'xml': {'name': 'Metadata'}},
}
@@ -657,10 +663,12 @@ class ShareItem(Model):
'name': 'Share'
}
- def __init__(self, *, name: str, properties, snapshot: str=None, metadata=None, **kwargs) -> None:
+ def __init__(self, *, name: str, properties, snapshot: str=None, deleted: bool=None, version: str=None, metadata=None, **kwargs) -> None:
super(ShareItem, self).__init__(**kwargs)
self.name = name
self.snapshot = snapshot
+ self.deleted = deleted
+ self.version = version
self.properties = properties
self.metadata = metadata
@@ -709,6 +717,10 @@ class ShareProperties(Model):
:type provisioned_egress_mbps: int
:param next_allowed_quota_downgrade_time:
:type next_allowed_quota_downgrade_time: datetime
+ :param deleted_time:
+ :type deleted_time: datetime
+ :param remaining_retention_days:
+ :type remaining_retention_days: int
"""
_validation = {
@@ -725,11 +737,13 @@ class ShareProperties(Model):
'provisioned_ingress_mbps': {'key': 'ProvisionedIngressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedIngressMBps'}},
'provisioned_egress_mbps': {'key': 'ProvisionedEgressMBps', 'type': 'int', 'xml': {'name': 'ProvisionedEgressMBps'}},
'next_allowed_quota_downgrade_time': {'key': 'NextAllowedQuotaDowngradeTime', 'type': 'rfc-1123', 'xml': {'name': 'NextAllowedQuotaDowngradeTime'}},
+ 'deleted_time': {'key': 'DeletedTime', 'type': 'rfc-1123', 'xml': {'name': 'DeletedTime'}},
+ 'remaining_retention_days': {'key': 'RemainingRetentionDays', 'type': 'int', 'xml': {'name': 'RemainingRetentionDays'}},
}
_xml_map = {
}
- def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: int=None, provisioned_ingress_mbps: int=None, provisioned_egress_mbps: int=None, next_allowed_quota_downgrade_time=None, **kwargs) -> None:
+ def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: int=None, provisioned_ingress_mbps: int=None, provisioned_egress_mbps: int=None, next_allowed_quota_downgrade_time=None, deleted_time=None, remaining_retention_days: int=None, **kwargs) -> None:
super(ShareProperties, self).__init__(**kwargs)
self.last_modified = last_modified
self.etag = etag
@@ -738,6 +752,8 @@ def __init__(self, *, last_modified, etag: str, quota: int, provisioned_iops: in
self.provisioned_ingress_mbps = provisioned_ingress_mbps
self.provisioned_egress_mbps = provisioned_egress_mbps
self.next_allowed_quota_downgrade_time = next_allowed_quota_downgrade_time
+ self.deleted_time = deleted_time
+ self.remaining_retention_days = remaining_retention_days
class ShareStats(Model):
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
index e6b590ed56cf..4b53be871c9f 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/operations/_share_operations.py
@@ -749,3 +749,77 @@ def get_statistics(self, timeout=None, cls=None, **kwargs):
return deserialized
get_statistics.metadata = {'url': '/{shareName}'}
+
+ def restore(self, timeout=None, request_id=None, deleted_share_name=None, deleted_share_version=None, cls=None, **kwargs):
+ """Restores a previously deleted Share.
+
+ :param timeout: The timeout parameter is expressed in seconds. For
+ more information, see Setting
+ Timeouts for File Service Operations.
+ :type timeout: int
+ :param request_id: Provides a client-generated, opaque value with a 1
+ KB character limit that is recorded in the analytics logs when storage
+ analytics logging is enabled.
+ :type request_id: str
+ :param deleted_share_name: Specifies the name of the
+ preivously-deleted share.
+ :type deleted_share_name: str
+ :param deleted_share_version: Specifies the version of the
+ preivously-deleted share.
+ :type deleted_share_version: str
+ :param callable cls: A custom type or function that will be passed the
+ direct response
+ :return: None or the result of cls(response)
+ :rtype: None
+ :raises:
+ :class:`StorageErrorException`
+ """
+ error_map = kwargs.pop('error_map', None)
+ comp = "undelete"
+
+ # Construct URL
+ url = self.restore.metadata['url']
+ path_format_arguments = {
+ 'url': self._serialize.url("self._config.url", self._config.url, 'str', skip_quote=True)
+ }
+ url = self._client.format_url(url, **path_format_arguments)
+
+ # Construct parameters
+ query_parameters = {}
+ if timeout is not None:
+ query_parameters['timeout'] = self._serialize.query("timeout", timeout, 'int', minimum=0)
+ query_parameters['restype'] = self._serialize.query("self.restype", self.restype, 'str')
+ query_parameters['comp'] = self._serialize.query("comp", comp, 'str')
+
+ # Construct headers
+ header_parameters = {}
+ header_parameters['x-ms-version'] = self._serialize.header("self._config.version", self._config.version, 'str')
+ if request_id is not None:
+ header_parameters['x-ms-client-request-id'] = self._serialize.header("request_id", request_id, 'str')
+ if deleted_share_name is not None:
+ header_parameters['x-ms-deleted-share-name'] = self._serialize.header("deleted_share_name", deleted_share_name, 'str')
+ if deleted_share_version is not None:
+ header_parameters['x-ms-deleted-share-version'] = self._serialize.header("deleted_share_version", deleted_share_version, 'str')
+
+ # Construct and send request
+ request = self._client.put(url, query_parameters, header_parameters)
+ pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
+ response = pipeline_response.http_response
+
+ if response.status_code not in [201]:
+ map_error(status_code=response.status_code, response=response, error_map=error_map)
+ raise models.StorageErrorException(response, self._deserialize)
+
+ if cls:
+ response_headers = {
+ 'ETag': self._deserialize('str', response.headers.get('ETag')),
+ 'Last-Modified': self._deserialize('rfc-1123', response.headers.get('Last-Modified')),
+ 'x-ms-request-id': self._deserialize('str', response.headers.get('x-ms-request-id')),
+ 'x-ms-client-request-id': self._deserialize('str', response.headers.get('x-ms-client-request-id')),
+ 'x-ms-version': self._deserialize('str', response.headers.get('x-ms-version')),
+ 'Date': self._deserialize('rfc-1123', response.headers.get('Date')),
+ 'x-ms-error-code': self._deserialize('str', response.headers.get('x-ms-error-code')),
+ }
+ return cls(response, None, response_headers)
+ restore.metadata = {'url': '/{shareName}'}
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py
index 629812170000..be045899fa00 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_generated/version.py
@@ -9,5 +9,5 @@
# regenerated.
# --------------------------------------------------------------------------
-VERSION = "2019-07-07"
+VERSION = "2019-12-12"
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
index 1488fcea6ebd..2d348d67d43a 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_models.py
@@ -275,6 +275,18 @@ class ShareProperties(DictMixin):
share as metadata.
:ivar str snapshot:
Snapshot of the share.
+ :ivar bool deleted:
+ To indicate if this share is deleted or not.
+ This is a service returned value, and the value will be set when list shared including deleted ones.
+ :ivar datetime deleted:
+ To indicate the deleted time of the deleted share.
+ This is a service returned value, and the value will be set when list shared including deleted ones.
+ :ivar str version:
+ To indicate the version of deleted share.
+ This is a service returned value, and the value will be set when list shared including deleted ones.
+ :ivar int remaining_retention_days:
+ To indicate how many remaining days the deleted share will be kept.
+ This is a service returned value, and the value will be set when list shared including deleted ones.
"""
def __init__(self, **kwargs):
@@ -285,6 +297,10 @@ def __init__(self, **kwargs):
self.next_allowed_quota_downgrade_time = kwargs.get('x-ms-share-next-allowed-quota-downgrade-time')
self.metadata = kwargs.get('metadata')
self.snapshot = None
+ self.deleted = None
+ self.deleted_time = None
+ self.version = None
+ self.remaining_retention_days = None
self.provisioned_egress_mbps = kwargs.get('x-ms-share-provisioned-egress-mbps')
self.provisioned_ingress_mbps = kwargs.get('x-ms-share-provisioned-ingress-mbps')
self.provisioned_iops = kwargs.get('x-ms-share-provisioned-iops')
@@ -299,6 +315,10 @@ def _from_generated(cls, generated):
props.next_allowed_quota_downgrade_time = generated.properties.next_allowed_quota_downgrade_time
props.metadata = generated.metadata
props.snapshot = generated.snapshot
+ props.deleted = generated.deleted
+ props.deleted_time = generated.properties.deleted_time
+ props.version = generated.version
+ props.remaining_retention_days = generated.properties.remaining_retention_days
props.provisioned_egress_mbps = generated.properties.provisioned_egress_mbps
props.provisioned_ingress_mbps = generated.properties.provisioned_ingress_mbps
props.provisioned_iops = generated.properties.provisioned_iops
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py
index de6191b54a41..c0755118477e 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_serialize.py
@@ -13,7 +13,8 @@
_SUPPORTED_API_VERSIONS = [
'2019-02-02',
- '2019-07-07'
+ '2019-07-07',
+ '2019-12-12'
]
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
index 49f3dac47b33..549e09f62965 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/_share_service_client.py
@@ -232,6 +232,9 @@ def list_shares(
Specifies that share metadata be returned in the response.
:param bool include_snapshots:
Specifies that share snapshot be returned in the response.
+ :keyword bool include_deleted:
+ Specifies that deleted shares be returned in the response.
+ This is only for share soft delete enabled account.
:keyword int timeout:
The timeout parameter is expressed in seconds.
:returns: An iterable (auto-paging) of ShareProperties.
@@ -248,10 +251,14 @@ def list_shares(
"""
timeout = kwargs.pop('timeout', None)
include = []
+ include_deleted = kwargs.pop('include_deleted', None)
+ if include_deleted:
+ include.append("deleted")
if include_metadata:
include.append('metadata')
if include_snapshots:
include.append('snapshots')
+
results_per_page = kwargs.pop('results_per_page', None)
command = functools.partial(
self._client.service.list_shares_segment,
@@ -334,6 +341,35 @@ def delete_share(
share.delete_share(
delete_snapshots=delete_snapshots, timeout=timeout, **kwargs)
+ @distributed_trace
+ def undelete_share(self, deleted_share_name, deleted_share_version, **kwargs):
+ # type: (str, str, **Any) -> ShareClient
+ """Restores soft-deleted share.
+
+ Operation will only be successful if used within the specified number of days
+ set in the delete retention policy.
+
+ .. versionadded:: 12.2.0
+ This operation was introduced in API version '2019-12-12'.
+
+ :param str deleted_share_name:
+ Specifies the name of the deleted share to restore.
+ :param str deleted_share_version:
+ Specifies the version of the deleted share to restore.
+ :keyword int timeout:
+ The timeout parameter is expressed in seconds.
+ :rtype: ~azure.storage.fileshare.ShareClient
+ """
+ share = self.get_share_client(deleted_share_name)
+
+ try:
+ share._client.share.restore(deleted_share_name=deleted_share_name, # pylint: disable = protected-access
+ deleted_share_version=deleted_share_version,
+ timeout=kwargs.pop('timeout', None), **kwargs)
+ return share
+ except StorageErrorException as error:
+ process_storage_error(error)
+
def get_share_client(self, share, snapshot=None):
# type: (Union[ShareProperties, str],Optional[Union[Dict[str, Any], str]]) -> ShareClient
"""Get a client to interact with the specified share.
diff --git a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
index 38d6ce3342b9..9b5e3f2a7310 100644
--- a/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
+++ b/sdk/storage/azure-storage-file-share/azure/storage/fileshare/aio/_share_service_client_async.py
@@ -186,6 +186,9 @@ def list_shares(
Specifies that share metadata be returned in the response.
:param bool include_snapshots:
Specifies that share snapshot be returned in the response.
+ :keyword bool include_deleted:
+ Specifies that deleted shares be returned in the response.
+ This is only for share soft delete enabled account.
:keyword int timeout:
The timeout parameter is expressed in seconds.
:returns: An iterable (auto-paging) of ShareProperties.
@@ -206,6 +209,10 @@ def list_shares(
include.append('metadata')
if include_snapshots:
include.append('snapshots')
+ include_deleted = kwargs.pop('include_deleted', None)
+ if include_deleted:
+ include.append("deleted")
+
results_per_page = kwargs.pop('results_per_page', None)
command = functools.partial(
self._client.service.list_shares_segment,
@@ -288,6 +295,34 @@ async def delete_share(
await share.delete_share(
delete_snapshots=delete_snapshots, timeout=timeout, **kwargs)
+ @distributed_trace_async
+ async def undelete_share(self, deleted_share_name, deleted_share_version, **kwargs):
+ # type: (str, str, **Any) -> ShareClient
+ """Restores soft-deleted share.
+
+ Operation will only be successful if used within the specified number of days
+ set in the delete retention policy.
+
+ .. versionadded:: 12.2.0
+ This operation was introduced in API version '2019-12-12'.
+
+ :param str deleted_share_name:
+ Specifies the name of the deleted share to restore.
+ :param str deleted_share_version:
+ Specifies the version of the deleted share to restore.
+ :keyword int timeout:
+ The timeout parameter is expressed in seconds.
+ :rtype: ~azure.storage.fileshare.aio.ShareClient
+ """
+ share = self.get_share_client(deleted_share_name)
+ try:
+ await share._client.share.restore(deleted_share_name=deleted_share_name, # pylint: disable = protected-access
+ deleted_share_version=deleted_share_version,
+ timeout=kwargs.pop('timeout', None), **kwargs)
+ return share
+ except StorageErrorException as error:
+ process_storage_error(error)
+
def get_share_client(self, share, snapshot=None):
# type: (Union[ShareProperties, str],Optional[Union[Dict[str, Any], str]]) -> ShareClient
"""Get a client to interact with the specified share.
diff --git a/sdk/storage/azure-storage-file-share/swagger/README.md b/sdk/storage/azure-storage-file-share/swagger/README.md
index 1f877ce45156..4cde1a2829d5 100644
--- a/sdk/storage/azure-storage-file-share/swagger/README.md
+++ b/sdk/storage/azure-storage-file-share/swagger/README.md
@@ -19,7 +19,7 @@ autorest --use=C:/work/autorest.python --version=2.0.4280
### Settings
``` yaml
-input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-07-07/file.json
+input-file: https://raw.githubusercontent.com/Azure/azure-rest-api-specs/storage-dataplane-preview/specification/storage/data-plane/Microsoft.FileStorage/preview/2019-12-12/file.json
output-folder: ../azure/storage/fileshare/_generated
namespace: azure.storage.fileshare
no-namespace-folders: true
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_restore_to_existing_share.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_restore_to_existing_share.yaml
new file mode 100644
index 000000000000..7e7c3a13af2f
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_restore_to_existing_share.yaml
@@ -0,0 +1,396 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:26 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Tue, 12 May 2020 19:18:26 GMT
+ etag:
+ - '"0x8D7F6A93F5D64D2"'
+ last-modified:
+ - Tue, 12 May 2020 19:18:26 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2019-12-12'
+ 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.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:26 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Tue, 12 May 2020 19:18:26 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 202
+ message: Accepted
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:27 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share
+ response:
+ body:
+ string: "\uFEFFShareNotFoundThe
+ specified share does not exist.\nRequestId:ebd69b17-501a-009d-3292-28049b000000\nTime:2020-05-12T19:18:27.0997404Z"
+ headers:
+ content-length:
+ - '217'
+ content-type:
+ - application/xml
+ date:
+ - Tue, 12 May 2020 19:18:26 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ShareNotFound
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 404
+ message: The specified share does not exist.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ etag:
+ - '"0x8D7F6A9516B1701"'
+ last-modified:
+ - Tue, 12 May 2020 19:18:57 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2019-12-12'
+ 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.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/?include=deleted&comp=list
+ response:
+ body:
+ string: "\uFEFFexisting647b1102Mon,
+ 11 May 2020 18:54:32 GMT\"0x8D7F5DCBE38249A\"5120TransactionOptimized5/11/2020
+ 6:54:32 PM$account-encryption-keyfalseshare647b1102true01D627C59E076480Mon,
+ 11 May 2020 18:54:36 GMT\"0x8D7F5DCC07E0DE1\"5120TransactionOptimized5/11/2020
+ 6:54:36 PM$account-encryption-keyfalseMon,
+ 11 May 2020 18:54:37 GMT0share647b1102true01D62891F1043495Tue,
+ 12 May 2020 19:17:13 GMT\"0x8D7F6A9137AA752\"5120TransactionOptimized5/12/2020
+ 7:17:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:17:13 GMT1share647b1102true01D628921CE6979FTue,
+ 12 May 2020 19:18:26 GMT\"0x8D7F6A93F5D64D2\"5120TransactionOptimized5/12/2020
+ 7:18:26 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:18:27 GMT1share647b1102Tue,
+ 12 May 2020 19:18:57 GMT\"0x8D7F6A9516B1701\"5120TransactionOptimized5/12/2020
+ 7:18:57 PM$account-encryption-keyfalsesharebed60c48true01D627C52CEB52B9Mon,
+ 11 May 2020 18:51:26 GMT\"0x8D7F5DC4F61D21E\"5120TransactionOptimized$account-encryption-keyfalseMon,
+ 11 May 2020 18:51:27 GMT0sharebed60c48true01D627C55A0F445CMon,
+ 11 May 2020 18:52:42 GMT\"0x8D7F5DC7C85BE7B\"5120TransactionOptimized5/11/2020
+ 6:52:42 PM$account-encryption-keyfalseMon,
+ 11 May 2020 18:52:43 GMT0sharebed60c48true01D627C7129D400EMon,
+ 11 May 2020 19:05:01 GMT\"0x8D7F5DE35139BF9\"5120TransactionOptimized5/11/2020
+ 7:05:01 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:05:03 GMT0sharebed60c48true01D627C7601CFB2FMon,
+ 11 May 2020 19:07:11 GMT\"0x8D7F5DE82937C31\"5120TransactionOptimized5/11/2020
+ 7:07:11 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:09:04 GMT0sharebed60c48true01D627C7FD80E72AMon,
+ 11 May 2020 19:11:35 GMT\"0x8D7F5DF1FF787C6\"5120TransactionOptimized5/11/2020
+ 7:11:35 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:11:47 GMT0sharebed60c48true01D627DF1C7AB73EMon,
+ 11 May 2020 21:57:06 GMT\"0x8D7F5F63EF11C0D\"5120TransactionOptimized5/11/2020
+ 9:57:06 PM$account-encryption-keyfalseMon,
+ 11 May 2020 21:59:02 GMT0sharebed60c48true01D627E6E3F182B7Mon,
+ 11 May 2020 22:52:47 GMT\"0x8D7F5FE0667FD31\"5120TransactionOptimized5/11/2020
+ 10:52:47 PM$account-encryption-keyfalseMon,
+ 11 May 2020 22:53:07 GMT0sharerestorebed60c48Tue,
+ 12 May 2020 01:27:19 GMT\"0x8D7F6139D00A95F\"5120TransactionOptimized5/12/2020
+ 1:26:19 AM$account-encryption-keyfalsesharetorestorebed60c48true01D627FC3CC9AC5BTue,
+ 12 May 2020 01:25:35 GMT\"0x8D7F6135F406102\"5120TransactionOptimized5/12/2020
+ 1:25:35 AM$account-encryption-keyfalseTue,
+ 12 May 2020 01:25:36 GMT0test-share-04423526-abc3-44c9-aa2e-540f6eecac0dSun,
+ 12 Apr 2020 18:42:18 GMT\"0x8D7DF113AB0D452\"5120TransactionOptimized$account-encryption-keyfalsetest-share-3754bd7d-b2e4-4079-a97e-a3b9afc1648cSat,
+ 11 Apr 2020 17:58:03 GMT\"0x8D7DE41E1D75DB4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6214a335-a4b0-498c-9995-1e50b6bb50a2Sat,
+ 11 Apr 2020 17:57:43 GMT\"0x8D7DE41D5B0D211\"5120TransactionOptimized$account-encryption-keyfalsetest-share-659cd252-38f3-43aa-8092-750973358be5Sun,
+ 12 Apr 2020 18:14:14 GMT\"0x8D7DF0D4EBB62F2\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6a598cdf-2116-4754-9b02-632b3399255ctrue01D627C9821CFD41Mon,
+ 11 May 2020 19:22:27 GMT\"0x8D7F5E0A49437CC\"5120TransactionOptimized5/11/2020
+ 7:21:57 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:22:28 GMT0test-share-6d528e3f-219f-44f9-b80b-3d2248cce9f3Sat,
+ 11 Apr 2020 17:58:24 GMT\"0x8D7DE41EDFB7785\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6fe76ac5-709b-4678-b55e-47e717c1d943Sun,
+ 12 Apr 2020 18:24:45 GMT\"0x8D7DF0EC69BCDD4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-745c2b22-c95a-4019-a1cf-df95f0cb7db9Sun,
+ 12 Apr 2020 18:42:49 GMT\"0x8D7DF114CDCA126\"5120TransactionOptimized$account-encryption-keyfalsetest-share-75a46ce4-c649-4e6f-8f2e-5e5c387615fatrue01D627C96FD67788Mon,
+ 11 May 2020 19:21:57 GMT\"0x8D7F5E0924DB393\"5120TransactionOptimized5/11/2020
+ 7:21:26 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:21:57 GMT0test-share-7e386df5-7d6b-4fcf-b23d-9e7dd2c13a2bSun,
+ 12 Apr 2020 18:23:37 GMT\"0x8D7DF0E9E44C712\"5120TransactionOptimized$account-encryption-keyfalsetest-share-93210600-6d3f-49e4-8e87-7e6947c23b8bSat,
+ 11 Apr 2020 17:57:33 GMT\"0x8D7DE41CF6BC1E8\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ba5d06e0-c1d4-41b7-8876-7aef01d366a7Sat,
+ 11 Apr 2020 17:57:53 GMT\"0x8D7DE41DBC30637\"5120TransactionOptimized$account-encryption-keyfalsetest-share-bed60c48true01D627CAB29A32B1Mon,
+ 11 May 2020 19:30:58 GMT\"0x8D7F5E1D510E716\"5120TransactionOptimized5/11/2020
+ 7:30:58 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:31:13 GMT0test-share-bed60c48true01D627CB92F7C53BMon,
+ 11 May 2020 19:37:15 GMT\"0x8D7F5E2B56E6EC3\"5120TransactionOptimized5/11/2020
+ 7:37:15 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:37:17 GMT0test-share-bed60c48true01D627CBA8F69588Mon,
+ 11 May 2020 19:37:52 GMT\"0x8D7F5E2CB6D3D46\"5120TransactionOptimized5/11/2020
+ 7:37:52 PM$account-encryption-keyfalseMon,
+ 11 May 2020 19:37:53 GMT0test-share-bed60c48Mon,
+ 11 May 2020 19:38:41 GMT\"0x8D7F5E2E8A4F4E3\"5120TransactionOptimized5/11/2020
+ 7:30:04 PM$account-encryption-keyfalsetest-share-bffb30c0-47cc-4cd0-b3b4-6c560832c136Sun,
+ 12 Apr 2020 18:44:28 GMT\"0x8D7DF11881FBCE1\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ce14a14c-6463-4bad-bedc-bedf7388d692Sat,
+ 11 Apr 2020 17:58:14 GMT\"0x8D7DE41E7E8F550\"5120TransactionOptimized$account-encryption-keyfalsetest-share-e21b1b2a-eaa6-4f88-928f-449387ef5cb9Sun,
+ 12 Apr 2020 18:13:43 GMT\"0x8D7DF0D3C81621C\"5120TransactionOptimized$account-encryption-keyfalse"
+ headers:
+ content-type:
+ - application/xml
+ date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding:
+ - chunked
+ x-ms-version:
+ - '2019-12-12'
+ 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.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ x-ms-deleted-share-name:
+ - /share647b1102
+ x-ms-deleted-share-version:
+ - 01D627C59E076480
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share&comp=undelete
+ response:
+ body:
+ string: "\uFEFFInvalidHeaderValueThe
+ value for one of the HTTP headers is not in the correct format.\nRequestId:ebd69b46-501a-009d-3e92-28049b000000\nTime:2020-05-12T19:18:57.5706606Zx-ms-deleted-share-name/share647b1102"
+ headers:
+ content-length:
+ - '343'
+ content-type:
+ - application/xml
+ date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - InvalidHeaderValue
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 400
+ message: The value for one of the HTTP headers is not in the correct format.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ x-ms-deleted-share-name:
+ - /share647b1102
+ x-ms-deleted-share-version:
+ - 01D62891F1043495
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share&comp=undelete
+ response:
+ body:
+ string: "\uFEFFInvalidHeaderValueThe
+ value for one of the HTTP headers is not in the correct format.\nRequestId:ebd69b47-501a-009d-3f92-28049b000000\nTime:2020-05-12T19:18:57.6667514Zx-ms-deleted-share-name/share647b1102"
+ headers:
+ content-length:
+ - '343'
+ content-type:
+ - application/xml
+ date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - InvalidHeaderValue
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 400
+ message: The value for one of the HTTP headers is not in the correct format.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ x-ms-deleted-share-name:
+ - /share647b1102
+ x-ms-deleted-share-version:
+ - 01D628921CE6979F
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/share647b1102?restype=share&comp=undelete
+ response:
+ body:
+ string: "\uFEFFInvalidHeaderValueThe
+ value for one of the HTTP headers is not in the correct format.\nRequestId:ebd69b4a-501a-009d-4092-28049b000000\nTime:2020-05-12T19:18:57.7638428Zx-ms-deleted-share-name/share647b1102"
+ headers:
+ content-length:
+ - '343'
+ content-type:
+ - application/xml
+ date:
+ - Tue, 12 May 2020 19:18:57 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - InvalidHeaderValue
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 400
+ message: The value for one of the HTTP headers is not in the correct format.
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_undelete_share.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_undelete_share.yaml
new file mode 100644
index 000000000000..a2e1146548fc
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share.test_undelete_share.yaml
@@ -0,0 +1,349 @@
+interactions:
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:45:47 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/sharerestorebed60c48?restype=share
+ response:
+ body:
+ string: "\uFEFFShareAlreadyExistsThe
+ specified share already exists.\nRequestId:06c6b9b1-001a-0074-604e-29c2d1000000\nTime:2020-05-13T17:45:47.6187422Z"
+ headers:
+ content-length:
+ - '222'
+ content-type:
+ - application/xml
+ date:
+ - Wed, 13 May 2020 17:45:46 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ShareAlreadyExists
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 409
+ message: The specified share already exists.
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ Content-Length:
+ - '0'
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:45:47 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/sharerestorebed60c48?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Wed, 13 May 2020 17:45:47 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 202
+ message: Accepted
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:45:48 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/sharerestorebed60c48?restype=share
+ response:
+ body:
+ string: "\uFEFFShareNotFoundThe
+ specified share does not exist.\nRequestId:06c6b9b6-001a-0074-624e-29c2d1000000\nTime:2020-05-13T17:45:48.3534340Z"
+ headers:
+ content-length:
+ - '217'
+ content-type:
+ - application/xml
+ date:
+ - Wed, 13 May 2020 17:45:47 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code:
+ - ShareNotFound
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 404
+ message: The specified share does not exist.
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:45:48 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/?include=deleted,metadata,snapshots&comp=list
+ response:
+ body:
+ string: "\uFEFFexisting647b1102Mon,
+ 11 May 2020 18:54:32 GMT\"0x8D7F5DCBE38249A\"5120TransactionOptimized5/11/2020
+ 6:54:32 PM$account-encryption-keyfalseshare647b1102true01D62891F1043495Tue,
+ 12 May 2020 19:17:13 GMT\"0x8D7F6A9137AA752\"5120TransactionOptimized5/12/2020
+ 7:17:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:17:13 GMT0share647b1102true01D628921CE6979FTue,
+ 12 May 2020 19:18:26 GMT\"0x8D7F6A93F5D64D2\"5120TransactionOptimized5/12/2020
+ 7:18:26 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:18:27 GMT0share647b1102Tue,
+ 12 May 2020 19:18:57 GMT\"0x8D7F6A9516B1701\"5120TransactionOptimized5/12/2020
+ 7:18:57 PM$account-encryption-keyfalseshared365137ftrue01D6289358749C19Tue,
+ 12 May 2020 19:27:16 GMT\"0x8D7F6AA7AEB06B6\"5120TransactionOptimized5/12/2020
+ 7:27:16 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:27:16 GMT0shared365137ftrue01D628936A7CCB5FTue,
+ 12 May 2020 19:27:46 GMT\"0x8D7F6AA8CF3289E\"5120TransactionOptimized5/12/2020
+ 7:27:46 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:34:47 GMT0shared365137ftrue01D62894782B2ED3Tue,
+ 12 May 2020 19:35:19 GMT\"0x8D7F6AB9A9E0823\"5120TransactionOptimized5/12/2020
+ 7:35:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:36:42 GMT0shared365137ftrue01D62894BBABA26ATue,
+ 12 May 2020 19:37:12 GMT\"0x8D7F6ABDE221895\"5120TransactionOptimized5/12/2020
+ 7:37:12 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:16:59 GMT0shared365137ftrue01D6289A5CED9EC1Tue,
+ 12 May 2020 20:17:30 GMT\"0x8D7F6B17F6378C3\"5120TransactionOptimized5/12/2020
+ 8:17:30 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:22:47 GMT0shared365137ftrue01D6289B2C4BE740Tue,
+ 12 May 2020 20:23:18 GMT\"0x8D7F6B24EC25185\"5120TransactionOptimized5/12/2020
+ 8:23:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:24:26 GMT0shared365137ftrue01D6289B670E0FE5Tue,
+ 12 May 2020 20:24:56 GMT\"0x8D7F6B28984B251\"5120TransactionOptimized5/12/2020
+ 8:24:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:26:35 GMT0shared365137ftrue01D6289BB89BF91ETue,
+ 12 May 2020 20:27:13 GMT\"0x8D7F6B2DB0FAFFB\"5120TransactionOptimized5/12/2020
+ 8:27:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:29:53 GMT0shared365137ftrue01D6289C29CC3751Tue,
+ 12 May 2020 20:30:23 GMT\"0x8D7F6B34C42D063\"5120TransactionOptimized5/12/2020
+ 8:30:23 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:31:16 GMT0shared365137fTue,
+ 12 May 2020 20:31:46 GMT\"0x8D7F6B37DDB00D5\"5120TransactionOptimized5/12/2020
+ 8:31:46 PM$account-encryption-keyfalsesharerestore12700ec5true01D62895E93C6018Tue,
+ 12 May 2020 19:45:38 GMT\"0x8D7F6AD0BB2D264\"5120TransactionOptimized5/12/2020
+ 7:45:38 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:45:38 GMT0sharerestore12700ec5true01D62896EE908613Tue,
+ 12 May 2020 19:52:56 GMT\"0x8D7F6AE1105D23C\"5120TransactionOptimized5/12/2020
+ 7:52:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:52:57 GMT0sharerestore12700ec5true01D62896FE2C7643Tue,
+ 12 May 2020 19:53:22 GMT\"0x8D7F6AE20A3E059\"5120TransactionOptimized5/12/2020
+ 7:36:51 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:36:15 GMT0sharerestore12700ec5Tue,
+ 12 May 2020 20:36:16 GMT\"0x8D7F6B41ECF17FA\"5120TransactionOptimized5/12/2020
+ 7:41:52 PM$account-encryption-keyfalsesharerestorebed60c48true01D628A02764BCEFTue,
+ 12 May 2020 20:58:57 GMT\"0x8D7F6B749DC1995\"5120TransactionOptimized5/12/2020
+ 1:26:19 AM$account-encryption-keyfalseWed,
+ 13 May 2020 17:45:48 GMT1test-share-04423526-abc3-44c9-aa2e-540f6eecac0dSun,
+ 12 Apr 2020 18:42:18 GMT\"0x8D7DF113AB0D452\"5120TransactionOptimized$account-encryption-keyfalsetest-share-3754bd7d-b2e4-4079-a97e-a3b9afc1648cSat,
+ 11 Apr 2020 17:58:03 GMT\"0x8D7DE41E1D75DB4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6214a335-a4b0-498c-9995-1e50b6bb50a2Sat,
+ 11 Apr 2020 17:57:43 GMT\"0x8D7DE41D5B0D211\"5120TransactionOptimized$account-encryption-keyfalsetest-share-659cd252-38f3-43aa-8092-750973358be5Sun,
+ 12 Apr 2020 18:14:14 GMT\"0x8D7DF0D4EBB62F2\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6d528e3f-219f-44f9-b80b-3d2248cce9f3Sat,
+ 11 Apr 2020 17:58:24 GMT\"0x8D7DE41EDFB7785\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6fe76ac5-709b-4678-b55e-47e717c1d943Sun,
+ 12 Apr 2020 18:24:45 GMT\"0x8D7DF0EC69BCDD4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-745c2b22-c95a-4019-a1cf-df95f0cb7db9Sun,
+ 12 Apr 2020 18:42:49 GMT\"0x8D7DF114CDCA126\"5120TransactionOptimized$account-encryption-keyfalsetest-share-7e386df5-7d6b-4fcf-b23d-9e7dd2c13a2bSun,
+ 12 Apr 2020 18:23:37 GMT\"0x8D7DF0E9E44C712\"5120TransactionOptimized$account-encryption-keyfalsetest-share-93210600-6d3f-49e4-8e87-7e6947c23b8bSat,
+ 11 Apr 2020 17:57:33 GMT\"0x8D7DE41CF6BC1E8\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ba5d06e0-c1d4-41b7-8876-7aef01d366a7Sat,
+ 11 Apr 2020 17:57:53 GMT\"0x8D7DE41DBC30637\"5120TransactionOptimized$account-encryption-keyfalsetest-share-bed60c48Mon,
+ 11 May 2020 19:38:41 GMT\"0x8D7F5E2E8A4F4E3\"5120TransactionOptimized5/11/2020
+ 7:30:04 PM$account-encryption-keyfalsetest-share-bffb30c0-47cc-4cd0-b3b4-6c560832c136Sun,
+ 12 Apr 2020 18:44:28 GMT\"0x8D7DF11881FBCE1\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ce14a14c-6463-4bad-bedc-bedf7388d692Sat,
+ 11 Apr 2020 17:58:14 GMT\"0x8D7DE41E7E8F550\"5120TransactionOptimized$account-encryption-keyfalsetest-share-e21b1b2a-eaa6-4f88-928f-449387ef5cb9Sun,
+ 12 Apr 2020 18:13:43 GMT\"0x8D7DF0D3C81621C\"5120TransactionOptimized$account-encryption-keyfalse"
+ headers:
+ content-type:
+ - application/xml
+ date:
+ - Wed, 13 May 2020 17:45:47 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding:
+ - chunked
+ x-ms-version:
+ - '2019-12-12'
+ 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.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:46:48 GMT
+ x-ms-deleted-share-name:
+ - sharerestorebed60c48
+ x-ms-deleted-share-version:
+ - 01D628A02764BCEF
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/sharerestorebed60c48?restype=share&comp=undelete
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Wed, 13 May 2020 17:46:48 GMT
+ etag:
+ - '"0x8D7F7659CAE040B"'
+ last-modified:
+ - Wed, 13 May 2020 17:46:48 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 201
+ message: Created
+- request:
+ body: null
+ headers:
+ Accept:
+ - '*/*'
+ Accept-Encoding:
+ - gzip, deflate
+ Connection:
+ - keep-alive
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Wed, 13 May 2020 17:46:48 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/sharerestorebed60c48?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length:
+ - '0'
+ date:
+ - Wed, 13 May 2020 17:46:48 GMT
+ etag:
+ - '"0x8D7F7659CAE040B"'
+ last-modified:
+ - Wed, 13 May 2020 17:46:48 GMT
+ server:
+ - Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-access-tier:
+ - TransactionOptimized
+ x-ms-access-tier-change-time:
+ - 5/12/2020 1:26:19 AM
+ x-ms-has-immutability-policy:
+ - 'false'
+ x-ms-has-legal-hold:
+ - 'false'
+ x-ms-share-quota:
+ - '5120'
+ x-ms-version:
+ - '2019-12-12'
+ status:
+ code: 200
+ message: OK
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_restore_to_existing_share.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_restore_to_existing_share.yaml
new file mode 100644
index 000000000000..733709f789ea
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_restore_to_existing_share.yaml
@@ -0,0 +1,249 @@
+interactions:
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:16 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/shared365137f?restype=share
+ response:
+ body:
+ string: "\uFEFFShareAlreadyExistsThe
+ specified share already exists.\nRequestId:eb5c5ea0-a01a-00eb-019c-288ed3000000\nTime:2020-05-12T20:31:16.4270939Z"
+ headers:
+ content-length: '222'
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:31:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code: ShareAlreadyExists
+ x-ms-version: '2019-12-12'
+ status:
+ code: 409
+ message: The specified share already exists.
+ url: https://seansoftdeletecanary.file.core.windows.net/shared365137f?restype=share
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:16 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/shared365137f?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length: '0'
+ date: Tue, 12 May 2020 20:31:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version: '2019-12-12'
+ status:
+ code: 202
+ message: Accepted
+ url: https://seansoftdeletecanary.file.core.windows.net/shared365137f?restype=share
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:16 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/shared365137f?restype=share
+ response:
+ body:
+ string: "\uFEFFShareNotFoundThe
+ specified share does not exist.\nRequestId:eb5c5ea4-a01a-00eb-039c-288ed3000000\nTime:2020-05-12T20:31:16.6162724Z"
+ headers:
+ content-length: '217'
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:31:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code: ShareNotFound
+ x-ms-version: '2019-12-12'
+ status:
+ code: 404
+ message: The specified share does not exist.
+ url: https://seansoftdeletecanary.file.core.windows.net/shared365137f?restype=share
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:46 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/shared365137f?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length: '0'
+ date: Tue, 12 May 2020 20:31:45 GMT
+ etag: '"0x8D7F6B37DDB00D5"'
+ last-modified: Tue, 12 May 2020 20:31:46 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version: '2019-12-12'
+ status:
+ code: 201
+ message: Created
+ url: https://seansoftdeletecanary.file.core.windows.net/shared365137f?restype=share
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:46 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/?include=deleted&comp=list
+ response:
+ body:
+ string: "\uFEFFexisting647b1102Mon,
+ 11 May 2020 18:54:32 GMT\"0x8D7F5DCBE38249A\"5120TransactionOptimized5/11/2020
+ 6:54:32 PM$account-encryption-keyfalseshare647b1102true01D62891F1043495Tue,
+ 12 May 2020 19:17:13 GMT\"0x8D7F6A9137AA752\"5120TransactionOptimized5/12/2020
+ 7:17:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:17:13 GMT0share647b1102true01D628921CE6979FTue,
+ 12 May 2020 19:18:26 GMT\"0x8D7F6A93F5D64D2\"5120TransactionOptimized5/12/2020
+ 7:18:26 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:18:27 GMT0share647b1102Tue,
+ 12 May 2020 19:18:57 GMT\"0x8D7F6A9516B1701\"5120TransactionOptimized5/12/2020
+ 7:18:57 PM$account-encryption-keyfalsesharebed60c48true01D627DF1C7AB73EMon,
+ 11 May 2020 21:57:06 GMT\"0x8D7F5F63EF11C0D\"5120TransactionOptimized5/11/2020
+ 9:57:06 PM$account-encryption-keyfalseMon,
+ 11 May 2020 21:59:02 GMT0sharebed60c48true01D627E6E3F182B7Mon,
+ 11 May 2020 22:52:47 GMT\"0x8D7F5FE0667FD31\"5120TransactionOptimized5/11/2020
+ 10:52:47 PM$account-encryption-keyfalseMon,
+ 11 May 2020 22:53:07 GMT0shared365137ftrue01D6289358749C19Tue,
+ 12 May 2020 19:27:16 GMT\"0x8D7F6AA7AEB06B6\"5120TransactionOptimized5/12/2020
+ 7:27:16 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:27:16 GMT0shared365137ftrue01D628936A7CCB5FTue,
+ 12 May 2020 19:27:46 GMT\"0x8D7F6AA8CF3289E\"5120TransactionOptimized5/12/2020
+ 7:27:46 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:34:47 GMT0shared365137ftrue01D62894782B2ED3Tue,
+ 12 May 2020 19:35:19 GMT\"0x8D7F6AB9A9E0823\"5120TransactionOptimized5/12/2020
+ 7:35:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:36:42 GMT0shared365137ftrue01D62894BBABA26ATue,
+ 12 May 2020 19:37:12 GMT\"0x8D7F6ABDE221895\"5120TransactionOptimized5/12/2020
+ 7:37:12 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:16:59 GMT1shared365137ftrue01D6289A5CED9EC1Tue,
+ 12 May 2020 20:17:30 GMT\"0x8D7F6B17F6378C3\"5120TransactionOptimized5/12/2020
+ 8:17:30 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:22:47 GMT1shared365137ftrue01D6289B2C4BE740Tue,
+ 12 May 2020 20:23:18 GMT\"0x8D7F6B24EC25185\"5120TransactionOptimized5/12/2020
+ 8:23:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:24:26 GMT1shared365137ftrue01D6289B670E0FE5Tue,
+ 12 May 2020 20:24:56 GMT\"0x8D7F6B28984B251\"5120TransactionOptimized5/12/2020
+ 8:24:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:26:35 GMT1shared365137ftrue01D6289BB89BF91ETue,
+ 12 May 2020 20:27:13 GMT\"0x8D7F6B2DB0FAFFB\"5120TransactionOptimized5/12/2020
+ 8:27:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:29:53 GMT1shared365137ftrue01D6289C29CC3751Tue,
+ 12 May 2020 20:30:23 GMT\"0x8D7F6B34C42D063\"5120TransactionOptimized5/12/2020
+ 8:30:23 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:31:16 GMT1shared365137fTue,
+ 12 May 2020 20:31:46 GMT\"0x8D7F6B37DDB00D5\"5120TransactionOptimized5/12/2020
+ 8:31:46 PM$account-encryption-keyfalsesharerestore12700ec5true01D62895628B32A6Tue,
+ 12 May 2020 19:41:52 GMT\"0x8D7F6AC84F7CE92\"5120TransactionOptimized5/12/2020
+ 7:41:52 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:41:52 GMT0sharerestore12700ec5true01D62895E93C6018Tue,
+ 12 May 2020 19:45:38 GMT\"0x8D7F6AD0BB2D264\"5120TransactionOptimized5/12/2020
+ 7:45:38 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:45:38 GMT0sharerestore12700ec5true01D62896EE908613Tue,
+ 12 May 2020 19:52:56 GMT\"0x8D7F6AE1105D23C\"5120TransactionOptimized5/12/2020
+ 7:52:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:52:57 GMT0sharerestore12700ec5Tue,
+ 12 May 2020 19:53:22 GMT\"0x8D7F6AE20A3E059\"5120TransactionOptimized5/12/2020
+ 7:36:51 PM$account-encryption-keyfalsesharerestorebed60c48Tue,
+ 12 May 2020 01:27:19 GMT\"0x8D7F6139D00A95F\"5120TransactionOptimized5/12/2020
+ 1:26:19 AM$account-encryption-keyfalsesharetorestorebed60c48true01D627FC3CC9AC5BTue,
+ 12 May 2020 01:25:35 GMT\"0x8D7F6135F406102\"5120TransactionOptimized5/12/2020
+ 1:25:35 AM$account-encryption-keyfalseTue,
+ 12 May 2020 01:25:36 GMT0test-share-04423526-abc3-44c9-aa2e-540f6eecac0dSun,
+ 12 Apr 2020 18:42:18 GMT\"0x8D7DF113AB0D452\"5120TransactionOptimized$account-encryption-keyfalsetest-share-3754bd7d-b2e4-4079-a97e-a3b9afc1648cSat,
+ 11 Apr 2020 17:58:03 GMT\"0x8D7DE41E1D75DB4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6214a335-a4b0-498c-9995-1e50b6bb50a2Sat,
+ 11 Apr 2020 17:57:43 GMT\"0x8D7DE41D5B0D211\"5120TransactionOptimized$account-encryption-keyfalsetest-share-659cd252-38f3-43aa-8092-750973358be5Sun,
+ 12 Apr 2020 18:14:14 GMT\"0x8D7DF0D4EBB62F2\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6d528e3f-219f-44f9-b80b-3d2248cce9f3Sat,
+ 11 Apr 2020 17:58:24 GMT\"0x8D7DE41EDFB7785\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6fe76ac5-709b-4678-b55e-47e717c1d943Sun,
+ 12 Apr 2020 18:24:45 GMT\"0x8D7DF0EC69BCDD4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-745c2b22-c95a-4019-a1cf-df95f0cb7db9Sun,
+ 12 Apr 2020 18:42:49 GMT\"0x8D7DF114CDCA126\"5120TransactionOptimized$account-encryption-keyfalsetest-share-7e386df5-7d6b-4fcf-b23d-9e7dd2c13a2bSun,
+ 12 Apr 2020 18:23:37 GMT\"0x8D7DF0E9E44C712\"5120TransactionOptimized$account-encryption-keyfalsetest-share-93210600-6d3f-49e4-8e87-7e6947c23b8bSat,
+ 11 Apr 2020 17:57:33 GMT\"0x8D7DE41CF6BC1E8\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ba5d06e0-c1d4-41b7-8876-7aef01d366a7Sat,
+ 11 Apr 2020 17:57:53 GMT\"0x8D7DE41DBC30637\"5120TransactionOptimized$account-encryption-keyfalsetest-share-bed60c48Mon,
+ 11 May 2020 19:38:41 GMT\"0x8D7F5E2E8A4F4E3\"5120TransactionOptimized5/11/2020
+ 7:30:04 PM$account-encryption-keyfalsetest-share-bffb30c0-47cc-4cd0-b3b4-6c560832c136Sun,
+ 12 Apr 2020 18:44:28 GMT\"0x8D7DF11881FBCE1\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ce14a14c-6463-4bad-bedc-bedf7388d692Sat,
+ 11 Apr 2020 17:58:14 GMT\"0x8D7DE41E7E8F550\"5120TransactionOptimized$account-encryption-keyfalsetest-share-e21b1b2a-eaa6-4f88-928f-449387ef5cb9Sun,
+ 12 Apr 2020 18:13:43 GMT\"0x8D7DF0D3C81621C\"5120TransactionOptimized$account-encryption-keyfalse"
+ headers:
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:31:46 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding: chunked
+ x-ms-version: '2019-12-12'
+ status:
+ code: 200
+ message: OK
+ url: https://seansoftdeletecanary.file.core.windows.net/?include=deleted&comp=list
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:31:52 GMT
+ x-ms-deleted-share-name:
+ - shared365137f
+ x-ms-deleted-share-version:
+ - 01D6289358749C19
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/shared365137f?restype=share&comp=undelete
+ response:
+ body:
+ string: "\uFEFFShareAlreadyExistsThe
+ specified share already exists.\nRequestId:eb5c5ed2-a01a-00eb-129c-288ed3000000\nTime:2020-05-12T20:31:52.6864351Z"
+ headers:
+ content-length: '222'
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:31:51 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code: ShareAlreadyExists
+ x-ms-version: '2019-12-12'
+ status:
+ code: 409
+ message: The specified share already exists.
+ url: https://seansoftdeletecanary.file.core.windows.net/shared365137f?restype=share&comp=undelete
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_undelete_share.yaml b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_undelete_share.yaml
new file mode 100644
index 000000000000..dcc4935dda4d
--- /dev/null
+++ b/sdk/storage/azure-storage-file-share/tests/recordings/test_share_async.test_undelete_share.yaml
@@ -0,0 +1,254 @@
+interactions:
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:15 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/sharerestore12700ec5?restype=share
+ response:
+ body:
+ string: "\uFEFFShareAlreadyExistsThe
+ specified share already exists.\nRequestId:a0737473-401a-00be-049c-289e58000000\nTime:2020-05-12T20:36:15.6647741Z"
+ headers:
+ content-length: '222'
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:36:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code: ShareAlreadyExists
+ x-ms-version: '2019-12-12'
+ status:
+ code: 409
+ message: The specified share already exists.
+ url: https://seansoftdeletecanary.file.core.windows.net/sharerestore12700ec5?restype=share
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:15 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: DELETE
+ uri: https://storagename.file.core.windows.net/sharerestore12700ec5?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length: '0'
+ date: Tue, 12 May 2020 20:36:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version: '2019-12-12'
+ status:
+ code: 202
+ message: Accepted
+ url: https://seansoftdeletecanary.file.core.windows.net/sharerestore12700ec5?restype=share
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:15 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/sharerestore12700ec5?restype=share
+ response:
+ body:
+ string: "\uFEFFShareNotFoundThe
+ specified share does not exist.\nRequestId:a0737478-401a-00be-069c-289e58000000\nTime:2020-05-12T20:36:16.0030965Z"
+ headers:
+ content-length: '217'
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:36:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-error-code: ShareNotFound
+ x-ms-version: '2019-12-12'
+ status:
+ code: 404
+ message: The specified share does not exist.
+ url: https://seansoftdeletecanary.file.core.windows.net/sharerestore12700ec5?restype=share
+- request:
+ body: null
+ headers:
+ Accept:
+ - application/xml
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:16 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/?include=deleted&comp=list
+ response:
+ body:
+ string: "\uFEFFexisting647b1102Mon,
+ 11 May 2020 18:54:32 GMT\"0x8D7F5DCBE38249A\"5120TransactionOptimized5/11/2020
+ 6:54:32 PM$account-encryption-keyfalseshare647b1102true01D62891F1043495Tue,
+ 12 May 2020 19:17:13 GMT\"0x8D7F6A9137AA752\"5120TransactionOptimized5/12/2020
+ 7:17:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:17:13 GMT0share647b1102true01D628921CE6979FTue,
+ 12 May 2020 19:18:26 GMT\"0x8D7F6A93F5D64D2\"5120TransactionOptimized5/12/2020
+ 7:18:26 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:18:27 GMT0share647b1102Tue,
+ 12 May 2020 19:18:57 GMT\"0x8D7F6A9516B1701\"5120TransactionOptimized5/12/2020
+ 7:18:57 PM$account-encryption-keyfalsesharebed60c48true01D627DF1C7AB73EMon,
+ 11 May 2020 21:57:06 GMT\"0x8D7F5F63EF11C0D\"5120TransactionOptimized5/11/2020
+ 9:57:06 PM$account-encryption-keyfalseMon,
+ 11 May 2020 21:59:02 GMT0sharebed60c48true01D627E6E3F182B7Mon,
+ 11 May 2020 22:52:47 GMT\"0x8D7F5FE0667FD31\"5120TransactionOptimized5/11/2020
+ 10:52:47 PM$account-encryption-keyfalseMon,
+ 11 May 2020 22:53:07 GMT0shared365137ftrue01D6289358749C19Tue,
+ 12 May 2020 19:27:16 GMT\"0x8D7F6AA7AEB06B6\"5120TransactionOptimized5/12/2020
+ 7:27:16 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:27:16 GMT0shared365137ftrue01D628936A7CCB5FTue,
+ 12 May 2020 19:27:46 GMT\"0x8D7F6AA8CF3289E\"5120TransactionOptimized5/12/2020
+ 7:27:46 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:34:47 GMT0shared365137ftrue01D62894782B2ED3Tue,
+ 12 May 2020 19:35:19 GMT\"0x8D7F6AB9A9E0823\"5120TransactionOptimized5/12/2020
+ 7:35:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:36:42 GMT0shared365137ftrue01D62894BBABA26ATue,
+ 12 May 2020 19:37:12 GMT\"0x8D7F6ABDE221895\"5120TransactionOptimized5/12/2020
+ 7:37:12 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:16:59 GMT1shared365137ftrue01D6289A5CED9EC1Tue,
+ 12 May 2020 20:17:30 GMT\"0x8D7F6B17F6378C3\"5120TransactionOptimized5/12/2020
+ 8:17:30 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:22:47 GMT1shared365137ftrue01D6289B2C4BE740Tue,
+ 12 May 2020 20:23:18 GMT\"0x8D7F6B24EC25185\"5120TransactionOptimized5/12/2020
+ 8:23:18 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:24:26 GMT1shared365137ftrue01D6289B670E0FE5Tue,
+ 12 May 2020 20:24:56 GMT\"0x8D7F6B28984B251\"5120TransactionOptimized5/12/2020
+ 8:24:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:26:35 GMT1shared365137ftrue01D6289BB89BF91ETue,
+ 12 May 2020 20:27:13 GMT\"0x8D7F6B2DB0FAFFB\"5120TransactionOptimized5/12/2020
+ 8:27:13 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:29:53 GMT1shared365137ftrue01D6289C29CC3751Tue,
+ 12 May 2020 20:30:23 GMT\"0x8D7F6B34C42D063\"5120TransactionOptimized5/12/2020
+ 8:30:23 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:31:16 GMT1shared365137fTue,
+ 12 May 2020 20:31:46 GMT\"0x8D7F6B37DDB00D5\"5120TransactionOptimized5/12/2020
+ 8:31:46 PM$account-encryption-keyfalsesharerestore12700ec5true01D62895628B32A6Tue,
+ 12 May 2020 19:41:52 GMT\"0x8D7F6AC84F7CE92\"5120TransactionOptimized5/12/2020
+ 7:41:52 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:41:52 GMT0sharerestore12700ec5true01D62895E93C6018Tue,
+ 12 May 2020 19:45:38 GMT\"0x8D7F6AD0BB2D264\"5120TransactionOptimized5/12/2020
+ 7:45:38 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:45:38 GMT0sharerestore12700ec5true01D62896EE908613Tue,
+ 12 May 2020 19:52:56 GMT\"0x8D7F6AE1105D23C\"5120TransactionOptimized5/12/2020
+ 7:52:56 PM$account-encryption-keyfalseTue,
+ 12 May 2020 19:52:57 GMT0sharerestore12700ec5true01D62896FE2C7643Tue,
+ 12 May 2020 19:53:22 GMT\"0x8D7F6AE20A3E059\"5120TransactionOptimized5/12/2020
+ 7:36:51 PM$account-encryption-keyfalseTue,
+ 12 May 2020 20:36:15 GMT1sharerestorebed60c48Tue,
+ 12 May 2020 01:27:19 GMT\"0x8D7F6139D00A95F\"5120TransactionOptimized5/12/2020
+ 1:26:19 AM$account-encryption-keyfalsesharetorestorebed60c48true01D627FC3CC9AC5BTue,
+ 12 May 2020 01:25:35 GMT\"0x8D7F6135F406102\"5120TransactionOptimized5/12/2020
+ 1:25:35 AM$account-encryption-keyfalseTue,
+ 12 May 2020 01:25:36 GMT0test-share-04423526-abc3-44c9-aa2e-540f6eecac0dSun,
+ 12 Apr 2020 18:42:18 GMT\"0x8D7DF113AB0D452\"5120TransactionOptimized$account-encryption-keyfalsetest-share-3754bd7d-b2e4-4079-a97e-a3b9afc1648cSat,
+ 11 Apr 2020 17:58:03 GMT\"0x8D7DE41E1D75DB4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6214a335-a4b0-498c-9995-1e50b6bb50a2Sat,
+ 11 Apr 2020 17:57:43 GMT\"0x8D7DE41D5B0D211\"5120TransactionOptimized$account-encryption-keyfalsetest-share-659cd252-38f3-43aa-8092-750973358be5Sun,
+ 12 Apr 2020 18:14:14 GMT\"0x8D7DF0D4EBB62F2\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6d528e3f-219f-44f9-b80b-3d2248cce9f3Sat,
+ 11 Apr 2020 17:58:24 GMT\"0x8D7DE41EDFB7785\"5120TransactionOptimized$account-encryption-keyfalsetest-share-6fe76ac5-709b-4678-b55e-47e717c1d943Sun,
+ 12 Apr 2020 18:24:45 GMT\"0x8D7DF0EC69BCDD4\"5120TransactionOptimized$account-encryption-keyfalsetest-share-745c2b22-c95a-4019-a1cf-df95f0cb7db9Sun,
+ 12 Apr 2020 18:42:49 GMT\"0x8D7DF114CDCA126\"5120TransactionOptimized$account-encryption-keyfalsetest-share-7e386df5-7d6b-4fcf-b23d-9e7dd2c13a2bSun,
+ 12 Apr 2020 18:23:37 GMT\"0x8D7DF0E9E44C712\"5120TransactionOptimized$account-encryption-keyfalsetest-share-93210600-6d3f-49e4-8e87-7e6947c23b8bSat,
+ 11 Apr 2020 17:57:33 GMT\"0x8D7DE41CF6BC1E8\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ba5d06e0-c1d4-41b7-8876-7aef01d366a7Sat,
+ 11 Apr 2020 17:57:53 GMT\"0x8D7DE41DBC30637\"5120TransactionOptimized$account-encryption-keyfalsetest-share-bed60c48Mon,
+ 11 May 2020 19:38:41 GMT\"0x8D7F5E2E8A4F4E3\"5120TransactionOptimized5/11/2020
+ 7:30:04 PM$account-encryption-keyfalsetest-share-bffb30c0-47cc-4cd0-b3b4-6c560832c136Sun,
+ 12 Apr 2020 18:44:28 GMT\"0x8D7DF11881FBCE1\"5120TransactionOptimized$account-encryption-keyfalsetest-share-ce14a14c-6463-4bad-bedc-bedf7388d692Sat,
+ 11 Apr 2020 17:58:14 GMT\"0x8D7DE41E7E8F550\"5120TransactionOptimized$account-encryption-keyfalsetest-share-e21b1b2a-eaa6-4f88-928f-449387ef5cb9Sun,
+ 12 Apr 2020 18:13:43 GMT\"0x8D7DF0D3C81621C\"5120TransactionOptimized$account-encryption-keyfalse"
+ headers:
+ content-type: application/xml
+ date: Tue, 12 May 2020 20:36:15 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ transfer-encoding: chunked
+ x-ms-version: '2019-12-12'
+ status:
+ code: 200
+ message: OK
+ url: https://seansoftdeletecanary.file.core.windows.net/?include=deleted&comp=list
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:16 GMT
+ x-ms-deleted-share-name:
+ - sharerestore12700ec5
+ x-ms-deleted-share-version:
+ - 01D62895628B32A6
+ x-ms-version:
+ - '2019-12-12'
+ method: PUT
+ uri: https://storagename.file.core.windows.net/sharerestore12700ec5?restype=share&comp=undelete
+ response:
+ body:
+ string: ''
+ headers:
+ content-length: '0'
+ date: Tue, 12 May 2020 20:36:16 GMT
+ etag: '"0x8D7F6B41ECF17FA"'
+ last-modified: Tue, 12 May 2020 20:36:16 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-version: '2019-12-12'
+ status:
+ code: 201
+ message: Created
+ url: https://seansoftdeletecanary.file.core.windows.net/sharerestore12700ec5?restype=share&comp=undelete
+- request:
+ body: null
+ headers:
+ User-Agent:
+ - azsdk-python-storage-file-share/12.1.2 Python/3.7.3 (Windows-10-10.0.18362-SP0)
+ x-ms-date:
+ - Tue, 12 May 2020 20:36:16 GMT
+ x-ms-version:
+ - '2019-12-12'
+ method: GET
+ uri: https://storagename.file.core.windows.net/sharerestore12700ec5?restype=share
+ response:
+ body:
+ string: ''
+ headers:
+ content-length: '0'
+ date: Tue, 12 May 2020 20:36:16 GMT
+ etag: '"0x8D7F6B41ECF17FA"'
+ last-modified: Tue, 12 May 2020 20:36:16 GMT
+ server: Windows-Azure-File/1.0 Microsoft-HTTPAPI/2.0
+ x-ms-access-tier: TransactionOptimized
+ x-ms-access-tier-change-time: 5/12/2020 7:41:52 PM
+ x-ms-has-immutability-policy: 'false'
+ x-ms-has-legal-hold: 'false'
+ x-ms-share-quota: '5120'
+ x-ms-version: '2019-12-12'
+ status:
+ code: 200
+ message: OK
+ url: https://seansoftdeletecanary.file.core.windows.net/sharerestore12700ec5?restype=share
+version: 1
diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
index 42207fe2de08..fdf04cca1970 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version.py
@@ -3,21 +3,17 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
-import unittest
import pytest
-import platform
-from datetime import datetime, timedelta
-from azure.core.exceptions import AzureError, ResourceExistsError
+from _shared.testcase import StorageTestCase, GlobalStorageAccountPreparer
+from azure.core.exceptions import ResourceExistsError
from azure.storage.fileshare import (
- VERSION,
ShareServiceClient,
ShareClient,
ShareDirectoryClient,
ShareFileClient
)
-from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer
-from _shared.testcase import StorageTestCase, GlobalStorageAccountPreparer
+from azure.storage.fileshare._generated import __version__ as version
# ------------------------------------------------------------------------------
TEST_FILE_PREFIX = 'file'
@@ -27,7 +23,7 @@ class StorageClientTest(StorageTestCase):
def setUp(self):
super(StorageClientTest, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = "2019-07-07"
+ self.api_version_2 = version
self.short_byte_data = self.get_random_bytes(1024)
# --Helpers-----------------------------------------------------------------
diff --git a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
index f5c9c26d91f8..a1875d7ca912 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_file_api_version_async.py
@@ -3,21 +3,18 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
-import unittest
import pytest
-import platform
-from datetime import datetime, timedelta
-from azure.core.exceptions import AzureError, ResourceExistsError
+from _shared.asynctestcase import AsyncStorageTestCase
+from _shared.testcase import GlobalStorageAccountPreparer
+from azure.core.exceptions import ResourceExistsError
from azure.storage.fileshare.aio import (
ShareServiceClient,
ShareClient,
ShareDirectoryClient,
ShareFileClient
)
-from devtools_testutils import ResourceGroupPreparer, StorageAccountPreparer
-from _shared.testcase import GlobalStorageAccountPreparer
-from _shared.asynctestcase import AsyncStorageTestCase
+from azure.storage.fileshare._generated import __version__ as version
# ------------------------------------------------------------------------------
TEST_FILE_PREFIX = 'file'
@@ -27,7 +24,7 @@ class AsyncStorageClientTest(AsyncStorageTestCase):
def setUp(self):
super(AsyncStorageTestCase, self).setUp()
self.api_version_1 = "2019-02-02"
- self.api_version_2 = "2019-07-07"
+ self.api_version_2 = version
self.short_byte_data = self.get_random_bytes(1024)
# --Helpers-----------------------------------------------------------------
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 ac47fe2fb325..0a75d28465ad 100644
--- a/sdk/storage/azure-storage-file-share/tests/test_share.py
+++ b/sdk/storage/azure-storage-file-share/tests/test_share.py
@@ -5,6 +5,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
+import time
import unittest
from datetime import datetime, timedelta
@@ -62,7 +63,10 @@ def _get_share_reference(self, prefix=TEST_SHARE_PREFIX):
def _create_share(self, prefix=TEST_SHARE_PREFIX):
share_client = self._get_share_reference(prefix)
- share = share_client.create_share()
+ try:
+ share_client.create_share()
+ except:
+ pass
return share_client
def _delete_shares(self, prefix=TEST_SHARE_PREFIX):
@@ -144,6 +148,59 @@ def test_delete_share_with_snapshots(self, resource_group, location, storage_acc
self.assertIsNone(deleted)
self._delete_shares()
+ @pytest.mark.playback_test_only
+ @GlobalStorageAccountPreparer()
+ def test_undelete_share(self, resource_group, location, storage_account, storage_account_key):
+ # share soft delete should enabled by SRP call or use armclient, so make this test as playback only.
+ self._setup(storage_account, storage_account_key)
+ share_client = self._create_share(prefix="sharerestore")
+
+ # Act
+ share_client.delete_share()
+ # to make sure the share deleted
+ with self.assertRaises(ResourceNotFoundError):
+ share_client.get_share_properties()
+
+ share_list = list(self.fsc.list_shares(include_deleted=True, include_snapshots=True, include_metadata=True))
+ self.assertTrue(len(share_list) >= 1)
+
+ for share in share_list:
+ # find the deleted share and restore it
+ if share.deleted and share.name == share_client.share_name:
+ if self.is_live:
+ time.sleep(60)
+ restored_share_client = self.fsc.undelete_share(share.name, share.version)
+
+ # to make sure the deleted share is restored
+ props = restored_share_client.get_share_properties()
+ self.assertIsNotNone(props)
+
+ @pytest.mark.playback_test_only
+ @GlobalStorageAccountPreparer()
+ def test_restore_to_existing_share(self, resource_group, location, storage_account, storage_account_key):
+ # share soft delete should enabled by SRP call or use armclient, so make this test as playback only.
+ self._setup(storage_account, storage_account_key)
+ # Act
+ share_client = self._create_share()
+ share_client.delete_share()
+ # to make sure the share deleted
+ with self.assertRaises(ResourceNotFoundError):
+ share_client.get_share_properties()
+
+ # create a share with the same name as the deleted one
+ if self.is_live:
+ time.sleep(30)
+ share_client.create_share()
+
+ share_list = list(self.fsc.list_shares(include_deleted=True))
+ self.assertTrue(len(share_list) >= 1)
+
+ for share in share_list:
+ # find the deleted share and restore it
+ if share.deleted and share.name == share_client.share_name:
+ with self.assertRaises(HttpResponseError):
+ self.fsc.undelete_share(share.name, share.version)
+
@GlobalStorageAccountPreparer()
def test_delete_snapshot(self, resource_group, location, storage_account, storage_account_key):
self._setup(storage_account, storage_account_key)
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 963d35f68ef6..671575a03ca9 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
@@ -5,6 +5,7 @@
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
+import time
import unittest
from datetime import datetime, timedelta
import asyncio
@@ -85,7 +86,10 @@ def _get_share_reference(self, prefix=TEST_SHARE_PREFIX):
async def _create_share(self, prefix=TEST_SHARE_PREFIX):
share_client = self._get_share_reference(prefix)
- share = await share_client.create_share()
+ try:
+ await share_client.create_share()
+ except:
+ pass
return share_client
# --Test cases for shares -----------------------------------------
@@ -166,6 +170,67 @@ async def test_delete_share_with_snapshots_async(self, resource_group, location,
self.assertIsNone(deleted)
await self._delete_shares(share.share_name)
+ @pytest.mark.playback_test_only
+ @GlobalStorageAccountPreparer()
+ @AsyncStorageTestCase.await_prepared_test
+ async def test_undelete_share(self, resource_group, location, storage_account, storage_account_key):
+ # share soft delete should enabled by SRP call or use armclient, so make this test as playback only.
+ self._setup(storage_account, storage_account_key)
+ share_client = await self._create_share(prefix="sharerestore")
+
+ # Act
+ await share_client.delete_share()
+ # to make sure the share deleted
+ with self.assertRaises(ResourceNotFoundError):
+ await share_client.get_share_properties()
+
+ share_list = list()
+ async for share in self.fsc.list_shares(include_deleted=True):
+ share_list.append(share)
+ self.assertTrue(len(share_list) >= 1)
+
+ for share in share_list:
+ # find the deleted share and restore it
+ if share.deleted and share.name == share_client.share_name:
+ if self.is_live:
+ time.sleep(60)
+ restored_share_client = await self.fsc.undelete_share(share.name, share.version)
+
+ # to make sure the deleted share is restored
+ props = await restored_share_client.get_share_properties()
+ self.assertIsNotNone(props)
+ break
+
+ @pytest.mark.playback_test_only
+ @GlobalStorageAccountPreparer()
+ @AsyncStorageTestCase.await_prepared_test
+ async def test_restore_to_existing_share(self, resource_group, location, storage_account, storage_account_key):
+ # share soft delete should enabled by SRP call or use armclient, so make this test as playback only.
+ self._setup(storage_account, storage_account_key)
+ # Act
+ share_client = await self._create_share()
+ await share_client.delete_share()
+ # to make sure the share deleted
+ with self.assertRaises(ResourceNotFoundError):
+ await share_client.get_share_properties()
+
+ # create a share with the same name as the deleted one
+ if self.is_live:
+ time.sleep(30)
+ await share_client.create_share()
+
+ share_list = []
+ async for share in self.fsc.list_shares(include_deleted=True):
+ share_list.append(share)
+ self.assertTrue(len(share_list) >= 1)
+
+ for share in share_list:
+ # find the deleted share and restore it
+ if share.deleted and share.name == share_client.share_name:
+ with self.assertRaises(HttpResponseError):
+ await self.fsc.undelete_share(share.name, share.version)
+ break
+
@GlobalStorageAccountPreparer()
@AsyncStorageTestCase.await_prepared_test
async def test_delete_snapshot_async(self, resource_group, location, storage_account, storage_account_key):