diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py index 052bbf8d5160..be2af98b41a5 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py @@ -15,20 +15,14 @@ from .metric_specification_py3 import MetricSpecification from .service_specification_py3 import ServiceSpecification from .operation_py3 import Operation - from .operation_list_result_py3 import OperationListResult from .net_app_account_py3 import NetAppAccount - from .net_app_account_list_py3 import NetAppAccountList from .net_app_account_patch_py3 import NetAppAccountPatch from .capacity_pool_py3 import CapacityPool - from .capacity_pool_list_py3 import CapacityPoolList from .capacity_pool_patch_py3 import CapacityPoolPatch from .volume_py3 import Volume - from .volume_list_py3 import VolumeList from .volume_patch_py3 import VolumePatch from .mount_target_py3 import MountTarget - from .mount_target_list_py3 import MountTargetList from .snapshot_py3 import Snapshot - from .snapshots_list_py3 import SnapshotsList from .error_py3 import Error, ErrorException except (SyntaxError, ImportError): from .operation_display import OperationDisplay @@ -36,21 +30,21 @@ from .metric_specification import MetricSpecification from .service_specification import ServiceSpecification from .operation import Operation - from .operation_list_result import OperationListResult from .net_app_account import NetAppAccount - from .net_app_account_list import NetAppAccountList from .net_app_account_patch import NetAppAccountPatch from .capacity_pool import CapacityPool - from .capacity_pool_list import CapacityPoolList from .capacity_pool_patch import CapacityPoolPatch from .volume import Volume - from .volume_list import VolumeList from .volume_patch import VolumePatch from .mount_target import MountTarget - from .mount_target_list import MountTargetList from .snapshot import Snapshot - from .snapshots_list import SnapshotsList from .error import Error, ErrorException +from .operation_paged import OperationPaged +from .net_app_account_paged import NetAppAccountPaged +from .capacity_pool_paged import CapacityPoolPaged +from .volume_paged import VolumePaged +from .mount_target_paged import MountTargetPaged +from .snapshot_paged import SnapshotPaged from .azure_net_app_files_management_client_enums import ( ServiceLevel, ) @@ -61,20 +55,20 @@ 'MetricSpecification', 'ServiceSpecification', 'Operation', - 'OperationListResult', 'NetAppAccount', - 'NetAppAccountList', 'NetAppAccountPatch', 'CapacityPool', - 'CapacityPoolList', 'CapacityPoolPatch', 'Volume', - 'VolumeList', 'VolumePatch', 'MountTarget', - 'MountTargetList', 'Snapshot', - 'SnapshotsList', 'Error', 'ErrorException', + 'OperationPaged', + 'NetAppAccountPaged', + 'CapacityPoolPaged', + 'VolumePaged', + 'MountTargetPaged', + 'SnapshotPaged', 'ServiceLevel', ] diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_paged.py similarity index 54% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list_py3.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_paged.py index ea1580e14806..fa7c435c870d 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list_py3.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class CapacityPoolList(Model): - """List of capacity pool resources. - - :param value: List of Capacity pools - :type value: list[~azure.mgmt.netapp.models.CapacityPool] +class CapacityPoolPaged(Paged): + """ + A paging container for iterating over a list of :class:`CapacityPool ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[CapacityPool]'} } - def __init__(self, *, value=None, **kwargs) -> None: - super(CapacityPoolList, self).__init__(**kwargs) - self.value = value + def __init__(self, *args, **kwargs): + + super(CapacityPoolPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_paged.py similarity index 55% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_paged.py index 14286d1639dd..8d9983678f24 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/capacity_pool_list.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class CapacityPoolList(Model): - """List of capacity pool resources. - - :param value: List of Capacity pools - :type value: list[~azure.mgmt.netapp.models.CapacityPool] +class MountTargetPaged(Paged): + """ + A paging container for iterating over a list of :class:`MountTarget ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityPool]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[MountTarget]'} } - def __init__(self, **kwargs): - super(CapacityPoolList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + def __init__(self, *args, **kwargs): + + super(MountTargetPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list.py deleted file mode 100644 index 1583fcfc9333..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class NetAppAccountList(Model): - """List of NetApp account resources. - - :param value: Multiple NetApp accounts - :type value: list[~azure.mgmt.netapp.models.NetAppAccount] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetAppAccount]'}, - } - - def __init__(self, **kwargs): - super(NetAppAccountList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list_py3.py deleted file mode 100644 index db06d6cf4d8e..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_list_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class NetAppAccountList(Model): - """List of NetApp account resources. - - :param value: Multiple NetApp accounts - :type value: list[~azure.mgmt.netapp.models.NetAppAccount] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetAppAccount]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(NetAppAccountList, self).__init__(**kwargs) - self.value = value diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_paged.py similarity index 54% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list_py3.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_paged.py index a2cb29128968..fd4a719a0737 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list_py3.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/net_app_account_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class MountTargetList(Model): - """List of Mount Targets. - - :param value: A list of Mount targets - :type value: list[~azure.mgmt.netapp.models.MountTarget] +class NetAppAccountPaged(Paged): + """ + A paging container for iterating over a list of :class:`NetAppAccount ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[MountTarget]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[NetAppAccount]'} } - def __init__(self, *, value=None, **kwargs) -> None: - super(MountTargetList, self).__init__(**kwargs) - self.value = value + def __init__(self, *args, **kwargs): + + super(NetAppAccountPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result.py deleted file mode 100644 index 3d3863e7cf70..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result.py +++ /dev/null @@ -1,30 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationListResult(Model): - """Result of the request to list Cloud Volume operations. It contains a list - of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource - provider. - :type value: list[~azure.mgmt.netapp.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__(self, **kwargs): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result_py3.py deleted file mode 100644 index 0a21dd4cf082..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_list_result_py3.py +++ /dev/null @@ -1,30 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class OperationListResult(Model): - """Result of the request to list Cloud Volume operations. It contains a list - of operations and a URL link to get the next set of results. - - :param value: List of Storage operations supported by the Storage resource - provider. - :type value: list[~azure.mgmt.netapp.models.Operation] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(OperationListResult, self).__init__(**kwargs) - self.value = value diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_paged.py similarity index 55% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/operation_paged.py index 7eb46f9d5c8c..75776552e32c 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/mount_target_list.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/operation_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class MountTargetList(Model): - """List of Mount Targets. - - :param value: A list of Mount targets - :type value: list[~azure.mgmt.netapp.models.MountTarget] +class OperationPaged(Paged): + """ + A paging container for iterating over a list of :class:`Operation ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[MountTarget]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Operation]'} } - def __init__(self, **kwargs): - super(MountTargetList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + def __init__(self, *args, **kwargs): + + super(OperationPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshot_paged.py similarity index 56% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/snapshot_paged.py index 9ec53fa2a6ea..95ab3fde9644 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshot_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class SnapshotsList(Model): - """List of Snapshots. - - :param value: A list of Snapshots - :type value: list[~azure.mgmt.netapp.models.Snapshot] +class SnapshotPaged(Paged): + """ + A paging container for iterating over a list of :class:`Snapshot ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Snapshot]'} } - def __init__(self, **kwargs): - super(SnapshotsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) + def __init__(self, *args, **kwargs): + + super(SnapshotPaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list.py deleted file mode 100644 index c2c603cb9045..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VolumeList(Model): - """List of volume resources. - - :param value: List of volumes - :type value: list[~azure.mgmt.netapp.models.Volume] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Volume]'}, - } - - def __init__(self, **kwargs): - super(VolumeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list_py3.py deleted file mode 100644 index 17cac5dfdde1..000000000000 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_list_py3.py +++ /dev/null @@ -1,28 +0,0 @@ -# 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. -# -------------------------------------------------------------------------- - -from msrest.serialization import Model - - -class VolumeList(Model): - """List of volume resources. - - :param value: List of volumes - :type value: list[~azure.mgmt.netapp.models.Volume] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Volume]'}, - } - - def __init__(self, *, value=None, **kwargs) -> None: - super(VolumeList, self).__init__(**kwargs) - self.value = value diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list_py3.py b/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_paged.py similarity index 56% rename from azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list_py3.py rename to azure-mgmt-netapp/azure/mgmt/netapp/models/volume_paged.py index 7c9e2a4e4917..17d9bd4c9d35 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/models/snapshots_list_py3.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/models/volume_paged.py @@ -9,20 +9,19 @@ # regenerated. # -------------------------------------------------------------------------- -from msrest.serialization import Model +from msrest.paging import Paged -class SnapshotsList(Model): - """List of Snapshots. - - :param value: A list of Snapshots - :type value: list[~azure.mgmt.netapp.models.Snapshot] +class VolumePaged(Paged): + """ + A paging container for iterating over a list of :class:`Volume ` object """ _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + 'current_page': {'key': 'value', 'type': '[Volume]'} } - def __init__(self, *, value=None, **kwargs) -> None: - super(SnapshotsList, self).__init__(**kwargs) - self.value = value + def __init__(self, *args, **kwargs): + + super(VolumePaged, self).__init__(*args, **kwargs) diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/accounts_operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/accounts_operations.py index 4ac6ded547d0..0e1dfd2f3376 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/accounts_operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/accounts_operations.py @@ -49,48 +49,56 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: NetAppAccountList or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.NetAppAccountList or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of NetAppAccount + :rtype: + ~azure.mgmt.netapp.models.NetAppAccountPaged[~azure.mgmt.netapp.models.NetAppAccount] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str') - } - 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') - - # 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.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('NetAppAccountList', response) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str') + } + 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') + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.NetAppAccountPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.NetAppAccountPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/mount_targets_operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/mount_targets_operations.py index 7634d45e4de1..fb1950a35bc2 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/mount_targets_operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/mount_targets_operations.py @@ -11,8 +11,6 @@ import uuid from msrest.pipeline import ClientRawResponse -from msrest.polling import LROPoller, NoPolling -from msrestazure.polling.arm_polling import ARMPolling from .. import models @@ -55,51 +53,59 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: MountTargetList or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.MountTargetList or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of MountTarget + :rtype: + ~azure.mgmt.netapp.models.MountTargetPaged[~azure.mgmt.netapp.models.MountTarget] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str') - } - 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') - - # 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.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('MountTargetList', response) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'poolName': self._serialize.url("pool_name", pool_name, 'str'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str') + } + 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') + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.MountTargetPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.MountTargetPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized @@ -174,93 +180,3 @@ def get( return deserialized get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/pools/{poolName}/volumes/{volumeName}/mountTargets/{mountTargetName}'} - - - def _delete_initial( - self, resource_group, account_name, pool_name, volume_name, mount_target_name, custom_headers=None, raw=False, **operation_config): - # Construct URL - url = self.delete.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str'), - 'mountTargetName': self._serialize.url("mount_target_name", mount_target_name, 'str') - } - 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') - - # 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 [202, 204]: - raise models.ErrorException(self._deserialize, response) - - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - def delete( - self, resource_group, account_name, pool_name, volume_name, mount_target_name, custom_headers=None, raw=False, polling=True, **operation_config): - """Delete mount target. - - :param resource_group: The name of the resource group. - :type resource_group: str - :param account_name: The name of the NetApp account - :type account_name: str - :param pool_name: The name of the capacity pool - :type pool_name: str - :param volume_name: The name of the volume - :type volume_name: str - :param mount_target_name: The name of the mount target - :type mount_target_name: str - :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 None or - ClientRawResponse if raw==True - :rtype: ~msrestazure.azure_operation.AzureOperationPoller[None] or - ~msrestazure.azure_operation.AzureOperationPoller[~msrest.pipeline.ClientRawResponse[None]] - :raises: - :class:`ErrorException` - """ - raw_result = self._delete_initial( - resource_group=resource_group, - account_name=account_name, - pool_name=pool_name, - volume_name=volume_name, - mount_target_name=mount_target_name, - custom_headers=custom_headers, - raw=True, - **operation_config - ) - - def get_long_running_output(response): - if raw: - client_raw_response = ClientRawResponse(None, response) - return client_raw_response - - lro_delay = operation_config.get( - 'long_running_operation_timeout', - self.config.long_running_operation_timeout) - if polling is True: polling_method = ARMPolling(lro_delay, **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) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/pools/{poolName}/volumes/{volumeName}/mountTargets/{mountTargetName}'} diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/operations.py index 033a61b89a6b..45d58bfbb766 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/operations.py @@ -45,43 +45,51 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: OperationListResult or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.OperationListResult or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Operation + :rtype: + ~azure.mgmt.netapp.models.OperationPaged[~azure.mgmt.netapp.models.Operation] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] + def internal_paging(next_link=None, raw=False): - # Construct parameters - query_parameters = {} - query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') + if not next_link: + # Construct URL + url = self.list.metadata['url'] - # 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 parameters + query_parameters = {} + query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') - # Construct and send request - request = self._client.get(url, query_parameters, header_parameters) - response = self._client.send(request, stream=False, **operation_config) + else: + url = next_link + query_parameters = {} - if response.status_code not in [200]: - raise models.ErrorException(self._deserialize, response) + # 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') - deserialized = None + # 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 == 200: - deserialized = self._deserialize('OperationListResult', response) + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.OperationPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.OperationPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/pools_operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/pools_operations.py index 2222fc93a6ca..431be201a4be 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/pools_operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/pools_operations.py @@ -51,49 +51,57 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: CapacityPoolList or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.CapacityPoolList or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of CapacityPool + :rtype: + ~azure.mgmt.netapp.models.CapacityPoolPaged[~azure.mgmt.netapp.models.CapacityPool] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str') - } - 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') - - # 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.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('CapacityPoolList', response) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str') + } + 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') + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.CapacityPoolPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.CapacityPoolPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/snapshots_operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/snapshots_operations.py index 76f13af587d9..41b6dfea9e52 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/snapshots_operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/snapshots_operations.py @@ -55,51 +55,59 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: SnapshotsList or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.SnapshotsList or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Snapshot + :rtype: + ~azure.mgmt.netapp.models.SnapshotPaged[~azure.mgmt.netapp.models.Snapshot] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str') - } - 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') - - # 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.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('SnapshotsList', response) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'poolName': self._serialize.url("pool_name", pool_name, 'str'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str') + } + 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') + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.SnapshotPaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.SnapshotPaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized diff --git a/azure-mgmt-netapp/azure/mgmt/netapp/operations/volumes_operations.py b/azure-mgmt-netapp/azure/mgmt/netapp/operations/volumes_operations.py index 235021e71108..38db59f3cd2b 100644 --- a/azure-mgmt-netapp/azure/mgmt/netapp/operations/volumes_operations.py +++ b/azure-mgmt-netapp/azure/mgmt/netapp/operations/volumes_operations.py @@ -53,50 +53,58 @@ def list( deserialized response :param operation_config: :ref:`Operation configuration overrides`. - :return: VolumeList or ClientRawResponse if raw=true - :rtype: ~azure.mgmt.netapp.models.VolumeList or - ~msrest.pipeline.ClientRawResponse + :return: An iterator like instance of Volume + :rtype: + ~azure.mgmt.netapp.models.VolumePaged[~azure.mgmt.netapp.models.Volume] :raises: :class:`ErrorException` """ - # Construct URL - url = self.list.metadata['url'] - path_format_arguments = { - 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), - 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), - 'accountName': self._serialize.url("account_name", account_name, 'str'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str') - } - 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') - - # 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.ErrorException(self._deserialize, response) - - deserialized = None - - if response.status_code == 200: - deserialized = self._deserialize('VolumeList', response) + def internal_paging(next_link=None, raw=False): + + if not next_link: + # Construct URL + url = self.list.metadata['url'] + path_format_arguments = { + 'subscriptionId': self._serialize.url("self.config.subscription_id", self.config.subscription_id, 'str'), + 'resourceGroup': self._serialize.url("resource_group", resource_group, 'str'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'poolName': self._serialize.url("pool_name", pool_name, 'str') + } + 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') + + 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) + response = self._client.send(request, stream=False, **operation_config) + + if response.status_code not in [200]: + raise models.ErrorException(self._deserialize, response) + + return response + + # Deserialize response + deserialized = models.VolumePaged(internal_paging, self._deserialize.dependencies) if raw: - client_raw_response = ClientRawResponse(deserialized, response) + header_dict = {} + client_raw_response = models.VolumePaged(internal_paging, self._deserialize.dependencies, header_dict) return client_raw_response return deserialized