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 cea94861c992..4a59a9330eae 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 @@ -15,6 +15,9 @@ from ._models_py3 import AzureEntityResource from ._models_py3 import AzureFilesIdentityBasedAuthentication from ._models_py3 import BlobContainer + from ._models_py3 import BlobRestoreParameters + from ._models_py3 import BlobRestoreRange + from ._models_py3 import BlobRestoreStatus from ._models_py3 import BlobServiceProperties from ._models_py3 import ChangeFeed from ._models_py3 import CheckNameAvailabilityResult @@ -23,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 @@ -66,6 +70,7 @@ from ._models_py3 import PrivateLinkServiceConnectionState from ._models_py3 import ProxyResource from ._models_py3 import Resource + from ._models_py3 import RestorePolicyProperties from ._models_py3 import Restriction from ._models_py3 import RoutingPreference from ._models_py3 import ServiceSasParameters @@ -94,6 +99,9 @@ from ._models import AzureEntityResource from ._models import AzureFilesIdentityBasedAuthentication from ._models import BlobContainer + from ._models import BlobRestoreParameters + from ._models import BlobRestoreRange + from ._models import BlobRestoreStatus from ._models import BlobServiceProperties from ._models import ChangeFeed from ._models import CheckNameAvailabilityResult @@ -102,6 +110,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 @@ -145,6 +154,7 @@ from ._models import PrivateLinkServiceConnectionState from ._models import ProxyResource from ._models import Resource + from ._models import RestorePolicyProperties from ._models import Restriction from ._models import RoutingPreference from ._models import ServiceSasParameters @@ -191,6 +201,7 @@ LargeFileSharesState, RoutingChoice, GeoReplicationStatus, + BlobRestoreProgressStatus, ProvisioningState, AccountStatus, PrivateEndpointServiceConnectionStatus, @@ -210,6 +221,7 @@ ImmutabilityPolicyUpdateType, StorageAccountExpand, ListKeyExpand, + ListSharesExpand, ) __all__ = [ @@ -218,6 +230,9 @@ 'AzureEntityResource', 'AzureFilesIdentityBasedAuthentication', 'BlobContainer', + 'BlobRestoreParameters', + 'BlobRestoreRange', + 'BlobRestoreStatus', 'BlobServiceProperties', 'ChangeFeed', 'CheckNameAvailabilityResult', @@ -226,6 +241,7 @@ 'CustomDomain', 'DateAfterCreation', 'DateAfterModification', + 'DeletedShare', 'DeleteRetentionPolicy', 'Dimension', 'Encryption', @@ -269,6 +285,7 @@ 'PrivateLinkServiceConnectionState', 'ProxyResource', 'Resource', + 'RestorePolicyProperties', 'Restriction', 'RoutingPreference', 'ServiceSasParameters', @@ -314,6 +331,7 @@ 'LargeFileSharesState', 'RoutingChoice', 'GeoReplicationStatus', + 'BlobRestoreProgressStatus', 'ProvisioningState', 'AccountStatus', 'PrivateEndpointServiceConnectionStatus', @@ -333,4 +351,5 @@ 'ImmutabilityPolicyUpdateType', 'StorageAccountExpand', 'ListKeyExpand', + 'ListSharesExpand', ] 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 4dc76e0d2469..cc33dd483c49 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 @@ -340,6 +340,105 @@ def __init__(self, **kwargs): self.has_immutability_policy = None +class BlobRestoreParameters(Model): + """Blob restore parameters. + + All required parameters must be populated in order to send to Azure. + + :param time_to_restore: Required. Restore blob to the specified time. + :type time_to_restore: datetime + :param blob_ranges: Required. Blob ranges to restore. + :type blob_ranges: + list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] + """ + + _validation = { + 'time_to_restore': {'required': True}, + 'blob_ranges': {'required': True}, + } + + _attribute_map = { + 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, + 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, + } + + def __init__(self, **kwargs): + super(BlobRestoreParameters, self).__init__(**kwargs) + self.time_to_restore = kwargs.get('time_to_restore', None) + self.blob_ranges = kwargs.get('blob_ranges', None) + + +class BlobRestoreRange(Model): + """Blob range. + + All required parameters must be populated in order to send to Azure. + + :param start_range: Required. Blob start range. Empty means account start. + :type start_range: str + :param end_range: Required. Blob end range. Empty means account end. + :type end_range: str + """ + + _validation = { + 'start_range': {'required': True}, + 'end_range': {'required': True}, + } + + _attribute_map = { + 'start_range': {'key': 'startRange', 'type': 'str'}, + 'end_range': {'key': 'endRange', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(BlobRestoreRange, self).__init__(**kwargs) + self.start_range = kwargs.get('start_range', None) + self.end_range = kwargs.get('end_range', None) + + +class BlobRestoreStatus(Model): + """Blob restore status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of blob restore progress. Possible values are: - + InProgress: Indicates that blob restore is ongoing. - Complete: Indicates + that blob restore has been completed successfully. - Failed: Indicates + that blob restore is failed. Possible values include: 'InProgress', + 'Complete', 'Failed' + :vartype status: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreProgressStatus + :ivar failure_reason: Failure reason when blob restore is failed. + :vartype failure_reason: str + :ivar restore_id: Id for tracking blob restore request. + :vartype restore_id: str + :ivar parameters: Blob restore request parameters. + :vartype parameters: + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters + """ + + _validation = { + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'restore_id': {'readonly': True}, + 'parameters': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'restore_id': {'key': 'restoreId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, + } + + def __init__(self, **kwargs): + super(BlobRestoreStatus, self).__init__(**kwargs) + self.status = None + self.failure_reason = None + self.restore_id = None + self.parameters = None + + class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. @@ -373,6 +472,10 @@ class BlobServiceProperties(Resource): :type automatic_snapshot_policy_enabled: bool :param change_feed: The blob service properties for change feed events. :type change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed + :param restore_policy: The blob service properties for blob restore + policy. + :type restore_policy: + ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku """ @@ -393,6 +496,7 @@ class BlobServiceProperties(Resource): 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, + 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, 'sku': {'key': 'sku', 'type': 'Sku'}, } @@ -403,6 +507,7 @@ def __init__(self, **kwargs): self.delete_retention_policy = kwargs.get('delete_retention_policy', None) self.automatic_snapshot_policy_enabled = kwargs.get('automatic_snapshot_policy_enabled', None) self.change_feed = kwargs.get('change_feed', None) + self.restore_policy = kwargs.get('restore_policy', None) self.sku = None @@ -662,6 +767,28 @@ 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. + + :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 + """ + + _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. @@ -1002,6 +1129,15 @@ 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 version: The version of the share. + :type 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 """ _validation = { @@ -1011,6 +1147,9 @@ class FileShare(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, } _attribute_map = { @@ -1021,6 +1160,10 @@ 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'}, + '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'}, } def __init__(self, **kwargs): @@ -1028,6 +1171,10 @@ def __init__(self, **kwargs): self.last_modified_time = None self.metadata = kwargs.get('metadata', None) self.share_quota = kwargs.get('share_quota', None) + self.version = kwargs.get('version', None) + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None class FileShareItem(AzureEntityResource): @@ -1056,6 +1203,15 @@ 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 version: The version of the share. + :type 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 """ _validation = { @@ -1065,6 +1221,9 @@ class FileShareItem(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, } _attribute_map = { @@ -1075,6 +1234,10 @@ 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'}, + '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'}, } def __init__(self, **kwargs): @@ -1082,6 +1245,10 @@ def __init__(self, **kwargs): self.last_modified_time = None self.metadata = kwargs.get('metadata', None) self.share_quota = kwargs.get('share_quota', None) + self.version = kwargs.get('version', None) + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None class GeoReplicationStats(Model): @@ -2204,6 +2371,34 @@ def __init__(self, **kwargs): super(ProxyResource, self).__init__(**kwargs) +class RestorePolicyProperties(Model): + """The blob service properties for blob restore policy. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Blob restore is enabled if set to true. + :type enabled: bool + :param days: how long this blob can be restored. It should be great than + zero and less than DeleteRetentionPolicy.days. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'maximum': 365, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, **kwargs): + super(RestorePolicyProperties, self).__init__(**kwargs) + self.enabled = kwargs.get('enabled', None) + self.days = kwargs.get('days', None) + + class Restriction(Model): """The restriction because of which SKU cannot be used. @@ -2679,6 +2874,9 @@ class StorageAccount(TrackedResource): choice opted by the user for data transfer :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :ivar blob_restore_status: Blob restore status + :vartype blob_restore_status: + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus """ _validation = { @@ -2704,6 +2902,7 @@ class StorageAccount(TrackedResource): 'geo_replication_stats': {'readonly': True}, 'failover_in_progress': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, + 'blob_restore_status': {'readonly': True}, } _attribute_map = { @@ -2736,6 +2935,7 @@ class StorageAccount(TrackedResource): 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, + 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, } def __init__(self, **kwargs): @@ -2764,6 +2964,7 @@ def __init__(self, **kwargs): self.large_file_shares_state = kwargs.get('large_file_shares_state', None) self.private_endpoint_connections = None self.routing_preference = kwargs.get('routing_preference', None) + self.blob_restore_status = None class StorageAccountCheckNameAvailabilityParameters(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 80f0266d442e..4a39eec8c1e7 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 @@ -340,6 +340,105 @@ def __init__(self, *, public_access=None, metadata=None, **kwargs) -> None: self.has_immutability_policy = None +class BlobRestoreParameters(Model): + """Blob restore parameters. + + All required parameters must be populated in order to send to Azure. + + :param time_to_restore: Required. Restore blob to the specified time. + :type time_to_restore: datetime + :param blob_ranges: Required. Blob ranges to restore. + :type blob_ranges: + list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] + """ + + _validation = { + 'time_to_restore': {'required': True}, + 'blob_ranges': {'required': True}, + } + + _attribute_map = { + 'time_to_restore': {'key': 'timeToRestore', 'type': 'iso-8601'}, + 'blob_ranges': {'key': 'blobRanges', 'type': '[BlobRestoreRange]'}, + } + + def __init__(self, *, time_to_restore, blob_ranges, **kwargs) -> None: + super(BlobRestoreParameters, self).__init__(**kwargs) + self.time_to_restore = time_to_restore + self.blob_ranges = blob_ranges + + +class BlobRestoreRange(Model): + """Blob range. + + All required parameters must be populated in order to send to Azure. + + :param start_range: Required. Blob start range. Empty means account start. + :type start_range: str + :param end_range: Required. Blob end range. Empty means account end. + :type end_range: str + """ + + _validation = { + 'start_range': {'required': True}, + 'end_range': {'required': True}, + } + + _attribute_map = { + 'start_range': {'key': 'startRange', 'type': 'str'}, + 'end_range': {'key': 'endRange', 'type': 'str'}, + } + + def __init__(self, *, start_range: str, end_range: str, **kwargs) -> None: + super(BlobRestoreRange, self).__init__(**kwargs) + self.start_range = start_range + self.end_range = end_range + + +class BlobRestoreStatus(Model): + """Blob restore status. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar status: The status of blob restore progress. Possible values are: - + InProgress: Indicates that blob restore is ongoing. - Complete: Indicates + that blob restore has been completed successfully. - Failed: Indicates + that blob restore is failed. Possible values include: 'InProgress', + 'Complete', 'Failed' + :vartype status: str or + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreProgressStatus + :ivar failure_reason: Failure reason when blob restore is failed. + :vartype failure_reason: str + :ivar restore_id: Id for tracking blob restore request. + :vartype restore_id: str + :ivar parameters: Blob restore request parameters. + :vartype parameters: + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreParameters + """ + + _validation = { + 'status': {'readonly': True}, + 'failure_reason': {'readonly': True}, + 'restore_id': {'readonly': True}, + 'parameters': {'readonly': True}, + } + + _attribute_map = { + 'status': {'key': 'status', 'type': 'str'}, + 'failure_reason': {'key': 'failureReason', 'type': 'str'}, + 'restore_id': {'key': 'restoreId', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': 'BlobRestoreParameters'}, + } + + def __init__(self, **kwargs) -> None: + super(BlobRestoreStatus, self).__init__(**kwargs) + self.status = None + self.failure_reason = None + self.restore_id = None + self.parameters = None + + class BlobServiceProperties(Resource): """The properties of a storage account’s Blob service. @@ -373,6 +472,10 @@ class BlobServiceProperties(Resource): :type automatic_snapshot_policy_enabled: bool :param change_feed: The blob service properties for change feed events. :type change_feed: ~azure.mgmt.storage.v2019_06_01.models.ChangeFeed + :param restore_policy: The blob service properties for blob restore + policy. + :type restore_policy: + ~azure.mgmt.storage.v2019_06_01.models.RestorePolicyProperties :ivar sku: Sku name and tier. :vartype sku: ~azure.mgmt.storage.v2019_06_01.models.Sku """ @@ -393,16 +496,18 @@ class BlobServiceProperties(Resource): 'delete_retention_policy': {'key': 'properties.deleteRetentionPolicy', 'type': 'DeleteRetentionPolicy'}, 'automatic_snapshot_policy_enabled': {'key': 'properties.automaticSnapshotPolicyEnabled', 'type': 'bool'}, 'change_feed': {'key': 'properties.changeFeed', 'type': 'ChangeFeed'}, + 'restore_policy': {'key': 'properties.restorePolicy', 'type': 'RestorePolicyProperties'}, 'sku': {'key': 'sku', 'type': 'Sku'}, } - def __init__(self, *, cors=None, default_service_version: str=None, delete_retention_policy=None, automatic_snapshot_policy_enabled: bool=None, change_feed=None, **kwargs) -> None: + def __init__(self, *, cors=None, default_service_version: str=None, delete_retention_policy=None, automatic_snapshot_policy_enabled: bool=None, change_feed=None, restore_policy=None, **kwargs) -> None: super(BlobServiceProperties, self).__init__(**kwargs) self.cors = cors self.default_service_version = default_service_version self.delete_retention_policy = delete_retention_policy self.automatic_snapshot_policy_enabled = automatic_snapshot_policy_enabled self.change_feed = change_feed + self.restore_policy = restore_policy self.sku = None @@ -662,6 +767,28 @@ 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. + + :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 + """ + + _attribute_map = { + 'deleted_share_name': {'key': 'deletedShareName', 'type': 'str'}, + 'deleted_share_version': {'key': 'deletedShareVersion', 'type': 'str'}, + } + + def __init__(self, *, deleted_share_name: str=None, deleted_share_version: str=None, **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. @@ -1002,6 +1129,15 @@ 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 version: The version of the share. + :type 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 """ _validation = { @@ -1011,6 +1147,9 @@ class FileShare(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, } _attribute_map = { @@ -1021,13 +1160,21 @@ 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'}, + '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'}, } - def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + def __init__(self, *, metadata=None, share_quota: int=None, version: str=None, **kwargs) -> None: super(FileShare, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata self.share_quota = share_quota + self.version = version + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None class FileShareItem(AzureEntityResource): @@ -1056,6 +1203,15 @@ 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 version: The version of the share. + :type 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 """ _validation = { @@ -1065,6 +1221,9 @@ class FileShareItem(AzureEntityResource): 'etag': {'readonly': True}, 'last_modified_time': {'readonly': True}, 'share_quota': {'maximum': 102400, 'minimum': 1}, + 'deleted': {'readonly': True}, + 'deleted_time': {'readonly': True}, + 'remaining_retention_days': {'readonly': True}, } _attribute_map = { @@ -1075,13 +1234,21 @@ 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'}, + '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'}, } - def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: + def __init__(self, *, metadata=None, share_quota: int=None, version: str=None, **kwargs) -> None: super(FileShareItem, self).__init__(**kwargs) self.last_modified_time = None self.metadata = metadata self.share_quota = share_quota + self.version = version + self.deleted = None + self.deleted_time = None + self.remaining_retention_days = None class GeoReplicationStats(Model): @@ -2204,6 +2371,34 @@ def __init__(self, **kwargs) -> None: super(ProxyResource, self).__init__(**kwargs) +class RestorePolicyProperties(Model): + """The blob service properties for blob restore policy. + + All required parameters must be populated in order to send to Azure. + + :param enabled: Required. Blob restore is enabled if set to true. + :type enabled: bool + :param days: how long this blob can be restored. It should be great than + zero and less than DeleteRetentionPolicy.days. + :type days: int + """ + + _validation = { + 'enabled': {'required': True}, + 'days': {'maximum': 365, 'minimum': 1}, + } + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'days': {'key': 'days', 'type': 'int'}, + } + + def __init__(self, *, enabled: bool, days: int=None, **kwargs) -> None: + super(RestorePolicyProperties, self).__init__(**kwargs) + self.enabled = enabled + self.days = days + + class Restriction(Model): """The restriction because of which SKU cannot be used. @@ -2679,6 +2874,9 @@ class StorageAccount(TrackedResource): choice opted by the user for data transfer :type routing_preference: ~azure.mgmt.storage.v2019_06_01.models.RoutingPreference + :ivar blob_restore_status: Blob restore status + :vartype blob_restore_status: + ~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus """ _validation = { @@ -2704,6 +2902,7 @@ class StorageAccount(TrackedResource): 'geo_replication_stats': {'readonly': True}, 'failover_in_progress': {'readonly': True}, 'private_endpoint_connections': {'readonly': True}, + 'blob_restore_status': {'readonly': True}, } _attribute_map = { @@ -2736,6 +2935,7 @@ class StorageAccount(TrackedResource): 'large_file_shares_state': {'key': 'properties.largeFileSharesState', 'type': 'str'}, 'private_endpoint_connections': {'key': 'properties.privateEndpointConnections', 'type': '[PrivateEndpointConnection]'}, 'routing_preference': {'key': 'properties.routingPreference', 'type': 'RoutingPreference'}, + 'blob_restore_status': {'key': 'properties.blobRestoreStatus', 'type': 'BlobRestoreStatus'}, } def __init__(self, *, location: str, tags=None, identity=None, azure_files_identity_based_authentication=None, enable_https_traffic_only: bool=None, is_hns_enabled: bool=None, large_file_shares_state=None, routing_preference=None, **kwargs) -> None: @@ -2764,6 +2964,7 @@ def __init__(self, *, location: str, tags=None, identity=None, azure_files_ident self.large_file_shares_state = large_file_shares_state self.private_endpoint_connections = None self.routing_preference = routing_preference + self.blob_restore_status = None class StorageAccountCheckNameAvailabilityParameters(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 ac1809559f89..39b9012ef9f9 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 @@ -123,6 +123,13 @@ class GeoReplicationStatus(str, Enum): unavailable = "Unavailable" +class BlobRestoreProgressStatus(str, Enum): + + in_progress = "InProgress" + complete = "Complete" + failed = "Failed" + + class ProvisioningState(str, Enum): creating = "Creating" @@ -252,8 +259,14 @@ class ImmutabilityPolicyUpdateType(str, Enum): class StorageAccountExpand(str, Enum): geo_replication_stats = "geoReplicationStats" + blob_restore_status = "blobRestoreStatus" class ListKeyExpand(str, Enum): kerb = "kerb" + + +class ListSharesExpand(str, Enum): + + deleted = "deleted" 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..f5f1bd3f1ef1 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 = { @@ -432,3 +424,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=None, deleted_share_version=None, 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'} diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py index 528a9d2c90e5..ce9f19d296d2 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_storage_accounts_operations.py @@ -286,8 +286,8 @@ def get_properties( :type account_name: str :param expand: May be used to expand the properties within account's properties. By default, data is not included when fetching properties. - Currently we only support geoReplicationStats. Possible values - include: 'geoReplicationStats' + Currently we only support geoReplicationStats and blobRestoreStatus. + Possible values include: 'geoReplicationStats', 'blobRestoreStatus' :type expand: str or ~azure.mgmt.storage.v2019_06_01.models.StorageAccountExpand :param dict custom_headers: headers that will be added to the request @@ -941,6 +941,117 @@ def get_long_running_output(response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) failover.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/failover'} + + def _restore_blob_ranges_initial( + self, resource_group_name, account_name, time_to_restore, blob_ranges, custom_headers=None, raw=False, **operation_config): + parameters = models.BlobRestoreParameters(time_to_restore=time_to_restore, blob_ranges=blob_ranges) + + # Construct URL + url = self.restore_blob_ranges.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), + '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['Accept'] = 'application/json' + 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(parameters, 'BlobRestoreParameters') + + # 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, 202]: + exp = CloudError(response) + exp.request_id = response.headers.get('x-ms-request-id') + raise exp + + deserialized = None + + if response.status_code == 200: + deserialized = self._deserialize('BlobRestoreStatus', response) + if response.status_code == 202: + deserialized = self._deserialize('BlobRestoreStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + def restore_blob_ranges( + self, resource_group_name, account_name, time_to_restore, blob_ranges, custom_headers=None, raw=False, polling=True, **operation_config): + """Restore blobs in the specified blob ranges. + + :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 time_to_restore: Restore blob to the specified time. + :type time_to_restore: datetime + :param blob_ranges: Blob ranges to restore. + :type blob_ranges: + list[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreRange] + :param dict custom_headers: headers that will be added to the request + :param bool raw: The poller return type is ClientRawResponse, the + direct response alongside the deserialized response + :param polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :return: An instance of LROPoller that returns BlobRestoreStatus or + ClientRawResponse if raw==True + :rtype: + ~msrestazure.azure_operation.AzureOperationPoller[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus] + or + ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[~azure.mgmt.storage.v2019_06_01.models.BlobRestoreStatus]] + :raises: :class:`CloudError` + """ + raw_result = self._restore_blob_ranges_initial( + resource_group_name=resource_group_name, + account_name=account_name, + time_to_restore=time_to_restore, + blob_ranges=blob_ranges, + custom_headers=custom_headers, + raw=True, + **operation_config + ) + + def get_long_running_output(response): + deserialized = self._deserialize('BlobRestoreStatus', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + + lro_delay = operation_config.get( + 'long_running_operation_timeout', + self.config.long_running_operation_timeout) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **operation_config) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + restore_blob_ranges.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/restoreBlobRanges'} + def revoke_user_delegation_keys( self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): """Revoke user delegation keys.