diff --git a/sdk/netapp/azure-mgmt-netapp/_meta.json b/sdk/netapp/azure-mgmt-netapp/_meta.json index a0e15e564120..4cee9e31a466 100644 --- a/sdk/netapp/azure-mgmt-netapp/_meta.json +++ b/sdk/netapp/azure-mgmt-netapp/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "6b95b0f0fa71e18a350cf0ba152591a29a94bdc0", + "commit": "178fe404f9cc585b0708f59efb830d5180340a36", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/netapp/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/netapp/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/netapp/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py index d1b2ac094d5f..b9f5b3f19232 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['NetAppManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py index 827f8636220a..7dbd4c884fc6 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py @@ -6,18 +6,16 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential @@ -35,20 +33,19 @@ class NetAppManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(NetAppManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(NetAppManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = "2021-08-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json index 84abb483e858..aaf44ea3ab6f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], + "chosen_version": "2021-08-01", + "total_api_version_list": ["2021-08-01"], "client": { "name": "NetAppManagementClient", "filename": "_net_app_management_client", "description": "Microsoft NetApp Files Azure Resource Provider specification.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetAppManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetAppManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetAppManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"NetAppManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "operations": "Operations", @@ -109,6 +108,7 @@ "backups": "BackupsOperations", "account_backups": "AccountBackupsOperations", "backup_policies": "BackupPoliciesOperations", - "vaults": "VaultsOperations" + "vaults": "VaultsOperations", + "volume_groups": "VolumeGroupsOperations" } } \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py index e1e62edc2125..3173cbab61eb 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_net_app_management_client.py @@ -6,35 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import NetAppManagementClientConfiguration +from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse - -from ._configuration import NetAppManagementClientConfiguration -from .operations import Operations -from .operations import NetAppResourceOperations -from .operations import NetAppResourceQuotaLimitsOperations -from .operations import AccountsOperations -from .operations import PoolsOperations -from .operations import VolumesOperations -from .operations import SnapshotsOperations -from .operations import SnapshotPoliciesOperations -from .operations import BackupsOperations -from .operations import AccountBackupsOperations -from .operations import BackupPoliciesOperations -from .operations import VaultsOperations -from . import models - -class NetAppManagementClient(object): +class NetAppManagementClient: """Microsoft NetApp Files Azure Resource Provider specification. :ivar operations: Operations operations @@ -42,7 +29,8 @@ class NetAppManagementClient(object): :ivar net_app_resource: NetAppResourceOperations operations :vartype net_app_resource: azure.mgmt.netapp.operations.NetAppResourceOperations :ivar net_app_resource_quota_limits: NetAppResourceQuotaLimitsOperations operations - :vartype net_app_resource_quota_limits: azure.mgmt.netapp.operations.NetAppResourceQuotaLimitsOperations + :vartype net_app_resource_quota_limits: + azure.mgmt.netapp.operations.NetAppResourceQuotaLimitsOperations :ivar accounts: AccountsOperations operations :vartype accounts: azure.mgmt.netapp.operations.AccountsOperations :ivar pools: PoolsOperations operations @@ -61,74 +49,73 @@ class NetAppManagementClient(object): :vartype backup_policies: azure.mgmt.netapp.operations.BackupPoliciesOperations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.netapp.operations.VaultsOperations + :ivar volume_groups: VolumeGroupsOperations operations + :vartype volume_groups: azure.mgmt.netapp.operations.VolumeGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = NetAppManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = NetAppManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.net_app_resource = NetAppResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.pools = PoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.volumes = VolumesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshot_policies = SnapshotPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backups = BackupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.account_backups = AccountBackupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_policies = BackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.net_app_resource = NetAppResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volumes = VolumesOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshot_policies = SnapshotPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_backups = AccountBackupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volume_groups = VolumeGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: HttpRequest + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_patch.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# 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 azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py index 8f380e13c4d3..c1ce68ce405c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/__init__.py @@ -8,3 +8,8 @@ from ._net_app_management_client import NetAppManagementClient __all__ = ['NetAppManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py index 18017d867f8d..62d66353af20 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(NetAppManagementClientConfiguration, self).__init__(**kwargs) if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(NetAppManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = "2021-08-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py index 0bf052399fa0..46f034177fad 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_net_app_management_client.py @@ -6,33 +6,22 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import NetAppManagementClientConfiguration +from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import NetAppManagementClientConfiguration -from .operations import Operations -from .operations import NetAppResourceOperations -from .operations import NetAppResourceQuotaLimitsOperations -from .operations import AccountsOperations -from .operations import PoolsOperations -from .operations import VolumesOperations -from .operations import SnapshotsOperations -from .operations import SnapshotPoliciesOperations -from .operations import BackupsOperations -from .operations import AccountBackupsOperations -from .operations import BackupPoliciesOperations -from .operations import VaultsOperations -from .. import models - - -class NetAppManagementClient(object): +class NetAppManagementClient: """Microsoft NetApp Files Azure Resource Provider specification. :ivar operations: Operations operations @@ -40,7 +29,8 @@ class NetAppManagementClient(object): :ivar net_app_resource: NetAppResourceOperations operations :vartype net_app_resource: azure.mgmt.netapp.aio.operations.NetAppResourceOperations :ivar net_app_resource_quota_limits: NetAppResourceQuotaLimitsOperations operations - :vartype net_app_resource_quota_limits: azure.mgmt.netapp.aio.operations.NetAppResourceQuotaLimitsOperations + :vartype net_app_resource_quota_limits: + azure.mgmt.netapp.aio.operations.NetAppResourceQuotaLimitsOperations :ivar accounts: AccountsOperations operations :vartype accounts: azure.mgmt.netapp.aio.operations.AccountsOperations :ivar pools: PoolsOperations operations @@ -59,72 +49,73 @@ class NetAppManagementClient(object): :vartype backup_policies: azure.mgmt.netapp.aio.operations.BackupPoliciesOperations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.netapp.aio.operations.VaultsOperations + :ivar volume_groups: VolumeGroupsOperations operations + :vartype volume_groups: azure.mgmt.netapp.aio.operations.VolumeGroupsOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + :param subscription_id: Subscription credentials which uniquely identify Microsoft Azure + subscription. The subscription ID forms part of the URI for every service call. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is 'https://management.azure.com'. + :type base_url: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = NetAppManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = NetAppManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.net_app_resource = NetAppResourceOperations(self._client, self._config, self._serialize, self._deserialize) + self.net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations(self._client, self._config, self._serialize, self._deserialize) + self.accounts = AccountsOperations(self._client, self._config, self._serialize, self._deserialize) + self.pools = PoolsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volumes = VolumesOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshots = SnapshotsOperations(self._client, self._config, self._serialize, self._deserialize) + self.snapshot_policies = SnapshotPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.backups = BackupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.account_backups = AccountBackupsOperations(self._client, self._config, self._serialize, self._deserialize) + self.backup_policies = BackupPoliciesOperations(self._client, self._config, self._serialize, self._deserialize) + self.vaults = VaultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.volume_groups = VolumeGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.net_app_resource = NetAppResourceOperations( - self._client, self._config, self._serialize, self._deserialize) - self.net_app_resource_quota_limits = NetAppResourceQuotaLimitsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.accounts = AccountsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.pools = PoolsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.volumes = VolumesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshots = SnapshotsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.snapshot_policies = SnapshotPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backups = BackupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.account_backups = AccountBackupsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.backup_policies = BackupPoliciesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.vaults = VaultsOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_patch.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py index 77e29c38a55f..ce5a3a9ff24f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/__init__.py @@ -18,6 +18,7 @@ from ._account_backups_operations import AccountBackupsOperations from ._backup_policies_operations import BackupPoliciesOperations from ._vaults_operations import VaultsOperations +from ._volume_groups_operations import VolumeGroupsOperations __all__ = [ 'Operations', @@ -32,4 +33,5 @@ 'AccountBackupsOperations', 'BackupPoliciesOperations', 'VaultsOperations', + 'VolumeGroupsOperations', ] diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py index a581c209a989..634cd432bdb1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_account_backups_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._account_backups_operations import build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BackupsList', pipeline_response) + deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_name=backup_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, @@ -195,26 +192,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_name=backup_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -227,6 +216,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -246,15 +237,17 @@ async def begin_delete( :type backup_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -269,22 +262,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -296,4 +281,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py index f121a53ccc0e..e03d5d08354a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_accounts_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._accounts_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_subscription_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, **kwargs: Any @@ -61,34 +67,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetAppAccountList', pipeline_response) + deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,11 +107,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -132,35 +135,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('NetAppAccountList', pipeline_response) + deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -178,11 +177,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -207,27 +208,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,8 +232,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -255,32 +248,22 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'NetAppAccount') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'NetAppAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -298,8 +281,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -319,15 +305,19 @@ async def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.NetAppAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NetAppAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetAppAccount or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.NetAppAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -339,27 +329,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('NetAppAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -371,6 +355,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore async def _delete_initial( @@ -384,25 +369,17 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -415,6 +392,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -431,15 +410,17 @@ async def begin_delete( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -453,21 +434,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -479,6 +453,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore async def _update_initial( @@ -493,32 +468,22 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'NetAppAccountPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'NetAppAccountPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -536,8 +501,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -557,15 +525,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.NetAppAccountPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either NetAppAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NetAppAccount or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.NetAppAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -577,27 +549,21 @@ async def begin_update( resource_group_name=resource_group_name, account_name=account_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('NetAppAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -609,4 +575,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py index d0e07c54eef5..f076f3683cdb 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backup_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backup_policies_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BackupPoliciesList', pipeline_response) + deserialized = self._deserialize("BackupPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -196,33 +193,23 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'BackupPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'BackupPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -241,8 +228,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -265,15 +255,19 @@ async def begin_create( :type body: ~azure.mgmt.netapp.models.BackupPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BackupPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackupPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.BackupPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -286,28 +280,21 @@ async def begin_create( account_name=account_name, backup_policy_name=backup_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -319,6 +306,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore async def _update_initial( @@ -334,33 +322,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'BackupPolicyPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'BackupPolicyPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -378,8 +356,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -402,15 +383,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.BackupPolicyPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either BackupPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either BackupPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.BackupPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -423,28 +408,21 @@ async def begin_update( account_name=account_name, backup_policy_name=backup_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -456,6 +434,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore async def _delete_initial( @@ -470,26 +449,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -502,6 +473,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -521,15 +494,17 @@ async def begin_delete( :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -544,22 +519,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -571,4 +538,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py index 22ce3192bc3b..647240531128 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._backups_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_get_status_request, build_get_volume_restore_status_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get_status( self, resource_group_name: str, @@ -73,29 +79,19 @@ async def get_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -109,8 +105,11 @@ async def get_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus'} # type: ignore + + @distributed_trace_async async def get_volume_restore_status( self, resource_group_name: str, @@ -141,29 +140,19 @@ async def get_volume_restore_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_volume_restore_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_volume_restore_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get_volume_restore_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,8 +166,11 @@ async def get_volume_restore_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_volume_restore_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus'} # type: ignore + + @distributed_trace def list( self, resource_group_name: str, @@ -209,38 +201,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('BackupsList', pipeline_response) + deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -258,11 +249,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -296,30 +289,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -333,8 +316,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -350,35 +335,25 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Backup') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Backup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -397,8 +372,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -427,15 +405,19 @@ async def begin_create( :type body: ~azure.mgmt.netapp.models.Backup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Backup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Backup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Backup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] lro_delay = kwargs.pop( 'polling_interval', @@ -450,30 +432,21 @@ async def begin_create( volume_name=volume_name, backup_name=backup_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Backup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -485,6 +458,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore async def _update_initial( @@ -502,38 +476,28 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'BackupPatch') + _json = self._serialize.body(body, 'BackupPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -551,8 +515,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -581,15 +548,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.BackupPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Backup or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Backup or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Backup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] lro_delay = kwargs.pop( 'polling_interval', @@ -604,30 +575,21 @@ async def begin_update( volume_name=volume_name, backup_name=backup_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Backup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -639,6 +601,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore async def _delete_initial( @@ -655,28 +618,20 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -689,6 +644,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -714,15 +671,17 @@ async def begin_delete( :type backup_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -739,24 +698,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -768,4 +717,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py index 159e06205fda..36ac75667cb8 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_operations.py @@ -5,16 +5,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._net_app_resource_operations import build_check_file_path_availability_request, build_check_name_availability_request, build_check_quota_availability_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def check_name_availability( self, location: str, @@ -71,32 +76,21 @@ async def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group) + _json = self._serialize.body(_body, 'ResourceNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'ResourceNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -110,8 +104,11 @@ async def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace_async async def check_file_path_availability( self, location: str, @@ -141,32 +138,21 @@ async def check_file_path_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_file_path_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) + _json = self._serialize.body(_body, 'FilePathAvailabilityRequest') + + request = build_check_file_path_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_file_path_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'FilePathAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -180,8 +166,11 @@ async def check_file_path_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_file_path_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability'} # type: ignore + + @distributed_trace_async async def check_quota_availability( self, location: str, @@ -213,32 +202,21 @@ async def check_quota_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.QuotaAvailabilityRequest(name=name, type=type, resource_group=resource_group) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_quota_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.QuotaAvailabilityRequest(name=name, type=type, resource_group=resource_group) + _json = self._serialize.body(_body, 'QuotaAvailabilityRequest') + + request = build_check_quota_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_quota_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'QuotaAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -252,4 +230,6 @@ async def check_quota_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py index c3224aadc11d..93bfa8cd92e1 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_net_app_resource_quota_limits_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._net_app_resource_quota_limits_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location: str, @@ -53,8 +59,10 @@ def list( :param location: The location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionQuotaItemList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.netapp.models.SubscriptionQuotaItemList] + :return: An iterator like instance of either SubscriptionQuotaItemList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.netapp.models.SubscriptionQuotaItemList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.SubscriptionQuotaItemList"] @@ -62,35 +70,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionQuotaItemList', pipeline_response) + deserialized = self._deserialize("SubscriptionQuotaItemList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -108,11 +112,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits'} # type: ignore + @distributed_trace_async async def get( self, location: str, @@ -137,27 +143,17 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'quotaLimitName': self._serialize.url("quota_limit_name", quota_limit_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + quota_limit_name=quota_limit_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -171,4 +167,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py index d7f8e3b3babe..7df352f9fcd2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -59,30 +65,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -100,6 +103,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py index 9e12d11a694d..f546f0ca83b6 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_pools_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._pools_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -67,36 +73,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityPoolList', pipeline_response) + deserialized = self._deserialize("CapacityPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,11 +117,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -146,28 +151,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -181,8 +176,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -196,33 +193,23 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'CapacityPool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CapacityPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -240,8 +227,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -264,15 +254,19 @@ async def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.CapacityPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CapacityPool or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.CapacityPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -285,28 +279,21 @@ async def begin_create_or_update( account_name=account_name, pool_name=pool_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -318,6 +305,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore async def _update_initial( @@ -333,33 +321,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'CapacityPoolPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CapacityPoolPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -375,8 +353,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -399,15 +380,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.CapacityPoolPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either CapacityPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either CapacityPool or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.CapacityPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -420,28 +405,21 @@ async def begin_update( account_name=account_name, pool_name=pool_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -453,6 +431,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore async def _delete_initial( @@ -467,26 +446,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -499,6 +470,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -518,15 +491,17 @@ async def begin_delete( :type pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -541,22 +516,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -568,4 +535,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py index da75e80aa1b9..7f137d1c004a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshot_policies_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshot_policies_operations import build_create_request, build_delete_request_initial, build_get_request, build_list_request, build_list_volumes_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -56,7 +62,8 @@ def list( :param account_name: The name of the NetApp account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotPoliciesList or the result of cls(response) + :return: An iterator like instance of either SnapshotPoliciesList or the result of + cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.netapp.models.SnapshotPoliciesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -65,36 +72,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotPoliciesList', pipeline_response) + deserialized = self._deserialize("SnapshotPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,11 +116,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -142,28 +148,18 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,8 +173,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace_async async def create( self, resource_group_name: str, @@ -207,33 +206,23 @@ async def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'SnapshotPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SnapshotPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,8 +240,10 @@ async def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + async def _update_initial( self, resource_group_name: str, @@ -266,33 +257,23 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'SnapshotPolicyPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SnapshotPolicyPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -310,8 +291,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -332,15 +316,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.SnapshotPolicyPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either SnapshotPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SnapshotPolicy or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.SnapshotPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -353,28 +341,21 @@ async def begin_update( account_name=account_name, snapshot_policy_name=snapshot_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SnapshotPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -386,6 +367,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore async def _delete_initial( @@ -400,26 +382,18 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -432,6 +406,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -449,15 +425,17 @@ async def begin_delete( :type snapshot_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -472,22 +450,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -499,8 +469,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + @distributed_trace_async async def list_volumes( self, resource_group_name: str, @@ -528,28 +500,18 @@ async def list_volumes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_volumes.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_volumes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self.list_volumes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -563,4 +525,6 @@ async def list_volumes( return cls(pipeline_response, deserialized, {}) return deserialized + list_volumes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py index 7410f39fb12a..65141d6fa001 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_snapshots_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._snapshots_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -73,38 +79,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotsList', pipeline_response) + deserialized = self._deserialize("SnapshotsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -122,11 +127,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -160,30 +167,20 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -197,8 +194,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + async def _create_initial( self, resource_group_name: str, @@ -214,35 +213,25 @@ async def _create_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Snapshot') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Snapshot') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,8 +247,11 @@ async def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_create( self, resource_group_name: str, @@ -288,15 +280,19 @@ async def begin_create( :type body: ~azure.mgmt.netapp.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -311,30 +307,21 @@ async def begin_create( volume_name=volume_name, snapshot_name=snapshot_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -346,6 +333,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore async def _update_initial( @@ -363,35 +351,25 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'object') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'object') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -407,8 +385,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -437,15 +418,19 @@ async def begin_update( :type body: any :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Snapshot or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Snapshot or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -460,30 +445,21 @@ async def begin_update( volume_name=volume_name, snapshot_name=snapshot_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -495,6 +471,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore async def _delete_initial( @@ -511,28 +488,20 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -545,6 +514,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -570,15 +541,17 @@ async def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -595,24 +568,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -624,4 +587,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py index 9a692b8422dd..c2af63b89715 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_vaults_operations.py @@ -5,17 +5,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._vaults_operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +46,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -65,36 +71,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -112,6 +115,7 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py new file mode 100644 index 000000000000..1b114eea1925 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_groups_operations.py @@ -0,0 +1,411 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._volume_groups_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_net_app_account_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VolumeGroupsOperations: + """VolumeGroupsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.netapp.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_net_app_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VolumeGroupList"]: + """Describe all volume groups. + + List all volume groups for given account. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VolumeGroupList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.netapp.models.VolumeGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_net_app_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_by_net_app_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_net_app_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("VolumeGroupList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_net_app_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> "_models.VolumeGroupDetails": + """Describe a Volume Group. + + Get details of the specified volume group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VolumeGroupDetails, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.VolumeGroupDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + body: "_models.VolumeGroupDetails", + **kwargs: Any + ) -> "_models.VolumeGroupDetails": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'VolumeGroupDetails') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + body: "_models.VolumeGroupDetails", + **kwargs: Any + ) -> AsyncLROPoller["_models.VolumeGroupDetails"]: + """Create the specified volume group and volumes. Creating volume group will create all the + volumes specified in request body implicitly. Once volumes are created using volume group, + those will be treated as regular volumes thereafter. + + Create a volume group along with specified volumes. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :param body: Volume Group object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeGroupDetails + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either VolumeGroupDetails or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.VolumeGroupDetails] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + body=body, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a volume group. + + Delete the specified volume group only if there are no volumes under volume group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py index 7a291bdacb2d..66433016d648 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volumes_operations.py @@ -5,19 +5,24 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- +import functools from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._volumes_operations import build_authorize_replication_request_initial, build_break_replication_request_initial, build_create_or_update_request_initial, build_delete_replication_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_pool_change_request_initial, build_re_initialize_replication_request_initial, build_replication_status_request, build_resync_replication_request_initial, build_revert_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,6 +48,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -70,37 +76,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('VolumeList', pipeline_response) + deserialized = self._deserialize("VolumeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,11 +122,13 @@ async def get_next(next_link=None): return pipeline_response + return AsyncItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -153,29 +159,19 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -189,8 +185,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -205,34 +203,24 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Volume') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Volume') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -251,8 +239,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -278,15 +269,19 @@ async def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.Volume :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Volume"] lro_delay = kwargs.pop( 'polling_interval', @@ -300,29 +295,21 @@ async def begin_create_or_update( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Volume', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -334,6 +321,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore async def _update_initial( @@ -350,34 +338,24 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'VolumePatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'VolumePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -393,8 +371,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -420,15 +401,19 @@ async def begin_update( :type body: ~azure.mgmt.netapp.models.VolumePatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Volume or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Volume or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Volume"] lro_delay = kwargs.pop( 'polling_interval', @@ -442,29 +427,21 @@ async def begin_update( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Volume', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -476,6 +453,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore async def _delete_initial( @@ -491,27 +469,19 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -524,6 +494,8 @@ async def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, @@ -546,15 +518,17 @@ async def begin_delete( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -570,23 +544,14 @@ async def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -598,6 +563,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore async def _revert_initial( @@ -614,32 +580,24 @@ async def _revert_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._revert_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'VolumeRevert') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_revert_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._revert_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'VolumeRevert') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -652,6 +610,8 @@ async def _revert_initial( _revert_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore + + @distributed_trace_async async def begin_revert( self, resource_group_name: str, @@ -677,15 +637,18 @@ async def begin_revert( :type body: ~azure.mgmt.netapp.models.VolumeRevert :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -699,26 +662,18 @@ async def begin_revert( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -730,6 +685,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore async def _break_replication_initial( @@ -746,35 +702,27 @@ async def _break_replication_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._break_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'BreakReplicationRequest') + _json = self._serialize.body(body, 'BreakReplicationRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_break_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._break_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -787,6 +735,8 @@ async def _break_replication_initial( _break_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication'} # type: ignore + + @distributed_trace_async async def begin_break_replication( self, resource_group_name: str, @@ -812,15 +762,18 @@ async def begin_break_replication( :type body: ~azure.mgmt.netapp.models.BreakReplicationRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -834,26 +787,18 @@ async def begin_break_replication( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -865,8 +810,10 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_break_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication'} # type: ignore + @distributed_trace_async async def replication_status( self, resource_group_name: str, @@ -897,29 +844,19 @@ async def replication_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.replication_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_replication_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.replication_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -933,8 +870,10 @@ async def replication_status( return cls(pipeline_response, deserialized, {}) return deserialized + replication_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus'} # type: ignore + async def _resync_replication_initial( self, resource_group_name: str, @@ -948,27 +887,19 @@ async def _resync_replication_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._resync_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_resync_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._resync_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -981,6 +912,8 @@ async def _resync_replication_initial( _resync_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication'} # type: ignore + + @distributed_trace_async async def begin_resync_replication( self, resource_group_name: str, @@ -1004,15 +937,17 @@ async def begin_resync_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1028,23 +963,14 @@ async def begin_resync_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1056,6 +982,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resync_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication'} # type: ignore async def _delete_replication_initial( @@ -1071,27 +998,19 @@ async def _delete_replication_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._delete_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1104,6 +1023,8 @@ async def _delete_replication_initial( _delete_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication'} # type: ignore + + @distributed_trace_async async def begin_delete_replication( self, resource_group_name: str, @@ -1127,15 +1048,17 @@ async def begin_delete_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1151,23 +1074,14 @@ async def begin_delete_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1179,6 +1093,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication'} # type: ignore async def _authorize_replication_initial( @@ -1195,32 +1110,24 @@ async def _authorize_replication_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._authorize_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(body, 'AuthorizeRequest') + + request = build_authorize_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._authorize_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'AuthorizeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1233,6 +1140,8 @@ async def _authorize_replication_initial( _authorize_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication'} # type: ignore + + @distributed_trace_async async def begin_authorize_replication( self, resource_group_name: str, @@ -1258,15 +1167,18 @@ async def begin_authorize_replication( :type body: ~azure.mgmt.netapp.models.AuthorizeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1280,26 +1192,18 @@ async def begin_authorize_replication( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1311,6 +1215,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_authorize_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication'} # type: ignore async def _re_initialize_replication_initial( @@ -1326,27 +1231,19 @@ async def _re_initialize_replication_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._re_initialize_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_re_initialize_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._re_initialize_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1359,6 +1256,8 @@ async def _re_initialize_replication_initial( _re_initialize_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication'} # type: ignore + + @distributed_trace_async async def begin_re_initialize_replication( self, resource_group_name: str, @@ -1381,15 +1280,17 @@ async def begin_re_initialize_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1405,23 +1306,14 @@ async def begin_re_initialize_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1433,6 +1325,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_re_initialize_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication'} # type: ignore async def _pool_change_initial( @@ -1449,32 +1342,24 @@ async def _pool_change_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._pool_change_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PoolChangeRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_pool_change_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._pool_change_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PoolChangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1487,6 +1372,8 @@ async def _pool_change_initial( _pool_change_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange'} # type: ignore + + @distributed_trace_async async def begin_pool_change( self, resource_group_name: str, @@ -1512,15 +1399,18 @@ async def begin_pool_change( :type body: ~azure.mgmt.netapp.models.PoolChangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1534,26 +1424,18 @@ async def begin_pool_change( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -1565,4 +1447,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pool_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py index d7ff6ec6ea32..5d5e0343f13e 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/__init__.py @@ -6,145 +6,84 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AccountEncryption - from ._models_py3 import ActiveDirectory - from ._models_py3 import AuthorizeRequest - from ._models_py3 import Backup - from ._models_py3 import BackupPatch - from ._models_py3 import BackupPoliciesList - from ._models_py3 import BackupPolicy - from ._models_py3 import BackupPolicyDetails - from ._models_py3 import BackupPolicyPatch - from ._models_py3 import BackupStatus - from ._models_py3 import BackupsList - from ._models_py3 import BreakReplicationRequest - from ._models_py3 import CapacityPool - from ._models_py3 import CapacityPoolList - from ._models_py3 import CapacityPoolPatch - from ._models_py3 import CheckAvailabilityResponse - from ._models_py3 import CloudErrorBody - from ._models_py3 import DailySchedule - from ._models_py3 import Dimension - from ._models_py3 import ExportPolicyRule - from ._models_py3 import FilePathAvailabilityRequest - from ._models_py3 import HourlySchedule - from ._models_py3 import LogSpecification - from ._models_py3 import MetricSpecification - from ._models_py3 import MonthlySchedule - from ._models_py3 import MountTarget - from ._models_py3 import MountTargetProperties - from ._models_py3 import NetAppAccount - from ._models_py3 import NetAppAccountList - from ._models_py3 import NetAppAccountPatch - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import PoolChangeRequest - from ._models_py3 import ProxyResource - from ._models_py3 import QuotaAvailabilityRequest - from ._models_py3 import ReplicationObject - from ._models_py3 import ReplicationStatus - from ._models_py3 import Resource - from ._models_py3 import ResourceIdentity - from ._models_py3 import ResourceNameAvailabilityRequest - from ._models_py3 import RestoreStatus - from ._models_py3 import ServiceSpecification - from ._models_py3 import Snapshot - from ._models_py3 import SnapshotPoliciesList - from ._models_py3 import SnapshotPolicy - from ._models_py3 import SnapshotPolicyDetails - from ._models_py3 import SnapshotPolicyPatch - from ._models_py3 import SnapshotPolicyVolumeList - from ._models_py3 import SnapshotsList - from ._models_py3 import SubscriptionQuotaItem - from ._models_py3 import SubscriptionQuotaItemList - from ._models_py3 import SystemData - from ._models_py3 import Vault - from ._models_py3 import VaultList - from ._models_py3 import Volume - from ._models_py3 import VolumeBackupProperties - from ._models_py3 import VolumeBackups - from ._models_py3 import VolumeList - from ._models_py3 import VolumePatch - from ._models_py3 import VolumePatchPropertiesDataProtection - from ._models_py3 import VolumePatchPropertiesExportPolicy - from ._models_py3 import VolumePropertiesDataProtection - from ._models_py3 import VolumePropertiesExportPolicy - from ._models_py3 import VolumeRevert - from ._models_py3 import VolumeSnapshotProperties - from ._models_py3 import WeeklySchedule -except (SyntaxError, ImportError): - from ._models import AccountEncryption # type: ignore - from ._models import ActiveDirectory # type: ignore - from ._models import AuthorizeRequest # type: ignore - from ._models import Backup # type: ignore - from ._models import BackupPatch # type: ignore - from ._models import BackupPoliciesList # type: ignore - from ._models import BackupPolicy # type: ignore - from ._models import BackupPolicyDetails # type: ignore - from ._models import BackupPolicyPatch # type: ignore - from ._models import BackupStatus # type: ignore - from ._models import BackupsList # type: ignore - from ._models import BreakReplicationRequest # type: ignore - from ._models import CapacityPool # type: ignore - from ._models import CapacityPoolList # type: ignore - from ._models import CapacityPoolPatch # type: ignore - from ._models import CheckAvailabilityResponse # type: ignore - from ._models import CloudErrorBody # type: ignore - from ._models import DailySchedule # type: ignore - from ._models import Dimension # type: ignore - from ._models import ExportPolicyRule # type: ignore - from ._models import FilePathAvailabilityRequest # type: ignore - from ._models import HourlySchedule # type: ignore - from ._models import LogSpecification # type: ignore - from ._models import MetricSpecification # type: ignore - from ._models import MonthlySchedule # type: ignore - from ._models import MountTarget # type: ignore - from ._models import MountTargetProperties # type: ignore - from ._models import NetAppAccount # type: ignore - from ._models import NetAppAccountList # type: ignore - from ._models import NetAppAccountPatch # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import PoolChangeRequest # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import QuotaAvailabilityRequest # type: ignore - from ._models import ReplicationObject # type: ignore - from ._models import ReplicationStatus # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import ResourceNameAvailabilityRequest # type: ignore - from ._models import RestoreStatus # type: ignore - from ._models import ServiceSpecification # type: ignore - from ._models import Snapshot # type: ignore - from ._models import SnapshotPoliciesList # type: ignore - from ._models import SnapshotPolicy # type: ignore - from ._models import SnapshotPolicyDetails # type: ignore - from ._models import SnapshotPolicyPatch # type: ignore - from ._models import SnapshotPolicyVolumeList # type: ignore - from ._models import SnapshotsList # type: ignore - from ._models import SubscriptionQuotaItem # type: ignore - from ._models import SubscriptionQuotaItemList # type: ignore - from ._models import SystemData # type: ignore - from ._models import Vault # type: ignore - from ._models import VaultList # type: ignore - from ._models import Volume # type: ignore - from ._models import VolumeBackupProperties # type: ignore - from ._models import VolumeBackups # type: ignore - from ._models import VolumeList # type: ignore - from ._models import VolumePatch # type: ignore - from ._models import VolumePatchPropertiesDataProtection # type: ignore - from ._models import VolumePatchPropertiesExportPolicy # type: ignore - from ._models import VolumePropertiesDataProtection # type: ignore - from ._models import VolumePropertiesExportPolicy # type: ignore - from ._models import VolumeRevert # type: ignore - from ._models import VolumeSnapshotProperties # type: ignore - from ._models import WeeklySchedule # type: ignore +from ._models_py3 import AccountEncryption +from ._models_py3 import ActiveDirectory +from ._models_py3 import AuthorizeRequest +from ._models_py3 import Backup +from ._models_py3 import BackupPatch +from ._models_py3 import BackupPoliciesList +from ._models_py3 import BackupPolicy +from ._models_py3 import BackupPolicyDetails +from ._models_py3 import BackupPolicyPatch +from ._models_py3 import BackupStatus +from ._models_py3 import BackupsList +from ._models_py3 import BreakReplicationRequest +from ._models_py3 import CapacityPool +from ._models_py3 import CapacityPoolList +from ._models_py3 import CapacityPoolPatch +from ._models_py3 import CheckAvailabilityResponse +from ._models_py3 import CloudErrorBody +from ._models_py3 import DailySchedule +from ._models_py3 import Dimension +from ._models_py3 import ExportPolicyRule +from ._models_py3 import FilePathAvailabilityRequest +from ._models_py3 import HourlySchedule +from ._models_py3 import LogSpecification +from ._models_py3 import MetricSpecification +from ._models_py3 import MonthlySchedule +from ._models_py3 import MountTarget +from ._models_py3 import MountTargetProperties +from ._models_py3 import NetAppAccount +from ._models_py3 import NetAppAccountList +from ._models_py3 import NetAppAccountPatch +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import PlacementKeyValuePairs +from ._models_py3 import PoolChangeRequest +from ._models_py3 import ProxyResource +from ._models_py3 import QuotaAvailabilityRequest +from ._models_py3 import ReplicationObject +from ._models_py3 import ReplicationStatus +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import ResourceNameAvailabilityRequest +from ._models_py3 import RestoreStatus +from ._models_py3 import ServiceSpecification +from ._models_py3 import Snapshot +from ._models_py3 import SnapshotPoliciesList +from ._models_py3 import SnapshotPolicy +from ._models_py3 import SnapshotPolicyDetails +from ._models_py3 import SnapshotPolicyPatch +from ._models_py3 import SnapshotPolicyVolumeList +from ._models_py3 import SnapshotsList +from ._models_py3 import SubscriptionQuotaItem +from ._models_py3 import SubscriptionQuotaItemList +from ._models_py3 import SystemData +from ._models_py3 import Vault +from ._models_py3 import VaultList +from ._models_py3 import Volume +from ._models_py3 import VolumeBackupProperties +from ._models_py3 import VolumeBackups +from ._models_py3 import VolumeGroup +from ._models_py3 import VolumeGroupDetails +from ._models_py3 import VolumeGroupList +from ._models_py3 import VolumeGroupMetaData +from ._models_py3 import VolumeGroupVolumeProperties +from ._models_py3 import VolumeList +from ._models_py3 import VolumePatch +from ._models_py3 import VolumePatchPropertiesDataProtection +from ._models_py3 import VolumePatchPropertiesExportPolicy +from ._models_py3 import VolumePropertiesDataProtection +from ._models_py3 import VolumePropertiesExportPolicy +from ._models_py3 import VolumeRevert +from ._models_py3 import VolumeSnapshotProperties +from ._models_py3 import WeeklySchedule + from ._net_app_management_client_enums import ( ActiveDirectoryStatus, + ApplicationType, AvsDataStore, BackupType, CheckNameResourceTypes, @@ -199,6 +138,7 @@ 'Operation', 'OperationDisplay', 'OperationListResult', + 'PlacementKeyValuePairs', 'PoolChangeRequest', 'ProxyResource', 'QuotaAvailabilityRequest', @@ -224,6 +164,11 @@ 'Volume', 'VolumeBackupProperties', 'VolumeBackups', + 'VolumeGroup', + 'VolumeGroupDetails', + 'VolumeGroupList', + 'VolumeGroupMetaData', + 'VolumeGroupVolumeProperties', 'VolumeList', 'VolumePatch', 'VolumePatchPropertiesDataProtection', @@ -234,6 +179,7 @@ 'VolumeSnapshotProperties', 'WeeklySchedule', 'ActiveDirectoryStatus', + 'ApplicationType', 'AvsDataStore', 'BackupType', 'CheckNameResourceTypes', diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py deleted file mode 100644 index d78614cc759b..000000000000 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py +++ /dev/null @@ -1,3027 +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. -# -------------------------------------------------------------------------- - -import msrest.serialization - - -class AccountEncryption(msrest.serialization.Model): - """Encryption settings. - - :param key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - :type key_source: str - """ - - _attribute_map = { - 'key_source': {'key': 'keySource', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AccountEncryption, self).__init__(**kwargs) - self.key_source = kwargs.get('key_source', None) - - -class ActiveDirectory(msrest.serialization.Model): - """Active Directory. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param active_directory_id: Id of the Active Directory. - :type active_directory_id: str - :param username: Username of Active Directory domain administrator. - :type username: str - :param password: Plain text password of Active Directory domain administrator, value is masked - in the response. - :type password: str - :param domain: Name of the Active Directory domain. - :type domain: str - :param dns: Comma separated list of DNS server IP addresses (IPv4 only) for the Active - Directory domain. - :type dns: str - :ivar status: Status of the Active Directory. Possible values include: "Created", "InUse", - "Deleted", "Error", "Updating". - :vartype status: str or ~azure.mgmt.netapp.models.ActiveDirectoryStatus - :ivar status_details: Any details in regards to the Status of the Active Directory. - :vartype status_details: str - :param smb_server_name: NetBIOS name of the SMB server. This name will be registered as a - computer account in the AD and used to mount volumes. - :type smb_server_name: str - :param organizational_unit: The Organizational Unit (OU) within the Windows Active Directory. - :type organizational_unit: str - :param site: The Active Directory site the service will limit Domain Controller discovery to. - :type site: str - :param backup_operators: Users to be added to the Built-in Backup Operator active directory - group. A list of unique usernames without domain specifier. - :type backup_operators: list[str] - :param administrators: Users to be added to the Built-in Administrators active directory group. - A list of unique usernames without domain specifier. - :type administrators: list[str] - :param kdc_ip: kdc server IP addresses for the active directory machine. This optional - parameter is used only while creating kerberos volume. - :type kdc_ip: str - :param ad_name: Name of the active directory machine. This optional parameter is used only - while creating kerberos volume. - :type ad_name: str - :param server_root_ca_certificate: When LDAP over SSL/TLS is enabled, the LDAP client is - required to have base64 encoded Active Directory Certificate Service's self-signed root CA - certificate, this optional parameter is used only for dual protocol with LDAP user-mapping - volumes. - :type server_root_ca_certificate: str - :param aes_encryption: If enabled, AES encryption will be enabled for SMB communication. - :type aes_encryption: bool - :param ldap_signing: Specifies whether or not the LDAP traffic needs to be signed. - :type ldap_signing: bool - :param security_operators: Domain Users in the Active directory to be given SeSecurityPrivilege - privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames - without domain specifier. - :type security_operators: list[str] - :param ldap_over_tls: Specifies whether or not the LDAP traffic needs to be secured via TLS. - :type ldap_over_tls: bool - :param allow_local_nfs_users_with_ldap: If enabled, NFS client local users can also (in - addition to LDAP users) access the NFS volumes. - :type allow_local_nfs_users_with_ldap: bool - """ - - _validation = { - 'dns': {'pattern': r'^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)((, ?)(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$'}, - 'status': {'readonly': True}, - 'status_details': {'readonly': True}, - 'kdc_ip': {'pattern': r'^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)((, ?)(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))*$'}, - 'ad_name': {'max_length': 64, 'min_length': 1}, - 'server_root_ca_certificate': {'max_length': 10240, 'min_length': 1}, - } - - _attribute_map = { - 'active_directory_id': {'key': 'activeDirectoryId', 'type': 'str'}, - 'username': {'key': 'username', 'type': 'str'}, - 'password': {'key': 'password', 'type': 'str'}, - 'domain': {'key': 'domain', 'type': 'str'}, - 'dns': {'key': 'dns', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'status_details': {'key': 'statusDetails', 'type': 'str'}, - 'smb_server_name': {'key': 'smbServerName', 'type': 'str'}, - 'organizational_unit': {'key': 'organizationalUnit', 'type': 'str'}, - 'site': {'key': 'site', 'type': 'str'}, - 'backup_operators': {'key': 'backupOperators', 'type': '[str]'}, - 'administrators': {'key': 'administrators', 'type': '[str]'}, - 'kdc_ip': {'key': 'kdcIP', 'type': 'str'}, - 'ad_name': {'key': 'adName', 'type': 'str'}, - 'server_root_ca_certificate': {'key': 'serverRootCACertificate', 'type': 'str'}, - 'aes_encryption': {'key': 'aesEncryption', 'type': 'bool'}, - 'ldap_signing': {'key': 'ldapSigning', 'type': 'bool'}, - 'security_operators': {'key': 'securityOperators', 'type': '[str]'}, - 'ldap_over_tls': {'key': 'ldapOverTLS', 'type': 'bool'}, - 'allow_local_nfs_users_with_ldap': {'key': 'allowLocalNfsUsersWithLdap', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ActiveDirectory, self).__init__(**kwargs) - self.active_directory_id = kwargs.get('active_directory_id', None) - self.username = kwargs.get('username', None) - self.password = kwargs.get('password', None) - self.domain = kwargs.get('domain', None) - self.dns = kwargs.get('dns', None) - self.status = None - self.status_details = None - self.smb_server_name = kwargs.get('smb_server_name', None) - self.organizational_unit = kwargs.get('organizational_unit', "CN=Computers") - self.site = kwargs.get('site', None) - self.backup_operators = kwargs.get('backup_operators', None) - self.administrators = kwargs.get('administrators', None) - self.kdc_ip = kwargs.get('kdc_ip', None) - self.ad_name = kwargs.get('ad_name', None) - self.server_root_ca_certificate = kwargs.get('server_root_ca_certificate', None) - self.aes_encryption = kwargs.get('aes_encryption', None) - self.ldap_signing = kwargs.get('ldap_signing', None) - self.security_operators = kwargs.get('security_operators', None) - self.ldap_over_tls = kwargs.get('ldap_over_tls', None) - self.allow_local_nfs_users_with_ldap = kwargs.get('allow_local_nfs_users_with_ldap', None) - - -class AuthorizeRequest(msrest.serialization.Model): - """Authorize request. - - :param remote_volume_resource_id: Resource id of the remote volume. - :type remote_volume_resource_id: str - """ - - _attribute_map = { - 'remote_volume_resource_id': {'key': 'remoteVolumeResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AuthorizeRequest, self).__init__(**kwargs) - self.remote_volume_resource_id = kwargs.get('remote_volume_resource_id', None) - - -class Backup(msrest.serialization.Model): - """Backup of a Volume. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar backup_id: UUID v4 used to identify the Backup. - :vartype backup_id: str - :ivar creation_date: The creation date of the backup. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :ivar size: Size of backup. - :vartype size: long - :param label: Label for backup. - :type label: str - :ivar backup_type: Type of backup Manual or Scheduled. Possible values include: "Manual", - "Scheduled". - :vartype backup_type: str or ~azure.mgmt.netapp.models.BackupType - :ivar failure_reason: Failure reason. - :vartype failure_reason: str - :ivar volume_name: Volume name. - :vartype volume_name: str - :param use_existing_snapshot: Manual backup an already existing snapshot. This will always be - false for scheduled backups and true/false for manual backups. - :type use_existing_snapshot: bool - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'backup_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'size': {'readonly': True}, - 'backup_type': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'volume_name': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'backup_id': {'key': 'properties.backupId', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'size': {'key': 'properties.size', 'type': 'long'}, - 'label': {'key': 'properties.label', 'type': 'str'}, - 'backup_type': {'key': 'properties.backupType', 'type': 'str'}, - 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, - 'volume_name': {'key': 'properties.volumeName', 'type': 'str'}, - 'use_existing_snapshot': {'key': 'properties.useExistingSnapshot', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Backup, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.type = None - self.backup_id = None - self.creation_date = None - self.provisioning_state = None - self.size = None - self.label = kwargs.get('label', None) - self.backup_type = None - self.failure_reason = None - self.volume_name = None - self.use_existing_snapshot = kwargs.get('use_existing_snapshot', False) - - -class BackupPatch(msrest.serialization.Model): - """Backup patch. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar backup_id: UUID v4 used to identify the Backup. - :vartype backup_id: str - :ivar creation_date: The creation date of the backup. - :vartype creation_date: ~datetime.datetime - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :ivar size: Size of backup. - :vartype size: long - :param label: Label for backup. - :type label: str - :ivar backup_type: Type of backup Manual or Scheduled. Possible values include: "Manual", - "Scheduled". - :vartype backup_type: str or ~azure.mgmt.netapp.models.BackupType - :ivar failure_reason: Failure reason. - :vartype failure_reason: str - :ivar volume_name: Volume name. - :vartype volume_name: str - :param use_existing_snapshot: Manual backup an already existing snapshot. This will always be - false for scheduled backups and true/false for manual backups. - :type use_existing_snapshot: bool - """ - - _validation = { - 'backup_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'creation_date': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'size': {'readonly': True}, - 'backup_type': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'volume_name': {'readonly': True}, - } - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'backup_id': {'key': 'properties.backupId', 'type': 'str'}, - 'creation_date': {'key': 'properties.creationDate', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'size': {'key': 'properties.size', 'type': 'long'}, - 'label': {'key': 'properties.label', 'type': 'str'}, - 'backup_type': {'key': 'properties.backupType', 'type': 'str'}, - 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, - 'volume_name': {'key': 'properties.volumeName', 'type': 'str'}, - 'use_existing_snapshot': {'key': 'properties.useExistingSnapshot', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPatch, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.backup_id = None - self.creation_date = None - self.provisioning_state = None - self.size = None - self.label = kwargs.get('label', None) - self.backup_type = None - self.failure_reason = None - self.volume_name = None - self.use_existing_snapshot = kwargs.get('use_existing_snapshot', False) - - -class BackupPoliciesList(msrest.serialization.Model): - """List of Backup Policies. - - :param value: A list of backup policies. - :type value: list[~azure.mgmt.netapp.models.BackupPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[BackupPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPoliciesList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class BackupPolicy(msrest.serialization.Model): - """Backup policy information. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str - :ivar backup_policy_id: Backup Policy Resource ID. - :vartype backup_policy_id: str - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int - :ivar volumes_assigned: Volumes using current backup policy. - :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar volume_backups: A list of volumes assigned to this policy. - :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, - 'backup_policy_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'volumes_assigned': {'readonly': True}, - 'volume_backups': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, - 'weekly_backups_to_keep': {'key': 'properties.weeklyBackupsToKeep', 'type': 'int'}, - 'monthly_backups_to_keep': {'key': 'properties.monthlyBackupsToKeep', 'type': 'int'}, - 'volumes_assigned': {'key': 'properties.volumesAssigned', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'volume_backups': {'key': 'properties.volumeBackups', 'type': '[VolumeBackups]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPolicy, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.etag = None - self.type = None - self.tags = kwargs.get('tags', None) - self.name_properties_name = None - self.backup_policy_id = None - self.provisioning_state = None - self.daily_backups_to_keep = kwargs.get('daily_backups_to_keep', None) - self.weekly_backups_to_keep = kwargs.get('weekly_backups_to_keep', None) - self.monthly_backups_to_keep = kwargs.get('monthly_backups_to_keep', None) - self.volumes_assigned = None - self.enabled = kwargs.get('enabled', None) - self.volume_backups = None - - -class BackupPolicyDetails(msrest.serialization.Model): - """Backup policy properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str - :ivar backup_policy_id: Backup Policy Resource ID. - :vartype backup_policy_id: str - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int - :ivar volumes_assigned: Volumes using current backup policy. - :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar volume_backups: A list of volumes assigned to this policy. - :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, - 'backup_policy_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'volumes_assigned': {'readonly': True}, - 'volume_backups': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, - 'weekly_backups_to_keep': {'key': 'properties.weeklyBackupsToKeep', 'type': 'int'}, - 'monthly_backups_to_keep': {'key': 'properties.monthlyBackupsToKeep', 'type': 'int'}, - 'volumes_assigned': {'key': 'properties.volumesAssigned', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'volume_backups': {'key': 'properties.volumeBackups', 'type': '[VolumeBackups]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPolicyDetails, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.name_properties_name = None - self.backup_policy_id = None - self.provisioning_state = None - self.daily_backups_to_keep = kwargs.get('daily_backups_to_keep', None) - self.weekly_backups_to_keep = kwargs.get('weekly_backups_to_keep', None) - self.monthly_backups_to_keep = kwargs.get('monthly_backups_to_keep', None) - self.volumes_assigned = None - self.enabled = kwargs.get('enabled', None) - self.volume_backups = None - - -class BackupPolicyPatch(msrest.serialization.Model): - """Backup policy Details for create and update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str - :ivar backup_policy_id: Backup Policy Resource ID. - :vartype backup_policy_id: str - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int - :ivar volumes_assigned: Volumes using current backup policy. - :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar volume_backups: A list of volumes assigned to this policy. - :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, - 'backup_policy_id': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'volumes_assigned': {'readonly': True}, - 'volume_backups': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, - 'weekly_backups_to_keep': {'key': 'properties.weeklyBackupsToKeep', 'type': 'int'}, - 'monthly_backups_to_keep': {'key': 'properties.monthlyBackupsToKeep', 'type': 'int'}, - 'volumes_assigned': {'key': 'properties.volumesAssigned', 'type': 'int'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'volume_backups': {'key': 'properties.volumeBackups', 'type': '[VolumeBackups]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupPolicyPatch, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.name_properties_name = None - self.backup_policy_id = None - self.provisioning_state = None - self.daily_backups_to_keep = kwargs.get('daily_backups_to_keep', None) - self.weekly_backups_to_keep = kwargs.get('weekly_backups_to_keep', None) - self.monthly_backups_to_keep = kwargs.get('monthly_backups_to_keep', None) - self.volumes_assigned = None - self.enabled = kwargs.get('enabled', None) - self.volume_backups = None - - -class BackupsList(msrest.serialization.Model): - """List of Backups. - - :param value: A list of Backups. - :type value: list[~azure.mgmt.netapp.models.Backup] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Backup]'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class BackupStatus(msrest.serialization.Model): - """Backup status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar healthy: Backup health status. - :vartype healthy: bool - :ivar relationship_status: Status of the backup mirror relationship. Possible values include: - "Idle", "Transferring". - :vartype relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus - :ivar mirror_state: The status of the backup. Possible values include: "Uninitialized", - "Mirrored", "Broken". - :vartype mirror_state: str or ~azure.mgmt.netapp.models.MirrorState - :ivar unhealthy_reason: Reason for the unhealthy backup relationship. - :vartype unhealthy_reason: str - :ivar error_message: Displays error message if the backup is in an error state. - :vartype error_message: str - :ivar last_transfer_size: Displays the last transfer size. - :vartype last_transfer_size: long - :ivar last_transfer_type: Displays the last transfer type. - :vartype last_transfer_type: str - :ivar total_transfer_bytes: Displays the total bytes transferred. - :vartype total_transfer_bytes: long - """ - - _validation = { - 'healthy': {'readonly': True}, - 'relationship_status': {'readonly': True}, - 'mirror_state': {'readonly': True}, - 'unhealthy_reason': {'readonly': True}, - 'error_message': {'readonly': True}, - 'last_transfer_size': {'readonly': True}, - 'last_transfer_type': {'readonly': True}, - 'total_transfer_bytes': {'readonly': True}, - } - - _attribute_map = { - 'healthy': {'key': 'healthy', 'type': 'bool'}, - 'relationship_status': {'key': 'relationshipStatus', 'type': 'str'}, - 'mirror_state': {'key': 'mirrorState', 'type': 'str'}, - 'unhealthy_reason': {'key': 'unhealthyReason', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'last_transfer_size': {'key': 'lastTransferSize', 'type': 'long'}, - 'last_transfer_type': {'key': 'lastTransferType', 'type': 'str'}, - 'total_transfer_bytes': {'key': 'totalTransferBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(BackupStatus, self).__init__(**kwargs) - self.healthy = None - self.relationship_status = None - self.mirror_state = None - self.unhealthy_reason = None - self.error_message = None - self.last_transfer_size = None - self.last_transfer_type = None - self.total_transfer_bytes = None - - -class BreakReplicationRequest(msrest.serialization.Model): - """Break replication request. - - :param force_break_replication: If replication is in status transferring and you want to force - break the replication, set to true. - :type force_break_replication: bool - """ - - _attribute_map = { - 'force_break_replication': {'key': 'forceBreakReplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(BreakReplicationRequest, self).__init__(**kwargs) - self.force_break_replication = kwargs.get('force_break_replication', None) - - -class CapacityPool(msrest.serialization.Model): - """Capacity pool resource. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar pool_id: UUID v4 used to identify the Pool. - :vartype pool_id: str - :param size: Required. Provisioned size of the pool (in bytes). Allowed values are in 4TiB - chunks (value must be multiply of 4398046511104). - :type size: long - :param service_level: Required. The service level of the file system. Possible values include: - "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :ivar total_throughput_mibps: Total throughput of pool in Mibps. - :vartype total_throughput_mibps: float - :ivar utilized_throughput_mibps: Utilized throughput of pool in Mibps. - :vartype utilized_throughput_mibps: float - :param qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". - :type qos_type: str or ~azure.mgmt.netapp.models.QosType - :param cool_access: If enabled (true) the pool can contain cool Access enabled volumes. - :type cool_access: bool - :param encryption_type: Encryption type of the capacity pool, set encryption type for data at - rest for this pool and all volumes in it. This value can only be set when creating new pool. - Possible values include: "Single", "Double". Default value: "Single". - :type encryption_type: str or ~azure.mgmt.netapp.models.EncryptionType - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - 'pool_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'size': {'required': True, 'maximum': 549755813888000, 'minimum': 4398046511104}, - 'service_level': {'required': True}, - 'provisioning_state': {'readonly': True}, - 'total_throughput_mibps': {'readonly': True}, - 'utilized_throughput_mibps': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'pool_id': {'key': 'properties.poolId', 'type': 'str'}, - 'size': {'key': 'properties.size', 'type': 'long'}, - 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'total_throughput_mibps': {'key': 'properties.totalThroughputMibps', 'type': 'float'}, - 'utilized_throughput_mibps': {'key': 'properties.utilizedThroughputMibps', 'type': 'float'}, - 'qos_type': {'key': 'properties.qosType', 'type': 'str'}, - 'cool_access': {'key': 'properties.coolAccess', 'type': 'bool'}, - 'encryption_type': {'key': 'properties.encryptionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityPool, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.etag = None - self.type = None - self.tags = kwargs.get('tags', None) - self.pool_id = None - self.size = kwargs['size'] - self.service_level = kwargs.get('service_level', "Premium") - self.provisioning_state = None - self.total_throughput_mibps = None - self.utilized_throughput_mibps = None - self.qos_type = kwargs.get('qos_type', None) - self.cool_access = kwargs.get('cool_access', False) - self.encryption_type = kwargs.get('encryption_type', "Single") - - -class CapacityPoolList(msrest.serialization.Model): - """List of capacity pool resources. - - :param value: List of Capacity pools. - :type value: list[~azure.mgmt.netapp.models.CapacityPool] - :param next_link: URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapacityPool]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityPoolList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class CapacityPoolPatch(msrest.serialization.Model): - """Capacity pool patch resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param size: Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value - must be multiply of 4398046511104). - :type size: long - :param qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". - :type qos_type: str or ~azure.mgmt.netapp.models.QosType - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'size': {'maximum': 549755813888000, 'minimum': 4398046511104}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'size': {'key': 'properties.size', 'type': 'long'}, - 'qos_type': {'key': 'properties.qosType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapacityPoolPatch, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.size = kwargs.get('size', 4398046511104) - self.qos_type = kwargs.get('qos_type', None) - - -class CheckAvailabilityResponse(msrest.serialization.Model): - """Information regarding availability of a resource. - - :param is_available: :code:`true` indicates name is valid and available. - :code:`false` indicates the name is invalid, unavailable, or both. - :type is_available: bool - :param reason: :code:`Invalid` indicates the name provided does not match Azure - App Service naming requirements. :code:`AlreadyExists` indicates that the name is - already in use and is therefore unavailable. Possible values include: "Invalid", - "AlreadyExists". - :type reason: str or ~azure.mgmt.netapp.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why the given name is - invalid, and provide the resource naming requirements so that the user can select a valid name. - If reason == AlreadyExists, explain that resource name is already in use, and direct them to - select a different name. - :type message: str - """ - - _attribute_map = { - 'is_available': {'key': 'isAvailable', 'type': 'bool'}, - 'reason': {'key': 'reason', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CheckAvailabilityResponse, self).__init__(**kwargs) - self.is_available = kwargs.get('is_available', None) - self.reason = kwargs.get('reason', None) - self.message = kwargs.get('message', None) - - -class CloudErrorBody(msrest.serialization.Model): - """An error response from the service. - - :param code: An identifier for the error. Codes are invariant and are intended to be consumed - programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user - interface. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CloudErrorBody, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class DailySchedule(msrest.serialization.Model): - """Daily Schedule properties. - - :param snapshots_to_keep: Daily snapshot count to keep. - :type snapshots_to_keep: int - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long - """ - - _attribute_map = { - 'snapshots_to_keep': {'key': 'snapshotsToKeep', 'type': 'int'}, - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - 'used_bytes': {'key': 'usedBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(DailySchedule, self).__init__(**kwargs) - self.snapshots_to_keep = kwargs.get('snapshots_to_keep', None) - self.hour = kwargs.get('hour', None) - self.minute = kwargs.get('minute', None) - self.used_bytes = kwargs.get('used_bytes', None) - - -class Dimension(msrest.serialization.Model): - """Dimension of blobs, possibly be blob type or access tier. - - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Dimension, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class ExportPolicyRule(msrest.serialization.Model): - """Volume Export Policy Rule. - - :param rule_index: Order index. - :type rule_index: int - :param unix_read_only: Read only access. - :type unix_read_only: bool - :param unix_read_write: Read and write access. - :type unix_read_write: bool - :param kerberos5_read_only: Kerberos5 Read only access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_read_only: bool - :param kerberos5_read_write: Kerberos5 Read and write access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_read_write: bool - :param kerberos5_i_read_only: Kerberos5i Read only access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_i_read_only: bool - :param kerberos5_i_read_write: Kerberos5i Read and write access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_i_read_write: bool - :param kerberos5_p_read_only: Kerberos5p Read only access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_p_read_only: bool - :param kerberos5_p_read_write: Kerberos5p Read and write access. To be use with swagger version - 2020-05-01 or later. - :type kerberos5_p_read_write: bool - :param cifs: Allows CIFS protocol. - :type cifs: bool - :param nfsv3: Allows NFSv3 protocol. Enable only for NFSv3 type volumes. - :type nfsv3: bool - :param nfsv41: Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. - :type nfsv41: bool - :param allowed_clients: Client ingress specification as comma separated string with IPv4 CIDRs, - IPv4 host addresses and host names. - :type allowed_clients: str - :param has_root_access: Has root access to volume. - :type has_root_access: bool - :param chown_mode: This parameter specifies who is authorized to change the ownership of a - file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root - users can change ownership of files that they own. Possible values include: "Restricted", - "Unrestricted". Default value: "Restricted". - :type chown_mode: str or ~azure.mgmt.netapp.models.ChownMode - """ - - _attribute_map = { - 'rule_index': {'key': 'ruleIndex', 'type': 'int'}, - 'unix_read_only': {'key': 'unixReadOnly', 'type': 'bool'}, - 'unix_read_write': {'key': 'unixReadWrite', 'type': 'bool'}, - 'kerberos5_read_only': {'key': 'kerberos5ReadOnly', 'type': 'bool'}, - 'kerberos5_read_write': {'key': 'kerberos5ReadWrite', 'type': 'bool'}, - 'kerberos5_i_read_only': {'key': 'kerberos5iReadOnly', 'type': 'bool'}, - 'kerberos5_i_read_write': {'key': 'kerberos5iReadWrite', 'type': 'bool'}, - 'kerberos5_p_read_only': {'key': 'kerberos5pReadOnly', 'type': 'bool'}, - 'kerberos5_p_read_write': {'key': 'kerberos5pReadWrite', 'type': 'bool'}, - 'cifs': {'key': 'cifs', 'type': 'bool'}, - 'nfsv3': {'key': 'nfsv3', 'type': 'bool'}, - 'nfsv41': {'key': 'nfsv41', 'type': 'bool'}, - 'allowed_clients': {'key': 'allowedClients', 'type': 'str'}, - 'has_root_access': {'key': 'hasRootAccess', 'type': 'bool'}, - 'chown_mode': {'key': 'chownMode', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExportPolicyRule, self).__init__(**kwargs) - self.rule_index = kwargs.get('rule_index', None) - self.unix_read_only = kwargs.get('unix_read_only', None) - self.unix_read_write = kwargs.get('unix_read_write', None) - self.kerberos5_read_only = kwargs.get('kerberos5_read_only', False) - self.kerberos5_read_write = kwargs.get('kerberos5_read_write', False) - self.kerberos5_i_read_only = kwargs.get('kerberos5_i_read_only', False) - self.kerberos5_i_read_write = kwargs.get('kerberos5_i_read_write', False) - self.kerberos5_p_read_only = kwargs.get('kerberos5_p_read_only', False) - self.kerberos5_p_read_write = kwargs.get('kerberos5_p_read_write', False) - self.cifs = kwargs.get('cifs', None) - self.nfsv3 = kwargs.get('nfsv3', None) - self.nfsv41 = kwargs.get('nfsv41', None) - self.allowed_clients = kwargs.get('allowed_clients', None) - self.has_root_access = kwargs.get('has_root_access', True) - self.chown_mode = kwargs.get('chown_mode', "Restricted") - - -class FilePathAvailabilityRequest(msrest.serialization.Model): - """File path availability request content - availability is based on the name and the subnetId. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. File path to verify. - :type name: str - :param subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the - delegation Microsoft.NetApp/volumes. - :type subnet_id: str - """ - - _validation = { - 'name': {'required': True}, - 'subnet_id': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'subnet_id': {'key': 'subnetId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(FilePathAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - self.subnet_id = kwargs['subnet_id'] - - -class HourlySchedule(msrest.serialization.Model): - """Hourly Schedule properties. - - :param snapshots_to_keep: Hourly snapshot count to keep. - :type snapshots_to_keep: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long - """ - - _attribute_map = { - 'snapshots_to_keep': {'key': 'snapshotsToKeep', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - 'used_bytes': {'key': 'usedBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(HourlySchedule, self).__init__(**kwargs) - self.snapshots_to_keep = kwargs.get('snapshots_to_keep', None) - self.minute = kwargs.get('minute', None) - self.used_bytes = kwargs.get('used_bytes', None) - - -class LogSpecification(msrest.serialization.Model): - """Log Definition of a single resource metric. - - :param name: - :type name: str - :param display_name: - :type display_name: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(LogSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - - -class MetricSpecification(msrest.serialization.Model): - """Metric specification of operation. - - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or ~azure.mgmt.netapp.models.MetricAggregationType] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. - :type enable_regional_mdm_account: bool - :param source_mdm_account: The source MDM account. - :type source_mdm_account: str - :param source_mdm_namespace: The source MDM namespace. - :type source_mdm_namespace: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.netapp.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - :param is_internal: Whether the metric is internal. - :type is_internal: bool - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display_name': {'key': 'displayName', 'type': 'str'}, - 'display_description': {'key': 'displayDescription', 'type': 'str'}, - 'unit': {'key': 'unit', 'type': 'str'}, - 'supported_aggregation_types': {'key': 'supportedAggregationTypes', 'type': '[str]'}, - 'supported_time_grain_types': {'key': 'supportedTimeGrainTypes', 'type': '[str]'}, - 'internal_metric_name': {'key': 'internalMetricName', 'type': 'str'}, - 'enable_regional_mdm_account': {'key': 'enableRegionalMdmAccount', 'type': 'bool'}, - 'source_mdm_account': {'key': 'sourceMdmAccount', 'type': 'str'}, - 'source_mdm_namespace': {'key': 'sourceMdmNamespace', 'type': 'str'}, - 'dimensions': {'key': 'dimensions', 'type': '[Dimension]'}, - 'aggregation_type': {'key': 'aggregationType', 'type': 'str'}, - 'fill_gap_with_zero': {'key': 'fillGapWithZero', 'type': 'bool'}, - 'category': {'key': 'category', 'type': 'str'}, - 'resource_id_dimension_name_override': {'key': 'resourceIdDimensionNameOverride', 'type': 'str'}, - 'is_internal': {'key': 'isInternal', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(MetricSpecification, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display_name = kwargs.get('display_name', None) - self.display_description = kwargs.get('display_description', None) - self.unit = kwargs.get('unit', None) - self.supported_aggregation_types = kwargs.get('supported_aggregation_types', None) - self.supported_time_grain_types = kwargs.get('supported_time_grain_types', None) - self.internal_metric_name = kwargs.get('internal_metric_name', None) - self.enable_regional_mdm_account = kwargs.get('enable_regional_mdm_account', None) - self.source_mdm_account = kwargs.get('source_mdm_account', None) - self.source_mdm_namespace = kwargs.get('source_mdm_namespace', None) - self.dimensions = kwargs.get('dimensions', None) - self.aggregation_type = kwargs.get('aggregation_type', None) - self.fill_gap_with_zero = kwargs.get('fill_gap_with_zero', None) - self.category = kwargs.get('category', None) - self.resource_id_dimension_name_override = kwargs.get('resource_id_dimension_name_override', None) - self.is_internal = kwargs.get('is_internal', None) - - -class MonthlySchedule(msrest.serialization.Model): - """Monthly Schedule properties. - - :param snapshots_to_keep: Monthly snapshot count to keep. - :type snapshots_to_keep: int - :param days_of_month: Indicates which days of the month snapshot should be taken. A comma - delimited string. - :type days_of_month: str - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long - """ - - _attribute_map = { - 'snapshots_to_keep': {'key': 'snapshotsToKeep', 'type': 'int'}, - 'days_of_month': {'key': 'daysOfMonth', 'type': 'str'}, - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - 'used_bytes': {'key': 'usedBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(MonthlySchedule, self).__init__(**kwargs) - self.snapshots_to_keep = kwargs.get('snapshots_to_keep', None) - self.days_of_month = kwargs.get('days_of_month', None) - self.hour = kwargs.get('hour', None) - self.minute = kwargs.get('minute', None) - self.used_bytes = kwargs.get('used_bytes', None) - - -class MountTarget(msrest.serialization.Model): - """Mount Target. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar mount_target_id: UUID v4 used to identify the MountTarget. - :vartype mount_target_id: str - :param file_system_id: Required. UUID v4 used to identify the MountTarget. - :type file_system_id: str - :ivar ip_address: The mount target's IPv4 address. - :vartype ip_address: str - :param smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. - :type smb_server_fqdn: str - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'mount_target_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'file_system_id': {'required': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'ip_address': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'mount_target_id': {'key': 'properties.mountTargetId', 'type': 'str'}, - 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, - 'ip_address': {'key': 'properties.ipAddress', 'type': 'str'}, - 'smb_server_fqdn': {'key': 'properties.smbServerFqdn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountTarget, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.mount_target_id = None - self.file_system_id = kwargs['file_system_id'] - self.ip_address = None - self.smb_server_fqdn = kwargs.get('smb_server_fqdn', None) - - -class MountTargetProperties(msrest.serialization.Model): - """Mount target properties. - - 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 mount_target_id: UUID v4 used to identify the MountTarget. - :vartype mount_target_id: str - :param file_system_id: Required. UUID v4 used to identify the MountTarget. - :type file_system_id: str - :ivar ip_address: The mount target's IPv4 address. - :vartype ip_address: str - :param smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. - :type smb_server_fqdn: str - """ - - _validation = { - 'mount_target_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'file_system_id': {'required': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'ip_address': {'readonly': True}, - } - - _attribute_map = { - 'mount_target_id': {'key': 'mountTargetId', 'type': 'str'}, - 'file_system_id': {'key': 'fileSystemId', 'type': 'str'}, - 'ip_address': {'key': 'ipAddress', 'type': 'str'}, - 'smb_server_fqdn': {'key': 'smbServerFqdn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MountTargetProperties, self).__init__(**kwargs) - self.mount_target_id = None - self.file_system_id = kwargs['file_system_id'] - self.ip_address = None - self.smb_server_fqdn = kwargs.get('smb_server_fqdn', None) - - -class NetAppAccount(msrest.serialization.Model): - """NetApp account resource. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.netapp.models.SystemData - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param active_directories: Active Directories. - :type active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] - :param encryption: Encryption settings. - :type encryption: ~azure.mgmt.netapp.models.AccountEncryption - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'active_directories': {'key': 'properties.activeDirectories', 'type': '[ActiveDirectory]'}, - 'encryption': {'key': 'properties.encryption', 'type': 'AccountEncryption'}, - } - - def __init__( - self, - **kwargs - ): - super(NetAppAccount, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.etag = None - self.type = None - self.tags = kwargs.get('tags', None) - self.system_data = None - self.provisioning_state = None - self.active_directories = kwargs.get('active_directories', None) - self.encryption = kwargs.get('encryption', None) - - -class NetAppAccountList(msrest.serialization.Model): - """List of NetApp account resources. - - :param value: Multiple NetApp accounts. - :type value: list[~azure.mgmt.netapp.models.NetAppAccount] - :param next_link: URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[NetAppAccount]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(NetAppAccountList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class NetAppAccountPatch(msrest.serialization.Model): - """NetApp account patch resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param active_directories: Active Directories. - :type active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] - :param encryption: Encryption settings. - :type encryption: ~azure.mgmt.netapp.models.AccountEncryption - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'active_directories': {'key': 'properties.activeDirectories', 'type': '[ActiveDirectory]'}, - 'encryption': {'key': 'properties.encryption', 'type': 'AccountEncryption'}, - } - - def __init__( - self, - **kwargs - ): - super(NetAppAccountPatch, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.provisioning_state = None - self.active_directories = kwargs.get('active_directories', None) - self.encryption = kwargs.get('encryption', None) - - -class Operation(msrest.serialization.Model): - """Microsoft.NetApp REST API operation definition. - - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.netapp.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.netapp.models.ServiceSpecification - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'service_specification': {'key': 'properties.serviceSpecification', 'type': 'ServiceSpecification'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.service_specification = kwargs.get('service_specification', None) - - -class OperationDisplay(msrest.serialization.Model): - """Display metadata associated with the operation. - - :param provider: Service provider: Microsoft NetApp. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Operation description. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class OperationListResult(msrest.serialization.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) - - -class PoolChangeRequest(msrest.serialization.Model): - """Pool change request. - - All required parameters must be populated in order to send to Azure. - - :param new_pool_resource_id: Required. Resource id of the pool to move volume to. - :type new_pool_resource_id: str - """ - - _validation = { - 'new_pool_resource_id': {'required': True}, - } - - _attribute_map = { - 'new_pool_resource_id': {'key': 'newPoolResourceId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PoolChangeRequest, self).__init__(**kwargs) - self.new_pool_resource_id = kwargs['new_pool_resource_id'] - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - - -class QuotaAvailabilityRequest(msrest.serialization.Model): - """Quota availability request content. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Name of the resource to verify. - :type name: str - :param type: Required. Resource type used for verification. Possible values include: - "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", - "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", - "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". - :type type: str or ~azure.mgmt.netapp.models.CheckQuotaNameResourceTypes - :param resource_group: Required. Resource group name. - :type resource_group: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'resource_group': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(QuotaAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.resource_group = kwargs['resource_group'] - - -class ReplicationObject(msrest.serialization.Model): - """Replication properties. - - All required parameters must be populated in order to send to Azure. - - :param replication_id: Id. - :type replication_id: str - :param endpoint_type: Indicates whether the local volume is the source or destination for the - Volume Replication. Possible values include: "src", "dst". - :type endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType - :param replication_schedule: Schedule. Possible values include: "_10minutely", "hourly", - "daily". - :type replication_schedule: str or ~azure.mgmt.netapp.models.ReplicationSchedule - :param remote_volume_resource_id: Required. The resource ID of the remote volume. - :type remote_volume_resource_id: str - :param remote_volume_region: The remote region for the other end of the Volume Replication. - :type remote_volume_region: str - """ - - _validation = { - 'remote_volume_resource_id': {'required': True}, - } - - _attribute_map = { - 'replication_id': {'key': 'replicationId', 'type': 'str'}, - 'endpoint_type': {'key': 'endpointType', 'type': 'str'}, - 'replication_schedule': {'key': 'replicationSchedule', 'type': 'str'}, - 'remote_volume_resource_id': {'key': 'remoteVolumeResourceId', 'type': 'str'}, - 'remote_volume_region': {'key': 'remoteVolumeRegion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationObject, self).__init__(**kwargs) - self.replication_id = kwargs.get('replication_id', None) - self.endpoint_type = kwargs.get('endpoint_type', None) - self.replication_schedule = kwargs.get('replication_schedule', None) - self.remote_volume_resource_id = kwargs['remote_volume_resource_id'] - self.remote_volume_region = kwargs.get('remote_volume_region', None) - - -class ReplicationStatus(msrest.serialization.Model): - """Replication status. - - :param healthy: Replication health check. - :type healthy: bool - :param relationship_status: Status of the mirror relationship. Possible values include: "Idle", - "Transferring". - :type relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus - :param mirror_state: The status of the replication. Possible values include: "Uninitialized", - "Mirrored", "Broken". - :type mirror_state: str or ~azure.mgmt.netapp.models.MirrorState - :param total_progress: The progress of the replication. - :type total_progress: str - :param error_message: Displays error message if the replication is in an error state. - :type error_message: str - """ - - _attribute_map = { - 'healthy': {'key': 'healthy', 'type': 'bool'}, - 'relationship_status': {'key': 'relationshipStatus', 'type': 'str'}, - 'mirror_state': {'key': 'mirrorState', 'type': 'str'}, - 'total_progress': {'key': 'totalProgress', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ReplicationStatus, self).__init__(**kwargs) - self.healthy = kwargs.get('healthy', None) - self.relationship_status = kwargs.get('relationship_status', None) - self.mirror_state = kwargs.get('mirror_state', None) - self.total_progress = kwargs.get('total_progress', None) - self.error_message = kwargs.get('error_message', None) - - -class ResourceIdentity(msrest.serialization.Model): - """Identity for the resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: Object id of the identity resource. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the resource. - :vartype tenant_id: str - :param type: Type of Identity. Supported values are: 'None', 'SystemAssigned'. - :type type: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - - -class ResourceNameAvailabilityRequest(msrest.serialization.Model): - """Resource name availability request content. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. Resource name to verify. - :type name: str - :param type: Required. Resource type used for verification. Possible values include: - "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", - "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", - "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". - :type type: str or ~azure.mgmt.netapp.models.CheckNameResourceTypes - :param resource_group: Required. Resource group name. - :type resource_group: str - """ - - _validation = { - 'name': {'required': True}, - 'type': {'required': True}, - 'resource_group': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'resource_group': {'key': 'resourceGroup', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) - self.name = kwargs['name'] - self.type = kwargs['type'] - self.resource_group = kwargs['resource_group'] - - -class RestoreStatus(msrest.serialization.Model): - """Restore status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar healthy: Restore health status. - :vartype healthy: bool - :ivar relationship_status: Status of the restore SnapMirror relationship. Possible values - include: "Idle", "Transferring". - :vartype relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus - :ivar mirror_state: The status of the restore. Possible values include: "Uninitialized", - "Mirrored", "Broken". - :vartype mirror_state: str or ~azure.mgmt.netapp.models.MirrorState - :ivar unhealthy_reason: Reason for the unhealthy restore relationship. - :vartype unhealthy_reason: str - :ivar error_message: Displays error message if the restore is in an error state. - :vartype error_message: str - :ivar total_transfer_bytes: Displays the total bytes transferred. - :vartype total_transfer_bytes: long - """ - - _validation = { - 'healthy': {'readonly': True}, - 'relationship_status': {'readonly': True}, - 'mirror_state': {'readonly': True}, - 'unhealthy_reason': {'readonly': True}, - 'error_message': {'readonly': True}, - 'total_transfer_bytes': {'readonly': True}, - } - - _attribute_map = { - 'healthy': {'key': 'healthy', 'type': 'bool'}, - 'relationship_status': {'key': 'relationshipStatus', 'type': 'str'}, - 'mirror_state': {'key': 'mirrorState', 'type': 'str'}, - 'unhealthy_reason': {'key': 'unhealthyReason', 'type': 'str'}, - 'error_message': {'key': 'errorMessage', 'type': 'str'}, - 'total_transfer_bytes': {'key': 'totalTransferBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(RestoreStatus, self).__init__(**kwargs) - self.healthy = None - self.relationship_status = None - self.mirror_state = None - self.unhealthy_reason = None - self.error_message = None - self.total_transfer_bytes = None - - -class ServiceSpecification(msrest.serialization.Model): - """One property of operation, include metric specifications. - - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.netapp.models.MetricSpecification] - :param log_specifications: - :type log_specifications: list[~azure.mgmt.netapp.models.LogSpecification] - """ - - _attribute_map = { - 'metric_specifications': {'key': 'metricSpecifications', 'type': '[MetricSpecification]'}, - 'log_specifications': {'key': 'logSpecifications', 'type': '[LogSpecification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceSpecification, self).__init__(**kwargs) - self.metric_specifications = kwargs.get('metric_specifications', None) - self.log_specifications = kwargs.get('log_specifications', None) - - -class Snapshot(msrest.serialization.Model): - """Snapshot of a Volume. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :ivar snapshot_id: UUID v4 used to identify the Snapshot. - :vartype snapshot_id: str - :ivar created: The creation date of the snapshot. - :vartype created: ~datetime.datetime - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'snapshot_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'created': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'str'}, - 'created': {'key': 'properties.created', 'type': 'iso-8601'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Snapshot, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.type = None - self.snapshot_id = None - self.created = None - self.provisioning_state = None - - -class SnapshotPoliciesList(msrest.serialization.Model): - """List of Snapshot Policies. - - :param value: A list of snapshot policies. - :type value: list[~azure.mgmt.netapp.models.SnapshotPolicy] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SnapshotPolicy]'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotPoliciesList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SnapshotPolicy(msrest.serialization.Model): - """Snapshot policy information. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'hourly_schedule': {'key': 'properties.hourlySchedule', 'type': 'HourlySchedule'}, - 'daily_schedule': {'key': 'properties.dailySchedule', 'type': 'DailySchedule'}, - 'weekly_schedule': {'key': 'properties.weeklySchedule', 'type': 'WeeklySchedule'}, - 'monthly_schedule': {'key': 'properties.monthlySchedule', 'type': 'MonthlySchedule'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotPolicy, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.etag = None - self.type = None - self.tags = kwargs.get('tags', None) - self.hourly_schedule = kwargs.get('hourly_schedule', None) - self.daily_schedule = kwargs.get('daily_schedule', None) - self.weekly_schedule = kwargs.get('weekly_schedule', None) - self.monthly_schedule = kwargs.get('monthly_schedule', None) - self.enabled = kwargs.get('enabled', None) - self.provisioning_state = None - - -class SnapshotPolicyDetails(msrest.serialization.Model): - """Snapshot policy properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'hourly_schedule': {'key': 'properties.hourlySchedule', 'type': 'HourlySchedule'}, - 'daily_schedule': {'key': 'properties.dailySchedule', 'type': 'DailySchedule'}, - 'weekly_schedule': {'key': 'properties.weeklySchedule', 'type': 'WeeklySchedule'}, - 'monthly_schedule': {'key': 'properties.monthlySchedule', 'type': 'MonthlySchedule'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotPolicyDetails, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.hourly_schedule = kwargs.get('hourly_schedule', None) - self.daily_schedule = kwargs.get('daily_schedule', None) - self.weekly_schedule = kwargs.get('weekly_schedule', None) - self.monthly_schedule = kwargs.get('monthly_schedule', None) - self.enabled = kwargs.get('enabled', None) - self.provisioning_state = None - - -class SnapshotPolicyPatch(msrest.serialization.Model): - """Snapshot policy Details for create and update. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'hourly_schedule': {'key': 'properties.hourlySchedule', 'type': 'HourlySchedule'}, - 'daily_schedule': {'key': 'properties.dailySchedule', 'type': 'DailySchedule'}, - 'weekly_schedule': {'key': 'properties.weeklySchedule', 'type': 'WeeklySchedule'}, - 'monthly_schedule': {'key': 'properties.monthlySchedule', 'type': 'MonthlySchedule'}, - 'enabled': {'key': 'properties.enabled', 'type': 'bool'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotPolicyPatch, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.hourly_schedule = kwargs.get('hourly_schedule', None) - self.daily_schedule = kwargs.get('daily_schedule', None) - self.weekly_schedule = kwargs.get('weekly_schedule', None) - self.monthly_schedule = kwargs.get('monthly_schedule', None) - self.enabled = kwargs.get('enabled', None) - self.provisioning_state = None - - -class SnapshotPolicyVolumeList(msrest.serialization.Model): - """Volumes associated with snapshot policy. - - :param value: List of volumes. - :type value: list[any] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[object]'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotPolicyVolumeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SnapshotsList(msrest.serialization.Model): - """List of Snapshots. - - :param value: A list of Snapshots. - :type value: list[~azure.mgmt.netapp.models.Snapshot] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Snapshot]'}, - } - - def __init__( - self, - **kwargs - ): - super(SnapshotsList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SubscriptionQuotaItem(ProxyResource): - """Information regarding Subscription Quota Item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :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. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system meta data relating to this resource. - :vartype system_data: ~azure.mgmt.netapp.models.SystemData - :ivar name_properties_name: Quota Item name. - :vartype name_properties_name: str - :ivar current: The current quota value. - :vartype current: int - :ivar default: The default quota value. - :vartype default: int - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'name_properties_name': {'readonly': True}, - 'current': {'readonly': True}, - 'default': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, - 'current': {'key': 'properties.current', 'type': 'int'}, - 'default': {'key': 'properties.default', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionQuotaItem, self).__init__(**kwargs) - self.system_data = None - self.name_properties_name = None - self.current = None - self.default = None - - -class SubscriptionQuotaItemList(msrest.serialization.Model): - """List of Subscription Quota Items. - - :param value: A list of SubscriptionQuotaItems. - :type value: list[~azure.mgmt.netapp.models.SubscriptionQuotaItem] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[SubscriptionQuotaItem]'}, - } - - def __init__( - self, - **kwargs - ): - super(SubscriptionQuotaItemList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Vault(msrest.serialization.Model): - """Vault information. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param vault_name: Vault Name. - :type vault_name: str - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'vault_name': {'key': 'properties.vaultName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Vault, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.type = None - self.vault_name = kwargs.get('vault_name', None) - - -class VaultList(msrest.serialization.Model): - """List of Vaults. - - :param value: A list of vaults. - :type value: list[~azure.mgmt.netapp.models.Vault] - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Vault]'}, - } - - def __init__( - self, - **kwargs - ): - super(VaultList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - - -class Volume(msrest.serialization.Model): - """Volume resource. - - 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 location: Required. Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar etag: A unique read-only string that changes whenever the resource is updated. - :vartype etag: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar file_system_id: Unique FileSystem Identifier. - :vartype file_system_id: str - :param creation_token: Required. A unique file path for the volume. Used when creating mount - targets. - :type creation_token: str - :param service_level: The service level of the file system. Possible values include: - "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel - :param usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. - This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. - Specified in bytes. - :type usage_threshold: long - :param export_policy: Set of export policy rules. - :type export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy - :param protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. - :type protocol_types: list[str] - :ivar provisioning_state: Azure lifecycle management. - :vartype provisioning_state: str - :param snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. - :type snapshot_id: str - :param backup_id: UUID v4 or resource identifier used to identify the Backup. - :type backup_id: str - :ivar baremetal_tenant_id: Unique Baremetal Tenant Identifier. - :vartype baremetal_tenant_id: str - :param subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the - delegation Microsoft.NetApp/volumes. - :type subnet_id: str - :param network_features: Basic network, or Standard features available to the volume. Possible - values include: "Basic", "Standard". Default value: "Basic". - :type network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures - :ivar network_sibling_set_id: Network Sibling Set ID for the the group of volumes sharing - networking resources. - :vartype network_sibling_set_id: str - :ivar storage_to_network_proximity: Provides storage to network proximity information for the - volume. Possible values include: "Default", "T1", "T2". - :vartype storage_to_network_proximity: str or - ~azure.mgmt.netapp.models.VolumeStorageToNetworkProximity - :ivar mount_targets: List of mount targets. - :vartype mount_targets: list[~azure.mgmt.netapp.models.MountTargetProperties] - :param volume_type: What type of volume is this. For destination volumes in Cross Region - Replication, set type to DataProtection. - :type volume_type: str - :param data_protection: DataProtection type volumes include an object containing details of the - replication. - :type data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection - :param is_restoring: Restoring. - :type is_restoring: bool - :param snapshot_directory_visible: If enabled (true) the volume will contain a read-only - snapshot directory which provides access to each of the volume's snapshots (default to true). - :type snapshot_directory_visible: bool - :param kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger - version 2020-05-01 or later. - :type kerberos_enabled: bool - :param security_style: The security style of volume, default unix, defaults to ntfs for dual - protocol or CIFS protocol. Possible values include: "ntfs", "unix". Default value: "unix". - :type security_style: str or ~azure.mgmt.netapp.models.SecurityStyle - :param smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for - SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - :type smb_encryption: bool - :param smb_continuously_available: Enables continuously available share property for smb - volume. Only applicable for SMB volume. - :type smb_continuously_available: bool - :param throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume. - :type throughput_mibps: float - :param encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - :type encryption_key_source: str - :param ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. - :type ldap_enabled: bool - :param cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. - :type cool_access: bool - :param coolness_period: Specifies the number of days after which data that is not accessed by - clients will be tiered. - :type coolness_period: int - :param unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. - First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second - digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third - selects permissions for other users in the same group. the fourth for other users not in the - group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other - users. - :type unix_permissions: str - :ivar clone_progress: When a volume is being restored from another volume's snapshot, will show - the percentage completion of this cloning process. When this value is empty/null there is no - cloning process currently happening on this volume. This value will update every 5 minutes - during cloning. - :vartype clone_progress: int - :param avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution (AVS) - datastore purpose. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore - :param is_default_quota_enabled: Specifies if default quota is enabled for the volume. - :type is_default_quota_enabled: bool - :param default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If - isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - :type default_user_quota_in_ki_bs: long - :param default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If - isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - :type default_group_quota_in_ki_bs: long - """ - - _validation = { - 'location': {'required': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'etag': {'readonly': True}, - 'type': {'readonly': True}, - 'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'}, - 'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400}, - 'provisioning_state': {'readonly': True}, - 'snapshot_id': {'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$'}, - 'backup_id': {'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$'}, - 'baremetal_tenant_id': {'readonly': True}, - 'subnet_id': {'required': True}, - 'network_sibling_set_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'storage_to_network_proximity': {'readonly': True}, - 'mount_targets': {'readonly': True}, - 'throughput_mibps': {'maximum': 4500, 'minimum': 0}, - 'coolness_period': {'maximum': 63, 'minimum': 7}, - 'unix_permissions': {'max_length': 4, 'min_length': 4}, - 'clone_progress': {'readonly': True}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, - 'creation_token': {'key': 'properties.creationToken', 'type': 'str'}, - 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, - 'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'}, - 'export_policy': {'key': 'properties.exportPolicy', 'type': 'VolumePropertiesExportPolicy'}, - 'protocol_types': {'key': 'properties.protocolTypes', 'type': '[str]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'str'}, - 'backup_id': {'key': 'properties.backupId', 'type': 'str'}, - 'baremetal_tenant_id': {'key': 'properties.baremetalTenantId', 'type': 'str'}, - 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, - 'network_features': {'key': 'properties.networkFeatures', 'type': 'str'}, - 'network_sibling_set_id': {'key': 'properties.networkSiblingSetId', 'type': 'str'}, - 'storage_to_network_proximity': {'key': 'properties.storageToNetworkProximity', 'type': 'str'}, - 'mount_targets': {'key': 'properties.mountTargets', 'type': '[MountTargetProperties]'}, - 'volume_type': {'key': 'properties.volumeType', 'type': 'str'}, - 'data_protection': {'key': 'properties.dataProtection', 'type': 'VolumePropertiesDataProtection'}, - 'is_restoring': {'key': 'properties.isRestoring', 'type': 'bool'}, - 'snapshot_directory_visible': {'key': 'properties.snapshotDirectoryVisible', 'type': 'bool'}, - 'kerberos_enabled': {'key': 'properties.kerberosEnabled', 'type': 'bool'}, - 'security_style': {'key': 'properties.securityStyle', 'type': 'str'}, - 'smb_encryption': {'key': 'properties.smbEncryption', 'type': 'bool'}, - 'smb_continuously_available': {'key': 'properties.smbContinuouslyAvailable', 'type': 'bool'}, - 'throughput_mibps': {'key': 'properties.throughputMibps', 'type': 'float'}, - 'encryption_key_source': {'key': 'properties.encryptionKeySource', 'type': 'str'}, - 'ldap_enabled': {'key': 'properties.ldapEnabled', 'type': 'bool'}, - 'cool_access': {'key': 'properties.coolAccess', 'type': 'bool'}, - 'coolness_period': {'key': 'properties.coolnessPeriod', 'type': 'int'}, - 'unix_permissions': {'key': 'properties.unixPermissions', 'type': 'str'}, - 'clone_progress': {'key': 'properties.cloneProgress', 'type': 'int'}, - 'avs_data_store': {'key': 'properties.avsDataStore', 'type': 'str'}, - 'is_default_quota_enabled': {'key': 'properties.isDefaultQuotaEnabled', 'type': 'bool'}, - 'default_user_quota_in_ki_bs': {'key': 'properties.defaultUserQuotaInKiBs', 'type': 'long'}, - 'default_group_quota_in_ki_bs': {'key': 'properties.defaultGroupQuotaInKiBs', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(Volume, self).__init__(**kwargs) - self.location = kwargs['location'] - self.id = None - self.name = None - self.etag = None - self.type = None - self.tags = kwargs.get('tags', None) - self.file_system_id = None - self.creation_token = kwargs['creation_token'] - self.service_level = kwargs.get('service_level', "Premium") - self.usage_threshold = kwargs.get('usage_threshold', 107374182400) - self.export_policy = kwargs.get('export_policy', None) - self.protocol_types = kwargs.get('protocol_types', None) - self.provisioning_state = None - self.snapshot_id = kwargs.get('snapshot_id', None) - self.backup_id = kwargs.get('backup_id', None) - self.baremetal_tenant_id = None - self.subnet_id = kwargs['subnet_id'] - self.network_features = kwargs.get('network_features', "Basic") - self.network_sibling_set_id = None - self.storage_to_network_proximity = None - self.mount_targets = None - self.volume_type = kwargs.get('volume_type', None) - self.data_protection = kwargs.get('data_protection', None) - self.is_restoring = kwargs.get('is_restoring', None) - self.snapshot_directory_visible = kwargs.get('snapshot_directory_visible', True) - self.kerberos_enabled = kwargs.get('kerberos_enabled', False) - self.security_style = kwargs.get('security_style', "unix") - self.smb_encryption = kwargs.get('smb_encryption', False) - self.smb_continuously_available = kwargs.get('smb_continuously_available', False) - self.throughput_mibps = kwargs.get('throughput_mibps', 0) - self.encryption_key_source = kwargs.get('encryption_key_source', None) - self.ldap_enabled = kwargs.get('ldap_enabled', False) - self.cool_access = kwargs.get('cool_access', False) - self.coolness_period = kwargs.get('coolness_period', None) - self.unix_permissions = kwargs.get('unix_permissions', "0770") - self.clone_progress = None - self.avs_data_store = kwargs.get('avs_data_store', "Disabled") - self.is_default_quota_enabled = kwargs.get('is_default_quota_enabled', False) - self.default_user_quota_in_ki_bs = kwargs.get('default_user_quota_in_ki_bs', 0) - self.default_group_quota_in_ki_bs = kwargs.get('default_group_quota_in_ki_bs', 0) - - -class VolumeBackupProperties(msrest.serialization.Model): - """Volume Backup Properties. - - :param backup_policy_id: Backup Policy Resource ID. - :type backup_policy_id: str - :param policy_enforced: Policy Enforced. - :type policy_enforced: bool - :param vault_id: Vault Resource ID. - :type vault_id: str - :param backup_enabled: Backup Enabled. - :type backup_enabled: bool - """ - - _attribute_map = { - 'backup_policy_id': {'key': 'backupPolicyId', 'type': 'str'}, - 'policy_enforced': {'key': 'policyEnforced', 'type': 'bool'}, - 'vault_id': {'key': 'vaultId', 'type': 'str'}, - 'backup_enabled': {'key': 'backupEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeBackupProperties, self).__init__(**kwargs) - self.backup_policy_id = kwargs.get('backup_policy_id', None) - self.policy_enforced = kwargs.get('policy_enforced', None) - self.vault_id = kwargs.get('vault_id', None) - self.backup_enabled = kwargs.get('backup_enabled', None) - - -class VolumeBackups(msrest.serialization.Model): - """Volume details using the backup policy. - - :param volume_name: Volume name. - :type volume_name: str - :param backups_count: Total count of backups for volume. - :type backups_count: int - :param policy_enabled: Policy enabled. - :type policy_enabled: bool - """ - - _attribute_map = { - 'volume_name': {'key': 'volumeName', 'type': 'str'}, - 'backups_count': {'key': 'backupsCount', 'type': 'int'}, - 'policy_enabled': {'key': 'policyEnabled', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeBackups, self).__init__(**kwargs) - self.volume_name = kwargs.get('volume_name', None) - self.backups_count = kwargs.get('backups_count', None) - self.policy_enabled = kwargs.get('policy_enabled', None) - - -class VolumeList(msrest.serialization.Model): - """List of volume resources. - - :param value: List of volumes. - :type value: list[~azure.mgmt.netapp.models.Volume] - :param next_link: URL to get the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Volume]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class VolumePatch(msrest.serialization.Model): - """Volume patch resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param location: Resource location. - :type location: str - :ivar id: Resource Id. - :vartype id: str - :ivar name: Resource name. - :vartype name: str - :ivar type: Resource type. - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param service_level: The service level of the file system. Possible values include: - "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel - :param usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a - soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in - bytes. - :type usage_threshold: long - :param export_policy: Set of export policy rules. - :type export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy - :param throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume. - :type throughput_mibps: float - :param data_protection: DataProtection type volumes include an object containing details of the - replication. - :type data_protection: ~azure.mgmt.netapp.models.VolumePatchPropertiesDataProtection - :param is_default_quota_enabled: Specifies if default quota is enabled for the volume. - :type is_default_quota_enabled: bool - :param default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If - isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - :type default_user_quota_in_ki_bs: long - :param default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If - isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - :type default_group_quota_in_ki_bs: long - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'usage_threshold': {'maximum': 109951162777600, 'minimum': 107374182400}, - 'throughput_mibps': {'maximum': 4500, 'minimum': 1}, - } - - _attribute_map = { - 'location': {'key': 'location', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, - 'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'}, - 'export_policy': {'key': 'properties.exportPolicy', 'type': 'VolumePatchPropertiesExportPolicy'}, - 'throughput_mibps': {'key': 'properties.throughputMibps', 'type': 'float'}, - 'data_protection': {'key': 'properties.dataProtection', 'type': 'VolumePatchPropertiesDataProtection'}, - 'is_default_quota_enabled': {'key': 'properties.isDefaultQuotaEnabled', 'type': 'bool'}, - 'default_user_quota_in_ki_bs': {'key': 'properties.defaultUserQuotaInKiBs', 'type': 'long'}, - 'default_group_quota_in_ki_bs': {'key': 'properties.defaultGroupQuotaInKiBs', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumePatch, self).__init__(**kwargs) - self.location = kwargs.get('location', None) - self.id = None - self.name = None - self.type = None - self.tags = kwargs.get('tags', None) - self.service_level = kwargs.get('service_level', "Premium") - self.usage_threshold = kwargs.get('usage_threshold', 107374182400) - self.export_policy = kwargs.get('export_policy', None) - self.throughput_mibps = kwargs.get('throughput_mibps', None) - self.data_protection = kwargs.get('data_protection', None) - self.is_default_quota_enabled = kwargs.get('is_default_quota_enabled', False) - self.default_user_quota_in_ki_bs = kwargs.get('default_user_quota_in_ki_bs', 0) - self.default_group_quota_in_ki_bs = kwargs.get('default_group_quota_in_ki_bs', 0) - - -class VolumePatchPropertiesDataProtection(msrest.serialization.Model): - """DataProtection type volumes include an object containing details of the replication. - - :param backup: Backup Properties. - :type backup: ~azure.mgmt.netapp.models.VolumeBackupProperties - :param snapshot: Snapshot properties. - :type snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties - """ - - _attribute_map = { - 'backup': {'key': 'backup', 'type': 'VolumeBackupProperties'}, - 'snapshot': {'key': 'snapshot', 'type': 'VolumeSnapshotProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumePatchPropertiesDataProtection, self).__init__(**kwargs) - self.backup = kwargs.get('backup', None) - self.snapshot = kwargs.get('snapshot', None) - - -class VolumePatchPropertiesExportPolicy(msrest.serialization.Model): - """Set of export policy rules. - - :param rules: Export policy rule. - :type rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ExportPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumePatchPropertiesExportPolicy, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - - -class VolumePropertiesDataProtection(msrest.serialization.Model): - """DataProtection type volumes include an object containing details of the replication. - - :param backup: Backup Properties. - :type backup: ~azure.mgmt.netapp.models.VolumeBackupProperties - :param replication: Replication properties. - :type replication: ~azure.mgmt.netapp.models.ReplicationObject - :param snapshot: Snapshot properties. - :type snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties - """ - - _attribute_map = { - 'backup': {'key': 'backup', 'type': 'VolumeBackupProperties'}, - 'replication': {'key': 'replication', 'type': 'ReplicationObject'}, - 'snapshot': {'key': 'snapshot', 'type': 'VolumeSnapshotProperties'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumePropertiesDataProtection, self).__init__(**kwargs) - self.backup = kwargs.get('backup', None) - self.replication = kwargs.get('replication', None) - self.snapshot = kwargs.get('snapshot', None) - - -class VolumePropertiesExportPolicy(msrest.serialization.Model): - """Set of export policy rules. - - :param rules: Export policy rule. - :type rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] - """ - - _attribute_map = { - 'rules': {'key': 'rules', 'type': '[ExportPolicyRule]'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumePropertiesExportPolicy, self).__init__(**kwargs) - self.rules = kwargs.get('rules', None) - - -class VolumeRevert(msrest.serialization.Model): - """revert a volume to the snapshot. - - :param snapshot_id: Resource id of the snapshot. - :type snapshot_id: str - """ - - _attribute_map = { - 'snapshot_id': {'key': 'snapshotId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeRevert, self).__init__(**kwargs) - self.snapshot_id = kwargs.get('snapshot_id', None) - - -class VolumeSnapshotProperties(msrest.serialization.Model): - """Volume Snapshot Properties. - - :param snapshot_policy_id: Snapshot Policy ResourceId. - :type snapshot_policy_id: str - """ - - _attribute_map = { - 'snapshot_policy_id': {'key': 'snapshotPolicyId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(VolumeSnapshotProperties, self).__init__(**kwargs) - self.snapshot_policy_id = kwargs.get('snapshot_policy_id', None) - - -class WeeklySchedule(msrest.serialization.Model): - """Weekly Schedule properties, make a snapshot every week at a specific day or days. - - :param snapshots_to_keep: Weekly snapshot count to keep. - :type snapshots_to_keep: int - :param day: Indicates which weekdays snapshot should be taken, accepts a comma separated list - of week day names in english. - :type day: str - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long - """ - - _attribute_map = { - 'snapshots_to_keep': {'key': 'snapshotsToKeep', 'type': 'int'}, - 'day': {'key': 'day', 'type': 'str'}, - 'hour': {'key': 'hour', 'type': 'int'}, - 'minute': {'key': 'minute', 'type': 'int'}, - 'used_bytes': {'key': 'usedBytes', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(WeeklySchedule, self).__init__(**kwargs) - self.snapshots_to_keep = kwargs.get('snapshots_to_keep', None) - self.day = kwargs.get('day', None) - self.hour = kwargs.get('hour', None) - self.minute = kwargs.get('minute', None) - self.used_bytes = kwargs.get('used_bytes', None) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py index d2dddd6fb4ed..c8239b06064b 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Any, Dict, List, Optional, Union +from typing import Dict, List, Optional, Union import msrest.serialization @@ -17,8 +17,8 @@ class AccountEncryption(msrest.serialization.Model): """Encryption settings. - :param key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - :type key_source: str + :ivar key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :vartype key_source: str """ _attribute_map = { @@ -31,6 +31,10 @@ def __init__( key_source: Optional[str] = None, **kwargs ): + """ + :keyword key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :paramtype key_source: str + """ super(AccountEncryption, self).__init__(**kwargs) self.key_source = key_source @@ -40,60 +44,63 @@ class ActiveDirectory(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param active_directory_id: Id of the Active Directory. - :type active_directory_id: str - :param username: Username of Active Directory domain administrator. - :type username: str - :param password: Plain text password of Active Directory domain administrator, value is masked + :ivar active_directory_id: Id of the Active Directory. + :vartype active_directory_id: str + :ivar username: Username of Active Directory domain administrator. + :vartype username: str + :ivar password: Plain text password of Active Directory domain administrator, value is masked in the response. - :type password: str - :param domain: Name of the Active Directory domain. - :type domain: str - :param dns: Comma separated list of DNS server IP addresses (IPv4 only) for the Active - Directory domain. - :type dns: str + :vartype password: str + :ivar domain: Name of the Active Directory domain. + :vartype domain: str + :ivar dns: Comma separated list of DNS server IP addresses (IPv4 only) for the Active Directory + domain. + :vartype dns: str :ivar status: Status of the Active Directory. Possible values include: "Created", "InUse", "Deleted", "Error", "Updating". :vartype status: str or ~azure.mgmt.netapp.models.ActiveDirectoryStatus :ivar status_details: Any details in regards to the Status of the Active Directory. :vartype status_details: str - :param smb_server_name: NetBIOS name of the SMB server. This name will be registered as a + :ivar smb_server_name: NetBIOS name of the SMB server. This name will be registered as a computer account in the AD and used to mount volumes. - :type smb_server_name: str - :param organizational_unit: The Organizational Unit (OU) within the Windows Active Directory. - :type organizational_unit: str - :param site: The Active Directory site the service will limit Domain Controller discovery to. - :type site: str - :param backup_operators: Users to be added to the Built-in Backup Operator active directory + :vartype smb_server_name: str + :ivar organizational_unit: The Organizational Unit (OU) within the Windows Active Directory. + :vartype organizational_unit: str + :ivar site: The Active Directory site the service will limit Domain Controller discovery to. + :vartype site: str + :ivar backup_operators: Users to be added to the Built-in Backup Operator active directory group. A list of unique usernames without domain specifier. - :type backup_operators: list[str] - :param administrators: Users to be added to the Built-in Administrators active directory group. + :vartype backup_operators: list[str] + :ivar administrators: Users to be added to the Built-in Administrators active directory group. A list of unique usernames without domain specifier. - :type administrators: list[str] - :param kdc_ip: kdc server IP addresses for the active directory machine. This optional - parameter is used only while creating kerberos volume. - :type kdc_ip: str - :param ad_name: Name of the active directory machine. This optional parameter is used only - while creating kerberos volume. - :type ad_name: str - :param server_root_ca_certificate: When LDAP over SSL/TLS is enabled, the LDAP client is + :vartype administrators: list[str] + :ivar kdc_ip: kdc server IP addresses for the active directory machine. This optional parameter + is used only while creating kerberos volume. + :vartype kdc_ip: str + :ivar ad_name: Name of the active directory machine. This optional parameter is used only while + creating kerberos volume. + :vartype ad_name: str + :ivar server_root_ca_certificate: When LDAP over SSL/TLS is enabled, the LDAP client is required to have base64 encoded Active Directory Certificate Service's self-signed root CA certificate, this optional parameter is used only for dual protocol with LDAP user-mapping volumes. - :type server_root_ca_certificate: str - :param aes_encryption: If enabled, AES encryption will be enabled for SMB communication. - :type aes_encryption: bool - :param ldap_signing: Specifies whether or not the LDAP traffic needs to be signed. - :type ldap_signing: bool - :param security_operators: Domain Users in the Active directory to be given SeSecurityPrivilege + :vartype server_root_ca_certificate: str + :ivar aes_encryption: If enabled, AES encryption will be enabled for SMB communication. + :vartype aes_encryption: bool + :ivar ldap_signing: Specifies whether or not the LDAP traffic needs to be signed. + :vartype ldap_signing: bool + :ivar security_operators: Domain Users in the Active directory to be given SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of unique usernames without domain specifier. - :type security_operators: list[str] - :param ldap_over_tls: Specifies whether or not the LDAP traffic needs to be secured via TLS. - :type ldap_over_tls: bool - :param allow_local_nfs_users_with_ldap: If enabled, NFS client local users can also (in - addition to LDAP users) access the NFS volumes. - :type allow_local_nfs_users_with_ldap: bool + :vartype security_operators: list[str] + :ivar ldap_over_tls: Specifies whether or not the LDAP traffic needs to be secured via TLS. + :vartype ldap_over_tls: bool + :ivar allow_local_nfs_users_with_ldap: If enabled, NFS client local users can also (in addition + to LDAP users) access the NFS volumes. + :vartype allow_local_nfs_users_with_ldap: bool + :ivar encrypt_dc_connections: If enabled, Traffic between the SMB server to Domain Controller + (DC) will be encrypted. + :vartype encrypt_dc_connections: bool """ _validation = { @@ -126,6 +133,7 @@ class ActiveDirectory(msrest.serialization.Model): 'security_operators': {'key': 'securityOperators', 'type': '[str]'}, 'ldap_over_tls': {'key': 'ldapOverTLS', 'type': 'bool'}, 'allow_local_nfs_users_with_ldap': {'key': 'allowLocalNfsUsersWithLdap', 'type': 'bool'}, + 'encrypt_dc_connections': {'key': 'encryptDCConnections', 'type': 'bool'}, } def __init__( @@ -149,8 +157,63 @@ def __init__( security_operators: Optional[List[str]] = None, ldap_over_tls: Optional[bool] = None, allow_local_nfs_users_with_ldap: Optional[bool] = None, + encrypt_dc_connections: Optional[bool] = None, **kwargs ): + """ + :keyword active_directory_id: Id of the Active Directory. + :paramtype active_directory_id: str + :keyword username: Username of Active Directory domain administrator. + :paramtype username: str + :keyword password: Plain text password of Active Directory domain administrator, value is + masked in the response. + :paramtype password: str + :keyword domain: Name of the Active Directory domain. + :paramtype domain: str + :keyword dns: Comma separated list of DNS server IP addresses (IPv4 only) for the Active + Directory domain. + :paramtype dns: str + :keyword smb_server_name: NetBIOS name of the SMB server. This name will be registered as a + computer account in the AD and used to mount volumes. + :paramtype smb_server_name: str + :keyword organizational_unit: The Organizational Unit (OU) within the Windows Active Directory. + :paramtype organizational_unit: str + :keyword site: The Active Directory site the service will limit Domain Controller discovery to. + :paramtype site: str + :keyword backup_operators: Users to be added to the Built-in Backup Operator active directory + group. A list of unique usernames without domain specifier. + :paramtype backup_operators: list[str] + :keyword administrators: Users to be added to the Built-in Administrators active directory + group. A list of unique usernames without domain specifier. + :paramtype administrators: list[str] + :keyword kdc_ip: kdc server IP addresses for the active directory machine. This optional + parameter is used only while creating kerberos volume. + :paramtype kdc_ip: str + :keyword ad_name: Name of the active directory machine. This optional parameter is used only + while creating kerberos volume. + :paramtype ad_name: str + :keyword server_root_ca_certificate: When LDAP over SSL/TLS is enabled, the LDAP client is + required to have base64 encoded Active Directory Certificate Service's self-signed root CA + certificate, this optional parameter is used only for dual protocol with LDAP user-mapping + volumes. + :paramtype server_root_ca_certificate: str + :keyword aes_encryption: If enabled, AES encryption will be enabled for SMB communication. + :paramtype aes_encryption: bool + :keyword ldap_signing: Specifies whether or not the LDAP traffic needs to be signed. + :paramtype ldap_signing: bool + :keyword security_operators: Domain Users in the Active directory to be given + SeSecurityPrivilege privilege (Needed for SMB Continuously available shares for SQL). A list of + unique usernames without domain specifier. + :paramtype security_operators: list[str] + :keyword ldap_over_tls: Specifies whether or not the LDAP traffic needs to be secured via TLS. + :paramtype ldap_over_tls: bool + :keyword allow_local_nfs_users_with_ldap: If enabled, NFS client local users can also (in + addition to LDAP users) access the NFS volumes. + :paramtype allow_local_nfs_users_with_ldap: bool + :keyword encrypt_dc_connections: If enabled, Traffic between the SMB server to Domain + Controller (DC) will be encrypted. + :paramtype encrypt_dc_connections: bool + """ super(ActiveDirectory, self).__init__(**kwargs) self.active_directory_id = active_directory_id self.username = username @@ -172,13 +235,14 @@ def __init__( self.security_operators = security_operators self.ldap_over_tls = ldap_over_tls self.allow_local_nfs_users_with_ldap = allow_local_nfs_users_with_ldap + self.encrypt_dc_connections = encrypt_dc_connections class AuthorizeRequest(msrest.serialization.Model): """Authorize request. - :param remote_volume_resource_id: Resource id of the remote volume. - :type remote_volume_resource_id: str + :ivar remote_volume_resource_id: Resource id of the remote volume. + :vartype remote_volume_resource_id: str """ _attribute_map = { @@ -191,6 +255,10 @@ def __init__( remote_volume_resource_id: Optional[str] = None, **kwargs ): + """ + :keyword remote_volume_resource_id: Resource id of the remote volume. + :paramtype remote_volume_resource_id: str + """ super(AuthorizeRequest, self).__init__(**kwargs) self.remote_volume_resource_id = remote_volume_resource_id @@ -202,8 +270,8 @@ class Backup(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -218,8 +286,8 @@ class Backup(msrest.serialization.Model): :vartype provisioning_state: str :ivar size: Size of backup. :vartype size: long - :param label: Label for backup. - :type label: str + :ivar label: Label for backup. + :vartype label: str :ivar backup_type: Type of backup Manual or Scheduled. Possible values include: "Manual", "Scheduled". :vartype backup_type: str or ~azure.mgmt.netapp.models.BackupType @@ -227,9 +295,9 @@ class Backup(msrest.serialization.Model): :vartype failure_reason: str :ivar volume_name: Volume name. :vartype volume_name: str - :param use_existing_snapshot: Manual backup an already existing snapshot. This will always be + :ivar use_existing_snapshot: Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. - :type use_existing_snapshot: bool + :vartype use_existing_snapshot: bool """ _validation = { @@ -270,6 +338,15 @@ def __init__( use_existing_snapshot: Optional[bool] = False, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword label: Label for backup. + :paramtype label: str + :keyword use_existing_snapshot: Manual backup an already existing snapshot. This will always be + false for scheduled backups and true/false for manual backups. + :paramtype use_existing_snapshot: bool + """ super(Backup, self).__init__(**kwargs) self.location = location self.id = None @@ -291,8 +368,8 @@ class BackupPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar backup_id: UUID v4 used to identify the Backup. :vartype backup_id: str :ivar creation_date: The creation date of the backup. @@ -301,8 +378,8 @@ class BackupPatch(msrest.serialization.Model): :vartype provisioning_state: str :ivar size: Size of backup. :vartype size: long - :param label: Label for backup. - :type label: str + :ivar label: Label for backup. + :vartype label: str :ivar backup_type: Type of backup Manual or Scheduled. Possible values include: "Manual", "Scheduled". :vartype backup_type: str or ~azure.mgmt.netapp.models.BackupType @@ -310,9 +387,9 @@ class BackupPatch(msrest.serialization.Model): :vartype failure_reason: str :ivar volume_name: Volume name. :vartype volume_name: str - :param use_existing_snapshot: Manual backup an already existing snapshot. This will always be + :ivar use_existing_snapshot: Manual backup an already existing snapshot. This will always be false for scheduled backups and true/false for manual backups. - :type use_existing_snapshot: bool + :vartype use_existing_snapshot: bool """ _validation = { @@ -346,6 +423,15 @@ def __init__( use_existing_snapshot: Optional[bool] = False, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword label: Label for backup. + :paramtype label: str + :keyword use_existing_snapshot: Manual backup an already existing snapshot. This will always be + false for scheduled backups and true/false for manual backups. + :paramtype use_existing_snapshot: bool + """ super(BackupPatch, self).__init__(**kwargs) self.tags = tags self.backup_id = None @@ -362,8 +448,8 @@ def __init__( class BackupPoliciesList(msrest.serialization.Model): """List of Backup Policies. - :param value: A list of backup policies. - :type value: list[~azure.mgmt.netapp.models.BackupPolicy] + :ivar value: A list of backup policies. + :vartype value: list[~azure.mgmt.netapp.models.BackupPolicy] """ _attribute_map = { @@ -376,6 +462,10 @@ def __init__( value: Optional[List["BackupPolicy"]] = None, **kwargs ): + """ + :keyword value: A list of backup policies. + :paramtype value: list[~azure.mgmt.netapp.models.BackupPolicy] + """ super(BackupPoliciesList, self).__init__(**kwargs) self.value = value @@ -387,8 +477,8 @@ class BackupPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -397,24 +487,22 @@ class BackupPolicy(msrest.serialization.Model): :vartype etag: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar backup_policy_id: Backup Policy Resource ID. :vartype backup_policy_id: str :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int + :ivar daily_backups_to_keep: Daily backups count to keep. + :vartype daily_backups_to_keep: int + :ivar weekly_backups_to_keep: Weekly backups count to keep. + :vartype weekly_backups_to_keep: int + :ivar monthly_backups_to_keep: Monthly backups count to keep. + :vartype monthly_backups_to_keep: int :ivar volumes_assigned: Volumes using current backup policy. :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar volume_backups: A list of volumes assigned to this policy. :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] """ @@ -425,7 +513,6 @@ class BackupPolicy(msrest.serialization.Model): 'name': {'readonly': True}, 'etag': {'readonly': True}, 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, 'backup_policy_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'volumes_assigned': {'readonly': True}, @@ -439,7 +526,6 @@ class BackupPolicy(msrest.serialization.Model): 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, @@ -461,6 +547,20 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword daily_backups_to_keep: Daily backups count to keep. + :paramtype daily_backups_to_keep: int + :keyword weekly_backups_to_keep: Weekly backups count to keep. + :paramtype weekly_backups_to_keep: int + :keyword monthly_backups_to_keep: Monthly backups count to keep. + :paramtype monthly_backups_to_keep: int + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(BackupPolicy, self).__init__(**kwargs) self.location = location self.id = None @@ -468,7 +568,6 @@ def __init__( self.etag = None self.type = None self.tags = tags - self.name_properties_name = None self.backup_policy_id = None self.provisioning_state = None self.daily_backups_to_keep = daily_backups_to_keep @@ -484,32 +583,30 @@ class BackupPolicyDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar backup_policy_id: Backup Policy Resource ID. :vartype backup_policy_id: str :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int + :ivar daily_backups_to_keep: Daily backups count to keep. + :vartype daily_backups_to_keep: int + :ivar weekly_backups_to_keep: Weekly backups count to keep. + :vartype weekly_backups_to_keep: int + :ivar monthly_backups_to_keep: Monthly backups count to keep. + :vartype monthly_backups_to_keep: int :ivar volumes_assigned: Volumes using current backup policy. :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar volume_backups: A list of volumes assigned to this policy. :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] """ @@ -518,7 +615,6 @@ class BackupPolicyDetails(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, 'backup_policy_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'volumes_assigned': {'readonly': True}, @@ -531,7 +627,6 @@ class BackupPolicyDetails(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, @@ -553,13 +648,26 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword daily_backups_to_keep: Daily backups count to keep. + :paramtype daily_backups_to_keep: int + :keyword weekly_backups_to_keep: Weekly backups count to keep. + :paramtype weekly_backups_to_keep: int + :keyword monthly_backups_to_keep: Monthly backups count to keep. + :paramtype monthly_backups_to_keep: int + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(BackupPolicyDetails, self).__init__(**kwargs) self.location = location self.id = None self.name = None self.type = None self.tags = tags - self.name_properties_name = None self.backup_policy_id = None self.provisioning_state = None self.daily_backups_to_keep = daily_backups_to_keep @@ -575,32 +683,30 @@ class BackupPolicyPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :ivar name_properties_name: Name of backup policy. - :vartype name_properties_name: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar backup_policy_id: Backup Policy Resource ID. :vartype backup_policy_id: str :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param daily_backups_to_keep: Daily backups count to keep. - :type daily_backups_to_keep: int - :param weekly_backups_to_keep: Weekly backups count to keep. - :type weekly_backups_to_keep: int - :param monthly_backups_to_keep: Monthly backups count to keep. - :type monthly_backups_to_keep: int + :ivar daily_backups_to_keep: Daily backups count to keep. + :vartype daily_backups_to_keep: int + :ivar weekly_backups_to_keep: Weekly backups count to keep. + :vartype weekly_backups_to_keep: int + :ivar monthly_backups_to_keep: Monthly backups count to keep. + :vartype monthly_backups_to_keep: int :ivar volumes_assigned: Volumes using current backup policy. :vartype volumes_assigned: int - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar volume_backups: A list of volumes assigned to this policy. :vartype volume_backups: list[~azure.mgmt.netapp.models.VolumeBackups] """ @@ -609,7 +715,6 @@ class BackupPolicyPatch(msrest.serialization.Model): 'id': {'readonly': True}, 'name': {'readonly': True}, 'type': {'readonly': True}, - 'name_properties_name': {'readonly': True}, 'backup_policy_id': {'readonly': True}, 'provisioning_state': {'readonly': True}, 'volumes_assigned': {'readonly': True}, @@ -622,7 +727,6 @@ class BackupPolicyPatch(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'backup_policy_id': {'key': 'properties.backupPolicyId', 'type': 'str'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, 'daily_backups_to_keep': {'key': 'properties.dailyBackupsToKeep', 'type': 'int'}, @@ -644,13 +748,26 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword daily_backups_to_keep: Daily backups count to keep. + :paramtype daily_backups_to_keep: int + :keyword weekly_backups_to_keep: Weekly backups count to keep. + :paramtype weekly_backups_to_keep: int + :keyword monthly_backups_to_keep: Monthly backups count to keep. + :paramtype monthly_backups_to_keep: int + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(BackupPolicyPatch, self).__init__(**kwargs) self.location = location self.id = None self.name = None self.type = None self.tags = tags - self.name_properties_name = None self.backup_policy_id = None self.provisioning_state = None self.daily_backups_to_keep = daily_backups_to_keep @@ -664,8 +781,8 @@ def __init__( class BackupsList(msrest.serialization.Model): """List of Backups. - :param value: A list of Backups. - :type value: list[~azure.mgmt.netapp.models.Backup] + :ivar value: A list of Backups. + :vartype value: list[~azure.mgmt.netapp.models.Backup] """ _attribute_map = { @@ -678,6 +795,10 @@ def __init__( value: Optional[List["Backup"]] = None, **kwargs ): + """ + :keyword value: A list of Backups. + :paramtype value: list[~azure.mgmt.netapp.models.Backup] + """ super(BackupsList, self).__init__(**kwargs) self.value = value @@ -733,6 +854,8 @@ def __init__( self, **kwargs ): + """ + """ super(BackupStatus, self).__init__(**kwargs) self.healthy = None self.relationship_status = None @@ -747,9 +870,9 @@ def __init__( class BreakReplicationRequest(msrest.serialization.Model): """Break replication request. - :param force_break_replication: If replication is in status transferring and you want to force + :ivar force_break_replication: If replication is in status transferring and you want to force break the replication, set to true. - :type force_break_replication: bool + :vartype force_break_replication: bool """ _attribute_map = { @@ -762,6 +885,11 @@ def __init__( force_break_replication: Optional[bool] = None, **kwargs ): + """ + :keyword force_break_replication: If replication is in status transferring and you want to + force break the replication, set to true. + :paramtype force_break_replication: bool + """ super(BreakReplicationRequest, self).__init__(**kwargs) self.force_break_replication = force_break_replication @@ -773,8 +901,8 @@ class CapacityPool(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -783,30 +911,30 @@ class CapacityPool(msrest.serialization.Model): :vartype etag: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar pool_id: UUID v4 used to identify the Pool. :vartype pool_id: str - :param size: Required. Provisioned size of the pool (in bytes). Allowed values are in 4TiB + :ivar size: Required. Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). - :type size: long - :param service_level: Required. The service level of the file system. Possible values include: + :vartype size: long + :ivar service_level: Required. The service level of the file system. Possible values include: "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str :ivar total_throughput_mibps: Total throughput of pool in Mibps. :vartype total_throughput_mibps: float :ivar utilized_throughput_mibps: Utilized throughput of pool in Mibps. :vartype utilized_throughput_mibps: float - :param qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". - :type qos_type: str or ~azure.mgmt.netapp.models.QosType - :param cool_access: If enabled (true) the pool can contain cool Access enabled volumes. - :type cool_access: bool - :param encryption_type: Encryption type of the capacity pool, set encryption type for data at + :ivar qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". + :vartype qos_type: str or ~azure.mgmt.netapp.models.QosType + :ivar cool_access: If enabled (true) the pool can contain cool Access enabled volumes. + :vartype cool_access: bool + :ivar encryption_type: Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. Possible values include: "Single", "Double". Default value: "Single". - :type encryption_type: str or ~azure.mgmt.netapp.models.EncryptionType + :vartype encryption_type: str or ~azure.mgmt.netapp.models.EncryptionType """ _validation = { @@ -853,6 +981,26 @@ def __init__( encryption_type: Optional[Union[str, "EncryptionType"]] = "Single", **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword size: Required. Provisioned size of the pool (in bytes). Allowed values are in 4TiB + chunks (value must be multiply of 4398046511104). + :paramtype size: long + :keyword service_level: Required. The service level of the file system. Possible values + include: "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :keyword qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". + :paramtype qos_type: str or ~azure.mgmt.netapp.models.QosType + :keyword cool_access: If enabled (true) the pool can contain cool Access enabled volumes. + :paramtype cool_access: bool + :keyword encryption_type: Encryption type of the capacity pool, set encryption type for data at + rest for this pool and all volumes in it. This value can only be set when creating new pool. + Possible values include: "Single", "Double". Default value: "Single". + :paramtype encryption_type: str or ~azure.mgmt.netapp.models.EncryptionType + """ super(CapacityPool, self).__init__(**kwargs) self.location = location self.id = None @@ -874,10 +1022,10 @@ def __init__( class CapacityPoolList(msrest.serialization.Model): """List of capacity pool resources. - :param value: List of Capacity pools. - :type value: list[~azure.mgmt.netapp.models.CapacityPool] - :param next_link: URL to get the next set of results. - :type next_link: str + :ivar value: List of Capacity pools. + :vartype value: list[~azure.mgmt.netapp.models.CapacityPool] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -892,6 +1040,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of Capacity pools. + :paramtype value: list[~azure.mgmt.netapp.models.CapacityPool] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ super(CapacityPoolList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -902,21 +1056,21 @@ class CapacityPoolPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param size: Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar size: Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks (value must be multiply of 4398046511104). - :type size: long - :param qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". - :type qos_type: str or ~azure.mgmt.netapp.models.QosType + :vartype size: long + :ivar qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". + :vartype qos_type: str or ~azure.mgmt.netapp.models.QosType """ _validation = { @@ -945,6 +1099,17 @@ def __init__( qos_type: Optional[Union[str, "QosType"]] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword size: Provisioned size of the pool (in bytes). Allowed values are in 4TiB chunks + (value must be multiply of 4398046511104). + :paramtype size: long + :keyword qos_type: The qos type of the pool. Possible values include: "Auto", "Manual". + :paramtype qos_type: str or ~azure.mgmt.netapp.models.QosType + """ super(CapacityPoolPatch, self).__init__(**kwargs) self.location = location self.id = None @@ -958,19 +1123,19 @@ def __init__( class CheckAvailabilityResponse(msrest.serialization.Model): """Information regarding availability of a resource. - :param is_available: :code:`true` indicates name is valid and available. + :ivar is_available: :code:`true` indicates name is valid and available. :code:`false` indicates the name is invalid, unavailable, or both. - :type is_available: bool - :param reason: :code:`Invalid` indicates the name provided does not match Azure - App Service naming requirements. :code:`AlreadyExists` indicates that the name is + :vartype is_available: bool + :ivar reason: :code:`Invalid` indicates the name provided does not match Azure App + Service naming requirements. :code:`AlreadyExists` indicates that the name is already in use and is therefore unavailable. Possible values include: "Invalid", "AlreadyExists". - :type reason: str or ~azure.mgmt.netapp.models.InAvailabilityReasonType - :param message: If reason == invalid, provide the user with the reason why the given name is + :vartype reason: str or ~azure.mgmt.netapp.models.InAvailabilityReasonType + :ivar message: If reason == invalid, provide the user with the reason why the given name is invalid, and provide the resource naming requirements so that the user can select a valid name. If reason == AlreadyExists, explain that resource name is already in use, and direct them to select a different name. - :type message: str + :vartype message: str """ _attribute_map = { @@ -987,6 +1152,21 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword is_available: :code:`true` indicates name is valid and available. + :code:`false` indicates the name is invalid, unavailable, or both. + :paramtype is_available: bool + :keyword reason: :code:`Invalid` indicates the name provided does not match Azure + App Service naming requirements. :code:`AlreadyExists` indicates that the name is + already in use and is therefore unavailable. Possible values include: "Invalid", + "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.netapp.models.InAvailabilityReasonType + :keyword message: If reason == invalid, provide the user with the reason why the given name is + invalid, and provide the resource naming requirements so that the user can select a valid name. + If reason == AlreadyExists, explain that resource name is already in use, and direct them to + select a different name. + :paramtype message: str + """ super(CheckAvailabilityResponse, self).__init__(**kwargs) self.is_available = is_available self.reason = reason @@ -996,12 +1176,12 @@ def __init__( class CloudErrorBody(msrest.serialization.Model): """An error response from the service. - :param code: An identifier for the error. Codes are invariant and are intended to be consumed + :ivar code: An identifier for the error. Codes are invariant and are intended to be consumed programmatically. - :type code: str - :param message: A message describing the error, intended to be suitable for display in a user + :vartype code: str + :ivar message: A message describing the error, intended to be suitable for display in a user interface. - :type message: str + :vartype message: str """ _attribute_map = { @@ -1016,6 +1196,14 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: An identifier for the error. Codes are invariant and are intended to be consumed + programmatically. + :paramtype code: str + :keyword message: A message describing the error, intended to be suitable for display in a user + interface. + :paramtype message: str + """ super(CloudErrorBody, self).__init__(**kwargs) self.code = code self.message = message @@ -1024,14 +1212,14 @@ def __init__( class DailySchedule(msrest.serialization.Model): """Daily Schedule properties. - :param snapshots_to_keep: Daily snapshot count to keep. - :type snapshots_to_keep: int - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long + :ivar snapshots_to_keep: Daily snapshot count to keep. + :vartype snapshots_to_keep: int + :ivar hour: Indicates which hour in UTC timezone a snapshot should be taken. + :vartype hour: int + :ivar minute: Indicates which minute snapshot should be taken. + :vartype minute: int + :ivar used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :vartype used_bytes: long """ _attribute_map = { @@ -1050,6 +1238,16 @@ def __init__( used_bytes: Optional[int] = None, **kwargs ): + """ + :keyword snapshots_to_keep: Daily snapshot count to keep. + :paramtype snapshots_to_keep: int + :keyword hour: Indicates which hour in UTC timezone a snapshot should be taken. + :paramtype hour: int + :keyword minute: Indicates which minute snapshot should be taken. + :paramtype minute: int + :keyword used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :paramtype used_bytes: long + """ super(DailySchedule, self).__init__(**kwargs) self.snapshots_to_keep = snapshots_to_keep self.hour = hour @@ -1060,10 +1258,10 @@ def __init__( class Dimension(msrest.serialization.Model): """Dimension of blobs, possibly be blob type or access tier. - :param name: Display name of dimension. - :type name: str - :param display_name: Display name of dimension. - :type display_name: str + :ivar name: Display name of dimension. + :vartype name: str + :ivar display_name: Display name of dimension. + :vartype display_name: str """ _attribute_map = { @@ -1078,6 +1276,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Display name of dimension. + :paramtype name: str + :keyword display_name: Display name of dimension. + :paramtype display_name: str + """ super(Dimension, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1086,46 +1290,46 @@ def __init__( class ExportPolicyRule(msrest.serialization.Model): """Volume Export Policy Rule. - :param rule_index: Order index. - :type rule_index: int - :param unix_read_only: Read only access. - :type unix_read_only: bool - :param unix_read_write: Read and write access. - :type unix_read_write: bool - :param kerberos5_read_only: Kerberos5 Read only access. To be use with swagger version + :ivar rule_index: Order index. + :vartype rule_index: int + :ivar unix_read_only: Read only access. + :vartype unix_read_only: bool + :ivar unix_read_write: Read and write access. + :vartype unix_read_write: bool + :ivar kerberos5_read_only: Kerberos5 Read only access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_read_only: bool - :param kerberos5_read_write: Kerberos5 Read and write access. To be use with swagger version + :vartype kerberos5_read_only: bool + :ivar kerberos5_read_write: Kerberos5 Read and write access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_read_write: bool - :param kerberos5_i_read_only: Kerberos5i Read only access. To be use with swagger version + :vartype kerberos5_read_write: bool + :ivar kerberos5_i_read_only: Kerberos5i Read only access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_i_read_only: bool - :param kerberos5_i_read_write: Kerberos5i Read and write access. To be use with swagger version + :vartype kerberos5_i_read_only: bool + :ivar kerberos5_i_read_write: Kerberos5i Read and write access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_i_read_write: bool - :param kerberos5_p_read_only: Kerberos5p Read only access. To be use with swagger version + :vartype kerberos5_i_read_write: bool + :ivar kerberos5_p_read_only: Kerberos5p Read only access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_p_read_only: bool - :param kerberos5_p_read_write: Kerberos5p Read and write access. To be use with swagger version + :vartype kerberos5_p_read_only: bool + :ivar kerberos5_p_read_write: Kerberos5p Read and write access. To be use with swagger version 2020-05-01 or later. - :type kerberos5_p_read_write: bool - :param cifs: Allows CIFS protocol. - :type cifs: bool - :param nfsv3: Allows NFSv3 protocol. Enable only for NFSv3 type volumes. - :type nfsv3: bool - :param nfsv41: Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. - :type nfsv41: bool - :param allowed_clients: Client ingress specification as comma separated string with IPv4 CIDRs, + :vartype kerberos5_p_read_write: bool + :ivar cifs: Allows CIFS protocol. + :vartype cifs: bool + :ivar nfsv3: Allows NFSv3 protocol. Enable only for NFSv3 type volumes. + :vartype nfsv3: bool + :ivar nfsv41: Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. + :vartype nfsv41: bool + :ivar allowed_clients: Client ingress specification as comma separated string with IPv4 CIDRs, IPv4 host addresses and host names. - :type allowed_clients: str - :param has_root_access: Has root access to volume. - :type has_root_access: bool - :param chown_mode: This parameter specifies who is authorized to change the ownership of a - file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root - users can change ownership of files that they own. Possible values include: "Restricted", + :vartype allowed_clients: str + :ivar has_root_access: Has root access to volume. + :vartype has_root_access: bool + :ivar chown_mode: This parameter specifies who is authorized to change the ownership of a file. + restricted - Only root user can change the ownership of the file. unrestricted - Non-root users + can change ownership of files that they own. Possible values include: "Restricted", "Unrestricted". Default value: "Restricted". - :type chown_mode: str or ~azure.mgmt.netapp.models.ChownMode + :vartype chown_mode: str or ~azure.mgmt.netapp.models.ChownMode """ _attribute_map = { @@ -1166,6 +1370,48 @@ def __init__( chown_mode: Optional[Union[str, "ChownMode"]] = "Restricted", **kwargs ): + """ + :keyword rule_index: Order index. + :paramtype rule_index: int + :keyword unix_read_only: Read only access. + :paramtype unix_read_only: bool + :keyword unix_read_write: Read and write access. + :paramtype unix_read_write: bool + :keyword kerberos5_read_only: Kerberos5 Read only access. To be use with swagger version + 2020-05-01 or later. + :paramtype kerberos5_read_only: bool + :keyword kerberos5_read_write: Kerberos5 Read and write access. To be use with swagger version + 2020-05-01 or later. + :paramtype kerberos5_read_write: bool + :keyword kerberos5_i_read_only: Kerberos5i Read only access. To be use with swagger version + 2020-05-01 or later. + :paramtype kerberos5_i_read_only: bool + :keyword kerberos5_i_read_write: Kerberos5i Read and write access. To be use with swagger + version 2020-05-01 or later. + :paramtype kerberos5_i_read_write: bool + :keyword kerberos5_p_read_only: Kerberos5p Read only access. To be use with swagger version + 2020-05-01 or later. + :paramtype kerberos5_p_read_only: bool + :keyword kerberos5_p_read_write: Kerberos5p Read and write access. To be use with swagger + version 2020-05-01 or later. + :paramtype kerberos5_p_read_write: bool + :keyword cifs: Allows CIFS protocol. + :paramtype cifs: bool + :keyword nfsv3: Allows NFSv3 protocol. Enable only for NFSv3 type volumes. + :paramtype nfsv3: bool + :keyword nfsv41: Allows NFSv4.1 protocol. Enable only for NFSv4.1 type volumes. + :paramtype nfsv41: bool + :keyword allowed_clients: Client ingress specification as comma separated string with IPv4 + CIDRs, IPv4 host addresses and host names. + :paramtype allowed_clients: str + :keyword has_root_access: Has root access to volume. + :paramtype has_root_access: bool + :keyword chown_mode: This parameter specifies who is authorized to change the ownership of a + file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root + users can change ownership of files that they own. Possible values include: "Restricted", + "Unrestricted". Default value: "Restricted". + :paramtype chown_mode: str or ~azure.mgmt.netapp.models.ChownMode + """ super(ExportPolicyRule, self).__init__(**kwargs) self.rule_index = rule_index self.unix_read_only = unix_read_only @@ -1189,11 +1435,11 @@ class FilePathAvailabilityRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. File path to verify. - :type name: str - :param subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + :ivar name: Required. File path to verify. + :vartype name: str + :ivar subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - :type subnet_id: str + :vartype subnet_id: str """ _validation = { @@ -1213,6 +1459,13 @@ def __init__( subnet_id: str, **kwargs ): + """ + :keyword name: Required. File path to verify. + :paramtype name: str + :keyword subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + delegation Microsoft.NetApp/volumes. + :paramtype subnet_id: str + """ super(FilePathAvailabilityRequest, self).__init__(**kwargs) self.name = name self.subnet_id = subnet_id @@ -1221,12 +1474,12 @@ def __init__( class HourlySchedule(msrest.serialization.Model): """Hourly Schedule properties. - :param snapshots_to_keep: Hourly snapshot count to keep. - :type snapshots_to_keep: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long + :ivar snapshots_to_keep: Hourly snapshot count to keep. + :vartype snapshots_to_keep: int + :ivar minute: Indicates which minute snapshot should be taken. + :vartype minute: int + :ivar used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :vartype used_bytes: long """ _attribute_map = { @@ -1243,6 +1496,14 @@ def __init__( used_bytes: Optional[int] = None, **kwargs ): + """ + :keyword snapshots_to_keep: Hourly snapshot count to keep. + :paramtype snapshots_to_keep: int + :keyword minute: Indicates which minute snapshot should be taken. + :paramtype minute: int + :keyword used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :paramtype used_bytes: long + """ super(HourlySchedule, self).__init__(**kwargs) self.snapshots_to_keep = snapshots_to_keep self.minute = minute @@ -1252,10 +1513,10 @@ def __init__( class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. - :param name: - :type name: str - :param display_name: - :type display_name: str + :ivar name: Name of log specification. + :vartype name: str + :ivar display_name: Display name of log specification. + :vartype display_name: str """ _attribute_map = { @@ -1270,6 +1531,12 @@ def __init__( display_name: Optional[str] = None, **kwargs ): + """ + :keyword name: Name of log specification. + :paramtype name: str + :keyword display_name: Display name of log specification. + :paramtype display_name: str + """ super(LogSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1278,38 +1545,39 @@ def __init__( class MetricSpecification(msrest.serialization.Model): """Metric specification of operation. - :param name: Name of metric specification. - :type name: str - :param display_name: Display name of metric specification. - :type display_name: str - :param display_description: Display description of metric specification. - :type display_description: str - :param unit: Unit could be Bytes or Count. - :type unit: str - :param supported_aggregation_types: Support metric aggregation type. - :type supported_aggregation_types: list[str or ~azure.mgmt.netapp.models.MetricAggregationType] - :param supported_time_grain_types: The supported time grain types for the metrics. - :type supported_time_grain_types: list[str] - :param internal_metric_name: The internal metric name. - :type internal_metric_name: str - :param enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. - :type enable_regional_mdm_account: bool - :param source_mdm_account: The source MDM account. - :type source_mdm_account: str - :param source_mdm_namespace: The source MDM namespace. - :type source_mdm_namespace: str - :param dimensions: Dimensions of blobs, including blob type and access tier. - :type dimensions: list[~azure.mgmt.netapp.models.Dimension] - :param aggregation_type: Aggregation type could be Average. - :type aggregation_type: str - :param fill_gap_with_zero: The property to decide fill gap with zero or not. - :type fill_gap_with_zero: bool - :param category: The category this metric specification belong to, could be Capacity. - :type category: str - :param resource_id_dimension_name_override: Account Resource Id. - :type resource_id_dimension_name_override: str - :param is_internal: Whether the metric is internal. - :type is_internal: bool + :ivar name: Name of metric specification. + :vartype name: str + :ivar display_name: Display name of metric specification. + :vartype display_name: str + :ivar display_description: Display description of metric specification. + :vartype display_description: str + :ivar unit: Unit could be Bytes or Count. + :vartype unit: str + :ivar supported_aggregation_types: Support metric aggregation type. + :vartype supported_aggregation_types: list[str or + ~azure.mgmt.netapp.models.MetricAggregationType] + :ivar supported_time_grain_types: The supported time grain types for the metrics. + :vartype supported_time_grain_types: list[str] + :ivar internal_metric_name: The internal metric name. + :vartype internal_metric_name: str + :ivar enable_regional_mdm_account: Whether or not the service is using regional MDM accounts. + :vartype enable_regional_mdm_account: bool + :ivar source_mdm_account: The source MDM account. + :vartype source_mdm_account: str + :ivar source_mdm_namespace: The source MDM namespace. + :vartype source_mdm_namespace: str + :ivar dimensions: Dimensions of blobs, including blob type and access tier. + :vartype dimensions: list[~azure.mgmt.netapp.models.Dimension] + :ivar aggregation_type: Aggregation type could be Average. + :vartype aggregation_type: str + :ivar fill_gap_with_zero: The property to decide fill gap with zero or not. + :vartype fill_gap_with_zero: bool + :ivar category: The category this metric specification belong to, could be Capacity. + :vartype category: str + :ivar resource_id_dimension_name_override: Account Resource Id. + :vartype resource_id_dimension_name_override: str + :ivar is_internal: Whether the metric is internal. + :vartype is_internal: bool """ _attribute_map = { @@ -1352,6 +1620,42 @@ def __init__( is_internal: Optional[bool] = None, **kwargs ): + """ + :keyword name: Name of metric specification. + :paramtype name: str + :keyword display_name: Display name of metric specification. + :paramtype display_name: str + :keyword display_description: Display description of metric specification. + :paramtype display_description: str + :keyword unit: Unit could be Bytes or Count. + :paramtype unit: str + :keyword supported_aggregation_types: Support metric aggregation type. + :paramtype supported_aggregation_types: list[str or + ~azure.mgmt.netapp.models.MetricAggregationType] + :keyword supported_time_grain_types: The supported time grain types for the metrics. + :paramtype supported_time_grain_types: list[str] + :keyword internal_metric_name: The internal metric name. + :paramtype internal_metric_name: str + :keyword enable_regional_mdm_account: Whether or not the service is using regional MDM + accounts. + :paramtype enable_regional_mdm_account: bool + :keyword source_mdm_account: The source MDM account. + :paramtype source_mdm_account: str + :keyword source_mdm_namespace: The source MDM namespace. + :paramtype source_mdm_namespace: str + :keyword dimensions: Dimensions of blobs, including blob type and access tier. + :paramtype dimensions: list[~azure.mgmt.netapp.models.Dimension] + :keyword aggregation_type: Aggregation type could be Average. + :paramtype aggregation_type: str + :keyword fill_gap_with_zero: The property to decide fill gap with zero or not. + :paramtype fill_gap_with_zero: bool + :keyword category: The category this metric specification belong to, could be Capacity. + :paramtype category: str + :keyword resource_id_dimension_name_override: Account Resource Id. + :paramtype resource_id_dimension_name_override: str + :keyword is_internal: Whether the metric is internal. + :paramtype is_internal: bool + """ super(MetricSpecification, self).__init__(**kwargs) self.name = name self.display_name = display_name @@ -1374,17 +1678,17 @@ def __init__( class MonthlySchedule(msrest.serialization.Model): """Monthly Schedule properties. - :param snapshots_to_keep: Monthly snapshot count to keep. - :type snapshots_to_keep: int - :param days_of_month: Indicates which days of the month snapshot should be taken. A comma + :ivar snapshots_to_keep: Monthly snapshot count to keep. + :vartype snapshots_to_keep: int + :ivar days_of_month: Indicates which days of the month snapshot should be taken. A comma delimited string. - :type days_of_month: str - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long + :vartype days_of_month: str + :ivar hour: Indicates which hour in UTC timezone a snapshot should be taken. + :vartype hour: int + :ivar minute: Indicates which minute snapshot should be taken. + :vartype minute: int + :ivar used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :vartype used_bytes: long """ _attribute_map = { @@ -1405,6 +1709,19 @@ def __init__( used_bytes: Optional[int] = None, **kwargs ): + """ + :keyword snapshots_to_keep: Monthly snapshot count to keep. + :paramtype snapshots_to_keep: int + :keyword days_of_month: Indicates which days of the month snapshot should be taken. A comma + delimited string. + :paramtype days_of_month: str + :keyword hour: Indicates which hour in UTC timezone a snapshot should be taken. + :paramtype hour: int + :keyword minute: Indicates which minute snapshot should be taken. + :paramtype minute: int + :keyword used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :paramtype used_bytes: long + """ super(MonthlySchedule, self).__init__(**kwargs) self.snapshots_to_keep = snapshots_to_keep self.days_of_month = days_of_month @@ -1420,24 +1737,24 @@ class MountTarget(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar mount_target_id: UUID v4 used to identify the MountTarget. :vartype mount_target_id: str - :param file_system_id: Required. UUID v4 used to identify the MountTarget. - :type file_system_id: str + :ivar file_system_id: Required. UUID v4 used to identify the MountTarget. + :vartype file_system_id: str :ivar ip_address: The mount target's IPv4 address. :vartype ip_address: str - :param smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. - :type smb_server_fqdn: str + :ivar smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. + :vartype smb_server_fqdn: str """ _validation = { @@ -1471,6 +1788,16 @@ def __init__( smb_server_fqdn: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword file_system_id: Required. UUID v4 used to identify the MountTarget. + :paramtype file_system_id: str + :keyword smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. + :paramtype smb_server_fqdn: str + """ super(MountTarget, self).__init__(**kwargs) self.location = location self.id = None @@ -1492,12 +1819,12 @@ class MountTargetProperties(msrest.serialization.Model): :ivar mount_target_id: UUID v4 used to identify the MountTarget. :vartype mount_target_id: str - :param file_system_id: Required. UUID v4 used to identify the MountTarget. - :type file_system_id: str + :ivar file_system_id: Required. UUID v4 used to identify the MountTarget. + :vartype file_system_id: str :ivar ip_address: The mount target's IPv4 address. :vartype ip_address: str - :param smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. - :type smb_server_fqdn: str + :ivar smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. + :vartype smb_server_fqdn: str """ _validation = { @@ -1520,6 +1847,12 @@ def __init__( smb_server_fqdn: Optional[str] = None, **kwargs ): + """ + :keyword file_system_id: Required. UUID v4 used to identify the MountTarget. + :paramtype file_system_id: str + :keyword smb_server_fqdn: The SMB server's Fully Qualified Domain Name, FQDN. + :paramtype smb_server_fqdn: str + """ super(MountTargetProperties, self).__init__(**kwargs) self.mount_target_id = None self.file_system_id = file_system_id @@ -1534,8 +1867,8 @@ class NetAppAccount(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -1544,16 +1877,16 @@ class NetAppAccount(msrest.serialization.Model): :vartype etag: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.netapp.models.SystemData :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param active_directories: Active Directories. - :type active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] - :param encryption: Encryption settings. - :type encryption: ~azure.mgmt.netapp.models.AccountEncryption + :ivar active_directories: Active Directories. + :vartype active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] + :ivar encryption: Encryption settings. + :vartype encryption: ~azure.mgmt.netapp.models.AccountEncryption """ _validation = { @@ -1588,6 +1921,16 @@ def __init__( encryption: Optional["AccountEncryption"] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword active_directories: Active Directories. + :paramtype active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] + :keyword encryption: Encryption settings. + :paramtype encryption: ~azure.mgmt.netapp.models.AccountEncryption + """ super(NetAppAccount, self).__init__(**kwargs) self.location = location self.id = None @@ -1604,10 +1947,10 @@ def __init__( class NetAppAccountList(msrest.serialization.Model): """List of NetApp account resources. - :param value: Multiple NetApp accounts. - :type value: list[~azure.mgmt.netapp.models.NetAppAccount] - :param next_link: URL to get the next set of results. - :type next_link: str + :ivar value: Multiple NetApp accounts. + :vartype value: list[~azure.mgmt.netapp.models.NetAppAccount] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1622,6 +1965,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: Multiple NetApp accounts. + :paramtype value: list[~azure.mgmt.netapp.models.NetAppAccount] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ super(NetAppAccountList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1632,22 +1981,22 @@ class NetAppAccountPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param active_directories: Active Directories. - :type active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] - :param encryption: Encryption settings. - :type encryption: ~azure.mgmt.netapp.models.AccountEncryption + :ivar active_directories: Active Directories. + :vartype active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] + :ivar encryption: Encryption settings. + :vartype encryption: ~azure.mgmt.netapp.models.AccountEncryption """ _validation = { @@ -1677,6 +2026,16 @@ def __init__( encryption: Optional["AccountEncryption"] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword active_directories: Active Directories. + :paramtype active_directories: list[~azure.mgmt.netapp.models.ActiveDirectory] + :keyword encryption: Encryption settings. + :paramtype encryption: ~azure.mgmt.netapp.models.AccountEncryption + """ super(NetAppAccountPatch, self).__init__(**kwargs) self.location = location self.id = None @@ -1691,14 +2050,14 @@ def __init__( class Operation(msrest.serialization.Model): """Microsoft.NetApp REST API operation definition. - :param name: Operation name: {provider}/{resource}/{operation}. - :type name: str - :param display: Display metadata associated with the operation. - :type display: ~azure.mgmt.netapp.models.OperationDisplay - :param origin: The origin of operations. - :type origin: str - :param service_specification: One property of operation, include metric specifications. - :type service_specification: ~azure.mgmt.netapp.models.ServiceSpecification + :ivar name: Operation name: {provider}/{resource}/{operation}. + :vartype name: str + :ivar display: Display metadata associated with the operation. + :vartype display: ~azure.mgmt.netapp.models.OperationDisplay + :ivar origin: The origin of operations. + :vartype origin: str + :ivar service_specification: One property of operation, include metric specifications. + :vartype service_specification: ~azure.mgmt.netapp.models.ServiceSpecification """ _attribute_map = { @@ -1717,6 +2076,16 @@ def __init__( service_specification: Optional["ServiceSpecification"] = None, **kwargs ): + """ + :keyword name: Operation name: {provider}/{resource}/{operation}. + :paramtype name: str + :keyword display: Display metadata associated with the operation. + :paramtype display: ~azure.mgmt.netapp.models.OperationDisplay + :keyword origin: The origin of operations. + :paramtype origin: str + :keyword service_specification: One property of operation, include metric specifications. + :paramtype service_specification: ~azure.mgmt.netapp.models.ServiceSpecification + """ super(Operation, self).__init__(**kwargs) self.name = name self.display = display @@ -1727,14 +2096,14 @@ def __init__( class OperationDisplay(msrest.serialization.Model): """Display metadata associated with the operation. - :param provider: Service provider: Microsoft NetApp. - :type provider: str - :param resource: Resource on which the operation is performed etc. - :type resource: str - :param operation: Type of operation: get, read, delete, etc. - :type operation: str - :param description: Operation description. - :type description: str + :ivar provider: Service provider: Microsoft NetApp. + :vartype provider: str + :ivar resource: Resource on which the operation is performed etc. + :vartype resource: str + :ivar operation: Type of operation: get, read, delete, etc. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str """ _attribute_map = { @@ -1753,6 +2122,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: Service provider: Microsoft NetApp. + :paramtype provider: str + :keyword resource: Resource on which the operation is performed etc. + :paramtype resource: str + :keyword operation: Type of operation: get, read, delete, etc. + :paramtype operation: str + :keyword description: Operation description. + :paramtype description: str + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1763,8 +2142,8 @@ def __init__( class OperationListResult(msrest.serialization.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] + :ivar value: List of Storage operations supported by the Storage resource provider. + :vartype value: list[~azure.mgmt.netapp.models.Operation] """ _attribute_map = { @@ -1777,17 +2156,64 @@ def __init__( value: Optional[List["Operation"]] = None, **kwargs ): + """ + :keyword value: List of Storage operations supported by the Storage resource provider. + :paramtype value: list[~azure.mgmt.netapp.models.Operation] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value +class PlacementKeyValuePairs(msrest.serialization.Model): + """Application specific parameters for the placement of volumes in the volume group. + + All required parameters must be populated in order to send to Azure. + + :ivar key: Required. Key for an application specific parameter for the placement of volumes in + the volume group. + :vartype key: str + :ivar value: Required. Value for an application specific parameter for the placement of volumes + in the volume group. + :vartype value: str + """ + + _validation = { + 'key': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'key': {'key': 'key', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + key: str, + value: str, + **kwargs + ): + """ + :keyword key: Required. Key for an application specific parameter for the placement of volumes + in the volume group. + :paramtype key: str + :keyword value: Required. Value for an application specific parameter for the placement of + volumes in the volume group. + :paramtype value: str + """ + super(PlacementKeyValuePairs, self).__init__(**kwargs) + self.key = key + self.value = value + + class PoolChangeRequest(msrest.serialization.Model): """Pool change request. All required parameters must be populated in order to send to Azure. - :param new_pool_resource_id: Required. Resource id of the pool to move volume to. - :type new_pool_resource_id: str + :ivar new_pool_resource_id: Required. Resource id of the pool to move volume to. + :vartype new_pool_resource_id: str """ _validation = { @@ -1804,6 +2230,10 @@ def __init__( new_pool_resource_id: str, **kwargs ): + """ + :keyword new_pool_resource_id: Required. Resource id of the pool to move volume to. + :paramtype new_pool_resource_id: str + """ super(PoolChangeRequest, self).__init__(**kwargs) self.new_pool_resource_id = new_pool_resource_id @@ -1839,6 +2269,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1876,6 +2308,8 @@ def __init__( self, **kwargs ): + """ + """ super(ProxyResource, self).__init__(**kwargs) @@ -1884,15 +2318,15 @@ class QuotaAvailabilityRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Name of the resource to verify. - :type name: str - :param type: Required. Resource type used for verification. Possible values include: + :ivar name: Required. Name of the resource to verify. + :vartype name: str + :ivar type: Required. Resource type used for verification. Possible values include: "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". - :type type: str or ~azure.mgmt.netapp.models.CheckQuotaNameResourceTypes - :param resource_group: Required. Resource group name. - :type resource_group: str + :vartype type: str or ~azure.mgmt.netapp.models.CheckQuotaNameResourceTypes + :ivar resource_group: Required. Resource group name. + :vartype resource_group: str """ _validation = { @@ -1915,6 +2349,17 @@ def __init__( resource_group: str, **kwargs ): + """ + :keyword name: Required. Name of the resource to verify. + :paramtype name: str + :keyword type: Required. Resource type used for verification. Possible values include: + "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", + "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", + "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". + :paramtype type: str or ~azure.mgmt.netapp.models.CheckQuotaNameResourceTypes + :keyword resource_group: Required. Resource group name. + :paramtype resource_group: str + """ super(QuotaAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -1926,18 +2371,18 @@ class ReplicationObject(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param replication_id: Id. - :type replication_id: str - :param endpoint_type: Indicates whether the local volume is the source or destination for the + :ivar replication_id: Id. + :vartype replication_id: str + :ivar endpoint_type: Indicates whether the local volume is the source or destination for the Volume Replication. Possible values include: "src", "dst". - :type endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType - :param replication_schedule: Schedule. Possible values include: "_10minutely", "hourly", + :vartype endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType + :ivar replication_schedule: Schedule. Possible values include: "_10minutely", "hourly", "daily". - :type replication_schedule: str or ~azure.mgmt.netapp.models.ReplicationSchedule - :param remote_volume_resource_id: Required. The resource ID of the remote volume. - :type remote_volume_resource_id: str - :param remote_volume_region: The remote region for the other end of the Volume Replication. - :type remote_volume_region: str + :vartype replication_schedule: str or ~azure.mgmt.netapp.models.ReplicationSchedule + :ivar remote_volume_resource_id: Required. The resource ID of the remote volume. + :vartype remote_volume_resource_id: str + :ivar remote_volume_region: The remote region for the other end of the Volume Replication. + :vartype remote_volume_region: str """ _validation = { @@ -1962,6 +2407,20 @@ def __init__( remote_volume_region: Optional[str] = None, **kwargs ): + """ + :keyword replication_id: Id. + :paramtype replication_id: str + :keyword endpoint_type: Indicates whether the local volume is the source or destination for the + Volume Replication. Possible values include: "src", "dst". + :paramtype endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType + :keyword replication_schedule: Schedule. Possible values include: "_10minutely", "hourly", + "daily". + :paramtype replication_schedule: str or ~azure.mgmt.netapp.models.ReplicationSchedule + :keyword remote_volume_resource_id: Required. The resource ID of the remote volume. + :paramtype remote_volume_resource_id: str + :keyword remote_volume_region: The remote region for the other end of the Volume Replication. + :paramtype remote_volume_region: str + """ super(ReplicationObject, self).__init__(**kwargs) self.replication_id = replication_id self.endpoint_type = endpoint_type @@ -1973,18 +2432,18 @@ def __init__( class ReplicationStatus(msrest.serialization.Model): """Replication status. - :param healthy: Replication health check. - :type healthy: bool - :param relationship_status: Status of the mirror relationship. Possible values include: "Idle", + :ivar healthy: Replication health check. + :vartype healthy: bool + :ivar relationship_status: Status of the mirror relationship. Possible values include: "Idle", "Transferring". - :type relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus - :param mirror_state: The status of the replication. Possible values include: "Uninitialized", + :vartype relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus + :ivar mirror_state: The status of the replication. Possible values include: "Uninitialized", "Mirrored", "Broken". - :type mirror_state: str or ~azure.mgmt.netapp.models.MirrorState - :param total_progress: The progress of the replication. - :type total_progress: str - :param error_message: Displays error message if the replication is in an error state. - :type error_message: str + :vartype mirror_state: str or ~azure.mgmt.netapp.models.MirrorState + :ivar total_progress: The progress of the replication. + :vartype total_progress: str + :ivar error_message: Displays error message if the replication is in an error state. + :vartype error_message: str """ _attribute_map = { @@ -2005,6 +2464,20 @@ def __init__( error_message: Optional[str] = None, **kwargs ): + """ + :keyword healthy: Replication health check. + :paramtype healthy: bool + :keyword relationship_status: Status of the mirror relationship. Possible values include: + "Idle", "Transferring". + :paramtype relationship_status: str or ~azure.mgmt.netapp.models.RelationshipStatus + :keyword mirror_state: The status of the replication. Possible values include: "Uninitialized", + "Mirrored", "Broken". + :paramtype mirror_state: str or ~azure.mgmt.netapp.models.MirrorState + :keyword total_progress: The progress of the replication. + :paramtype total_progress: str + :keyword error_message: Displays error message if the replication is in an error state. + :paramtype error_message: str + """ super(ReplicationStatus, self).__init__(**kwargs) self.healthy = healthy self.relationship_status = relationship_status @@ -2022,8 +2495,8 @@ class ResourceIdentity(msrest.serialization.Model): :vartype principal_id: str :ivar tenant_id: The tenant id of the resource. :vartype tenant_id: str - :param type: Type of Identity. Supported values are: 'None', 'SystemAssigned'. - :type type: str + :ivar type: Type of Identity. Supported values are: 'None', 'SystemAssigned'. + :vartype type: str """ _validation = { @@ -2043,6 +2516,10 @@ def __init__( type: Optional[str] = None, **kwargs ): + """ + :keyword type: Type of Identity. Supported values are: 'None', 'SystemAssigned'. + :paramtype type: str + """ super(ResourceIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2054,15 +2531,15 @@ class ResourceNameAvailabilityRequest(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Resource name to verify. - :type name: str - :param type: Required. Resource type used for verification. Possible values include: + :ivar name: Required. Resource name to verify. + :vartype name: str + :ivar type: Required. Resource type used for verification. Possible values include: "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". - :type type: str or ~azure.mgmt.netapp.models.CheckNameResourceTypes - :param resource_group: Required. Resource group name. - :type resource_group: str + :vartype type: str or ~azure.mgmt.netapp.models.CheckNameResourceTypes + :ivar resource_group: Required. Resource group name. + :vartype resource_group: str """ _validation = { @@ -2085,6 +2562,17 @@ def __init__( resource_group: str, **kwargs ): + """ + :keyword name: Required. Resource name to verify. + :paramtype name: str + :keyword type: Required. Resource type used for verification. Possible values include: + "Microsoft.NetApp/netAppAccounts", "Microsoft.NetApp/netAppAccounts/capacityPools", + "Microsoft.NetApp/netAppAccounts/capacityPools/volumes", + "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots". + :paramtype type: str or ~azure.mgmt.netapp.models.CheckNameResourceTypes + :keyword resource_group: Required. Resource group name. + :paramtype resource_group: str + """ super(ResourceNameAvailabilityRequest, self).__init__(**kwargs) self.name = name self.type = type @@ -2134,6 +2622,8 @@ def __init__( self, **kwargs ): + """ + """ super(RestoreStatus, self).__init__(**kwargs) self.healthy = None self.relationship_status = None @@ -2146,10 +2636,10 @@ def __init__( class ServiceSpecification(msrest.serialization.Model): """One property of operation, include metric specifications. - :param metric_specifications: Metric specifications of operation. - :type metric_specifications: list[~azure.mgmt.netapp.models.MetricSpecification] - :param log_specifications: - :type log_specifications: list[~azure.mgmt.netapp.models.LogSpecification] + :ivar metric_specifications: Metric specifications of operation. + :vartype metric_specifications: list[~azure.mgmt.netapp.models.MetricSpecification] + :ivar log_specifications: Log specification of operation. + :vartype log_specifications: list[~azure.mgmt.netapp.models.LogSpecification] """ _attribute_map = { @@ -2164,6 +2654,12 @@ def __init__( log_specifications: Optional[List["LogSpecification"]] = None, **kwargs ): + """ + :keyword metric_specifications: Metric specifications of operation. + :paramtype metric_specifications: list[~azure.mgmt.netapp.models.MetricSpecification] + :keyword log_specifications: Log specification of operation. + :paramtype log_specifications: list[~azure.mgmt.netapp.models.LogSpecification] + """ super(ServiceSpecification, self).__init__(**kwargs) self.metric_specifications = metric_specifications self.log_specifications = log_specifications @@ -2176,8 +2672,8 @@ class Snapshot(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -2218,6 +2714,10 @@ def __init__( location: str, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + """ super(Snapshot, self).__init__(**kwargs) self.location = location self.id = None @@ -2231,8 +2731,8 @@ def __init__( class SnapshotPoliciesList(msrest.serialization.Model): """List of Snapshot Policies. - :param value: A list of snapshot policies. - :type value: list[~azure.mgmt.netapp.models.SnapshotPolicy] + :ivar value: A list of snapshot policies. + :vartype value: list[~azure.mgmt.netapp.models.SnapshotPolicy] """ _attribute_map = { @@ -2245,6 +2745,10 @@ def __init__( value: Optional[List["SnapshotPolicy"]] = None, **kwargs ): + """ + :keyword value: A list of snapshot policies. + :paramtype value: list[~azure.mgmt.netapp.models.SnapshotPolicy] + """ super(SnapshotPoliciesList, self).__init__(**kwargs) self.value = value @@ -2256,8 +2760,8 @@ class SnapshotPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -2266,18 +2770,18 @@ class SnapshotPolicy(msrest.serialization.Model): :vartype etag: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar hourly_schedule: Schedule for hourly snapshots. + :vartype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :ivar daily_schedule: Schedule for daily snapshots. + :vartype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :ivar weekly_schedule: Schedule for weekly snapshots. + :vartype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :ivar monthly_schedule: Schedule for monthly snapshots. + :vartype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str """ @@ -2318,6 +2822,22 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword hourly_schedule: Schedule for hourly snapshots. + :paramtype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :keyword daily_schedule: Schedule for daily snapshots. + :paramtype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :keyword weekly_schedule: Schedule for weekly snapshots. + :paramtype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :keyword monthly_schedule: Schedule for monthly snapshots. + :paramtype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(SnapshotPolicy, self).__init__(**kwargs) self.location = location self.id = None @@ -2338,26 +2858,26 @@ class SnapshotPolicyDetails(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar hourly_schedule: Schedule for hourly snapshots. + :vartype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :ivar daily_schedule: Schedule for daily snapshots. + :vartype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :ivar weekly_schedule: Schedule for weekly snapshots. + :vartype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :ivar monthly_schedule: Schedule for monthly snapshots. + :vartype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str """ @@ -2395,6 +2915,22 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword hourly_schedule: Schedule for hourly snapshots. + :paramtype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :keyword daily_schedule: Schedule for daily snapshots. + :paramtype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :keyword weekly_schedule: Schedule for weekly snapshots. + :paramtype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :keyword monthly_schedule: Schedule for monthly snapshots. + :paramtype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(SnapshotPolicyDetails, self).__init__(**kwargs) self.location = location self.id = None @@ -2414,26 +2950,26 @@ class SnapshotPolicyPatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param hourly_schedule: Schedule for hourly snapshots. - :type hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule - :param daily_schedule: Schedule for daily snapshots. - :type daily_schedule: ~azure.mgmt.netapp.models.DailySchedule - :param weekly_schedule: Schedule for weekly snapshots. - :type weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule - :param monthly_schedule: Schedule for monthly snapshots. - :type monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule - :param enabled: The property to decide policy is enabled or not. - :type enabled: bool + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar hourly_schedule: Schedule for hourly snapshots. + :vartype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :ivar daily_schedule: Schedule for daily snapshots. + :vartype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :ivar weekly_schedule: Schedule for weekly snapshots. + :vartype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :ivar monthly_schedule: Schedule for monthly snapshots. + :vartype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :ivar enabled: The property to decide policy is enabled or not. + :vartype enabled: bool :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str """ @@ -2471,6 +3007,22 @@ def __init__( enabled: Optional[bool] = None, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword hourly_schedule: Schedule for hourly snapshots. + :paramtype hourly_schedule: ~azure.mgmt.netapp.models.HourlySchedule + :keyword daily_schedule: Schedule for daily snapshots. + :paramtype daily_schedule: ~azure.mgmt.netapp.models.DailySchedule + :keyword weekly_schedule: Schedule for weekly snapshots. + :paramtype weekly_schedule: ~azure.mgmt.netapp.models.WeeklySchedule + :keyword monthly_schedule: Schedule for monthly snapshots. + :paramtype monthly_schedule: ~azure.mgmt.netapp.models.MonthlySchedule + :keyword enabled: The property to decide policy is enabled or not. + :paramtype enabled: bool + """ super(SnapshotPolicyPatch, self).__init__(**kwargs) self.location = location self.id = None @@ -2488,20 +3040,24 @@ def __init__( class SnapshotPolicyVolumeList(msrest.serialization.Model): """Volumes associated with snapshot policy. - :param value: List of volumes. - :type value: list[any] + :ivar value: List of volumes. + :vartype value: list[~azure.mgmt.netapp.models.Volume] """ _attribute_map = { - 'value': {'key': 'value', 'type': '[object]'}, + 'value': {'key': 'value', 'type': '[Volume]'}, } def __init__( self, *, - value: Optional[List[Any]] = None, + value: Optional[List["Volume"]] = None, **kwargs ): + """ + :keyword value: List of volumes. + :paramtype value: list[~azure.mgmt.netapp.models.Volume] + """ super(SnapshotPolicyVolumeList, self).__init__(**kwargs) self.value = value @@ -2509,8 +3065,8 @@ def __init__( class SnapshotsList(msrest.serialization.Model): """List of Snapshots. - :param value: A list of Snapshots. - :type value: list[~azure.mgmt.netapp.models.Snapshot] + :ivar value: A list of Snapshots. + :vartype value: list[~azure.mgmt.netapp.models.Snapshot] """ _attribute_map = { @@ -2523,6 +3079,10 @@ def __init__( value: Optional[List["Snapshot"]] = None, **kwargs ): + """ + :keyword value: A list of Snapshots. + :paramtype value: list[~azure.mgmt.netapp.models.Snapshot] + """ super(SnapshotsList, self).__init__(**kwargs) self.value = value @@ -2542,8 +3102,6 @@ class SubscriptionQuotaItem(ProxyResource): :vartype type: str :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.netapp.models.SystemData - :ivar name_properties_name: Quota Item name. - :vartype name_properties_name: str :ivar current: The current quota value. :vartype current: int :ivar default: The default quota value. @@ -2555,7 +3113,6 @@ class SubscriptionQuotaItem(ProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'name_properties_name': {'readonly': True}, 'current': {'readonly': True}, 'default': {'readonly': True}, } @@ -2565,7 +3122,6 @@ class SubscriptionQuotaItem(ProxyResource): 'name': {'key': 'name', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'current': {'key': 'properties.current', 'type': 'int'}, 'default': {'key': 'properties.default', 'type': 'int'}, } @@ -2574,9 +3130,10 @@ def __init__( self, **kwargs ): + """ + """ super(SubscriptionQuotaItem, self).__init__(**kwargs) self.system_data = None - self.name_properties_name = None self.current = None self.default = None @@ -2584,8 +3141,8 @@ def __init__( class SubscriptionQuotaItemList(msrest.serialization.Model): """List of Subscription Quota Items. - :param value: A list of SubscriptionQuotaItems. - :type value: list[~azure.mgmt.netapp.models.SubscriptionQuotaItem] + :ivar value: A list of SubscriptionQuotaItems. + :vartype value: list[~azure.mgmt.netapp.models.SubscriptionQuotaItem] """ _attribute_map = { @@ -2598,6 +3155,10 @@ def __init__( value: Optional[List["SubscriptionQuotaItem"]] = None, **kwargs ): + """ + :keyword value: A list of SubscriptionQuotaItems. + :paramtype value: list[~azure.mgmt.netapp.models.SubscriptionQuotaItem] + """ super(SubscriptionQuotaItemList, self).__init__(**kwargs) self.value = value @@ -2605,20 +3166,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.netapp.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -2641,6 +3202,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.netapp.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -2657,16 +3234,16 @@ class Vault(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param vault_name: Vault Name. - :type vault_name: str + :ivar vault_name: Vault Name. + :vartype vault_name: str """ _validation = { @@ -2691,6 +3268,12 @@ def __init__( vault_name: Optional[str] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword vault_name: Vault Name. + :paramtype vault_name: str + """ super(Vault, self).__init__(**kwargs) self.location = location self.id = None @@ -2702,8 +3285,8 @@ def __init__( class VaultList(msrest.serialization.Model): """List of Vaults. - :param value: A list of vaults. - :type value: list[~azure.mgmt.netapp.models.Vault] + :ivar value: A list of vaults. + :vartype value: list[~azure.mgmt.netapp.models.Vault] """ _attribute_map = { @@ -2716,6 +3299,10 @@ def __init__( value: Optional[List["Vault"]] = None, **kwargs ): + """ + :keyword value: A list of vaults. + :paramtype value: list[~azure.mgmt.netapp.models.Vault] + """ super(VaultList, self).__init__(**kwargs) self.value = value @@ -2727,8 +3314,8 @@ class Volume(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param location: Required. Resource location. - :type location: str + :ivar location: Required. Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. @@ -2737,38 +3324,38 @@ class Volume(msrest.serialization.Model): :vartype etag: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] :ivar file_system_id: Unique FileSystem Identifier. :vartype file_system_id: str - :param creation_token: Required. A unique file path for the volume. Used when creating mount + :ivar creation_token: Required. A unique file path for the volume. Used when creating mount targets. - :type creation_token: str - :param service_level: The service level of the file system. Possible values include: - "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel - :param usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. - This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. + :vartype creation_token: str + :ivar service_level: The service level of the file system. Possible values include: "Standard", + "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :ivar usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. This + is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - :type usage_threshold: long - :param export_policy: Set of export policy rules. - :type export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy - :param protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. - :type protocol_types: list[str] + :vartype usage_threshold: long + :ivar export_policy: Set of export policy rules. + :vartype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy + :ivar protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. + :vartype protocol_types: list[str] :ivar provisioning_state: Azure lifecycle management. :vartype provisioning_state: str - :param snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. - :type snapshot_id: str - :param backup_id: UUID v4 or resource identifier used to identify the Backup. - :type backup_id: str + :ivar snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. + :vartype snapshot_id: str + :ivar backup_id: UUID v4 or resource identifier used to identify the Backup. + :vartype backup_id: str :ivar baremetal_tenant_id: Unique Baremetal Tenant Identifier. :vartype baremetal_tenant_id: str - :param subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + :ivar subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the delegation Microsoft.NetApp/volumes. - :type subnet_id: str - :param network_features: Basic network, or Standard features available to the volume. Possible + :vartype subnet_id: str + :ivar network_features: Basic network, or Standard features available to the volume. Possible values include: "Basic", "Standard". Default value: "Basic". - :type network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures + :vartype network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures :ivar network_sibling_set_id: Network Sibling Set ID for the the group of volumes sharing networking resources. :vartype network_sibling_set_id: str @@ -2778,63 +3365,78 @@ class Volume(msrest.serialization.Model): ~azure.mgmt.netapp.models.VolumeStorageToNetworkProximity :ivar mount_targets: List of mount targets. :vartype mount_targets: list[~azure.mgmt.netapp.models.MountTargetProperties] - :param volume_type: What type of volume is this. For destination volumes in Cross Region + :ivar volume_type: What type of volume is this. For destination volumes in Cross Region Replication, set type to DataProtection. - :type volume_type: str - :param data_protection: DataProtection type volumes include an object containing details of the + :vartype volume_type: str + :ivar data_protection: DataProtection type volumes include an object containing details of the replication. - :type data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection - :param is_restoring: Restoring. - :type is_restoring: bool - :param snapshot_directory_visible: If enabled (true) the volume will contain a read-only + :vartype data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection + :ivar is_restoring: Restoring. + :vartype is_restoring: bool + :ivar snapshot_directory_visible: If enabled (true) the volume will contain a read-only snapshot directory which provides access to each of the volume's snapshots (default to true). - :type snapshot_directory_visible: bool - :param kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger - version 2020-05-01 or later. - :type kerberos_enabled: bool - :param security_style: The security style of volume, default unix, defaults to ntfs for dual + :vartype snapshot_directory_visible: bool + :ivar kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger version + 2020-05-01 or later. + :vartype kerberos_enabled: bool + :ivar security_style: The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol. Possible values include: "ntfs", "unix". Default value: "unix". - :type security_style: str or ~azure.mgmt.netapp.models.SecurityStyle - :param smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for + :vartype security_style: str or ~azure.mgmt.netapp.models.SecurityStyle + :ivar smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. - :type smb_encryption: bool - :param smb_continuously_available: Enables continuously available share property for smb - volume. Only applicable for SMB volume. - :type smb_continuously_available: bool - :param throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume. - :type throughput_mibps: float - :param encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. - :type encryption_key_source: str - :param ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. - :type ldap_enabled: bool - :param cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. - :type cool_access: bool - :param coolness_period: Specifies the number of days after which data that is not accessed by + :vartype smb_encryption: bool + :ivar smb_continuously_available: Enables continuously available share property for smb volume. + Only applicable for SMB volume. + :vartype smb_continuously_available: bool + :ivar throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :vartype throughput_mibps: float + :ivar encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :vartype encryption_key_source: str + :ivar ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. + :vartype ldap_enabled: bool + :ivar cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. + :vartype cool_access: bool + :ivar coolness_period: Specifies the number of days after which data that is not accessed by clients will be tiered. - :type coolness_period: int - :param unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. - First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second - digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third + :vartype coolness_period: int + :ivar unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. First + digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit + selects permission for the owner of the file: read (4), write (2) and execute (1). Third selects permissions for other users in the same group. the fourth for other users not in the group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other users. - :type unix_permissions: str + :vartype unix_permissions: str :ivar clone_progress: When a volume is being restored from another volume's snapshot, will show the percentage completion of this cloning process. When this value is empty/null there is no cloning process currently happening on this volume. This value will update every 5 minutes during cloning. :vartype clone_progress: int - :param avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution (AVS) + :ivar avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose. Possible values include: "Enabled", "Disabled". Default value: "Disabled". - :type avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore - :param is_default_quota_enabled: Specifies if default quota is enabled for the volume. - :type is_default_quota_enabled: bool - :param default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + :vartype avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore + :ivar is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :vartype is_default_quota_enabled: bool + :ivar default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - :type default_user_quota_in_ki_bs: long - :param default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + :vartype default_user_quota_in_ki_bs: long + :ivar default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - :type default_group_quota_in_ki_bs: long + :vartype default_group_quota_in_ki_bs: long + :ivar volume_group_name: Volume Group Name. + :vartype volume_group_name: str + :ivar capacity_pool_resource_id: Pool Resource Id used in case of creating a volume through + volume group. + :vartype capacity_pool_resource_id: str + :ivar proximity_placement_group: Proximity placement group associated with the volume. + :vartype proximity_placement_group: str + :ivar t2_network: T2 network information. + :vartype t2_network: str + :ivar volume_spec_name: Volume spec name is the application specific designation or identifier + for the particular volume in a volume group for e.g. data, log. + :vartype volume_spec_name: str + :ivar placement_rules: Application specific placement rules for the particular volume. + :vartype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] """ _validation = { @@ -2854,10 +3456,11 @@ class Volume(msrest.serialization.Model): 'network_sibling_set_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, 'storage_to_network_proximity': {'readonly': True}, 'mount_targets': {'readonly': True}, - 'throughput_mibps': {'maximum': 4500, 'minimum': 0}, 'coolness_period': {'maximum': 63, 'minimum': 7}, 'unix_permissions': {'max_length': 4, 'min_length': 4}, 'clone_progress': {'readonly': True}, + 'volume_group_name': {'readonly': True}, + 't2_network': {'readonly': True}, } _attribute_map = { @@ -2901,6 +3504,12 @@ class Volume(msrest.serialization.Model): 'is_default_quota_enabled': {'key': 'properties.isDefaultQuotaEnabled', 'type': 'bool'}, 'default_user_quota_in_ki_bs': {'key': 'properties.defaultUserQuotaInKiBs', 'type': 'long'}, 'default_group_quota_in_ki_bs': {'key': 'properties.defaultGroupQuotaInKiBs', 'type': 'long'}, + 'volume_group_name': {'key': 'properties.volumeGroupName', 'type': 'str'}, + 'capacity_pool_resource_id': {'key': 'properties.capacityPoolResourceId', 'type': 'str'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'str'}, + 't2_network': {'key': 'properties.t2Network', 'type': 'str'}, + 'volume_spec_name': {'key': 'properties.volumeSpecName', 'type': 'str'}, + 'placement_rules': {'key': 'properties.placementRules', 'type': '[PlacementKeyValuePairs]'}, } def __init__( @@ -2935,8 +3544,106 @@ def __init__( is_default_quota_enabled: Optional[bool] = False, default_user_quota_in_ki_bs: Optional[int] = 0, default_group_quota_in_ki_bs: Optional[int] = 0, + capacity_pool_resource_id: Optional[str] = None, + proximity_placement_group: Optional[str] = None, + volume_spec_name: Optional[str] = None, + placement_rules: Optional[List["PlacementKeyValuePairs"]] = None, **kwargs ): + """ + :keyword location: Required. Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword creation_token: Required. A unique file path for the volume. Used when creating mount + targets. + :paramtype creation_token: str + :keyword service_level: The service level of the file system. Possible values include: + "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :keyword usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. + This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. + Specified in bytes. + :paramtype usage_threshold: long + :keyword export_policy: Set of export policy rules. + :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy + :keyword protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. + :paramtype protocol_types: list[str] + :keyword snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. + :paramtype snapshot_id: str + :keyword backup_id: UUID v4 or resource identifier used to identify the Backup. + :paramtype backup_id: str + :keyword subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + delegation Microsoft.NetApp/volumes. + :paramtype subnet_id: str + :keyword network_features: Basic network, or Standard features available to the volume. + Possible values include: "Basic", "Standard". Default value: "Basic". + :paramtype network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures + :keyword volume_type: What type of volume is this. For destination volumes in Cross Region + Replication, set type to DataProtection. + :paramtype volume_type: str + :keyword data_protection: DataProtection type volumes include an object containing details of + the replication. + :paramtype data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection + :keyword is_restoring: Restoring. + :paramtype is_restoring: bool + :keyword snapshot_directory_visible: If enabled (true) the volume will contain a read-only + snapshot directory which provides access to each of the volume's snapshots (default to true). + :paramtype snapshot_directory_visible: bool + :keyword kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger + version 2020-05-01 or later. + :paramtype kerberos_enabled: bool + :keyword security_style: The security style of volume, default unix, defaults to ntfs for dual + protocol or CIFS protocol. Possible values include: "ntfs", "unix". Default value: "unix". + :paramtype security_style: str or ~azure.mgmt.netapp.models.SecurityStyle + :keyword smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for + SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + :paramtype smb_encryption: bool + :keyword smb_continuously_available: Enables continuously available share property for smb + volume. Only applicable for SMB volume. + :paramtype smb_continuously_available: bool + :keyword throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :paramtype throughput_mibps: float + :keyword encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :paramtype encryption_key_source: str + :keyword ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. + :paramtype ldap_enabled: bool + :keyword cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. + :paramtype cool_access: bool + :keyword coolness_period: Specifies the number of days after which data that is not accessed by + clients will be tiered. + :paramtype coolness_period: int + :keyword unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. + First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second + digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third + selects permissions for other users in the same group. the fourth for other users not in the + group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other + users. + :paramtype unix_permissions: str + :keyword avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution + (AVS) datastore purpose. Possible values include: "Enabled", "Disabled". Default value: + "Disabled". + :paramtype avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore + :keyword is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :paramtype is_default_quota_enabled: bool + :keyword default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + :paramtype default_user_quota_in_ki_bs: long + :keyword default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + :paramtype default_group_quota_in_ki_bs: long + :keyword capacity_pool_resource_id: Pool Resource Id used in case of creating a volume through + volume group. + :paramtype capacity_pool_resource_id: str + :keyword proximity_placement_group: Proximity placement group associated with the volume. + :paramtype proximity_placement_group: str + :keyword volume_spec_name: Volume spec name is the application specific designation or + identifier for the particular volume in a volume group for e.g. data, log. + :paramtype volume_spec_name: str + :keyword placement_rules: Application specific placement rules for the particular volume. + :paramtype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] + """ super(Volume, self).__init__(**kwargs) self.location = location self.id = None @@ -2978,19 +3685,25 @@ def __init__( self.is_default_quota_enabled = is_default_quota_enabled self.default_user_quota_in_ki_bs = default_user_quota_in_ki_bs self.default_group_quota_in_ki_bs = default_group_quota_in_ki_bs + self.volume_group_name = None + self.capacity_pool_resource_id = capacity_pool_resource_id + self.proximity_placement_group = proximity_placement_group + self.t2_network = None + self.volume_spec_name = volume_spec_name + self.placement_rules = placement_rules class VolumeBackupProperties(msrest.serialization.Model): """Volume Backup Properties. - :param backup_policy_id: Backup Policy Resource ID. - :type backup_policy_id: str - :param policy_enforced: Policy Enforced. - :type policy_enforced: bool - :param vault_id: Vault Resource ID. - :type vault_id: str - :param backup_enabled: Backup Enabled. - :type backup_enabled: bool + :ivar backup_policy_id: Backup Policy Resource ID. + :vartype backup_policy_id: str + :ivar policy_enforced: Policy Enforced. + :vartype policy_enforced: bool + :ivar vault_id: Vault Resource ID. + :vartype vault_id: str + :ivar backup_enabled: Backup Enabled. + :vartype backup_enabled: bool """ _attribute_map = { @@ -3009,6 +3722,16 @@ def __init__( backup_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword backup_policy_id: Backup Policy Resource ID. + :paramtype backup_policy_id: str + :keyword policy_enforced: Policy Enforced. + :paramtype policy_enforced: bool + :keyword vault_id: Vault Resource ID. + :paramtype vault_id: str + :keyword backup_enabled: Backup Enabled. + :paramtype backup_enabled: bool + """ super(VolumeBackupProperties, self).__init__(**kwargs) self.backup_policy_id = backup_policy_id self.policy_enforced = policy_enforced @@ -3019,12 +3742,12 @@ def __init__( class VolumeBackups(msrest.serialization.Model): """Volume details using the backup policy. - :param volume_name: Volume name. - :type volume_name: str - :param backups_count: Total count of backups for volume. - :type backups_count: int - :param policy_enabled: Policy enabled. - :type policy_enabled: bool + :ivar volume_name: Volume name. + :vartype volume_name: str + :ivar backups_count: Total count of backups for volume. + :vartype backups_count: int + :ivar policy_enabled: Policy enabled. + :vartype policy_enabled: bool """ _attribute_map = { @@ -3041,19 +3764,627 @@ def __init__( policy_enabled: Optional[bool] = None, **kwargs ): + """ + :keyword volume_name: Volume name. + :paramtype volume_name: str + :keyword backups_count: Total count of backups for volume. + :paramtype backups_count: int + :keyword policy_enabled: Policy enabled. + :paramtype policy_enabled: bool + """ super(VolumeBackups, self).__init__(**kwargs) self.volume_name = volume_name self.backups_count = backups_count self.policy_enabled = policy_enabled +class VolumeGroup(msrest.serialization.Model): + """Volume group resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar provisioning_state: Azure lifecycle management. + :vartype provisioning_state: str + :ivar group_meta_data: Volume group details. + :vartype group_meta_data: ~azure.mgmt.netapp.models.VolumeGroupMetaData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'group_meta_data': {'key': 'properties.groupMetaData', 'type': 'VolumeGroupMetaData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + group_meta_data: Optional["VolumeGroupMetaData"] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword group_meta_data: Volume group details. + :paramtype group_meta_data: ~azure.mgmt.netapp.models.VolumeGroupMetaData + """ + super(VolumeGroup, self).__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.type = None + self.tags = tags + self.provisioning_state = None + self.group_meta_data = group_meta_data + + +class VolumeGroupDetails(msrest.serialization.Model): + """Volume group resource for create. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar location: Resource location. + :vartype location: str + :ivar id: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar provisioning_state: Azure lifecycle management. + :vartype provisioning_state: str + :ivar group_meta_data: Volume group details. + :vartype group_meta_data: ~azure.mgmt.netapp.models.VolumeGroupMetaData + :ivar volumes: List of volumes from group. + :vartype volumes: list[~azure.mgmt.netapp.models.VolumeGroupVolumeProperties] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'location': {'key': 'location', 'type': 'str'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'group_meta_data': {'key': 'properties.groupMetaData', 'type': 'VolumeGroupMetaData'}, + 'volumes': {'key': 'properties.volumes', 'type': '[VolumeGroupVolumeProperties]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + group_meta_data: Optional["VolumeGroupMetaData"] = None, + volumes: Optional[List["VolumeGroupVolumeProperties"]] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword group_meta_data: Volume group details. + :paramtype group_meta_data: ~azure.mgmt.netapp.models.VolumeGroupMetaData + :keyword volumes: List of volumes from group. + :paramtype volumes: list[~azure.mgmt.netapp.models.VolumeGroupVolumeProperties] + """ + super(VolumeGroupDetails, self).__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.type = None + self.tags = tags + self.provisioning_state = None + self.group_meta_data = group_meta_data + self.volumes = volumes + + +class VolumeGroupList(msrest.serialization.Model): + """List of volume group resources. + + :ivar value: List of volume Groups. + :vartype value: list[~azure.mgmt.netapp.models.VolumeGroup] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VolumeGroup]'}, + } + + def __init__( + self, + *, + value: Optional[List["VolumeGroup"]] = None, + **kwargs + ): + """ + :keyword value: List of volume Groups. + :paramtype value: list[~azure.mgmt.netapp.models.VolumeGroup] + """ + super(VolumeGroupList, self).__init__(**kwargs) + self.value = value + + +class VolumeGroupMetaData(msrest.serialization.Model): + """Volume group properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar group_description: Group Description. + :vartype group_description: str + :ivar application_type: Application Type. Possible values include: "SAP-HANA". + :vartype application_type: str or ~azure.mgmt.netapp.models.ApplicationType + :ivar application_identifier: Application specific identifier. + :vartype application_identifier: str + :ivar global_placement_rules: Application specific placement rules for the volume group. + :vartype global_placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] + :ivar deployment_spec_id: Application specific identifier of deployment rules for the volume + group. + :vartype deployment_spec_id: str + :ivar volumes_count: Number of volumes in volume group. + :vartype volumes_count: long + """ + + _validation = { + 'volumes_count': {'readonly': True}, + } + + _attribute_map = { + 'group_description': {'key': 'groupDescription', 'type': 'str'}, + 'application_type': {'key': 'applicationType', 'type': 'str'}, + 'application_identifier': {'key': 'applicationIdentifier', 'type': 'str'}, + 'global_placement_rules': {'key': 'globalPlacementRules', 'type': '[PlacementKeyValuePairs]'}, + 'deployment_spec_id': {'key': 'deploymentSpecId', 'type': 'str'}, + 'volumes_count': {'key': 'volumesCount', 'type': 'long'}, + } + + def __init__( + self, + *, + group_description: Optional[str] = None, + application_type: Optional[Union[str, "ApplicationType"]] = None, + application_identifier: Optional[str] = None, + global_placement_rules: Optional[List["PlacementKeyValuePairs"]] = None, + deployment_spec_id: Optional[str] = None, + **kwargs + ): + """ + :keyword group_description: Group Description. + :paramtype group_description: str + :keyword application_type: Application Type. Possible values include: "SAP-HANA". + :paramtype application_type: str or ~azure.mgmt.netapp.models.ApplicationType + :keyword application_identifier: Application specific identifier. + :paramtype application_identifier: str + :keyword global_placement_rules: Application specific placement rules for the volume group. + :paramtype global_placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] + :keyword deployment_spec_id: Application specific identifier of deployment rules for the volume + group. + :paramtype deployment_spec_id: str + """ + super(VolumeGroupMetaData, self).__init__(**kwargs) + self.group_description = group_description + self.application_type = application_type + self.application_identifier = application_identifier + self.global_placement_rules = global_placement_rules + self.deployment_spec_id = deployment_spec_id + self.volumes_count = None + + +class VolumeGroupVolumeProperties(msrest.serialization.Model): + """Volume resource. + + 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: Resource Id. + :vartype id: str + :ivar name: Resource name. + :vartype name: str + :ivar type: Resource type. + :vartype type: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar file_system_id: Unique FileSystem Identifier. + :vartype file_system_id: str + :ivar creation_token: Required. A unique file path for the volume. Used when creating mount + targets. + :vartype creation_token: str + :ivar service_level: The service level of the file system. Possible values include: "Standard", + "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :ivar usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. This + is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. + Specified in bytes. + :vartype usage_threshold: long + :ivar export_policy: Set of export policy rules. + :vartype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy + :ivar protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. + :vartype protocol_types: list[str] + :ivar provisioning_state: Azure lifecycle management. + :vartype provisioning_state: str + :ivar snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. + :vartype snapshot_id: str + :ivar backup_id: UUID v4 or resource identifier used to identify the Backup. + :vartype backup_id: str + :ivar baremetal_tenant_id: Unique Baremetal Tenant Identifier. + :vartype baremetal_tenant_id: str + :ivar subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + delegation Microsoft.NetApp/volumes. + :vartype subnet_id: str + :ivar network_features: Basic network, or Standard features available to the volume. Possible + values include: "Basic", "Standard". Default value: "Basic". + :vartype network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures + :ivar network_sibling_set_id: Network Sibling Set ID for the the group of volumes sharing + networking resources. + :vartype network_sibling_set_id: str + :ivar storage_to_network_proximity: Provides storage to network proximity information for the + volume. Possible values include: "Default", "T1", "T2". + :vartype storage_to_network_proximity: str or + ~azure.mgmt.netapp.models.VolumeStorageToNetworkProximity + :ivar mount_targets: List of mount targets. + :vartype mount_targets: list[~azure.mgmt.netapp.models.MountTargetProperties] + :ivar volume_type: What type of volume is this. For destination volumes in Cross Region + Replication, set type to DataProtection. + :vartype volume_type: str + :ivar data_protection: DataProtection type volumes include an object containing details of the + replication. + :vartype data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection + :ivar is_restoring: Restoring. + :vartype is_restoring: bool + :ivar snapshot_directory_visible: If enabled (true) the volume will contain a read-only + snapshot directory which provides access to each of the volume's snapshots (default to true). + :vartype snapshot_directory_visible: bool + :ivar kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger version + 2020-05-01 or later. + :vartype kerberos_enabled: bool + :ivar security_style: The security style of volume, default unix, defaults to ntfs for dual + protocol or CIFS protocol. Possible values include: "ntfs", "unix". Default value: "unix". + :vartype security_style: str or ~azure.mgmt.netapp.models.SecurityStyle + :ivar smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for + SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + :vartype smb_encryption: bool + :ivar smb_continuously_available: Enables continuously available share property for smb volume. + Only applicable for SMB volume. + :vartype smb_continuously_available: bool + :ivar throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :vartype throughput_mibps: float + :ivar encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :vartype encryption_key_source: str + :ivar ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. + :vartype ldap_enabled: bool + :ivar cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. + :vartype cool_access: bool + :ivar coolness_period: Specifies the number of days after which data that is not accessed by + clients will be tiered. + :vartype coolness_period: int + :ivar unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. First + digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second digit + selects permission for the owner of the file: read (4), write (2) and execute (1). Third + selects permissions for other users in the same group. the fourth for other users not in the + group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other + users. + :vartype unix_permissions: str + :ivar clone_progress: When a volume is being restored from another volume's snapshot, will show + the percentage completion of this cloning process. When this value is empty/null there is no + cloning process currently happening on this volume. This value will update every 5 minutes + during cloning. + :vartype clone_progress: int + :ivar avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution (AVS) + datastore purpose. Possible values include: "Enabled", "Disabled". Default value: "Disabled". + :vartype avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore + :ivar is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :vartype is_default_quota_enabled: bool + :ivar default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + :vartype default_user_quota_in_ki_bs: long + :ivar default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + :vartype default_group_quota_in_ki_bs: long + :ivar volume_group_name: Volume Group Name. + :vartype volume_group_name: str + :ivar capacity_pool_resource_id: Pool Resource Id used in case of creating a volume through + volume group. + :vartype capacity_pool_resource_id: str + :ivar proximity_placement_group: Proximity placement group associated with the volume. + :vartype proximity_placement_group: str + :ivar t2_network: T2 network information. + :vartype t2_network: str + :ivar volume_spec_name: Volume spec name is the application specific designation or identifier + for the particular volume in a volume group for e.g. data, log. + :vartype volume_spec_name: str + :ivar placement_rules: Application specific placement rules for the particular volume. + :vartype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] + """ + + _validation = { + 'id': {'readonly': True}, + 'type': {'readonly': True}, + 'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, + 'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'}, + 'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400}, + 'provisioning_state': {'readonly': True}, + 'snapshot_id': {'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$'}, + 'backup_id': {'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}|(\\?([^\/]*[\/])*)([^\/]+)$'}, + 'baremetal_tenant_id': {'readonly': True}, + 'subnet_id': {'required': True}, + 'network_sibling_set_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, + 'storage_to_network_proximity': {'readonly': True}, + 'mount_targets': {'readonly': True}, + 'coolness_period': {'maximum': 63, 'minimum': 7}, + 'unix_permissions': {'max_length': 4, 'min_length': 4}, + 'clone_progress': {'readonly': True}, + 'volume_group_name': {'readonly': True}, + 't2_network': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, + 'creation_token': {'key': 'properties.creationToken', 'type': 'str'}, + 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, + 'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'}, + 'export_policy': {'key': 'properties.exportPolicy', 'type': 'VolumePropertiesExportPolicy'}, + 'protocol_types': {'key': 'properties.protocolTypes', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'snapshot_id': {'key': 'properties.snapshotId', 'type': 'str'}, + 'backup_id': {'key': 'properties.backupId', 'type': 'str'}, + 'baremetal_tenant_id': {'key': 'properties.baremetalTenantId', 'type': 'str'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'network_features': {'key': 'properties.networkFeatures', 'type': 'str'}, + 'network_sibling_set_id': {'key': 'properties.networkSiblingSetId', 'type': 'str'}, + 'storage_to_network_proximity': {'key': 'properties.storageToNetworkProximity', 'type': 'str'}, + 'mount_targets': {'key': 'properties.mountTargets', 'type': '[MountTargetProperties]'}, + 'volume_type': {'key': 'properties.volumeType', 'type': 'str'}, + 'data_protection': {'key': 'properties.dataProtection', 'type': 'VolumePropertiesDataProtection'}, + 'is_restoring': {'key': 'properties.isRestoring', 'type': 'bool'}, + 'snapshot_directory_visible': {'key': 'properties.snapshotDirectoryVisible', 'type': 'bool'}, + 'kerberos_enabled': {'key': 'properties.kerberosEnabled', 'type': 'bool'}, + 'security_style': {'key': 'properties.securityStyle', 'type': 'str'}, + 'smb_encryption': {'key': 'properties.smbEncryption', 'type': 'bool'}, + 'smb_continuously_available': {'key': 'properties.smbContinuouslyAvailable', 'type': 'bool'}, + 'throughput_mibps': {'key': 'properties.throughputMibps', 'type': 'float'}, + 'encryption_key_source': {'key': 'properties.encryptionKeySource', 'type': 'str'}, + 'ldap_enabled': {'key': 'properties.ldapEnabled', 'type': 'bool'}, + 'cool_access': {'key': 'properties.coolAccess', 'type': 'bool'}, + 'coolness_period': {'key': 'properties.coolnessPeriod', 'type': 'int'}, + 'unix_permissions': {'key': 'properties.unixPermissions', 'type': 'str'}, + 'clone_progress': {'key': 'properties.cloneProgress', 'type': 'int'}, + 'avs_data_store': {'key': 'properties.avsDataStore', 'type': 'str'}, + 'is_default_quota_enabled': {'key': 'properties.isDefaultQuotaEnabled', 'type': 'bool'}, + 'default_user_quota_in_ki_bs': {'key': 'properties.defaultUserQuotaInKiBs', 'type': 'long'}, + 'default_group_quota_in_ki_bs': {'key': 'properties.defaultGroupQuotaInKiBs', 'type': 'long'}, + 'volume_group_name': {'key': 'properties.volumeGroupName', 'type': 'str'}, + 'capacity_pool_resource_id': {'key': 'properties.capacityPoolResourceId', 'type': 'str'}, + 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'str'}, + 't2_network': {'key': 'properties.t2Network', 'type': 'str'}, + 'volume_spec_name': {'key': 'properties.volumeSpecName', 'type': 'str'}, + 'placement_rules': {'key': 'properties.placementRules', 'type': '[PlacementKeyValuePairs]'}, + } + + def __init__( + self, + *, + creation_token: str, + usage_threshold: int = 107374182400, + subnet_id: str, + name: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + service_level: Optional[Union[str, "ServiceLevel"]] = "Premium", + export_policy: Optional["VolumePropertiesExportPolicy"] = None, + protocol_types: Optional[List[str]] = None, + snapshot_id: Optional[str] = None, + backup_id: Optional[str] = None, + network_features: Optional[Union[str, "NetworkFeatures"]] = "Basic", + volume_type: Optional[str] = None, + data_protection: Optional["VolumePropertiesDataProtection"] = None, + is_restoring: Optional[bool] = None, + snapshot_directory_visible: Optional[bool] = True, + kerberos_enabled: Optional[bool] = False, + security_style: Optional[Union[str, "SecurityStyle"]] = "unix", + smb_encryption: Optional[bool] = False, + smb_continuously_available: Optional[bool] = False, + throughput_mibps: Optional[float] = 0, + encryption_key_source: Optional[str] = None, + ldap_enabled: Optional[bool] = False, + cool_access: Optional[bool] = False, + coolness_period: Optional[int] = None, + unix_permissions: Optional[str] = "0770", + avs_data_store: Optional[Union[str, "AvsDataStore"]] = "Disabled", + is_default_quota_enabled: Optional[bool] = False, + default_user_quota_in_ki_bs: Optional[int] = 0, + default_group_quota_in_ki_bs: Optional[int] = 0, + capacity_pool_resource_id: Optional[str] = None, + proximity_placement_group: Optional[str] = None, + volume_spec_name: Optional[str] = None, + placement_rules: Optional[List["PlacementKeyValuePairs"]] = None, + **kwargs + ): + """ + :keyword name: Resource name. + :paramtype name: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword creation_token: Required. A unique file path for the volume. Used when creating mount + targets. + :paramtype creation_token: str + :keyword service_level: The service level of the file system. Possible values include: + "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :keyword usage_threshold: Required. Maximum storage quota allowed for a file system in bytes. + This is a soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. + Specified in bytes. + :paramtype usage_threshold: long + :keyword export_policy: Set of export policy rules. + :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePropertiesExportPolicy + :keyword protocol_types: Set of protocol types, default NFSv3, CIFS for SMB protocol. + :paramtype protocol_types: list[str] + :keyword snapshot_id: UUID v4 or resource identifier used to identify the Snapshot. + :paramtype snapshot_id: str + :keyword backup_id: UUID v4 or resource identifier used to identify the Backup. + :paramtype backup_id: str + :keyword subnet_id: Required. The Azure Resource URI for a delegated subnet. Must have the + delegation Microsoft.NetApp/volumes. + :paramtype subnet_id: str + :keyword network_features: Basic network, or Standard features available to the volume. + Possible values include: "Basic", "Standard". Default value: "Basic". + :paramtype network_features: str or ~azure.mgmt.netapp.models.NetworkFeatures + :keyword volume_type: What type of volume is this. For destination volumes in Cross Region + Replication, set type to DataProtection. + :paramtype volume_type: str + :keyword data_protection: DataProtection type volumes include an object containing details of + the replication. + :paramtype data_protection: ~azure.mgmt.netapp.models.VolumePropertiesDataProtection + :keyword is_restoring: Restoring. + :paramtype is_restoring: bool + :keyword snapshot_directory_visible: If enabled (true) the volume will contain a read-only + snapshot directory which provides access to each of the volume's snapshots (default to true). + :paramtype snapshot_directory_visible: bool + :keyword kerberos_enabled: Describe if a volume is KerberosEnabled. To be use with swagger + version 2020-05-01 or later. + :paramtype kerberos_enabled: bool + :keyword security_style: The security style of volume, default unix, defaults to ntfs for dual + protocol or CIFS protocol. Possible values include: "ntfs", "unix". Default value: "unix". + :paramtype security_style: str or ~azure.mgmt.netapp.models.SecurityStyle + :keyword smb_encryption: Enables encryption for in-flight smb3 data. Only applicable for + SMB/DualProtocol volume. To be used with swagger version 2020-08-01 or later. + :paramtype smb_encryption: bool + :keyword smb_continuously_available: Enables continuously available share property for smb + volume. Only applicable for SMB volume. + :paramtype smb_continuously_available: bool + :keyword throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :paramtype throughput_mibps: float + :keyword encryption_key_source: Encryption Key Source. Possible values are: 'Microsoft.NetApp'. + :paramtype encryption_key_source: str + :keyword ldap_enabled: Specifies whether LDAP is enabled or not for a given NFS volume. + :paramtype ldap_enabled: bool + :keyword cool_access: Specifies whether Cool Access(tiering) is enabled for the volume. + :paramtype cool_access: bool + :keyword coolness_period: Specifies the number of days after which data that is not accessed by + clients will be tiered. + :paramtype coolness_period: int + :keyword unix_permissions: UNIX permissions for NFS volume accepted in octal 4 digit format. + First digit selects the set user ID(4), set group ID (2) and sticky (1) attributes. Second + digit selects permission for the owner of the file: read (4), write (2) and execute (1). Third + selects permissions for other users in the same group. the fourth for other users not in the + group. 0755 - gives read/write/execute permissions to owner and read/execute to group and other + users. + :paramtype unix_permissions: str + :keyword avs_data_store: Specifies whether the volume is enabled for Azure VMware Solution + (AVS) datastore purpose. Possible values include: "Enabled", "Disabled". Default value: + "Disabled". + :paramtype avs_data_store: str or ~azure.mgmt.netapp.models.AvsDataStore + :keyword is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :paramtype is_default_quota_enabled: bool + :keyword default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + :paramtype default_user_quota_in_ki_bs: long + :keyword default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + :paramtype default_group_quota_in_ki_bs: long + :keyword capacity_pool_resource_id: Pool Resource Id used in case of creating a volume through + volume group. + :paramtype capacity_pool_resource_id: str + :keyword proximity_placement_group: Proximity placement group associated with the volume. + :paramtype proximity_placement_group: str + :keyword volume_spec_name: Volume spec name is the application specific designation or + identifier for the particular volume in a volume group for e.g. data, log. + :paramtype volume_spec_name: str + :keyword placement_rules: Application specific placement rules for the particular volume. + :paramtype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] + """ + super(VolumeGroupVolumeProperties, self).__init__(**kwargs) + self.id = None + self.name = name + self.type = None + self.tags = tags + self.file_system_id = None + self.creation_token = creation_token + self.service_level = service_level + self.usage_threshold = usage_threshold + self.export_policy = export_policy + self.protocol_types = protocol_types + self.provisioning_state = None + self.snapshot_id = snapshot_id + self.backup_id = backup_id + self.baremetal_tenant_id = None + self.subnet_id = subnet_id + self.network_features = network_features + self.network_sibling_set_id = None + self.storage_to_network_proximity = None + self.mount_targets = None + self.volume_type = volume_type + self.data_protection = data_protection + self.is_restoring = is_restoring + self.snapshot_directory_visible = snapshot_directory_visible + self.kerberos_enabled = kerberos_enabled + self.security_style = security_style + self.smb_encryption = smb_encryption + self.smb_continuously_available = smb_continuously_available + self.throughput_mibps = throughput_mibps + self.encryption_key_source = encryption_key_source + self.ldap_enabled = ldap_enabled + self.cool_access = cool_access + self.coolness_period = coolness_period + self.unix_permissions = unix_permissions + self.clone_progress = None + self.avs_data_store = avs_data_store + self.is_default_quota_enabled = is_default_quota_enabled + self.default_user_quota_in_ki_bs = default_user_quota_in_ki_bs + self.default_group_quota_in_ki_bs = default_group_quota_in_ki_bs + self.volume_group_name = None + self.capacity_pool_resource_id = capacity_pool_resource_id + self.proximity_placement_group = proximity_placement_group + self.t2_network = None + self.volume_spec_name = volume_spec_name + self.placement_rules = placement_rules + + class VolumeList(msrest.serialization.Model): """List of volume resources. - :param value: List of volumes. - :type value: list[~azure.mgmt.netapp.models.Volume] - :param next_link: URL to get the next set of results. - :type next_link: str + :ivar value: List of volumes. + :vartype value: list[~azure.mgmt.netapp.models.Volume] + :ivar next_link: URL to get the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -3068,6 +4399,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: List of volumes. + :paramtype value: list[~azure.mgmt.netapp.models.Volume] + :keyword next_link: URL to get the next set of results. + :paramtype next_link: str + """ super(VolumeList, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -3078,38 +4415,39 @@ class VolumePatch(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param location: Resource location. - :type location: str + :ivar location: Resource location. + :vartype location: str :ivar id: Resource Id. :vartype id: str :ivar name: Resource name. :vartype name: str :ivar type: Resource type. :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param service_level: The service level of the file system. Possible values include: - "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". - :type service_level: str or ~azure.mgmt.netapp.models.ServiceLevel - :param usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a - soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar service_level: The service level of the file system. Possible values include: "Standard", + "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :vartype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :ivar usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a soft + quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in bytes. - :type usage_threshold: long - :param export_policy: Set of export policy rules. - :type export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy - :param throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume. - :type throughput_mibps: float - :param data_protection: DataProtection type volumes include an object containing details of the + :vartype usage_threshold: long + :ivar export_policy: Set of export policy rules. + :vartype export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy + :ivar throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :vartype throughput_mibps: float + :ivar data_protection: DataProtection type volumes include an object containing details of the replication. - :type data_protection: ~azure.mgmt.netapp.models.VolumePatchPropertiesDataProtection - :param is_default_quota_enabled: Specifies if default quota is enabled for the volume. - :type is_default_quota_enabled: bool - :param default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + :vartype data_protection: ~azure.mgmt.netapp.models.VolumePatchPropertiesDataProtection + :ivar is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :vartype is_default_quota_enabled: bool + :ivar default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . - :type default_user_quota_in_ki_bs: long - :param default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + :vartype default_user_quota_in_ki_bs: long + :ivar default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. - :type default_group_quota_in_ki_bs: long + :vartype default_group_quota_in_ki_bs: long """ _validation = { @@ -3117,7 +4455,6 @@ class VolumePatch(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'usage_threshold': {'maximum': 109951162777600, 'minimum': 107374182400}, - 'throughput_mibps': {'maximum': 4500, 'minimum': 1}, } _attribute_map = { @@ -3144,13 +4481,42 @@ def __init__( service_level: Optional[Union[str, "ServiceLevel"]] = "Premium", usage_threshold: Optional[int] = 107374182400, export_policy: Optional["VolumePatchPropertiesExportPolicy"] = None, - throughput_mibps: Optional[float] = None, + throughput_mibps: Optional[float] = 0, data_protection: Optional["VolumePatchPropertiesDataProtection"] = None, is_default_quota_enabled: Optional[bool] = False, default_user_quota_in_ki_bs: Optional[int] = 0, default_group_quota_in_ki_bs: Optional[int] = 0, **kwargs ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword service_level: The service level of the file system. Possible values include: + "Standard", "Premium", "Ultra", "StandardZRS". Default value: "Premium". + :paramtype service_level: str or ~azure.mgmt.netapp.models.ServiceLevel + :keyword usage_threshold: Maximum storage quota allowed for a file system in bytes. This is a + soft quota used for alerting only. Minimum size is 100 GiB. Upper limit is 100TiB. Specified in + bytes. + :paramtype usage_threshold: long + :keyword export_policy: Set of export policy rules. + :paramtype export_policy: ~azure.mgmt.netapp.models.VolumePatchPropertiesExportPolicy + :keyword throughput_mibps: Maximum throughput in Mibps that can be achieved by this volume and + this will be accepted as input only for manual qosType volume. + :paramtype throughput_mibps: float + :keyword data_protection: DataProtection type volumes include an object containing details of + the replication. + :paramtype data_protection: ~azure.mgmt.netapp.models.VolumePatchPropertiesDataProtection + :keyword is_default_quota_enabled: Specifies if default quota is enabled for the volume. + :paramtype is_default_quota_enabled: bool + :keyword default_user_quota_in_ki_bs: Default user quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies . + :paramtype default_user_quota_in_ki_bs: long + :keyword default_group_quota_in_ki_bs: Default group quota for volume in KiBs. If + isDefaultQuotaEnabled is set, the minimum value of 4 KiBs applies. + :paramtype default_group_quota_in_ki_bs: long + """ super(VolumePatch, self).__init__(**kwargs) self.location = location self.id = None @@ -3170,10 +4536,10 @@ def __init__( class VolumePatchPropertiesDataProtection(msrest.serialization.Model): """DataProtection type volumes include an object containing details of the replication. - :param backup: Backup Properties. - :type backup: ~azure.mgmt.netapp.models.VolumeBackupProperties - :param snapshot: Snapshot properties. - :type snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties + :ivar backup: Backup Properties. + :vartype backup: ~azure.mgmt.netapp.models.VolumeBackupProperties + :ivar snapshot: Snapshot properties. + :vartype snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties """ _attribute_map = { @@ -3188,6 +4554,12 @@ def __init__( snapshot: Optional["VolumeSnapshotProperties"] = None, **kwargs ): + """ + :keyword backup: Backup Properties. + :paramtype backup: ~azure.mgmt.netapp.models.VolumeBackupProperties + :keyword snapshot: Snapshot properties. + :paramtype snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties + """ super(VolumePatchPropertiesDataProtection, self).__init__(**kwargs) self.backup = backup self.snapshot = snapshot @@ -3196,8 +4568,8 @@ def __init__( class VolumePatchPropertiesExportPolicy(msrest.serialization.Model): """Set of export policy rules. - :param rules: Export policy rule. - :type rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] + :ivar rules: Export policy rule. + :vartype rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] """ _attribute_map = { @@ -3210,6 +4582,10 @@ def __init__( rules: Optional[List["ExportPolicyRule"]] = None, **kwargs ): + """ + :keyword rules: Export policy rule. + :paramtype rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] + """ super(VolumePatchPropertiesExportPolicy, self).__init__(**kwargs) self.rules = rules @@ -3217,12 +4593,12 @@ def __init__( class VolumePropertiesDataProtection(msrest.serialization.Model): """DataProtection type volumes include an object containing details of the replication. - :param backup: Backup Properties. - :type backup: ~azure.mgmt.netapp.models.VolumeBackupProperties - :param replication: Replication properties. - :type replication: ~azure.mgmt.netapp.models.ReplicationObject - :param snapshot: Snapshot properties. - :type snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties + :ivar backup: Backup Properties. + :vartype backup: ~azure.mgmt.netapp.models.VolumeBackupProperties + :ivar replication: Replication properties. + :vartype replication: ~azure.mgmt.netapp.models.ReplicationObject + :ivar snapshot: Snapshot properties. + :vartype snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties """ _attribute_map = { @@ -3239,6 +4615,14 @@ def __init__( snapshot: Optional["VolumeSnapshotProperties"] = None, **kwargs ): + """ + :keyword backup: Backup Properties. + :paramtype backup: ~azure.mgmt.netapp.models.VolumeBackupProperties + :keyword replication: Replication properties. + :paramtype replication: ~azure.mgmt.netapp.models.ReplicationObject + :keyword snapshot: Snapshot properties. + :paramtype snapshot: ~azure.mgmt.netapp.models.VolumeSnapshotProperties + """ super(VolumePropertiesDataProtection, self).__init__(**kwargs) self.backup = backup self.replication = replication @@ -3248,8 +4632,8 @@ def __init__( class VolumePropertiesExportPolicy(msrest.serialization.Model): """Set of export policy rules. - :param rules: Export policy rule. - :type rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] + :ivar rules: Export policy rule. + :vartype rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] """ _attribute_map = { @@ -3262,6 +4646,10 @@ def __init__( rules: Optional[List["ExportPolicyRule"]] = None, **kwargs ): + """ + :keyword rules: Export policy rule. + :paramtype rules: list[~azure.mgmt.netapp.models.ExportPolicyRule] + """ super(VolumePropertiesExportPolicy, self).__init__(**kwargs) self.rules = rules @@ -3269,8 +4657,8 @@ def __init__( class VolumeRevert(msrest.serialization.Model): """revert a volume to the snapshot. - :param snapshot_id: Resource id of the snapshot. - :type snapshot_id: str + :ivar snapshot_id: Resource id of the snapshot. + :vartype snapshot_id: str """ _attribute_map = { @@ -3283,6 +4671,10 @@ def __init__( snapshot_id: Optional[str] = None, **kwargs ): + """ + :keyword snapshot_id: Resource id of the snapshot. + :paramtype snapshot_id: str + """ super(VolumeRevert, self).__init__(**kwargs) self.snapshot_id = snapshot_id @@ -3290,8 +4682,8 @@ def __init__( class VolumeSnapshotProperties(msrest.serialization.Model): """Volume Snapshot Properties. - :param snapshot_policy_id: Snapshot Policy ResourceId. - :type snapshot_policy_id: str + :ivar snapshot_policy_id: Snapshot Policy ResourceId. + :vartype snapshot_policy_id: str """ _attribute_map = { @@ -3304,6 +4696,10 @@ def __init__( snapshot_policy_id: Optional[str] = None, **kwargs ): + """ + :keyword snapshot_policy_id: Snapshot Policy ResourceId. + :paramtype snapshot_policy_id: str + """ super(VolumeSnapshotProperties, self).__init__(**kwargs) self.snapshot_policy_id = snapshot_policy_id @@ -3311,17 +4707,17 @@ def __init__( class WeeklySchedule(msrest.serialization.Model): """Weekly Schedule properties, make a snapshot every week at a specific day or days. - :param snapshots_to_keep: Weekly snapshot count to keep. - :type snapshots_to_keep: int - :param day: Indicates which weekdays snapshot should be taken, accepts a comma separated list - of week day names in english. - :type day: str - :param hour: Indicates which hour in UTC timezone a snapshot should be taken. - :type hour: int - :param minute: Indicates which minute snapshot should be taken. - :type minute: int - :param used_bytes: Resource size in bytes, current storage usage for the volume in bytes. - :type used_bytes: long + :ivar snapshots_to_keep: Weekly snapshot count to keep. + :vartype snapshots_to_keep: int + :ivar day: Indicates which weekdays snapshot should be taken, accepts a comma separated list of + week day names in english. + :vartype day: str + :ivar hour: Indicates which hour in UTC timezone a snapshot should be taken. + :vartype hour: int + :ivar minute: Indicates which minute snapshot should be taken. + :vartype minute: int + :ivar used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :vartype used_bytes: long """ _attribute_map = { @@ -3342,6 +4738,19 @@ def __init__( used_bytes: Optional[int] = None, **kwargs ): + """ + :keyword snapshots_to_keep: Weekly snapshot count to keep. + :paramtype snapshots_to_keep: int + :keyword day: Indicates which weekdays snapshot should be taken, accepts a comma separated list + of week day names in english. + :paramtype day: str + :keyword hour: Indicates which hour in UTC timezone a snapshot should be taken. + :paramtype hour: int + :keyword minute: Indicates which minute snapshot should be taken. + :paramtype minute: int + :keyword used_bytes: Resource size in bytes, current storage usage for the volume in bytes. + :paramtype used_bytes: long + """ super(WeeklySchedule, self).__init__(**kwargs) self.snapshots_to_keep = snapshots_to_keep self.day = day diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_net_app_management_client_enums.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_net_app_management_client_enums.py index 436c8e4cee7b..39a9c6b8d79e 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_net_app_management_client_enums.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_net_app_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActiveDirectoryStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActiveDirectoryStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the Active Directory """ @@ -41,7 +26,13 @@ class ActiveDirectoryStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: Active Directory Updating. UPDATING = "Updating" -class AvsDataStore(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ApplicationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Application Type + """ + + SAP_HANA = "SAP-HANA" + +class AvsDataStore(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies whether the volume is enabled for Azure VMware Solution (AVS) datastore purpose """ @@ -50,7 +41,7 @@ class AvsDataStore(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: avsDataStore is disabled. DISABLED = "Disabled" -class BackupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class BackupType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Type of backup Manual or Scheduled """ @@ -59,7 +50,7 @@ class BackupType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Scheduled backup. SCHEDULED = "Scheduled" -class CheckNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CheckNameResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource type used for verification. """ @@ -68,7 +59,7 @@ class CheckNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum) MICROSOFT_NET_APP_NET_APP_ACCOUNTS_CAPACITY_POOLS_VOLUMES = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" MICROSOFT_NET_APP_NET_APP_ACCOUNTS_CAPACITY_POOLS_VOLUMES_SNAPSHOTS = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -class CheckQuotaNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CheckQuotaNameResourceTypes(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Resource type used for verification. """ @@ -77,7 +68,7 @@ class CheckQuotaNameResourceTypes(with_metaclass(_CaseInsensitiveEnumMeta, str, MICROSOFT_NET_APP_NET_APP_ACCOUNTS_CAPACITY_POOLS_VOLUMES = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes" MICROSOFT_NET_APP_NET_APP_ACCOUNTS_CAPACITY_POOLS_VOLUMES_SNAPSHOTS = "Microsoft.NetApp/netAppAccounts/capacityPools/volumes/snapshots" -class ChownMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ChownMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This parameter specifies who is authorized to change the ownership of a file. restricted - Only root user can change the ownership of the file. unrestricted - Non-root users can change ownership of files that they own. @@ -86,7 +77,7 @@ class ChownMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): RESTRICTED = "Restricted" UNRESTRICTED = "Unrestricted" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -95,7 +86,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EncryptionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Encryption type of the capacity pool, set encryption type for data at rest for this pool and all volumes in it. This value can only be set when creating new pool. """ @@ -105,14 +96,14 @@ class EncryptionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: EncryptionType Double, volumes will use double encryption at rest. DOUBLE = "Double" -class EndpointType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class EndpointType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates whether the local volume is the source or destination for the Volume Replication """ SRC = "src" DST = "dst" -class InAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class InAvailabilityReasonType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """:code:`Invalid` indicates the name provided does not match Azure App Service naming requirements. :code:`AlreadyExists` indicates that the name is already in use and is therefore unavailable. @@ -121,11 +112,11 @@ class InAvailabilityReasonType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu INVALID = "Invalid" ALREADY_EXISTS = "AlreadyExists" -class MetricAggregationType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MetricAggregationType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): AVERAGE = "Average" -class MirrorState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MirrorState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The status of the replication """ @@ -133,7 +124,7 @@ class MirrorState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MIRRORED = "Mirrored" BROKEN = "Broken" -class NetworkFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NetworkFeatures(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Basic network, or Standard features available to the volume. """ @@ -142,7 +133,7 @@ class NetworkFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Standard network feature. STANDARD = "Standard" -class QosType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class QosType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The qos type of the pool """ @@ -151,14 +142,14 @@ class QosType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: qos type Manual. MANUAL = "Manual" -class RelationshipStatus(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RelationshipStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the mirror relationship """ IDLE = "Idle" TRANSFERRING = "Transferring" -class ReplicationSchedule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReplicationSchedule(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Schedule """ @@ -166,14 +157,14 @@ class ReplicationSchedule(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HOURLY = "hourly" DAILY = "daily" -class SecurityStyle(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SecurityStyle(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The security style of volume, default unix, defaults to ntfs for dual protocol or CIFS protocol """ NTFS = "ntfs" UNIX = "unix" -class ServiceLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The service level of the file system """ @@ -186,7 +177,7 @@ class ServiceLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Zone redundant storage service level. STANDARD_ZRS = "StandardZRS" -class VolumeStorageToNetworkProximity(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VolumeStorageToNetworkProximity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Provides storage to network proximity information for the volume. """ diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py index 77e29c38a55f..ce5a3a9ff24f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/__init__.py @@ -18,6 +18,7 @@ from ._account_backups_operations import AccountBackupsOperations from ._backup_policies_operations import BackupPoliciesOperations from ._vaults_operations import VaultsOperations +from ._volume_groups_operations import VolumeGroupsOperations __all__ = [ 'Operations', @@ -32,4 +33,5 @@ 'AccountBackupsOperations', 'BackupPoliciesOperations', 'VaultsOperations', + 'VolumeGroupsOperations', ] diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py index 070ab64a25e5..00d659b3165c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_account_backups_operations.py @@ -5,25 +5,130 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class AccountBackupsOperations(object): """AccountBackupsOperations operations. @@ -47,13 +152,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupsList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BackupsList"]: """List Backups for a Netapp Account. List all Backups for a Netapp Account. @@ -72,36 +177,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BackupsList', pipeline_response) + deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +221,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Backup" + resource_group_name: str, + account_name: str, + backup_name: str, + **kwargs: Any + ) -> "_models.Backup": """Get Backup for a Netapp Account. Gets the specified backup for a Netapp Account. @@ -152,28 +255,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_name=backup_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,41 +280,34 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + backup_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_name=backup_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -234,14 +320,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + backup_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete Backup for a Netapp Account. Delete the specified Backup for a Netapp Account. @@ -254,15 +341,17 @@ def begin_delete( :type backup_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -277,22 +366,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -304,4 +385,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py index fda9037863bf..6c77f6586cd8 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_accounts_operations.py @@ -5,25 +5,244 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class AccountsOperations(object): """AccountsOperations operations. @@ -47,11 +266,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetAppAccountList"] + **kwargs: Any + ) -> Iterable["_models.NetAppAccountList"]: """Describe all NetApp Accounts in a subscription. List and describe all NetApp accounts in the subscription. @@ -66,34 +285,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_by_subscription.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetAppAccountList', pipeline_response) + deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,17 +325,18 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NetAppAccountList"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.NetAppAccountList"]: """Describe all NetApp Accounts in a resource group. List and describe all NetApp accounts in the resource group. @@ -138,35 +353,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('NetAppAccountList', pipeline_response) + deserialized = self._deserialize("NetAppAccountList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -184,18 +395,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NetAppAccount" + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> "_models.NetAppAccount": """Describe a NetApp Account. Get the NetApp account. @@ -214,27 +426,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,47 +450,38 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - body, # type: "_models.NetAppAccount" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetAppAccount" + resource_group_name: str, + account_name: str, + body: "_models.NetAppAccount", + **kwargs: Any + ) -> "_models.NetAppAccount": cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'NetAppAccount') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'NetAppAccount') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -306,16 +499,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - body, # type: "_models.NetAppAccount" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.NetAppAccount"] + resource_group_name: str, + account_name: str, + body: "_models.NetAppAccount", + **kwargs: Any + ) -> LROPoller["_models.NetAppAccount"]: """Create or update a NetApp account. Create or update the specified NetApp account within the resource group. @@ -328,15 +523,19 @@ def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.NetAppAccount :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NetAppAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetAppAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.NetAppAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -348,27 +547,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, account_name=account_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('NetAppAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -380,39 +573,31 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -425,13 +610,14 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a NetApp account. Delete the specified NetApp account. @@ -442,15 +628,17 @@ def begin_delete( :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -464,21 +652,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -490,47 +671,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - body, # type: "_models.NetAppAccountPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.NetAppAccount" + resource_group_name: str, + account_name: str, + body: "_models.NetAppAccountPatch", + **kwargs: Any + ) -> "_models.NetAppAccount": cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'NetAppAccountPatch') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'NetAppAccountPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -548,16 +719,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - body, # type: "_models.NetAppAccountPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.NetAppAccount"] + resource_group_name: str, + account_name: str, + body: "_models.NetAppAccountPatch", + **kwargs: Any + ) -> LROPoller["_models.NetAppAccount"]: """Update a NetApp account. Patch the specified NetApp account. @@ -570,15 +743,19 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.NetAppAccountPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either NetAppAccount or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either NetAppAccount or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.NetAppAccount] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NetAppAccount"] lro_delay = kwargs.pop( 'polling_interval', @@ -590,27 +767,21 @@ def begin_update( resource_group_name=resource_group_name, account_name=account_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('NetAppAccount', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -622,4 +793,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py index b7c2cdcf7074..0d9dc057aabb 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backup_policies_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + backup_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "backupPolicyName": _SERIALIZER.url("backup_policy_name", backup_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class BackupPoliciesOperations(object): """BackupPoliciesOperations operations. @@ -47,13 +245,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupPoliciesList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.BackupPoliciesList"]: """List backup policies. List backup policies for Netapp Account. @@ -72,36 +270,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BackupPoliciesList', pipeline_response) + deserialized = self._deserialize("BackupPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +314,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupPolicy" + resource_group_name: str, + account_name: str, + backup_policy_name: str, + **kwargs: Any + ) -> "_models.BackupPolicy": """Get a backup Policy. Get a particular backup Policy. @@ -152,28 +348,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +373,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - body, # type: "_models.BackupPolicy" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.BackupPolicy"] + resource_group_name: str, + account_name: str, + backup_policy_name: str, + body: "_models.BackupPolicy", + **kwargs: Any + ) -> Optional["_models.BackupPolicy"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.BackupPolicy"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'BackupPolicy') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'BackupPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -248,17 +425,19 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - body, # type: "_models.BackupPolicy" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BackupPolicy"] + resource_group_name: str, + account_name: str, + backup_policy_name: str, + body: "_models.BackupPolicy", + **kwargs: Any + ) -> LROPoller["_models.BackupPolicy"]: """Create a backup policy. Create a backup policy for Netapp Account. @@ -273,15 +452,19 @@ def begin_create( :type body: ~azure.mgmt.netapp.models.BackupPolicy :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BackupPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BackupPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.BackupPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -294,28 +477,21 @@ def begin_create( account_name=account_name, backup_policy_name=backup_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -327,49 +503,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - body, # type: "_models.BackupPolicyPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupPolicy" + resource_group_name: str, + account_name: str, + backup_policy_name: str, + body: "_models.BackupPolicyPatch", + **kwargs: Any + ) -> "_models.BackupPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'BackupPolicyPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'BackupPolicyPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -387,17 +553,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - body, # type: "_models.BackupPolicyPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.BackupPolicy"] + resource_group_name: str, + account_name: str, + backup_policy_name: str, + body: "_models.BackupPolicyPatch", + **kwargs: Any + ) -> LROPoller["_models.BackupPolicy"]: """Patch a backup policy. Patch a backup policy for Netapp Account. @@ -412,15 +580,19 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.BackupPolicyPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either BackupPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either BackupPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.BackupPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -433,28 +605,21 @@ def begin_update( account_name=account_name, backup_policy_name=backup_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('BackupPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -466,41 +631,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + backup_policy_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + backup_policy_name=backup_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -513,14 +670,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - backup_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + backup_policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a backup policy. Delete backup policy. @@ -533,15 +691,17 @@ def begin_delete( :type backup_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -556,22 +716,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'backupPolicyName': self._serialize.url("backup_policy_name", backup_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -583,4 +735,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py index 4b8f3d252e68..ab4d0ae8d23d 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_backups_operations.py @@ -5,25 +5,321 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_status_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_volume_restore_status_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "backupName": _SERIALIZER.url("backup_name", backup_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class BackupsOperations(object): """BackupsOperations operations. @@ -47,15 +343,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get_status( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.BackupStatus" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.BackupStatus": """Get volume's backup status. Get the status of the backup for a volume. @@ -78,29 +374,19 @@ def get_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -114,17 +400,19 @@ def get_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backupStatus'} # type: ignore + + @distributed_trace def get_volume_restore_status( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.RestoreStatus" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.RestoreStatus": """Get volume's restore status. Get the status of the restore for a volume. @@ -147,29 +435,19 @@ def get_volume_restore_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_volume_restore_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_volume_restore_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get_volume_restore_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,17 +461,19 @@ def get_volume_restore_status( return cls(pipeline_response, deserialized, {}) return deserialized + get_volume_restore_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/restoreStatus'} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.BackupsList"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> Iterable["_models.BackupsList"]: """List Backups. List all backups for a volume. @@ -216,38 +496,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('BackupsList', pipeline_response) + deserialized = self._deserialize("BackupsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -265,21 +544,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Backup" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + **kwargs: Any + ) -> "_models.Backup": """Get a backup. Gets the specified backup of the volume. @@ -304,30 +584,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -341,53 +611,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - body, # type: "_models.Backup" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Backup"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + body: "_models.Backup", + **kwargs: Any + ) -> Optional["_models.Backup"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Backup"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Backup') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Backup') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -406,19 +667,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - body, # type: "_models.Backup" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Backup"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + body: "_models.Backup", + **kwargs: Any + ) -> LROPoller["_models.Backup"]: """Create a backup. Create a backup for the volume. @@ -437,15 +700,18 @@ def begin_create( :type body: ~azure.mgmt.netapp.models.Backup :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Backup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Backup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] lro_delay = kwargs.pop( 'polling_interval', @@ -460,30 +726,21 @@ def begin_create( volume_name=volume_name, backup_name=backup_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Backup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -495,56 +752,46 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - body=None, # type: Optional["_models.BackupPatch"] - **kwargs # type: Any - ): - # type: (...) -> "_models.Backup" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + body: Optional["_models.BackupPatch"] = None, + **kwargs: Any + ) -> "_models.Backup": cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'BackupPatch') + _json = self._serialize.body(body, 'BackupPatch') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -562,19 +809,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - body=None, # type: Optional["_models.BackupPatch"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Backup"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + body: Optional["_models.BackupPatch"] = None, + **kwargs: Any + ) -> LROPoller["_models.Backup"]: """Patch a backup. Patch a backup for the volume. @@ -593,15 +842,18 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.BackupPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Backup or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Backup] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] lro_delay = kwargs.pop( 'polling_interval', @@ -616,30 +868,21 @@ def begin_update( volume_name=volume_name, backup_name=backup_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Backup', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -651,45 +894,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + backup_name=backup_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -702,16 +937,17 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - backup_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete backup. Delete a backup of the volume. @@ -728,15 +964,17 @@ def begin_delete( :type backup_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -753,24 +991,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'backupName': self._serialize.url("backup_name", backup_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -782,4 +1010,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py index dcd7f2813e1a..3de821364f82 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_operations.py @@ -5,22 +5,151 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_file_path_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_check_quota_availability_request( + subscription_id: str, + location: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class NetAppResourceOperations(object): """NetAppResourceOperations operations. @@ -44,15 +173,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def check_name_availability( self, - location, # type: str - name, # type: str - type, # type: Union[str, "_models.CheckNameResourceTypes"] - resource_group, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckAvailabilityResponse" + location: str, + name: str, + type: Union[str, "_models.CheckNameResourceTypes"], + resource_group: str, + **kwargs: Any + ) -> "_models.CheckAvailabilityResponse": """Check resource name availability. Check if a resource name is available. @@ -76,32 +205,21 @@ def check_name_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_name_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.ResourceNameAvailabilityRequest(name=name, type=type, resource_group=resource_group) + _json = self._serialize.body(_body, 'ResourceNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'ResourceNameAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -115,16 +233,18 @@ def check_name_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_name_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability'} # type: ignore + + @distributed_trace def check_file_path_availability( self, - location, # type: str - name, # type: str - subnet_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckAvailabilityResponse" + location: str, + name: str, + subnet_id: str, + **kwargs: Any + ) -> "_models.CheckAvailabilityResponse": """Check file path availability. Check if a file path is available. @@ -147,32 +267,21 @@ def check_file_path_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_file_path_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.FilePathAvailabilityRequest(name=name, subnet_id=subnet_id) + _json = self._serialize.body(_body, 'FilePathAvailabilityRequest') + + request = build_check_file_path_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_file_path_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'FilePathAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -186,17 +295,19 @@ def check_file_path_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_file_path_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability'} # type: ignore + + @distributed_trace def check_quota_availability( self, - location, # type: str - name, # type: str - type, # type: Union[str, "_models.CheckQuotaNameResourceTypes"] - resource_group, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CheckAvailabilityResponse" + location: str, + name: str, + type: Union[str, "_models.CheckQuotaNameResourceTypes"], + resource_group: str, + **kwargs: Any + ) -> "_models.CheckAvailabilityResponse": """Check quota availability. Check if a quota is available. @@ -220,32 +331,21 @@ def check_quota_availability( } error_map.update(kwargs.pop('error_map', {})) - _body = _models.QuotaAvailabilityRequest(name=name, type=type, resource_group=resource_group) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.check_quota_availability.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _body = _models.QuotaAvailabilityRequest(name=name, type=type, resource_group=resource_group) + _json = self._serialize.body(_body, 'QuotaAvailabilityRequest') + + request = build_check_quota_availability_request( + subscription_id=self._config.subscription_id, + location=location, + content_type=content_type, + json=_json, + template_url=self.check_quota_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(_body, 'QuotaAvailabilityRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -259,4 +359,6 @@ def check_quota_availability( return cls(pipeline_response, deserialized, {}) return deserialized + check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py index 0c28d9e614a8..717ed20e015a 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_net_app_resource_quota_limits_operations.py @@ -5,23 +5,93 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location: str, + quota_limit_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "quotaLimitName": _SERIALIZER.url("quota_limit_name", quota_limit_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class NetAppResourceQuotaLimitsOperations(object): """NetAppResourceQuotaLimitsOperations operations. @@ -45,12 +115,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SubscriptionQuotaItemList"] + location: str, + **kwargs: Any + ) -> Iterable["_models.SubscriptionQuotaItemList"]: """Get quota limits. Get the default and current limits for quotas. @@ -58,7 +128,8 @@ def list( :param location: The location. :type location: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SubscriptionQuotaItemList or the result of cls(response) + :return: An iterator like instance of either SubscriptionQuotaItemList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.netapp.models.SubscriptionQuotaItemList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -67,35 +138,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SubscriptionQuotaItemList', pipeline_response) + deserialized = self._deserialize("SubscriptionQuotaItemList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -113,18 +180,19 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits'} # type: ignore + @distributed_trace def get( self, - location, # type: str - quota_limit_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SubscriptionQuotaItem" + location: str, + quota_limit_name: str, + **kwargs: Any + ) -> "_models.SubscriptionQuotaItem": """Get quota limits. Get the default and current subscription quota limit. @@ -143,27 +211,17 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'location': self._serialize.url("location", location, 'str'), - 'quotaLimitName': self._serialize.url("quota_limit_name", quota_limit_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + quota_limit_name=quota_limit_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -177,4 +235,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py index 674a64b945c4..612920a32ece 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_operations.py @@ -5,23 +5,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/providers/Microsoft.NetApp/operations') + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +72,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Describes the Resource Provider. Lists all of the available Microsoft.NetApp Rest API operations. @@ -64,30 +91,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -105,6 +129,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py index d9d72902ce16..952ee443895d 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_pools_operations.py @@ -5,25 +5,223 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class PoolsOperations(object): """PoolsOperations operations. @@ -47,13 +245,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapacityPoolList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.CapacityPoolList"]: """Describe all Capacity Pools. List all capacity pools in the NetApp Account. @@ -72,36 +270,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapacityPoolList', pipeline_response) + deserialized = self._deserialize("CapacityPoolList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,19 +314,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityPool" + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> "_models.CapacityPool": """Describe a Capacity Pool. Get details of the specified capacity pool. @@ -152,28 +348,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -187,49 +373,40 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - body, # type: "_models.CapacityPool" - **kwargs # type: Any - ): - # type: (...) -> "_models.CapacityPool" + resource_group_name: str, + account_name: str, + pool_name: str, + body: "_models.CapacityPool", + **kwargs: Any + ) -> "_models.CapacityPool": cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityPool"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'CapacityPool') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CapacityPool') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -247,17 +424,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - body, # type: "_models.CapacityPool" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityPool"] + resource_group_name: str, + account_name: str, + pool_name: str, + body: "_models.CapacityPool", + **kwargs: Any + ) -> LROPoller["_models.CapacityPool"]: """Create or Update the specified capacity pool within the resource group. Create or Update a capacity pool. @@ -272,15 +451,19 @@ def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.CapacityPool :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CapacityPool or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.CapacityPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -293,28 +476,21 @@ def begin_create_or_update( account_name=account_name, pool_name=pool_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -326,49 +502,39 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - body, # type: "_models.CapacityPoolPatch" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.CapacityPool"] + resource_group_name: str, + account_name: str, + pool_name: str, + body: "_models.CapacityPoolPatch", + **kwargs: Any + ) -> Optional["_models.CapacityPool"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.CapacityPool"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'CapacityPoolPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'CapacityPoolPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -384,17 +550,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - body, # type: "_models.CapacityPoolPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.CapacityPool"] + resource_group_name: str, + account_name: str, + pool_name: str, + body: "_models.CapacityPoolPatch", + **kwargs: Any + ) -> LROPoller["_models.CapacityPool"]: """Update a capacity pool. Patch the specified capacity pool. @@ -409,15 +577,19 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.CapacityPoolPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either CapacityPool or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either CapacityPool or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.CapacityPool] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.CapacityPool"] lro_delay = kwargs.pop( 'polling_interval', @@ -430,28 +602,21 @@ def begin_update( account_name=account_name, pool_name=pool_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('CapacityPool', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -463,41 +628,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -510,14 +667,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a capacity pool. Delete the specified capacity pool. @@ -530,15 +688,17 @@ def begin_delete( :type pool_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -553,22 +713,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -580,4 +732,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py index aa8bd1265c48..43190ed450e2 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshot_policies_operations.py @@ -5,25 +5,260 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_list_volumes_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "snapshotPolicyName": _SERIALIZER.url("snapshot_policy_name", snapshot_policy_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class SnapshotPoliciesOperations(object): """SnapshotPoliciesOperations operations. @@ -47,13 +282,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotPoliciesList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotPoliciesList"]: """List snapshot policy. :param resource_group_name: The name of the resource group. @@ -61,7 +296,8 @@ def list( :param account_name: The name of the NetApp account. :type account_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either SnapshotPoliciesList or the result of cls(response) + :return: An iterator like instance of either SnapshotPoliciesList or the result of + cls(response) :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.netapp.models.SnapshotPoliciesList] :raises: ~azure.core.exceptions.HttpResponseError """ @@ -70,36 +306,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotPoliciesList', pipeline_response) + deserialized = self._deserialize("SnapshotPoliciesList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,19 +350,20 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SnapshotPolicy" + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any + ) -> "_models.SnapshotPolicy": """Get a snapshot Policy. :param resource_group_name: The name of the resource group. @@ -148,28 +382,18 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -183,17 +407,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace def create( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - body, # type: "_models.SnapshotPolicy" - **kwargs # type: Any - ): - # type: (...) -> "_models.SnapshotPolicy" + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + body: "_models.SnapshotPolicy", + **kwargs: Any + ) -> "_models.SnapshotPolicy": """Create a snapshot policy. :param resource_group_name: The name of the resource group. @@ -214,33 +440,23 @@ def create( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'SnapshotPolicy') + + request = build_create_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + content_type=content_type, + json=_json, + template_url=self.create.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SnapshotPolicy') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,49 +474,40 @@ def create( return cls(pipeline_response, deserialized, {}) return deserialized + create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - body, # type: "_models.SnapshotPolicyPatch" - **kwargs # type: Any - ): - # type: (...) -> "_models.SnapshotPolicy" + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + body: "_models.SnapshotPolicyPatch", + **kwargs: Any + ) -> "_models.SnapshotPolicy": cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotPolicy"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'SnapshotPolicyPatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'SnapshotPolicyPatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -318,17 +525,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - body, # type: "_models.SnapshotPolicyPatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.SnapshotPolicy"] + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + body: "_models.SnapshotPolicyPatch", + **kwargs: Any + ) -> LROPoller["_models.SnapshotPolicy"]: """Patch a snapshot policy. :param resource_group_name: The name of the resource group. @@ -341,15 +550,19 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.SnapshotPolicyPatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either SnapshotPolicy or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SnapshotPolicy or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.SnapshotPolicy] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.SnapshotPolicy"] lro_delay = kwargs.pop( 'polling_interval', @@ -362,28 +575,21 @@ def begin_update( account_name=account_name, snapshot_policy_name=snapshot_policy_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('SnapshotPolicy', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -395,41 +601,33 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -442,14 +640,15 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete snapshot policy. :param resource_group_name: The name of the resource group. @@ -460,15 +659,17 @@ def begin_delete( :type snapshot_policy_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -483,22 +684,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -510,16 +703,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}'} # type: ignore + @distributed_trace def list_volumes( self, - resource_group_name, # type: str - account_name, # type: str - snapshot_policy_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.SnapshotPolicyVolumeList" + resource_group_name: str, + account_name: str, + snapshot_policy_name: str, + **kwargs: Any + ) -> "_models.SnapshotPolicyVolumeList": """Get volumes for snapshot policy. Get volumes associated with snapshot policy. @@ -540,28 +734,18 @@ def list_volumes( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_volumes.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'snapshotPolicyName': self._serialize.url("snapshot_policy_name", snapshot_policy_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_volumes_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + snapshot_policy_name=snapshot_policy_name, + template_url=self.list_volumes.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -575,4 +759,6 @@ def list_volumes( return cls(pipeline_response, deserialized, {}) return deserialized + list_volumes.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py index 8b3e2a853793..7cf00d0cb224 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_snapshots_operations.py @@ -5,25 +5,243 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + "snapshotName": _SERIALIZER.url("snapshot_name", snapshot_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) class SnapshotsOperations(object): """SnapshotsOperations operations. @@ -47,15 +265,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.SnapshotsList"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> Iterable["_models.SnapshotsList"]: """Describe all snapshots. List all snapshots associated with the volume. @@ -78,38 +296,37 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('SnapshotsList', pipeline_response) + deserialized = self._deserialize("SnapshotsList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -127,21 +344,22 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Snapshot" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + **kwargs: Any + ) -> "_models.Snapshot": """Describe a snapshot. Get details of the specified snapshot. @@ -166,30 +384,20 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -203,53 +411,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + def _create_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - body, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Snapshot"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + body: "_models.Snapshot", + **kwargs: Any + ) -> Optional["_models.Snapshot"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Snapshot"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Snapshot') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Snapshot') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -265,19 +464,21 @@ def _create_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_create( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - body, # type: "_models.Snapshot" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + body: "_models.Snapshot", + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Create a snapshot. Create the specified snapshot within the given volume. @@ -296,15 +497,18 @@ def begin_create( :type body: ~azure.mgmt.netapp.models.Snapshot :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -319,30 +523,21 @@ def begin_create( volume_name=volume_name, snapshot_name=snapshot_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -354,53 +549,43 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - body, # type: Any - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Snapshot"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + body: Any, + **kwargs: Any + ) -> Optional["_models.Snapshot"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Snapshot"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'object') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'object') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -416,19 +601,21 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - body, # type: Any - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Snapshot"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + body: Any, + **kwargs: Any + ) -> LROPoller["_models.Snapshot"]: """Update a snapshot. Patch a snapshot. @@ -447,15 +634,18 @@ def begin_update( :type body: any :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Snapshot or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Snapshot] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Snapshot"] lro_delay = kwargs.pop( 'polling_interval', @@ -470,30 +660,21 @@ def begin_update( volume_name=volume_name, snapshot_name=snapshot_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Snapshot', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -505,45 +686,37 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + snapshot_name=snapshot_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -556,16 +729,17 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - snapshot_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + snapshot_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a snapshot. Delete snapshot. @@ -582,15 +756,17 @@ def begin_delete( :type snapshot_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -607,24 +783,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - 'snapshotName': self._serialize.url("snapshot_name", snapshot_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -636,4 +802,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py index a67942ccd520..d115f03f9c0f 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_vaults_operations.py @@ -5,23 +5,60 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) class VaultsOperations(object): """VaultsOperations operations. @@ -45,13 +82,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VaultList"] + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.VaultList"]: """List vaults. List vaults for a Netapp Account. @@ -70,36 +107,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VaultList', pipeline_response) + deserialized = self._deserialize("VaultList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -117,6 +151,7 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py new file mode 100644 index 000000000000..49322362e99c --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_groups_operations.py @@ -0,0 +1,562 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_net_app_account_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "volumeGroupName": _SERIALIZER.url("volume_group_name", volume_group_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + volume_group_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "volumeGroupName": _SERIALIZER.url("volume_group_name", volume_group_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "volumeGroupName": _SERIALIZER.url("volume_group_name", volume_group_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + +class VolumeGroupsOperations(object): + """VolumeGroupsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.netapp.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_net_app_account( + self, + resource_group_name: str, + account_name: str, + **kwargs: Any + ) -> Iterable["_models.VolumeGroupList"]: + """Describe all volume groups. + + List all volume groups for given account. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VolumeGroupList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.netapp.models.VolumeGroupList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_net_app_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=self.list_by_net_app_account.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_net_app_account_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("VolumeGroupList", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_net_app_account.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> "_models.VolumeGroupDetails": + """Describe a Volume Group. + + Get details of the specified volume group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VolumeGroupDetails, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.VolumeGroupDetails + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + body: "_models.VolumeGroupDetails", + **kwargs: Any + ) -> "_models.VolumeGroupDetails": + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'VolumeGroupDetails') + + request = build_create_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + content_type=content_type, + json=_json, + template_url=self._create_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + body: "_models.VolumeGroupDetails", + **kwargs: Any + ) -> LROPoller["_models.VolumeGroupDetails"]: + """Create the specified volume group and volumes. Creating volume group will create all the + volumes specified in request body implicitly. Once volumes are created using volume group, + those will be treated as regular volumes thereafter. + + Create a volume group along with specified volumes. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :param body: Volume Group object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeGroupDetails + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either VolumeGroupDetails or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.VolumeGroupDetails] + :raises: ~azure.core.exceptions.HttpResponseError + """ + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeGroupDetails"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_initial( + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + body=body, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('VolumeGroupDetails', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + account_name: str, + volume_group_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a volume group. + + Delete the specified volume group only if there are no volumes under volume group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param account_name: The name of the NetApp account. + :type account_name: str + :param volume_group_name: The name of the volumeGroup. + :type volume_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + account_name=account_name, + volume_group_name=volume_group_name, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}'} # type: ignore diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py index 60561b5fb6eb..67d0c0b13d5d 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volumes_operations.py @@ -5,25 +5,555 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +import functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling +from msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="DELETE", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_revert_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_break_replication_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_replication_status_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + +def build_resync_replication_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_delete_replication_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_authorize_replication_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_re_initialize_replication_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + **kwargs + ) + + +def build_pool_change_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2021-08-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + "accountName": _SERIALIZER.url("account_name", account_name, 'str'), + "poolName": _SERIALIZER.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + "volumeName": _SERIALIZER.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + } + + url = _format_url_section(url, **path_format_arguments) + + # Construct parameters + query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + + return HttpRequest( + method="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) class VolumesOperations(object): """VolumesOperations operations. @@ -47,14 +577,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.VolumeList"] + resource_group_name: str, + account_name: str, + pool_name: str, + **kwargs: Any + ) -> Iterable["_models.VolumeList"]: """Describe all volumes. List all volumes within the capacity pool. @@ -75,37 +605,35 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('VolumeList', pipeline_response) + deserialized = self._deserialize("VolumeList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,20 +651,21 @@ def get_next(next_link=None): return pipeline_response + return ItemPaged( get_next, extract_data ) list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Volume" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.Volume": """Describe a volume. Get the details of the specified volume. @@ -159,29 +688,19 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -195,51 +714,42 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.Volume" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Volume"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.Volume", + **kwargs: Any + ) -> Optional["_models.Volume"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Volume"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'Volume') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'Volume') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -258,18 +768,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.Volume" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Volume"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.Volume", + **kwargs: Any + ) -> LROPoller["_models.Volume"]: """Create or Update a volume. Create or update the specified volume within the capacity pool. @@ -286,15 +798,18 @@ def begin_create_or_update( :type body: ~azure.mgmt.netapp.models.Volume :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Volume"] lro_delay = kwargs.pop( 'polling_interval', @@ -308,29 +823,21 @@ def begin_create_or_update( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Volume', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'azure-async-operation'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -342,51 +849,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore def _update_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.VolumePatch" - **kwargs # type: Any - ): - # type: (...) -> Optional["_models.Volume"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.VolumePatch", + **kwargs: Any + ) -> Optional["_models.Volume"]: cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.Volume"]] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + _json = self._serialize.body(body, 'VolumePatch') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'VolumePatch') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -402,18 +899,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.VolumePatch" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Volume"] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.VolumePatch", + **kwargs: Any + ) -> LROPoller["_models.Volume"]: """Update a volume. Patch the specified volume. @@ -430,15 +929,18 @@ def begin_update( :type body: ~azure.mgmt.netapp.models.VolumePatch :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Volume or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Volume] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Volume"] lro_delay = kwargs.pop( 'polling_interval', @@ -452,29 +954,21 @@ def begin_update( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Volume', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -486,43 +980,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore def _delete_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -535,15 +1021,16 @@ def _delete_initial( _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete a volume. Delete the specified volume. @@ -558,15 +1045,17 @@ def begin_delete( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -582,23 +1071,14 @@ def begin_delete( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -610,49 +1090,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}'} # type: ignore def _revert_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.VolumeRevert" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.VolumeRevert", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._revert_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(body, 'VolumeRevert') + + request = build_revert_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._revert_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'VolumeRevert') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -665,16 +1137,17 @@ def _revert_initial( _revert_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore + + @distributed_trace def begin_revert( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.VolumeRevert" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.VolumeRevert", + **kwargs: Any + ) -> LROPoller[None]: """Revert a volume to one of its snapshots. Revert a volume to the snapshot specified in the body. @@ -691,15 +1164,18 @@ def begin_revert( :type body: ~azure.mgmt.netapp.models.VolumeRevert :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -713,26 +1189,18 @@ def begin_revert( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -744,52 +1212,44 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore def _break_replication_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body=None, # type: Optional["_models.BreakReplicationRequest"] - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: Optional["_models.BreakReplicationRequest"] = None, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._break_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if body is not None: - body_content = self._serialize.body(body, 'BreakReplicationRequest') + _json = self._serialize.body(body, 'BreakReplicationRequest') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + _json = None + + request = build_break_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._break_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -802,16 +1262,17 @@ def _break_replication_initial( _break_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication'} # type: ignore + + @distributed_trace def begin_break_replication( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body=None, # type: Optional["_models.BreakReplicationRequest"] - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: Optional["_models.BreakReplicationRequest"] = None, + **kwargs: Any + ) -> LROPoller[None]: """Break volume replication. Break the replication connection on the destination volume. @@ -828,15 +1289,18 @@ def begin_break_replication( :type body: ~azure.mgmt.netapp.models.BreakReplicationRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -850,26 +1314,18 @@ def begin_break_replication( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -881,17 +1337,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_break_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/breakReplication'} # type: ignore + @distributed_trace def replication_status( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ReplicationStatus" + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.ReplicationStatus": """Get volume replication status. Get the status of the replication. @@ -914,29 +1371,19 @@ def replication_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.replication_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_replication_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self.replication_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -950,43 +1397,36 @@ def replication_status( return cls(pipeline_response, deserialized, {}) return deserialized + replication_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus'} # type: ignore + def _resync_replication_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._resync_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_resync_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._resync_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -999,15 +1439,16 @@ def _resync_replication_initial( _resync_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication'} # type: ignore + + @distributed_trace def begin_resync_replication( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Resync volume replication. Resync the connection on the destination volume. If the operation is ran on the source volume @@ -1023,15 +1464,17 @@ def begin_resync_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1047,23 +1490,14 @@ def begin_resync_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1075,43 +1509,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_resync_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resyncReplication'} # type: ignore def _delete_replication_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._delete_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_delete_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._delete_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1124,15 +1550,16 @@ def _delete_replication_initial( _delete_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication'} # type: ignore + + @distributed_trace def begin_delete_replication( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Delete volume replication. Delete the replication connection on the destination volume, and send release to the source @@ -1148,15 +1575,17 @@ def begin_delete_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1172,23 +1601,14 @@ def begin_delete_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1200,49 +1620,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/deleteReplication'} # type: ignore def _authorize_replication_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.AuthorizeRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.AuthorizeRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._authorize_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + _json = self._serialize.body(body, 'AuthorizeRequest') + + request = build_authorize_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._authorize_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'AuthorizeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1255,16 +1667,17 @@ def _authorize_replication_initial( _authorize_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication'} # type: ignore + + @distributed_trace def begin_authorize_replication( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.AuthorizeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.AuthorizeRequest", + **kwargs: Any + ) -> LROPoller[None]: """Authorize source volume replication. Authorize the replication connection on the source volume. @@ -1281,15 +1694,18 @@ def begin_authorize_replication( :type body: ~azure.mgmt.netapp.models.AuthorizeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1303,26 +1719,18 @@ def begin_authorize_replication( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1334,43 +1742,35 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_authorize_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/authorizeReplication'} # type: ignore def _re_initialize_replication_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - - # Construct URL - url = self._re_initialize_replication_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] + + request = build_re_initialize_replication_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + template_url=self._re_initialize_replication_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1383,15 +1783,16 @@ def _re_initialize_replication_initial( _re_initialize_replication_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication'} # type: ignore + + @distributed_trace def begin_re_initialize_replication( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: """ReInitialize volume replication. Re-Initializes the replication connection on the destination volume. @@ -1406,15 +1807,17 @@ def begin_re_initialize_replication( :type volume_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1430,23 +1833,14 @@ def begin_re_initialize_replication( cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1458,49 +1852,41 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_re_initialize_replication.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/reinitializeReplication'} # type: ignore def _pool_change_initial( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.PoolChangeRequest" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.PoolChangeRequest", + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - - # Construct URL - url = self._pool_change_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(body, 'PoolChangeRequest') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') + request = build_pool_change_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + content_type=content_type, + json=_json, + template_url=self._pool_change_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(body, 'PoolChangeRequest') - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response @@ -1513,16 +1899,17 @@ def _pool_change_initial( _pool_change_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange'} # type: ignore + + @distributed_trace def begin_pool_change( self, - resource_group_name, # type: str - account_name, # type: str - pool_name, # type: str - volume_name, # type: str - body, # type: "_models.PoolChangeRequest" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + body: "_models.PoolChangeRequest", + **kwargs: Any + ) -> LROPoller[None]: """Change pool for volume. Moves volume to another pool. @@ -1539,15 +1926,18 @@ def begin_pool_change( :type body: ~azure.mgmt.netapp.models.PoolChangeRequest :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -1561,26 +1951,18 @@ def begin_pool_change( pool_name=pool_name, volume_name=volume_name, body=body, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - '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'), - 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), - 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -1592,4 +1974,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_pool_change.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/poolChange'} # type: ignore