From f93d2ccafd28df304d870657e02f12ab0fb65688 Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Tue, 21 Apr 2020 18:10:19 +0000 Subject: [PATCH] Generated from 5110ff0ad58303891a2515cd60059c99ac6e2e56 Address comment --- .../storage/v2019_06_01/models/__init__.py | 13 ++ .../storage/v2019_06_01/models/_models.py | 153 ++++++++++++++++ .../storage/v2019_06_01/models/_models_py3.py | 165 +++++++++++++++++- .../_storage_management_client_enums.py | 31 ++++ .../operations/_file_shares_operations.py | 118 ++++++++++--- 5 files changed, 452 insertions(+), 28 deletions(-) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py index 825458fba64b..338888703ce5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/__init__.py @@ -26,6 +26,7 @@ from ._models_py3 import CustomDomain from ._models_py3 import DateAfterCreation from ._models_py3 import DateAfterModification + from ._models_py3 import DeletedShare from ._models_py3 import DeleteRetentionPolicy from ._models_py3 import Dimension from ._models_py3 import Encryption @@ -114,6 +115,7 @@ from ._models import CustomDomain from ._models import DateAfterCreation from ._models import DateAfterModification + from ._models import DeletedShare from ._models import DeleteRetentionPolicy from ._models import Dimension from ._models import Encryption @@ -231,8 +233,13 @@ LeaseDuration, ImmutabilityPolicyState, ImmutabilityPolicyUpdateType, + EnabledProtocols, + RootSquashType, + ShareAccessTier, StorageAccountExpand, ListKeyExpand, + ListSharesExpand, + GetShareExpand, ) __all__ = [ @@ -252,6 +259,7 @@ 'CustomDomain', 'DateAfterCreation', 'DateAfterModification', + 'DeletedShare', 'DeleteRetentionPolicy', 'Dimension', 'Encryption', @@ -368,6 +376,11 @@ 'LeaseDuration', 'ImmutabilityPolicyState', 'ImmutabilityPolicyUpdateType', + 'EnabledProtocols', + 'RootSquashType', + 'ShareAccessTier', 'StorageAccountExpand', 'ListKeyExpand', + 'ListSharesExpand', + 'GetShareExpand', ] diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py index 3ae54832ea74..d166c4953154 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models.py @@ -789,6 +789,35 @@ def __init__(self, **kwargs): self.days_after_modification_greater_than = kwargs.get('days_after_modification_greater_than', None) +class DeletedShare(Model): + """The deleted share to be restored. + + All required parameters must be populated in order to send to Azure. + + :param deleted_share_name: Required. Required. Identify the name of the + deleted share that will be restored. + :type deleted_share_name: str + :param deleted_share_version: Required. Required. Identify the version of + the deleted share that will be restored. + :type deleted_share_version: str + """ + + _validation = { + 'deleted_share_name': {'required': True}, + 'deleted_share_version': {'required': True}, + } + + _attribute_map = { + 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, + 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedShare, self).__init__(**kwargs) + self.deleted_share_name = kwargs.get('deleted_share_name', None) + self.deleted_share_version = kwargs.get('deleted_share_version', None) + + class DeleteRetentionPolicy(Model): """The service properties for soft delete. @@ -1214,6 +1243,41 @@ class FileShare(AzureEntityResource): greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. :type share_quota: int + :param enabled_protocols: The authentication protocol that is used for the + file share. Can only be specified when creating a share. Possible values + include: 'SMB', 'NFS' + :type enabled_protocols: str or + ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :param root_squash: The property is for NFS share only. The default is + NoRootSquash. Possible values include: 'NoRootSquash', 'RootSquash', + 'AllSquash' + :type root_squash: str or + ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: datetime + :ivar remaining_retention_days: Remaining retention days for share that + was soft deleted. + :vartype remaining_retention_days: int + :param access_tier: Access tier for specific share. GpV2 account can + choose between TransactionOptimized (default), Hot, and Cool. FileStorage + account can choose Premium. Possible values include: + 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + :type access_tier: str or + ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for + share access tier. + :vartype access_tier_change_time: datetime + :ivar access_tier_status: Indicates if there is a pending transition for + access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the + share. Note that this value may not include all recently created or + recently resized files. + :vartype share_usage_bytes: int """ _validation = { @@ -1223,6 +1287,13 @@ class FileShare(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, } _attribute_map = { @@ -1233,6 +1304,16 @@ class FileShare(AzureEntityResource): 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'int'}, } def __init__(self, **kwargs): @@ -1240,6 +1321,16 @@ def __init__(self, **kwargs): self.last_modified_time = None self.metadata = kwargs.get('metadata', None) self.share_quota = kwargs.get('share_quota', None) + self.enabled_protocols = kwargs.get('enabled_protocols', None) + self.root_squash = kwargs.get('root_squash', None) + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = kwargs.get('access_tier', None) + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None class FileShareItem(AzureEntityResource): @@ -1268,6 +1359,41 @@ class FileShareItem(AzureEntityResource): greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. :type share_quota: int + :param enabled_protocols: The authentication protocol that is used for the + file share. Can only be specified when creating a share. Possible values + include: 'SMB', 'NFS' + :type enabled_protocols: str or + ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :param root_squash: The property is for NFS share only. The default is + NoRootSquash. Possible values include: 'NoRootSquash', 'RootSquash', + 'AllSquash' + :type root_squash: str or + ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: datetime + :ivar remaining_retention_days: Remaining retention days for share that + was soft deleted. + :vartype remaining_retention_days: int + :param access_tier: Access tier for specific share. GpV2 account can + choose between TransactionOptimized (default), Hot, and Cool. FileStorage + account can choose Premium. Possible values include: + 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + :type access_tier: str or + ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for + share access tier. + :vartype access_tier_change_time: datetime + :ivar access_tier_status: Indicates if there is a pending transition for + access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the + share. Note that this value may not include all recently created or + recently resized files. + :vartype share_usage_bytes: int """ _validation = { @@ -1277,6 +1403,13 @@ class FileShareItem(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, } _attribute_map = { @@ -1287,6 +1420,16 @@ class FileShareItem(AzureEntityResource): 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'int'}, } def __init__(self, **kwargs): @@ -1294,6 +1437,16 @@ def __init__(self, **kwargs): self.last_modified_time = None self.metadata = kwargs.get('metadata', None) self.share_quota = kwargs.get('share_quota', None) + self.enabled_protocols = kwargs.get('enabled_protocols', None) + self.root_squash = kwargs.get('root_squash', None) + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = kwargs.get('access_tier', None) + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None class GeoReplicationStats(Model): diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py index cadc881d9b92..2d5e2d31cb61 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_models_py3.py @@ -789,6 +789,35 @@ def __init__(self, *, days_after_modification_greater_than: float, **kwargs) -> self.days_after_modification_greater_than = days_after_modification_greater_than +class DeletedShare(Model): + """The deleted share to be restored. + + All required parameters must be populated in order to send to Azure. + + :param deleted_share_name: Required. Required. Identify the name of the + deleted share that will be restored. + :type deleted_share_name: str + :param deleted_share_version: Required. Required. Identify the version of + the deleted share that will be restored. + :type deleted_share_version: str + """ + + _validation = { + 'deleted_share_name': {'required': True}, + 'deleted_share_version': {'required': True}, + } + + _attribute_map = { + 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, + 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, + } + + def __init__(self, *, deleted_share_name: str, deleted_share_version: str, **kwargs) -> None: + super(DeletedShare, self).__init__(**kwargs) + self.deleted_share_name = deleted_share_name + self.deleted_share_version = deleted_share_version + + class DeleteRetentionPolicy(Model): """The service properties for soft delete. @@ -1214,6 +1243,41 @@ class FileShare(AzureEntityResource): greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. :type share_quota: int + :param enabled_protocols: The authentication protocol that is used for the + file share. Can only be specified when creating a share. Possible values + include: 'SMB', 'NFS' + :type enabled_protocols: str or + ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :param root_squash: The property is for NFS share only. The default is + NoRootSquash. Possible values include: 'NoRootSquash', 'RootSquash', + 'AllSquash' + :type root_squash: str or + ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: datetime + :ivar remaining_retention_days: Remaining retention days for share that + was soft deleted. + :vartype remaining_retention_days: int + :param access_tier: Access tier for specific share. GpV2 account can + choose between TransactionOptimized (default), Hot, and Cool. FileStorage + account can choose Premium. Possible values include: + 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + :type access_tier: str or + ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for + share access tier. + :vartype access_tier_change_time: datetime + :ivar access_tier_status: Indicates if there is a pending transition for + access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the + share. Note that this value may not include all recently created or + recently resized files. + :vartype share_usage_bytes: int """ _validation = { @@ -1223,6 +1287,13 @@ class FileShare(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, } _attribute_map = { @@ -1233,13 +1304,33 @@ class FileShare(AzureEntityResource): 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - } - - def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'int'}, + } + + def __init__(self, *, metadata=None, share_quota: int=None, enabled_protocols=None, root_squash=None, access_tier=None, **kwargs) -> None: super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata self.share_quota = share_quota + self.enabled_protocols = enabled_protocols + self.root_squash = root_squash + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = access_tier + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None class FileShareItem(AzureEntityResource): @@ -1268,6 +1359,41 @@ class FileShareItem(AzureEntityResource): greater than 0, and less than or equal to 5TB (5120). For Large File Shares, the maximum size is 102400. :type share_quota: int + :param enabled_protocols: The authentication protocol that is used for the + file share. Can only be specified when creating a share. Possible values + include: 'SMB', 'NFS' + :type enabled_protocols: str or + ~azure.mgmt.storage.v2019_06_01.models.EnabledProtocols + :param root_squash: The property is for NFS share only. The default is + NoRootSquash. Possible values include: 'NoRootSquash', 'RootSquash', + 'AllSquash' + :type root_squash: str or + ~azure.mgmt.storage.v2019_06_01.models.RootSquashType + :ivar version: The version of the share. + :vartype version: str + :ivar deleted: Indicates whether the share was deleted. + :vartype deleted: bool + :ivar deleted_time: The deleted time if the share was deleted. + :vartype deleted_time: datetime + :ivar remaining_retention_days: Remaining retention days for share that + was soft deleted. + :vartype remaining_retention_days: int + :param access_tier: Access tier for specific share. GpV2 account can + choose between TransactionOptimized (default), Hot, and Cool. FileStorage + account can choose Premium. Possible values include: + 'TransactionOptimized', 'Hot', 'Cool', 'Premium' + :type access_tier: str or + ~azure.mgmt.storage.v2019_06_01.models.ShareAccessTier + :ivar access_tier_change_time: Indicates the last modification time for + share access tier. + :vartype access_tier_change_time: datetime + :ivar access_tier_status: Indicates if there is a pending transition for + access tier. + :vartype access_tier_status: str + :ivar share_usage_bytes: The approximate size of the data stored on the + share. Note that this value may not include all recently created or + recently resized files. + :vartype share_usage_bytes: int """ _validation = { @@ -1277,6 +1403,13 @@ class FileShareItem(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'version': {'readonly': True}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, + 'access_tier_change_time': {'readonly': True}, + 'access_tier_status': {'readonly': True}, + 'share_usage_bytes': {'readonly': True}, } _attribute_map = { @@ -1287,13 +1420,33 @@ class FileShareItem(AzureEntityResource): 'last_modified_time': {'key': 'properties.lastModifiedTime', 'type': 'iso-8601'}, 'metadata': {'key': 'properties.metadata', 'type': '{str}'}, 'share_quota': {'key': 'properties.shareQuota', 'type': 'int'}, - } - - def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + 'enabled_protocols': {'key': 'properties.enabledProtocols', 'type': 'str'}, + 'root_squash': {'key': 'properties.rootSquash', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'deleted': {'key': 'properties.deleted', 'type': 'bool'}, + 'deleted_time': {'key': 'properties.deletedTime', 'type': 'iso-8601'}, + 'remaining_retention_days': {'key': 'properties.remainingRetentionDays', 'type': 'int'}, + 'access_tier': {'key': 'properties.accessTier', 'type': 'str'}, + 'access_tier_change_time': {'key': 'properties.accessTierChangeTime', 'type': 'iso-8601'}, + 'access_tier_status': {'key': 'properties.accessTierStatus', 'type': 'str'}, + 'share_usage_bytes': {'key': 'properties.shareUsageBytes', 'type': 'int'}, + } + + def __init__(self, *, metadata=None, share_quota: int=None, enabled_protocols=None, root_squash=None, access_tier=None, **kwargs) -> None: super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata self.share_quota = share_quota + self.enabled_protocols = enabled_protocols + self.root_squash = root_squash + self.version = None + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None + self.access_tier = access_tier + self.access_tier_change_time = None + self.access_tier_status = None + self.share_usage_bytes = None class GeoReplicationStats(Model): diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py index 19601af72a5a..c3344f03edbe 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_storage_management_client_enums.py @@ -268,6 +268,27 @@ class ImmutabilityPolicyUpdateType(str, Enum): extend = "extend" +class EnabledProtocols(str, Enum): + + smb = "SMB" + nfs = "NFS" + + +class RootSquashType(str, Enum): + + no_root_squash = "NoRootSquash" + root_squash = "RootSquash" + all_squash = "AllSquash" + + +class ShareAccessTier(str, Enum): + + transaction_optimized = "TransactionOptimized" + hot = "Hot" + cool = "Cool" + premium = "Premium" + + class StorageAccountExpand(str, Enum): geo_replication_stats = "geoReplicationStats" @@ -277,3 +298,13 @@ class StorageAccountExpand(str, Enum): class ListKeyExpand(str, Enum): kerb = "kerb" + + +class ListSharesExpand(str, Enum): + + deleted = "deleted" + + +class GetShareExpand(str, Enum): + + stats = "stats" diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py index ca0c37d18618..3c19ae4ae93a 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_file_shares_operations.py @@ -40,7 +40,7 @@ def __init__(self, client, config, serializer, deserializer): self.config = config def list( - self, resource_group_name, account_name, maxpagesize=None, filter=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, maxpagesize=None, filter=None, expand=None, custom_headers=None, raw=False, **operation_config): """Lists all shares. :param resource_group_name: The name of the resource group within the @@ -56,6 +56,10 @@ def list( :param filter: Optional. When specified, only share names starting with the filter will be listed. :type filter: str + :param expand: Optional, used to expand the properties within share's + properties. Possible values include: 'deleted' + :type expand: str or + ~azure.mgmt.storage.v2019_06_01.models.ListSharesExpand :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -84,6 +88,8 @@ def prepare_request(next_link=None): query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') if filter is not None: query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'ListSharesExpand') else: url = next_link @@ -125,7 +131,7 @@ def internal_paging(next_link=None): list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'} def create( - self, resource_group_name, account_name, share_name, metadata=None, share_quota=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_name, file_share, custom_headers=None, raw=False, **operation_config): """Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. It does not include a list of the files contained by the share. @@ -144,13 +150,8 @@ def create( dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param metadata: A name-value pair to associate with the share as - metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must - be greater than 0, and less than or equal to 5TB (5120). For Large - File Shares, the maximum size is 102400. - :type share_quota: int + :param file_share: Properties of the file share to create. + :type file_share: ~azure.mgmt.storage.v2019_06_01.models.FileShare :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -161,8 +162,6 @@ def create( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - file_share = models.FileShare(metadata=metadata, share_quota=share_quota) - # Construct URL url = self.create.metadata['url'] path_format_arguments = { @@ -214,7 +213,7 @@ def create( create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} def update( - self, resource_group_name, account_name, share_name, metadata=None, share_quota=None, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_name, file_share, custom_headers=None, raw=False, **operation_config): """Updates share properties as specified in request body. Properties not mentioned in the request will not be changed. Update fails if the specified share does not already exist. . @@ -232,13 +231,8 @@ def update( dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str - :param metadata: A name-value pair to associate with the share as - metadata. - :type metadata: dict[str, str] - :param share_quota: The maximum size of the share, in gigabytes. Must - be greater than 0, and less than or equal to 5TB (5120). For Large - File Shares, the maximum size is 102400. - :type share_quota: int + :param file_share: Properties to update for the file share. + :type file_share: ~azure.mgmt.storage.v2019_06_01.models.FileShare :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -249,8 +243,6 @@ def update( ~msrest.pipeline.ClientRawResponse :raises: :class:`CloudError` """ - file_share = models.FileShare(metadata=metadata, share_quota=share_quota) - # Construct URL url = self.update.metadata['url'] path_format_arguments = { @@ -300,7 +292,7 @@ def update( update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} def get( - self, resource_group_name, account_name, share_name, custom_headers=None, raw=False, **operation_config): + self, resource_group_name, account_name, share_name, expand=None, custom_headers=None, raw=False, **operation_config): """Gets properties of a specified share. :param resource_group_name: The name of the resource group within the @@ -316,6 +308,10 @@ def get( dash (-) character must be immediately preceded and followed by a letter or number. :type share_name: str + :param expand: Optional, used to expand the properties within share's + properties. Possible values include: 'stats' + :type expand: str or + ~azure.mgmt.storage.v2019_06_01.models.GetShareExpand :param dict custom_headers: headers that will be added to the request :param bool raw: returns the direct response alongside the deserialized response @@ -339,6 +335,8 @@ def get( # Construct parameters query_parameters = {} query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + if expand is not None: + query_parameters['$expand'] = self._serialize.query("expand", expand, 'GetShareExpand') # Construct headers header_parameters = {} @@ -432,3 +430,79 @@ def delete( client_raw_response = ClientRawResponse(None, response) return client_raw_response delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}'} + + def restore( + self, resource_group_name, account_name, share_name, deleted_share_name, deleted_share_version, custom_headers=None, raw=False, **operation_config): + """Restore a file share within a valid retention days if share soft delete + is enabled. + + :param resource_group_name: The name of the resource group within the + user's subscription. The name is case insensitive. + :type resource_group_name: str + :param account_name: The name of the storage account within the + specified resource group. Storage account names must be between 3 and + 24 characters in length and use numbers and lower-case letters only. + :type account_name: str + :param share_name: The name of the file share within the specified + storage account. File share names must be between 3 and 63 characters + in length and use numbers, lower-case letters and dash (-) only. Every + dash (-) character must be immediately preceded and followed by a + letter or number. + :type share_name: str + :param deleted_share_name: Required. Identify the name of the deleted + share that will be restored. + :type deleted_share_name: str + :param deleted_share_version: Required. Identify the version of the + deleted share that will be restored. + :type deleted_share_version: str + :param dict custom_headers: headers that will be added to the request + :param bool raw: returns the direct response alongside the + deserialized response + :param operation_config: :ref:`Operation configuration + overrides`. + :return: None or ClientRawResponse if raw=true + :rtype: None or ~msrest.pipeline.ClientRawResponse + :raises: :class:`CloudError` + """ + deleted_share = models.DeletedShare(deleted_share_name=deleted_share_name, deleted_share_version=deleted_share_version) + + # Construct URL + url = self.restore.metadata['url'] + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str', max_length=24, min_length=3), + 'shareName': self._serialize.url("share_name", share_name, 'str', max_length=63, min_length=3), + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str', min_length=1) + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str', min_length=1) + + # Construct headers + header_parameters = {} + header_parameters['Content-Type'] = 'application/json; charset=utf-8' + if self.config.generate_client_request_id: + header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) + if custom_headers: + header_parameters.update(custom_headers) + if self.config.accept_language is not None: + header_parameters['accept-language'] = self._serialize.header("self.config.accept_language", self.config.accept_language, 'str') + + # Construct body + body_content = self._serialize.body(deleted_share, 'DeletedShare') + + # Construct and send request + request = self._client.post(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + restore.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares/{shareName}/restore'}