diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py index b0ac56864838..418bd1796145 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/__init__.py @@ -31,7 +31,6 @@ from ._models_py3 import FileServiceProperties from ._models_py3 import FileShare from ._models_py3 import FileShareItem - from ._models_py3 import FileShareItems from ._models_py3 import GeoReplicationStats from ._models_py3 import Identity from ._models_py3 import ImmutabilityPolicy @@ -99,7 +98,6 @@ from ._models import FileServiceProperties from ._models import FileShare from ._models import FileShareItem - from ._models import FileShareItems from ._models import GeoReplicationStats from ._models import Identity from ._models import ImmutabilityPolicy @@ -146,6 +144,7 @@ from ._models import UsageName from ._models import VirtualNetworkRule from ._paged_models import BlobServicePropertiesPaged +from ._paged_models import FileShareItemPaged from ._paged_models import ListContainerItemPaged from ._paged_models import OperationPaged from ._paged_models import SkuPaged @@ -205,7 +204,6 @@ 'FileServiceProperties', 'FileShare', 'FileShareItem', - 'FileShareItems', 'GeoReplicationStats', 'Identity', 'ImmutabilityPolicy', @@ -257,6 +255,7 @@ 'UsagePaged', 'BlobServicePropertiesPaged', 'ListContainerItemPaged', + 'FileShareItemPaged', 'ReasonCode', 'SkuName', 'SkuTier', diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py index be20426fbaa4..76f675a1d708 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models.py @@ -957,37 +957,6 @@ def __init__(self, **kwargs): self.share_quota = kwargs.get('share_quota', None) -class FileShareItems(Model): - """Response schema. Contains list of shares returned, and if paging is - requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of - shares. Returned when total number of requested shares exceed maximum page - size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs): - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class GeoReplicationStats(Model): """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py index 458b800137f2..6949750c6955 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_models_py3.py @@ -957,37 +957,6 @@ def __init__(self, *, metadata=None, share_quota: int=None, **kwargs) -> None: self.share_quota = share_quota -class FileShareItems(Model): - """Response schema. Contains list of shares returned, and if paging is - requested or required, a URL to next page of shares. - - Variables are only populated by the server, and will be ignored when - sending a request. - - :ivar value: List of file shares returned. - :vartype value: list[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] - :ivar next_link: Request URL that can be used to query next page of - shares. Returned when total number of requested shares exceed maximum page - size. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[FileShareItem]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__(self, **kwargs) -> None: - super(FileShareItems, self).__init__(**kwargs) - self.value = None - self.next_link = None - - class GeoReplicationStats(Model): """Statistics related to replication for storage account's Blob, Table, Queue and File services. It is only available when geo-redundant replication is diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py index 9bdfb7303a88..b1c9ac4fe23c 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/models/_paged_models.py @@ -90,3 +90,16 @@ class ListContainerItemPaged(Paged): def __init__(self, *args, **kwargs): super(ListContainerItemPaged, self).__init__(*args, **kwargs) +class FileShareItemPaged(Paged): + """ + A paging container for iterating over a list of :class:`FileShareItem ` object + """ + + _attribute_map = { + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[FileShareItem]'} + } + + def __init__(self, *args, **kwargs): + + super(FileShareItemPaged, self).__init__(*args, **kwargs) diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py index 346875c3c6e5..2f69fef9ccbf 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_services_operations.py @@ -103,7 +103,7 @@ def list( return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices'} - def put_service_properties( + def set_service_properties( self, resource_group_name, account_name, cors=None, custom_headers=None, raw=False, **operation_config): """Sets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. . @@ -134,7 +134,7 @@ def put_service_properties( parameters = models.FileServiceProperties(cors=cors) # Construct URL - url = self.put_service_properties.metadata['url'] + url = self.set_service_properties.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), @@ -177,7 +177,7 @@ def put_service_properties( return client_raw_response return deserialized - put_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} + set_service_properties.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/{FileServicesName}'} def get_service_properties( self, resource_group_name, account_name, custom_headers=None, raw=False, **operation_config): diff --git a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py index 70035e2f650c..31b970865ea4 100644 --- a/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py +++ b/sdk/storage/azure-mgmt-storage/azure/mgmt/storage/v2019_04_01/operations/_file_shares_operations.py @@ -63,55 +63,66 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: FileShareItems or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.storage.v2019_04_01.models.FileShareItems or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of FileShareItem + :rtype: + ~azure.mgmt.storage.v2019_04_01.models.FileShareItemPaged[~azure.mgmt.storage.v2019_04_01.models.FileShareItem] :raises: :class:`ErrorResponseException` """ - # 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) - if skip_token is not None: - query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') - if maxpagesize is not None: - query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') - if filter is not None: - query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') - - # 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('FileShareItems', response) - + 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) + if skip_token is not None: + query_parameters['$skipToken'] = self._serialize.query("skip_token", skip_token, 'str') + if maxpagesize is not None: + query_parameters['$maxpagesize'] = self._serialize.query("maxpagesize", maxpagesize, 'str') + if filter is not None: + query_parameters['$filter'] = self._serialize.query("filter", filter, 'str') + + 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: - client_raw_response = ClientRawResponse(deserialized, response) - return client_raw_response + header_dict = {} + deserialized = models.FileShareItemPaged(internal_paging, self._deserialize.dependencies, header_dict) return deserialized list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Storage/storageAccounts/{accountName}/fileServices/default/shares'}