From 8ac4bc090c24fdfe9aeb3cd8b4c73b9ad7d89b5a Mon Sep 17 00:00:00 2001 From: SDK Automation Date: Mon, 27 Apr 2020 09:05:00 +0000 Subject: [PATCH] Update from master --- .../storage/_storage_management_client.py | 13 + .../v2019_06_01/_storage_management_client.py | 5 + .../storage/v2019_06_01/models/__init__.py | 27 ++ .../storage/v2019_06_01/models/_models.py | 334 ++++++++++++++++- .../storage/v2019_06_01/models/_models_py3.py | 348 +++++++++++++++++- .../v2019_06_01/models/_paged_models.py | 13 + .../_storage_management_client_enums.py | 31 ++ .../v2019_06_01/operations/__init__.py | 2 + .../operations/_file_shares_operations.py | 118 ++++-- ..._object_replication_policies_operations.py | 316 ++++++++++++++++ 10 files changed, 1174 insertions(+), 33 deletions(-) create mode 100644 sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py index 8dc5a6fb6dee..c0f6cd03ebe9 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/_storage_management_client.py @@ -237,6 +237,19 @@ def management_policies(self): raise NotImplementedError("APIVersion {} is not available".format(api_version)) return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property + def object_replication_policies(self): + """Instance depends on the API version: + + * 2019-06-01: :class:`ObjectReplicationPoliciesOperations` + """ + api_version = self._get_api_version('object_replication_policies') + if api_version == '2019-06-01': + from .v2019_06_01.operations import ObjectReplicationPoliciesOperations as OperationClass + else: + raise NotImplementedError("APIVersion {} is not available".format(api_version)) + return OperationClass(self._client, self.config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version))) + @property def operations(self): """Instance depends on the API version: diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py index 215670463ba7..955359f0b0e4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/_storage_management_client.py @@ -20,6 +20,7 @@ from .operations import ManagementPoliciesOperations from .operations import PrivateEndpointConnectionsOperations from .operations import PrivateLinkResourcesOperations +from .operations import ObjectReplicationPoliciesOperations from .operations import EncryptionScopesOperations from .operations import BlobServicesOperations from .operations import BlobContainersOperations @@ -48,6 +49,8 @@ class StorageManagementClient(SDKClient): :vartype private_endpoint_connections: azure.mgmt.storage.v2019_06_01.operations.PrivateEndpointConnectionsOperations :ivar private_link_resources: PrivateLinkResources operations :vartype private_link_resources: azure.mgmt.storage.v2019_06_01.operations.PrivateLinkResourcesOperations + :ivar object_replication_policies: ObjectReplicationPolicies operations + :vartype object_replication_policies: azure.mgmt.storage.v2019_06_01.operations.ObjectReplicationPoliciesOperations :ivar encryption_scopes: EncryptionScopes operations :vartype encryption_scopes: azure.mgmt.storage.v2019_06_01.operations.EncryptionScopesOperations :ivar blob_services: BlobServices operations @@ -92,6 +95,8 @@ def __init__( self._client, self.config, self._serialize, self._deserialize) self.private_link_resources = PrivateLinkResourcesOperations( self._client, self.config, self._serialize, self._deserialize) + self.object_replication_policies = ObjectReplicationPoliciesOperations( + self._client, self.config, self._serialize, self._deserialize) self.encryption_scopes = EncryptionScopesOperations( self._client, self.config, self._serialize, self._deserialize) self.blob_services = BlobServicesOperations( 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 dca930d902ba..fa8a2b91ac24 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 @@ -62,6 +63,9 @@ from ._models_py3 import ManagementPolicySnapShot from ._models_py3 import MetricSpecification from ._models_py3 import NetworkRuleSet + from ._models_py3 import ObjectReplicationPolicy + from ._models_py3 import ObjectReplicationPolicyFilter + from ._models_py3 import ObjectReplicationPolicyRule from ._models_py3 import Operation from ._models_py3 import OperationDisplay from ._models_py3 import PrivateEndpoint @@ -88,6 +92,7 @@ from ._models_py3 import StorageAccountMicrosoftEndpoints from ._models_py3 import StorageAccountRegenerateKeyParameters from ._models_py3 import StorageAccountUpdateParameters + from ._models_py3 import TagFilter from ._models_py3 import TagProperty from ._models_py3 import TrackedResource from ._models_py3 import UpdateHistoryProperty @@ -111,6 +116,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 @@ -147,6 +153,9 @@ from ._models import ManagementPolicySnapShot from ._models import MetricSpecification from ._models import NetworkRuleSet + from ._models import ObjectReplicationPolicy + from ._models import ObjectReplicationPolicyFilter + from ._models import ObjectReplicationPolicyRule from ._models import Operation from ._models import OperationDisplay from ._models import PrivateEndpoint @@ -173,6 +182,7 @@ from ._models import StorageAccountMicrosoftEndpoints from ._models import StorageAccountRegenerateKeyParameters from ._models import StorageAccountUpdateParameters + from ._models import TagFilter from ._models import TagProperty from ._models import TrackedResource from ._models import UpdateHistoryProperty @@ -183,6 +193,7 @@ from ._paged_models import EncryptionScopePaged from ._paged_models import FileShareItemPaged from ._paged_models import ListContainerItemPaged +from ._paged_models import ObjectReplicationPolicyPaged from ._paged_models import OperationPaged from ._paged_models import SkuInformationPaged from ._paged_models import StorageAccountPaged @@ -224,8 +235,13 @@ LeaseDuration, ImmutabilityPolicyState, ImmutabilityPolicyUpdateType, + EnabledProtocols, + RootSquashType, + ShareAccessTier, StorageAccountExpand, ListKeyExpand, + ListSharesExpand, + GetShareExpand, ) __all__ = [ @@ -245,6 +261,7 @@ 'CustomDomain', 'DateAfterCreation', 'DateAfterModification', + 'DeletedShare', 'DeleteRetentionPolicy', 'Dimension', 'Encryption', @@ -281,6 +298,9 @@ 'ManagementPolicySnapShot', 'MetricSpecification', 'NetworkRuleSet', + 'ObjectReplicationPolicy', + 'ObjectReplicationPolicyFilter', + 'ObjectReplicationPolicyRule', 'Operation', 'OperationDisplay', 'PrivateEndpoint', @@ -307,6 +327,7 @@ 'StorageAccountMicrosoftEndpoints', 'StorageAccountRegenerateKeyParameters', 'StorageAccountUpdateParameters', + 'TagFilter', 'TagProperty', 'TrackedResource', 'UpdateHistoryProperty', @@ -317,6 +338,7 @@ 'SkuInformationPaged', 'StorageAccountPaged', 'UsagePaged', + 'ObjectReplicationPolicyPaged', 'EncryptionScopePaged', 'BlobServicePropertiesPaged', 'ListContainerItemPaged', @@ -357,6 +379,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 f468bcf7ac20..0b2834a8b5d9 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 @@ -383,9 +383,11 @@ class BlobRestoreRange(Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. Empty means account start. + :param start_range: Required. Blob start range. This is inclusive. Empty + means account start. :type start_range: str - :param end_range: Required. Blob end range. Empty means account end. + :param end_range: Required. Blob end range. This is exclusive. Empty means + account end. :type end_range: str """ @@ -787,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. @@ -1212,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 = { @@ -1221,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 = { @@ -1231,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): @@ -1238,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): @@ -1266,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 = { @@ -1275,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 = { @@ -1285,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): @@ -1292,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): @@ -1994,6 +2149,10 @@ class ManagementPolicyFilter(Model): :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. :type blob_types: list[str] + :param blob_index_match: An array of blob index tag based filters, there + can be at most 10 tag filters + :type blob_index_match: + list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] """ _validation = { @@ -2003,12 +2162,14 @@ class ManagementPolicyFilter(Model): _attribute_map = { 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, + 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, } def __init__(self, **kwargs): super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = kwargs.get('prefix_match', None) self.blob_types = kwargs.get('blob_types', None) + self.blob_index_match = kwargs.get('blob_index_match', None) class ManagementPolicyRule(Model): @@ -2191,6 +2352,130 @@ def __init__(self, **kwargs): self.default_action = kwargs.get('default_action', "Allow") +class ObjectReplicationPolicy(Resource): + """The replication policy between two storage accounts. Multiple rules can be + defined in one policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar policy_id: A unique id for object replication policy. + :vartype policy_id: str + :ivar enabled_time: Indicates when the policy is enabled on the source + account. + :vartype enabled_time: datetime + :param source_account: Required. Required. Source account name. + :type source_account: str + :param destination_account: Required. Required. Destination account name. + :type destination_account: str + :param rules: The storage account object replication rules. + :type rules: + list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_id': {'readonly': True}, + 'enabled_time': {'readonly': True}, + 'source_account': {'required': True}, + 'destination_account': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, + 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, + 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, + 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicy, self).__init__(**kwargs) + self.policy_id = None + self.enabled_time = None + self.source_account = kwargs.get('source_account', None) + self.destination_account = kwargs.get('destination_account', None) + self.rules = kwargs.get('rules', None) + + +class ObjectReplicationPolicyFilter(Model): + """Filters limit replication to a subset of blobs within the storage account. + A logical OR is performed on values in the filter. If multiple filters are + defined, a logical AND is performed on all filters. + + :param prefix_match: Optional. Filters the results to replicate only blobs + whose names begin with the specified prefix. + :type prefix_match: list[str] + :param min_creation_time: Blobs created after the time will be replicated + to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. + Example: 2020-02-19T16:05:00Z + :type min_creation_time: str + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) + self.prefix_match = kwargs.get('prefix_match', None) + self.min_creation_time = kwargs.get('min_creation_time', None) + + +class ObjectReplicationPolicyRule(Model): + """The replication policy rule between two containers. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Rule Id is auto-generated for each new rule on destination + account. It is required for put policy on source account. + :type rule_id: str + :param source_container: Required. Required. Source container name. + :type source_container: str + :param destination_container: Required. Required. Destination container + name. + :type destination_container: str + :param filters: Optional. An object that defines the filter set. + :type filters: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + """ + + _validation = { + 'source_container': {'required': True}, + 'destination_container': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'source_container': {'key': 'sourceContainer', 'type': 'str'}, + 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, + 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, + } + + def __init__(self, **kwargs): + super(ObjectReplicationPolicyRule, self).__init__(**kwargs) + self.rule_id = kwargs.get('rule_id', None) + self.source_container = kwargs.get('source_container', None) + self.destination_container = kwargs.get('destination_container', None) + self.filters = kwargs.get('filters', None) + + class Operation(Model): """Storage REST API operation definition. @@ -2455,6 +2740,9 @@ def __init__(self, **kwargs): class RestorePolicyProperties(Model): """The blob service properties for blob restore policy. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param enabled: Required. Blob restore is enabled if set to true. @@ -2462,22 +2750,28 @@ class RestorePolicyProperties(Model): :param days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. :type days: int + :ivar last_enabled_time: Returns the date and time the restore policy was + last enabled. + :vartype last_enabled_time: datetime """ _validation = { 'enabled': {'required': True}, 'days': {'maximum': 365, 'minimum': 1}, + 'last_enabled_time': {'readonly': True}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'days': {'key': 'days', 'type': 'int'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, } def __init__(self, **kwargs): super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = kwargs.get('enabled', None) self.days = kwargs.get('days', None) + self.last_enabled_time = None class Restriction(Model): @@ -3441,6 +3735,42 @@ def __init__(self, **kwargs): self.kind = kwargs.get('kind', None) +class TagFilter(Model): + """Blob index tag based filtering for blob objects. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. This is the filter tag name, it can have 1 - 128 + characters + :type name: str + :param op: Required. This is the comparison operator which is used for + object comparison and filtering. Only == (equality operator) is currently + supported + :type op: str + :param value: Required. This is the filter tag value field used for tag + based filtering, it can have 0 - 256 characters + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'op': {'required': True}, + 'value': {'required': True, 'max_length': 256, 'min_length': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'op': {'key': 'op', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(TagFilter, self).__init__(**kwargs) + self.name = kwargs.get('name', None) + self.op = kwargs.get('op', None) + self.value = kwargs.get('value', None) + + class TagProperty(Model): """A tag of the LegalHold of a blob container. 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 05e6f0c193d7..a1fafeef2e6e 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 @@ -383,9 +383,11 @@ class BlobRestoreRange(Model): All required parameters must be populated in order to send to Azure. - :param start_range: Required. Blob start range. Empty means account start. + :param start_range: Required. Blob start range. This is inclusive. Empty + means account start. :type start_range: str - :param end_range: Required. Blob end range. Empty means account end. + :param end_range: Required. Blob end range. This is exclusive. Empty means + account end. :type end_range: str """ @@ -787,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. @@ -1212,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 = { @@ -1221,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 = { @@ -1231,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): @@ -1266,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 = { @@ -1275,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 = { @@ -1285,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): @@ -1994,6 +2149,10 @@ class ManagementPolicyFilter(Model): :param blob_types: Required. An array of predefined enum values. Only blockBlob is supported. :type blob_types: list[str] + :param blob_index_match: An array of blob index tag based filters, there + can be at most 10 tag filters + :type blob_index_match: + list[~azure.mgmt.storage.v2019_06_01.models.TagFilter] """ _validation = { @@ -2003,12 +2162,14 @@ class ManagementPolicyFilter(Model): _attribute_map = { 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, 'blob_types': {'key': 'blobTypes', 'type': '[str]'}, + 'blob_index_match': {'key': 'blobIndexMatch', 'type': '[TagFilter]'}, } - def __init__(self, *, blob_types, prefix_match=None, **kwargs) -> None: + def __init__(self, *, blob_types, prefix_match=None, blob_index_match=None, **kwargs) -> None: super(ManagementPolicyFilter, self).__init__(**kwargs) self.prefix_match = prefix_match self.blob_types = blob_types + self.blob_index_match = blob_index_match class ManagementPolicyRule(Model): @@ -2191,6 +2352,130 @@ def __init__(self, *, bypass="AzureServices", virtual_network_rules=None, ip_rul self.default_action = default_action +class ObjectReplicationPolicy(Resource): + """The replication policy between two storage accounts. Multiple rules can be + defined in one policy. + + Variables are only populated by the server, and will be ignored when + sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource Id for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + :vartype id: str + :ivar name: The name of the resource + :vartype name: str + :ivar type: The type of the resource. Ex- + Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + :vartype type: str + :ivar policy_id: A unique id for object replication policy. + :vartype policy_id: str + :ivar enabled_time: Indicates when the policy is enabled on the source + account. + :vartype enabled_time: datetime + :param source_account: Required. Required. Source account name. + :type source_account: str + :param destination_account: Required. Required. Destination account name. + :type destination_account: str + :param rules: The storage account object replication rules. + :type rules: + list[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyRule] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'policy_id': {'readonly': True}, + 'enabled_time': {'readonly': True}, + 'source_account': {'required': True}, + 'destination_account': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'policy_id': {'key': 'properties.policyId', 'type': 'str'}, + 'enabled_time': {'key': 'properties.enabledTime', 'type': 'iso-8601'}, + 'source_account': {'key': 'properties.sourceAccount', 'type': 'str'}, + 'destination_account': {'key': 'properties.destinationAccount', 'type': 'str'}, + 'rules': {'key': 'properties.rules', 'type': '[ObjectReplicationPolicyRule]'}, + } + + def __init__(self, *, source_account: str, destination_account: str, rules=None, **kwargs) -> None: + super(ObjectReplicationPolicy, self).__init__(**kwargs) + self.policy_id = None + self.enabled_time = None + self.source_account = source_account + self.destination_account = destination_account + self.rules = rules + + +class ObjectReplicationPolicyFilter(Model): + """Filters limit replication to a subset of blobs within the storage account. + A logical OR is performed on values in the filter. If multiple filters are + defined, a logical AND is performed on all filters. + + :param prefix_match: Optional. Filters the results to replicate only blobs + whose names begin with the specified prefix. + :type prefix_match: list[str] + :param min_creation_time: Blobs created after the time will be replicated + to the destination. It must be in datetime format 'yyyy-MM-ddTHH:mm:ssZ'. + Example: 2020-02-19T16:05:00Z + :type min_creation_time: str + """ + + _attribute_map = { + 'prefix_match': {'key': 'prefixMatch', 'type': '[str]'}, + 'min_creation_time': {'key': 'minCreationTime', 'type': 'str'}, + } + + def __init__(self, *, prefix_match=None, min_creation_time: str=None, **kwargs) -> None: + super(ObjectReplicationPolicyFilter, self).__init__(**kwargs) + self.prefix_match = prefix_match + self.min_creation_time = min_creation_time + + +class ObjectReplicationPolicyRule(Model): + """The replication policy rule between two containers. + + All required parameters must be populated in order to send to Azure. + + :param rule_id: Rule Id is auto-generated for each new rule on destination + account. It is required for put policy on source account. + :type rule_id: str + :param source_container: Required. Required. Source container name. + :type source_container: str + :param destination_container: Required. Required. Destination container + name. + :type destination_container: str + :param filters: Optional. An object that defines the filter set. + :type filters: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyFilter + """ + + _validation = { + 'source_container': {'required': True}, + 'destination_container': {'required': True}, + } + + _attribute_map = { + 'rule_id': {'key': 'ruleId', 'type': 'str'}, + 'source_container': {'key': 'sourceContainer', 'type': 'str'}, + 'destination_container': {'key': 'destinationContainer', 'type': 'str'}, + 'filters': {'key': 'filters', 'type': 'ObjectReplicationPolicyFilter'}, + } + + def __init__(self, *, source_container: str, destination_container: str, rule_id: str=None, filters=None, **kwargs) -> None: + super(ObjectReplicationPolicyRule, self).__init__(**kwargs) + self.rule_id = rule_id + self.source_container = source_container + self.destination_container = destination_container + self.filters = filters + + class Operation(Model): """Storage REST API operation definition. @@ -2455,6 +2740,9 @@ def __init__(self, **kwargs) -> None: class RestorePolicyProperties(Model): """The blob service properties for blob restore policy. + Variables are only populated by the server, and will be ignored when + sending a request. + All required parameters must be populated in order to send to Azure. :param enabled: Required. Blob restore is enabled if set to true. @@ -2462,22 +2750,28 @@ class RestorePolicyProperties(Model): :param days: how long this blob can be restored. It should be great than zero and less than DeleteRetentionPolicy.days. :type days: int + :ivar last_enabled_time: Returns the date and time the restore policy was + last enabled. + :vartype last_enabled_time: datetime """ _validation = { 'enabled': {'required': True}, 'days': {'maximum': 365, 'minimum': 1}, + 'last_enabled_time': {'readonly': True}, } _attribute_map = { 'enabled': {'key': 'enabled', 'type': 'bool'}, 'days': {'key': 'days', 'type': 'int'}, + 'last_enabled_time': {'key': 'lastEnabledTime', 'type': 'iso-8601'}, } def __init__(self, *, enabled: bool, days: int=None, **kwargs) -> None: super(RestorePolicyProperties, self).__init__(**kwargs) self.enabled = enabled self.days = days + self.last_enabled_time = None class Restriction(Model): @@ -3441,6 +3735,42 @@ def __init__(self, *, sku=None, tags=None, identity=None, custom_domain=None, en self.kind = kind +class TagFilter(Model): + """Blob index tag based filtering for blob objects. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. This is the filter tag name, it can have 1 - 128 + characters + :type name: str + :param op: Required. This is the comparison operator which is used for + object comparison and filtering. Only == (equality operator) is currently + supported + :type op: str + :param value: Required. This is the filter tag value field used for tag + based filtering, it can have 0 - 256 characters + :type value: str + """ + + _validation = { + 'name': {'required': True, 'max_length': 128, 'min_length': 1}, + 'op': {'required': True}, + 'value': {'required': True, 'max_length': 256, 'min_length': 0}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'op': {'key': 'op', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__(self, *, name: str, op: str, value: str, **kwargs) -> None: + super(TagFilter, self).__init__(**kwargs) + self.name = name + self.op = op + self.value = value + + class TagProperty(Model): """A tag of the LegalHold of a blob container. diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py index 2d27addefa8b..d82ca88ae5a5 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/models/_paged_models.py @@ -64,6 +64,19 @@ class UsagePaged(Paged): def __init__(self, *args, **kwargs): super(UsagePaged, self).__init__(*args, **kwargs) +class ObjectReplicationPolicyPaged(Paged): + """ + A paging container for iterating over a list of :class:`ObjectReplicationPolicy ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[ObjectReplicationPolicy]'} + } + + def __init__(self, *args, **kwargs): + + super(ObjectReplicationPolicyPaged, self).__init__(*args, **kwargs) class EncryptionScopePaged(Paged): """ A paging container for iterating over a list of :class:`EncryptionScope ` object 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/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py index b7aa936eb73a..e0f831848449 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/__init__.py @@ -16,6 +16,7 @@ from ._management_policies_operations import ManagementPoliciesOperations from ._private_endpoint_connections_operations import PrivateEndpointConnectionsOperations from ._private_link_resources_operations import PrivateLinkResourcesOperations +from ._object_replication_policies_operations import ObjectReplicationPoliciesOperations from ._encryption_scopes_operations import EncryptionScopesOperations from ._blob_services_operations import BlobServicesOperations from ._blob_containers_operations import BlobContainersOperations @@ -30,6 +31,7 @@ 'ManagementPoliciesOperations', 'PrivateEndpointConnectionsOperations', 'PrivateLinkResourcesOperations', + 'ObjectReplicationPoliciesOperations', 'EncryptionScopesOperations', 'BlobServicesOperations', 'BlobContainersOperations', 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'} diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py new file mode 100644 index 000000000000..84cff954bc16 --- /dev/null +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_06_01/operations/_object_replication_policies_operations.py @@ -0,0 +1,316 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +# +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is +# regenerated. +# -------------------------------------------------------------------------- + +import uuid +from msrest.pipeline import ClientRawResponse + +from .. import models + + +class ObjectReplicationPoliciesOperations(object): + """ObjectReplicationPoliciesOperations operations. + + You should not instantiate directly this class, but create a Client instance that will create it for you and attach it as attribute. + + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + :ivar api_version: The API version to use for this operation. Constant value: "2019-06-01". + """ + + models = models + + def __init__(self, client, config, serializer, deserializer): + + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self.api_version = "2019-06-01" + + self.config = config + + def list( + self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): + """List the object replication policies associated with the storage + account. + + :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 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: An iterator like instance of ObjectReplicationPolicy + :rtype: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicyPaged[~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy] + :raises: + :class:`ErrorResponseException` + """ + def prepare_request(next_link=None): + if not next_link: + # Construct URL + url = self.list.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) + + else: + url = next_link + query_parameters = {} + + # Construct headers + header_parameters = {} + header_parameters['Accept'] = 'application/json' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + return request + + def internal_paging(next_link=None): + request = prepare_request(next_link) + + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + return response + + # Deserialize response + header_dict = None + if raw: + header_dict = {} + deserialized = models.ObjectReplicationPolicyPaged(internal_paging, self._deserialize.dependencies, header_dict) + + return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies'} + + def get( + self, resource_group_name, account_name, object_replication_policy_id, custom_headers=None, raw=False, **operation_config): + """Get the object replication policy of the storage account by policy ID. + + :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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: 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: ObjectReplicationPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.get.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), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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' + 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 and send request + request = self._client.get(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ObjectReplicationPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} + + def create_or_update( + self, resource_group_name, account_name, object_replication_policy_id, properties, custom_headers=None, raw=False, **operation_config): + """Create or update the object replication policy of the storage account. + + :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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: str + :param properties: The object replication policy set to a storage + account. A unique policy ID will be created if absent. + :type properties: + ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + :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: ObjectReplicationPolicy or ClientRawResponse if raw=true + :rtype: ~azure.mgmt.storage.v2019_06_01.models.ObjectReplicationPolicy + or ~msrest.pipeline.ClientRawResponse + :raises: + :class:`ErrorResponseException` + """ + # Construct URL + url = self.create_or_update.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), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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(properties, 'ObjectReplicationPolicy') + + # Construct and send request + request = self._client.put(url, query_parameters, header_parameters, body_content) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorResponseException(self._deserialize, response) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('ObjectReplicationPolicy', response) + + if raw: + client_raw_response = ClientRawResponse(deserialized, response) + return client_raw_response + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'} + + def delete( + self, resource_group_name, account_name, object_replication_policy_id, custom_headers=None, raw=False, **operation_config): + """Deletes the object replication policy associated with the specified + storage account. + + :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 object_replication_policy_id: The ID of object replication + policy or 'default' if the policy ID is unknown. + :type object_replication_policy_id: 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:`ErrorResponseException` + """ + # Construct URL + url = self.delete.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), + 'objectReplicationPolicyId': self._serialize.url("object_replication_policy_id", object_replication_policy_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 = {} + 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 and send request + request = self._client.delete(url, query_parameters, header_parameters) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200, 204]: + raise models.ErrorResponseException(self._deserialize, response) + + if raw: + client_raw_response = ClientRawResponse(None, response) + return client_raw_response + delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/objectReplicationPolicies/{objectReplicationPolicyId}'}