diff --git a/sdk/netapp/azure-mgmt-netapp/_meta.json b/sdk/netapp/azure-mgmt-netapp/_meta.json index b7fa00fc86a2..03409588fc57 100644 --- a/sdk/netapp/azure-mgmt-netapp/_meta.json +++ b/sdk/netapp/azure-mgmt-netapp/_meta.json @@ -4,8 +4,8 @@ "@autorest/python@5.12.0", "@autorest/modelerfour@4.19.3" ], - "commit": "25a8355d4094595edf9b58b13e8c95b0b0c9c50c", + "commit": "8e3bb03c4761ede2e9ca8380914d446c9c4ee52f", "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/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/netapp/resource-manager/readme.md --multiapi --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --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/_configuration.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py index f641660ee740..64c917163cb7 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_configuration.py @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-01" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION)) self._configure(**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 9cf1df5116b1..238dcbe3e93c 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json @@ -1,6 +1,6 @@ { - "chosen_version": "2021-10-01", - "total_api_version_list": ["2021-10-01"], + "chosen_version": "2022-01-01", + "total_api_version_list": ["2022-01-01"], "client": { "name": "NetAppManagementClient", "filename": "_net_app_management_client", @@ -108,6 +108,7 @@ "backups": "BackupsOperations", "account_backups": "AccountBackupsOperations", "backup_policies": "BackupPoliciesOperations", + "volume_quota_rules": "VolumeQuotaRulesOperations", "vaults": "VaultsOperations", "volume_groups": "VolumeGroupsOperations", "subvolumes": "SubvolumesOperations" 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 aa2fcdaaf8ae..383dbe658d85 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 @@ -15,7 +15,7 @@ from . import models from ._configuration import NetAppManagementClientConfiguration -from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations +from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumeQuotaRulesOperations, VolumesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -47,6 +47,8 @@ class NetAppManagementClient: :vartype account_backups: azure.mgmt.netapp.operations.AccountBackupsOperations :ivar backup_policies: BackupPoliciesOperations operations :vartype backup_policies: azure.mgmt.netapp.operations.BackupPoliciesOperations + :ivar volume_quota_rules: VolumeQuotaRulesOperations operations + :vartype volume_quota_rules: azure.mgmt.netapp.operations.VolumeQuotaRulesOperations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.netapp.operations.VaultsOperations :ivar volume_groups: VolumeGroupsOperations operations @@ -89,6 +91,7 @@ def __init__( 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.volume_quota_rules = VolumeQuotaRulesOperations(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.subvolumes = SubvolumesOperations(self._client, self._config, self._serialize, self._deserialize) diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py index 364f3c906cf9..e786ca9d2565 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "7.0.0" +VERSION = "5.1.0" 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 037ccb42cda7..0a2c083c0576 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 @@ -45,7 +45,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-10-01" + self.api_version = "2022-01-01" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-netapp/{}'.format(VERSION)) self._configure(**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 c4639d602d3d..17d3cb1f11c2 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 @@ -15,7 +15,7 @@ from .. import models from ._configuration import NetAppManagementClientConfiguration -from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumesOperations +from .operations import AccountBackupsOperations, AccountsOperations, BackupPoliciesOperations, BackupsOperations, NetAppResourceOperations, NetAppResourceQuotaLimitsOperations, Operations, PoolsOperations, SnapshotPoliciesOperations, SnapshotsOperations, SubvolumesOperations, VaultsOperations, VolumeGroupsOperations, VolumeQuotaRulesOperations, VolumesOperations if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -47,6 +47,8 @@ class NetAppManagementClient: :vartype account_backups: azure.mgmt.netapp.aio.operations.AccountBackupsOperations :ivar backup_policies: BackupPoliciesOperations operations :vartype backup_policies: azure.mgmt.netapp.aio.operations.BackupPoliciesOperations + :ivar volume_quota_rules: VolumeQuotaRulesOperations operations + :vartype volume_quota_rules: azure.mgmt.netapp.aio.operations.VolumeQuotaRulesOperations :ivar vaults: VaultsOperations operations :vartype vaults: azure.mgmt.netapp.aio.operations.VaultsOperations :ivar volume_groups: VolumeGroupsOperations operations @@ -89,6 +91,7 @@ def __init__( 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.volume_quota_rules = VolumeQuotaRulesOperations(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.subvolumes = SubvolumesOperations(self._client, self._config, self._serialize, self._deserialize) 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 8e72a6f60883..7b804194eeb5 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 @@ -17,6 +17,7 @@ from ._backups_operations import BackupsOperations from ._account_backups_operations import AccountBackupsOperations from ._backup_policies_operations import BackupPoliciesOperations +from ._volume_quota_rules_operations import VolumeQuotaRulesOperations from ._vaults_operations import VaultsOperations from ._volume_groups_operations import VolumeGroupsOperations from ._subvolumes_operations import SubvolumesOperations @@ -33,6 +34,7 @@ 'BackupsOperations', 'AccountBackupsOperations', 'BackupPoliciesOperations', + 'VolumeQuotaRulesOperations', 'VaultsOperations', 'VolumeGroupsOperations', 'SubvolumesOperations', 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 36ac75667cb8..12b0490c37e0 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 @@ -18,7 +18,7 @@ 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 +from ...operations._net_app_resource_operations import build_check_file_path_availability_request, build_check_name_availability_request, build_check_quota_availability_request, build_query_region_info_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -233,3 +233,52 @@ async def check_quota_availability( check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability'} # type: ignore + + @distributed_trace_async + async def query_region_info( + self, + location: str, + **kwargs: Any + ) -> "_models.RegionInfo": + """Describes region specific information. + + Provides storage to network proximity and logical zone mapping information. + + :param location: The location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.RegionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_query_region_info_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.query_region_info.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('RegionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + query_region_info.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo'} # type: ignore + diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py new file mode 100644 index 000000000000..3335d1f09474 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_volume_quota_rules_operations.py @@ -0,0 +1,592 @@ +# 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_quota_rules_operations import build_create_request_initial, build_delete_request_initial, build_get_request, build_list_by_volume_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class VolumeQuotaRulesOperations: + """VolumeQuotaRulesOperations 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_volume( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.VolumeQuotaRulesList"]: + """Get all quota rules for a volume. + + List all quota rules associated with the volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VolumeQuotaRulesList or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.netapp.models.VolumeQuotaRulesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeQuotaRulesList"] + 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_volume_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_by_volume.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_volume_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("VolumeQuotaRulesList", 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_volume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules'} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + **kwargs: Any + ) -> "_models.VolumeQuotaRule": + """Describe a quota rule. + + Get details of the specified quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VolumeQuotaRule, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.VolumeQuotaRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeQuotaRule"] + 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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + async def _create_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> Optional["_models.VolumeQuotaRule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VolumeQuotaRule"]] + 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, 'VolumeQuotaRule') + + 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, + volume_quota_rule_name=volume_quota_rule_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace_async + async def begin_create( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> AsyncLROPoller["_models.VolumeQuotaRule"]: + """Create a quota rule. + + Create the specified quota rule within the given volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :param body: Quota rule object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeQuotaRule + :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 VolumeQuotaRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.VolumeQuotaRule] + :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.VolumeQuotaRule"] + 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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + 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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + async def _update_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> Optional["_models.VolumeQuotaRule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VolumeQuotaRule"]] + 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, 'VolumeQuotaRule') + + 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, + volume_quota_rule_name=volume_quota_rule_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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> AsyncLROPoller["_models.VolumeQuotaRule"]: + """Update a quota rule. + + Patch a quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :param body: Quota rule object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeQuotaRule + :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 VolumeQuotaRule or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.VolumeQuotaRule] + :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.VolumeQuotaRule"] + 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._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace_async + async def begin_delete( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a quota rule. + + Delete quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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, lro_options={'final-state-via': 'location'}, **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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # 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 89277da68d6a..911ff422fbfe 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 @@ -22,7 +22,7 @@ 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 +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_finalize_relocation_request_initial, build_get_request, build_list_replications_request, build_list_request, build_pool_change_request_initial, build_re_initialize_replication_request_initial, build_relocate_request_initial, build_replication_status_request, build_reset_cifs_password_request_initial, build_resync_replication_request_initial, build_revert_relocation_request_initial, build_revert_request_initial, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -695,6 +695,116 @@ def get_long_running_output(pipeline_response): begin_revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore + async def _reset_cifs_password_initial( + self, + 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', {})) + + + request = build_reset_cifs_password_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._reset_cifs_password_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]: + 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, {}) + + _reset_cifs_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword'} # type: ignore + + + @distributed_trace_async + async def begin_reset_cifs_password( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Reset cifs password. + + Reset cifs password from volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._reset_cifs_password_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_reset_cifs_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword'} # type: ignore + async def _break_replication_initial( self, resource_group_name: str, @@ -881,6 +991,67 @@ async def replication_status( replication_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus'} # type: ignore + @distributed_trace_async + async def list_replications( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.ListReplications": + """List replications for volume. + + List all replications for a specified volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListReplications, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.ListReplications + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListReplications"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_replications_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_replications.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('ListReplications', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications'} # type: ignore + + async def _resync_replication_initial( self, resource_group_name: str, @@ -1456,3 +1627,334 @@ def get_long_running_output(pipeline_response): 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 + + async def _relocate_initial( + self, + 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', {})) + + + request = build_relocate_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._relocate_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]: + 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, {}) + + _relocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate'} # type: ignore + + + @distributed_trace_async + async def begin_relocate( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Relocate volume. + + Relocates volume to a new stamp. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._relocate_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_relocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate'} # type: ignore + + async def _finalize_relocation_initial( + self, + 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', {})) + + + request = build_finalize_relocation_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._finalize_relocation_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]: + 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, {}) + + _finalize_relocation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation'} # type: ignore + + + @distributed_trace_async + async def begin_finalize_relocation( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Finalize volume relocation. + + Finalizes the relocation of the volume and cleans up the old volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._finalize_relocation_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_finalize_relocation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation'} # type: ignore + + async def _revert_relocation_initial( + self, + 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', {})) + + + request = build_revert_relocation_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._revert_relocation_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]: + 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, {}) + + _revert_relocation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation'} # type: ignore + + + @distributed_trace_async + async def begin_revert_relocation( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Revert volume relocation. + + Reverts the volume relocation process, cleans up the new volume and starts using the + former-existing volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._revert_relocation_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_revert_relocation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation'} # 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 c1875ba4618c..be3bff6c6405 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 @@ -29,6 +29,7 @@ from ._models_py3 import FilePathAvailabilityRequest from ._models_py3 import HourlySchedule from ._models_py3 import LdapSearchScopeOpt +from ._models_py3 import ListReplications from ._models_py3 import LogSpecification from ._models_py3 import MetricSpecification from ._models_py3 import MonthlySchedule @@ -44,6 +45,9 @@ from ._models_py3 import PoolChangeRequest from ._models_py3 import ProxyResource from ._models_py3 import QuotaAvailabilityRequest +from ._models_py3 import RegionInfo +from ._models_py3 import RegionInfoAvailabilityZoneMappingsItem +from ._models_py3 import Replication from ._models_py3 import ReplicationObject from ._models_py3 import ReplicationStatus from ._models_py3 import Resource @@ -82,6 +86,9 @@ from ._models_py3 import VolumePatchPropertiesExportPolicy from ._models_py3 import VolumePropertiesDataProtection from ._models_py3 import VolumePropertiesExportPolicy +from ._models_py3 import VolumeQuotaRule +from ._models_py3 import VolumeQuotaRulesList +from ._models_py3 import VolumeRelocationProperties from ._models_py3 import VolumeRevert from ._models_py3 import VolumeSnapshotProperties from ._models_py3 import WeeklySchedule @@ -104,10 +111,12 @@ MirrorState, NetworkFeatures, QosType, + RegionStorageToNetworkProximity, RelationshipStatus, ReplicationSchedule, SecurityStyle, ServiceLevel, + Type, VolumeStorageToNetworkProximity, ) @@ -135,6 +144,7 @@ 'FilePathAvailabilityRequest', 'HourlySchedule', 'LdapSearchScopeOpt', + 'ListReplications', 'LogSpecification', 'MetricSpecification', 'MonthlySchedule', @@ -150,6 +160,9 @@ 'PoolChangeRequest', 'ProxyResource', 'QuotaAvailabilityRequest', + 'RegionInfo', + 'RegionInfoAvailabilityZoneMappingsItem', + 'Replication', 'ReplicationObject', 'ReplicationStatus', 'Resource', @@ -188,6 +201,9 @@ 'VolumePatchPropertiesExportPolicy', 'VolumePropertiesDataProtection', 'VolumePropertiesExportPolicy', + 'VolumeQuotaRule', + 'VolumeQuotaRulesList', + 'VolumeRelocationProperties', 'VolumeRevert', 'VolumeSnapshotProperties', 'WeeklySchedule', @@ -207,9 +223,11 @@ 'MirrorState', 'NetworkFeatures', 'QosType', + 'RegionStorageToNetworkProximity', 'RelationshipStatus', 'ReplicationSchedule', 'SecurityStyle', 'ServiceLevel', + 'Type', 'VolumeStorageToNetworkProximity', ] 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 e3e98c936770..c162cfe2dee7 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 @@ -1573,6 +1573,31 @@ def __init__( self.group_membership_filter = group_membership_filter +class ListReplications(msrest.serialization.Model): + """List Replications. + + :ivar value: A list of replications. + :vartype value: list[~azure.mgmt.netapp.models.Replication] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Replication]'}, + } + + def __init__( + self, + *, + value: Optional[List["Replication"]] = None, + **kwargs + ): + """ + :keyword value: A list of replications. + :paramtype value: list[~azure.mgmt.netapp.models.Replication] + """ + super(ListReplications, self).__init__(**kwargs) + self.value = value + + class LogSpecification(msrest.serialization.Model): """Log Definition of a single resource metric. @@ -2429,6 +2454,134 @@ def __init__( self.resource_group = resource_group +class RegionInfo(msrest.serialization.Model): + """Provides region specific information. + + :ivar storage_to_network_proximity: Provides storage to network proximity information in the + region. Possible values include: "Default", "T1", "T2", "T1AndT2". + :vartype storage_to_network_proximity: str or + ~azure.mgmt.netapp.models.RegionStorageToNetworkProximity + :ivar availability_zone_mappings: Provides logical availability zone mappings for the + subscription for a region. + :vartype availability_zone_mappings: + list[~azure.mgmt.netapp.models.RegionInfoAvailabilityZoneMappingsItem] + """ + + _attribute_map = { + 'storage_to_network_proximity': {'key': 'storageToNetworkProximity', 'type': 'str'}, + 'availability_zone_mappings': {'key': 'availabilityZoneMappings', 'type': '[RegionInfoAvailabilityZoneMappingsItem]'}, + } + + def __init__( + self, + *, + storage_to_network_proximity: Optional[Union[str, "RegionStorageToNetworkProximity"]] = None, + availability_zone_mappings: Optional[List["RegionInfoAvailabilityZoneMappingsItem"]] = None, + **kwargs + ): + """ + :keyword storage_to_network_proximity: Provides storage to network proximity information in the + region. Possible values include: "Default", "T1", "T2", "T1AndT2". + :paramtype storage_to_network_proximity: str or + ~azure.mgmt.netapp.models.RegionStorageToNetworkProximity + :keyword availability_zone_mappings: Provides logical availability zone mappings for the + subscription for a region. + :paramtype availability_zone_mappings: + list[~azure.mgmt.netapp.models.RegionInfoAvailabilityZoneMappingsItem] + """ + super(RegionInfo, self).__init__(**kwargs) + self.storage_to_network_proximity = storage_to_network_proximity + self.availability_zone_mappings = availability_zone_mappings + + +class RegionInfoAvailabilityZoneMappingsItem(msrest.serialization.Model): + """RegionInfoAvailabilityZoneMappingsItem. + + :ivar availability_zone: Logical availability zone. + :vartype availability_zone: str + :ivar is_available: Available availability zone. + :vartype is_available: bool + """ + + _attribute_map = { + 'availability_zone': {'key': 'availabilityZone', 'type': 'str'}, + 'is_available': {'key': 'isAvailable', 'type': 'bool'}, + } + + def __init__( + self, + *, + availability_zone: Optional[str] = None, + is_available: Optional[bool] = None, + **kwargs + ): + """ + :keyword availability_zone: Logical availability zone. + :paramtype availability_zone: str + :keyword is_available: Available availability zone. + :paramtype is_available: bool + """ + super(RegionInfoAvailabilityZoneMappingsItem, self).__init__(**kwargs) + self.availability_zone = availability_zone + self.is_available = is_available + + +class Replication(msrest.serialization.Model): + """Replication properties. + + All required parameters must be populated in order to send to Azure. + + :ivar endpoint_type: Indicates whether the local volume is the source or destination for the + Volume Replication. Possible values include: "src", "dst". + :vartype endpoint_type: str or ~azure.mgmt.netapp.models.EndpointType + :ivar replication_schedule: Schedule. Possible values include: "_10minutely", "hourly", + "daily". + :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 = { + 'remote_volume_resource_id': {'required': True}, + } + + _attribute_map = { + '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, + *, + remote_volume_resource_id: str, + endpoint_type: Optional[Union[str, "EndpointType"]] = None, + replication_schedule: Optional[Union[str, "ReplicationSchedule"]] = None, + remote_volume_region: Optional[str] = None, + **kwargs + ): + """ + :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(Replication, self).__init__(**kwargs) + self.endpoint_type = endpoint_type + self.replication_schedule = replication_schedule + self.remote_volume_resource_id = remote_volume_resource_id + self.remote_volume_region = remote_volume_region + + class ReplicationObject(msrest.serialization.Model): """Replication properties. @@ -3672,6 +3825,8 @@ class Volume(msrest.serialization.Model): :vartype type: str :ivar tags: A set of tags. Resource tags. :vartype tags: dict[str, str] + :ivar zones: Availability Zone. + :vartype zones: list[str] :ivar system_data: The system meta data relating to this resource. :vartype system_data: ~azure.mgmt.netapp.models.SystemData :ivar file_system_id: Unique FileSystem Identifier. @@ -3786,6 +3941,9 @@ class Volume(msrest.serialization.Model): :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 encrypted: Specifies if the volume is encrypted or not. Only available on volumes created + or updated after 2022-01-01. + :vartype encrypted: bool :ivar placement_rules: Application specific placement rules for the particular volume. :vartype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] :ivar enable_subvolumes: Flag indicating whether subvolume operations are enabled on the @@ -3817,6 +3975,7 @@ class Volume(msrest.serialization.Model): 'maximum_number_of_files': {'readonly': True}, 'volume_group_name': {'readonly': True}, 't2_network': {'readonly': True}, + 'encrypted': {'readonly': True}, } _attribute_map = { @@ -3826,6 +3985,7 @@ class Volume(msrest.serialization.Model): 'etag': {'key': 'etag', 'type': 'str'}, 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, + 'zones': {'key': 'zones', 'type': '[str]'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, 'creation_token': {'key': 'properties.creationToken', 'type': 'str'}, @@ -3867,6 +4027,7 @@ class Volume(msrest.serialization.Model): 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'str'}, 't2_network': {'key': 'properties.t2Network', 'type': 'str'}, 'volume_spec_name': {'key': 'properties.volumeSpecName', 'type': 'str'}, + 'encrypted': {'key': 'properties.encrypted', 'type': 'bool'}, 'placement_rules': {'key': 'properties.placementRules', 'type': '[PlacementKeyValuePairs]'}, 'enable_subvolumes': {'key': 'properties.enableSubvolumes', 'type': 'str'}, } @@ -3879,6 +4040,7 @@ def __init__( usage_threshold: int = 107374182400, subnet_id: str, tags: Optional[Dict[str, str]] = None, + zones: Optional[List[str]] = None, service_level: Optional[Union[str, "ServiceLevel"]] = "Premium", export_policy: Optional["VolumePropertiesExportPolicy"] = None, protocol_types: Optional[List[str]] = None, @@ -3893,7 +4055,7 @@ def __init__( security_style: Optional[Union[str, "SecurityStyle"]] = "unix", smb_encryption: Optional[bool] = False, smb_continuously_available: Optional[bool] = False, - throughput_mibps: Optional[float] = 0, + throughput_mibps: Optional[float] = None, encryption_key_source: Optional[str] = None, ldap_enabled: Optional[bool] = False, cool_access: Optional[bool] = False, @@ -3915,6 +4077,8 @@ def __init__( :paramtype location: str :keyword tags: A set of tags. Resource tags. :paramtype tags: dict[str, str] + :keyword zones: Availability Zone. + :paramtype zones: list[str] :keyword creation_token: Required. A unique file path for the volume. Used when creating mount targets. :paramtype creation_token: str @@ -4014,6 +4178,7 @@ def __init__( self.etag = None self.type = None self.tags = tags + self.zones = zones self.system_data = None self.file_system_id = None self.creation_token = creation_token @@ -4055,6 +4220,7 @@ def __init__( self.proximity_placement_group = proximity_placement_group self.t2_network = None self.volume_spec_name = volume_spec_name + self.encrypted = None self.placement_rules = placement_rules self.enable_subvolumes = enable_subvolumes @@ -4496,6 +4662,9 @@ class VolumeGroupVolumeProperties(msrest.serialization.Model): :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 encrypted: Specifies if the volume is encrypted or not. Only available on volumes created + or updated after 2022-01-01. + :vartype encrypted: bool :ivar placement_rules: Application specific placement rules for the particular volume. :vartype placement_rules: list[~azure.mgmt.netapp.models.PlacementKeyValuePairs] :ivar enable_subvolumes: Flag indicating whether subvolume operations are enabled on the @@ -4523,6 +4692,7 @@ class VolumeGroupVolumeProperties(msrest.serialization.Model): 'maximum_number_of_files': {'readonly': True}, 'volume_group_name': {'readonly': True}, 't2_network': {'readonly': True}, + 'encrypted': {'readonly': True}, } _attribute_map = { @@ -4570,6 +4740,7 @@ class VolumeGroupVolumeProperties(msrest.serialization.Model): 'proximity_placement_group': {'key': 'properties.proximityPlacementGroup', 'type': 'str'}, 't2_network': {'key': 'properties.t2Network', 'type': 'str'}, 'volume_spec_name': {'key': 'properties.volumeSpecName', 'type': 'str'}, + 'encrypted': {'key': 'properties.encrypted', 'type': 'bool'}, 'placement_rules': {'key': 'properties.placementRules', 'type': '[PlacementKeyValuePairs]'}, 'enable_subvolumes': {'key': 'properties.enableSubvolumes', 'type': 'str'}, } @@ -4596,7 +4767,7 @@ def __init__( security_style: Optional[Union[str, "SecurityStyle"]] = "unix", smb_encryption: Optional[bool] = False, smb_continuously_available: Optional[bool] = False, - throughput_mibps: Optional[float] = 0, + throughput_mibps: Optional[float] = None, encryption_key_source: Optional[str] = None, ldap_enabled: Optional[bool] = False, cool_access: Optional[bool] = False, @@ -4755,6 +4926,7 @@ def __init__( self.proximity_placement_group = proximity_placement_group self.t2_network = None self.volume_spec_name = volume_spec_name + self.encrypted = None self.placement_rules = placement_rules self.enable_subvolumes = enable_subvolumes @@ -4871,7 +5043,7 @@ def __init__( service_level: Optional[Union[str, "ServiceLevel"]] = "Premium", usage_threshold: Optional[int] = 107374182400, export_policy: Optional["VolumePatchPropertiesExportPolicy"] = None, - throughput_mibps: Optional[float] = 0, + throughput_mibps: Optional[float] = None, data_protection: Optional["VolumePatchPropertiesDataProtection"] = None, is_default_quota_enabled: Optional[bool] = False, default_user_quota_in_ki_bs: Optional[int] = 0, @@ -5053,6 +5225,165 @@ def __init__( self.rules = rules +class VolumeQuotaRule(msrest.serialization.Model): + """Quota Rule of a Volume. + + 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 etag: A unique read-only string that changes whenever the resource is updated. + :vartype etag: str + :ivar type: Resource type. + :vartype type: 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 + :ivar quota_size_in_ki_bs: Size of quota. + :vartype quota_size_in_ki_bs: long + :ivar quota_type: Type of quota. Possible values include: "DefaultUserQuota", + "DefaultGroupQuota", "IndividualUserQuota", "IndividualGroupQuota". + :vartype quota_type: str or ~azure.mgmt.netapp.models.Type + :ivar quota_target: UserID/GroupID/SID based on the quota target type. UserID and groupID can + be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by + running :code:``. + :vartype quota_target: str + """ + + _validation = { + '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'}, + 'quota_size_in_ki_bs': {'key': 'properties.quotaSizeInKiBs', 'type': 'long'}, + 'quota_type': {'key': 'properties.quotaType', 'type': 'str'}, + 'quota_target': {'key': 'properties.quotaTarget', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + quota_size_in_ki_bs: Optional[int] = None, + quota_type: Optional[Union[str, "Type"]] = None, + quota_target: Optional[str] = None, + **kwargs + ): + """ + :keyword location: Resource location. + :paramtype location: str + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword quota_size_in_ki_bs: Size of quota. + :paramtype quota_size_in_ki_bs: long + :keyword quota_type: Type of quota. Possible values include: "DefaultUserQuota", + "DefaultGroupQuota", "IndividualUserQuota", "IndividualGroupQuota". + :paramtype quota_type: str or ~azure.mgmt.netapp.models.Type + :keyword quota_target: UserID/GroupID/SID based on the quota target type. UserID and groupID + can be found by running ‘id’ or ‘getent’ command for the user or group and SID can be found by + running :code:``. + :paramtype quota_target: str + """ + super(VolumeQuotaRule, self).__init__(**kwargs) + self.location = location + self.id = None + self.name = None + self.etag = None + self.type = None + self.tags = tags + self.system_data = None + self.provisioning_state = None + self.quota_size_in_ki_bs = quota_size_in_ki_bs + self.quota_type = quota_type + self.quota_target = quota_target + + +class VolumeQuotaRulesList(msrest.serialization.Model): + """List of Volume Quota Rules. + + :ivar value: A list of Volume Quota Rules. + :vartype value: list[~azure.mgmt.netapp.models.VolumeQuotaRule] + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[VolumeQuotaRule]'}, + } + + def __init__( + self, + *, + value: Optional[List["VolumeQuotaRule"]] = None, + **kwargs + ): + """ + :keyword value: A list of Volume Quota Rules. + :paramtype value: list[~azure.mgmt.netapp.models.VolumeQuotaRule] + """ + super(VolumeQuotaRulesList, self).__init__(**kwargs) + self.value = value + + +class VolumeRelocationProperties(msrest.serialization.Model): + """Volume relocation properties. + + :ivar old_volume_id: The id of the old volume that is being relocated. + :vartype old_volume_id: str + :ivar old_bare_metal_tenant_id: The id of the bare metal tenant owned by the existing volume. + :vartype old_bare_metal_tenant_id: str + :ivar relocation_requested: Has relocation been requested for this volume. + :vartype relocation_requested: bool + """ + + _attribute_map = { + 'old_volume_id': {'key': 'oldVolumeId', 'type': 'str'}, + 'old_bare_metal_tenant_id': {'key': 'oldBareMetalTenantId', 'type': 'str'}, + 'relocation_requested': {'key': 'relocationRequested', 'type': 'bool'}, + } + + def __init__( + self, + *, + old_volume_id: Optional[str] = None, + old_bare_metal_tenant_id: Optional[str] = None, + relocation_requested: Optional[bool] = None, + **kwargs + ): + """ + :keyword old_volume_id: The id of the old volume that is being relocated. + :paramtype old_volume_id: str + :keyword old_bare_metal_tenant_id: The id of the bare metal tenant owned by the existing + volume. + :paramtype old_bare_metal_tenant_id: str + :keyword relocation_requested: Has relocation been requested for this volume. + :paramtype relocation_requested: bool + """ + super(VolumeRelocationProperties, self).__init__(**kwargs) + self.old_volume_id = old_volume_id + self.old_bare_metal_tenant_id = old_bare_metal_tenant_id + self.relocation_requested = relocation_requested + + class VolumeRevert(msrest.serialization.Model): """revert a volume to the snapshot. 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 b9157e8f8b5c..ee17f5f34b6a 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 @@ -151,6 +151,19 @@ class QosType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: qos type Manual. MANUAL = "Manual" +class RegionStorageToNetworkProximity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provides storage to network proximity information in the region. + """ + + #: Basic network connectivity. + DEFAULT = "Default" + #: Standard T1 network connectivity. + T1 = "T1" + #: Standard T2 network connectivity. + T2 = "T2" + #: Standard T1 and T2 network connectivity. + T1_AND_T2 = "T1AndT2" + class RelationshipStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Status of the mirror relationship """ @@ -186,6 +199,19 @@ class ServiceLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): #: Zone redundant storage service level. STANDARD_ZRS = "StandardZRS" +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of quota + """ + + #: Default user quota. + DEFAULT_USER_QUOTA = "DefaultUserQuota" + #: Default group quota. + DEFAULT_GROUP_QUOTA = "DefaultGroupQuota" + #: Individual user quota. + INDIVIDUAL_USER_QUOTA = "IndividualUserQuota" + #: Individual group quota. + INDIVIDUAL_GROUP_QUOTA = "IndividualGroupQuota" + 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 8e72a6f60883..7b804194eeb5 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 @@ -17,6 +17,7 @@ from ._backups_operations import BackupsOperations from ._account_backups_operations import AccountBackupsOperations from ._backup_policies_operations import BackupPoliciesOperations +from ._volume_quota_rules_operations import VolumeQuotaRulesOperations from ._vaults_operations import VaultsOperations from ._volume_groups_operations import VolumeGroupsOperations from ._subvolumes_operations import SubvolumesOperations @@ -33,6 +34,7 @@ 'BackupsOperations', 'AccountBackupsOperations', 'BackupPoliciesOperations', + 'VolumeQuotaRulesOperations', 'VaultsOperations', 'VolumeGroupsOperations', 'SubvolumesOperations', 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 4fe908c4bcc4..3c222922083b 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 @@ -34,7 +34,7 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups') @@ -70,7 +70,7 @@ def build_get_request( backup_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}') @@ -107,7 +107,7 @@ def build_delete_request_initial( backup_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/accountBackups/{backupName}') path_format_arguments = { 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 a5ca791e6b28..e756f3398faf 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 @@ -33,7 +33,7 @@ def build_list_by_subscription_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/netAppAccounts') @@ -65,7 +65,7 @@ def build_list_request( resource_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts') @@ -99,7 +99,7 @@ def build_get_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') @@ -139,7 +139,7 @@ def build_create_or_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') @@ -178,7 +178,7 @@ def build_delete_request_initial( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') path_format_arguments = { @@ -212,7 +212,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}') 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 39c117796711..9b290479d48c 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 @@ -35,7 +35,7 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies') @@ -71,7 +71,7 @@ def build_get_request( backup_policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') @@ -113,7 +113,7 @@ def build_create_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') @@ -159,7 +159,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') @@ -200,7 +200,7 @@ def build_delete_request_initial( backup_policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/backupPolicies/{backupPolicyName}') path_format_arguments = { 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 cc4fff8a0387..fbe5617ddc36 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 @@ -37,7 +37,7 @@ def build_get_status_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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') @@ -76,7 +76,7 @@ def build_get_volume_restore_status_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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') @@ -115,7 +115,7 @@ def build_list_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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') @@ -155,7 +155,7 @@ def build_get_request( backup_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -201,7 +201,7 @@ def build_create_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -251,7 +251,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -296,7 +296,7 @@ def build_delete_request_initial( backup_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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 = { 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 049560270363..f0e3164964d4 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 @@ -36,7 +36,7 @@ def build_check_name_availability_request( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkNameAvailability') @@ -78,7 +78,7 @@ def build_check_file_path_availability_request( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkFilePathAvailability') @@ -120,7 +120,7 @@ def build_check_quota_availability_request( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability') @@ -151,6 +151,39 @@ def build_check_quota_availability_request( **kwargs ) + +def build_query_region_info_request( + subscription_id: str, + location: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo') + 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 + ) + class NetAppResourceOperations(object): """NetAppResourceOperations operations. @@ -362,3 +395,52 @@ def check_quota_availability( check_quota_availability.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/checkQuotaAvailability'} # type: ignore + + @distributed_trace + def query_region_info( + self, + location: str, + **kwargs: Any + ) -> "_models.RegionInfo": + """Describes region specific information. + + Provides storage to network proximity and logical zone mapping information. + + :param location: The location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: RegionInfo, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.RegionInfo + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.RegionInfo"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_query_region_info_request( + subscription_id=self._config.subscription_id, + location=location, + template_url=self.query_region_info.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('RegionInfo', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + query_region_info.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/regionInfo'} # 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 bf5532359663..eccc48837a52 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 @@ -31,7 +31,7 @@ def build_list_request( location: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits') @@ -65,7 +65,7 @@ def build_get_request( quota_limit_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.NetApp/locations/{location}/quotaLimits/{quotaLimitName}') 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 4c59e8b85b90..650855bc9709 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 @@ -29,7 +29,7 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/providers/Microsoft.NetApp/operations') 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 690af793bb29..e3239a11e823 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 @@ -35,7 +35,7 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools') @@ -71,7 +71,7 @@ def build_get_request( pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') @@ -113,7 +113,7 @@ def build_create_or_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') @@ -159,7 +159,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') @@ -200,7 +200,7 @@ def build_delete_request_initial( pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}') path_format_arguments = { 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 637d9af22673..65302f170705 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 @@ -35,7 +35,7 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies') @@ -71,7 +71,7 @@ def build_get_request( snapshot_policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') @@ -113,7 +113,7 @@ def build_create_request( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') @@ -159,7 +159,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') @@ -200,7 +200,7 @@ def build_delete_request_initial( snapshot_policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}') path_format_arguments = { @@ -231,7 +231,7 @@ def build_list_volumes_request( snapshot_policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/snapshotPolicies/{snapshotPolicyName}/volumes') 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 eb42d413b7ea..79b0ebef4e3d 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 @@ -37,7 +37,7 @@ def build_list_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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') @@ -77,7 +77,7 @@ def build_get_request( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -123,7 +123,7 @@ def build_create_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -173,7 +173,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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}') @@ -218,7 +218,7 @@ def build_delete_request_initial( snapshot_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -258,7 +258,7 @@ def build_restore_files_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/snapshots/{snapshotName}/restoreFiles') path_format_arguments = { diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py index adc4f3cbfdbe..ccdc4c9ec1e8 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_subvolumes_operations.py @@ -37,7 +37,7 @@ def build_list_by_volume_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes') @@ -77,7 +77,7 @@ def build_get_request( subvolume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}') @@ -123,7 +123,7 @@ def build_create_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}') @@ -173,7 +173,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}') @@ -218,7 +218,7 @@ def build_delete_request_initial( subvolume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}') path_format_arguments = { @@ -253,7 +253,7 @@ def build_get_metadata_request_initial( subvolume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/subvolumes/{subvolumeName}/getMetadata') 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 8777ddbe3c01..c3f7dfd905fa 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 @@ -32,7 +32,7 @@ def build_list_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/vaults') 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 index cdcf3fc175a9..129659a04a91 100644 --- 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 @@ -35,7 +35,7 @@ def build_list_by_net_app_account_request( account_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups') @@ -71,7 +71,7 @@ def build_get_request( volume_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') @@ -113,7 +113,7 @@ def build_create_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') @@ -154,7 +154,7 @@ def build_delete_request_initial( volume_group_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/volumeGroups/{volumeGroupName}') path_format_arguments = { diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py new file mode 100644 index 000000000000..fa3229b7e5f0 --- /dev/null +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/operations/_volume_quota_rules_operations.py @@ -0,0 +1,809 @@ +# 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_volume_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules') + 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, + volume_quota_rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}') + 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}$'), + "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_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, + volume_quota_rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}') + 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}$'), + "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_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, + volume_quota_rule_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}') + 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}$'), + "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_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, + volume_quota_rule_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}') + 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}$'), + "volumeQuotaRuleName": _SERIALIZER.url("volume_quota_rule_name", volume_quota_rule_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 VolumeQuotaRulesOperations(object): + """VolumeQuotaRulesOperations 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_volume( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> Iterable["_models.VolumeQuotaRulesList"]: + """Get all quota rules for a volume. + + List all quota rules associated with the volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either VolumeQuotaRulesList or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.netapp.models.VolumeQuotaRulesList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeQuotaRulesList"] + 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_volume_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_by_volume.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_volume_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("VolumeQuotaRulesList", 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_volume.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules'} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + **kwargs: Any + ) -> "_models.VolumeQuotaRule": + """Describe a quota rule. + + Get details of the specified quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: VolumeQuotaRule, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.VolumeQuotaRule + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.VolumeQuotaRule"] + 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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + def _create_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> Optional["_models.VolumeQuotaRule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VolumeQuotaRule"]] + 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, 'VolumeQuotaRule') + + 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, + volume_quota_rule_name=volume_quota_rule_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, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 201: + deserialized = self._deserialize('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace + def begin_create( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> LROPoller["_models.VolumeQuotaRule"]: + """Create a quota rule. + + Create the specified quota rule within the given volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :param body: Quota rule object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeQuotaRule + :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 VolumeQuotaRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.VolumeQuotaRule] + :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.VolumeQuotaRule"] + 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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + 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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + def _update_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> Optional["_models.VolumeQuotaRule"]: + cls = kwargs.pop('cls', None) # type: ClsType[Optional["_models.VolumeQuotaRule"]] + 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, 'VolumeQuotaRule') + + 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, + volume_quota_rule_name=volume_quota_rule_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 + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + deserialized = None + if response.status_code == 200: + deserialized = self._deserialize('VolumeQuotaRule', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + body: "_models.VolumeQuotaRule", + **kwargs: Any + ) -> LROPoller["_models.VolumeQuotaRule"]: + """Update a quota rule. + + Patch a quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_name: str + :param body: Quota rule object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.VolumeQuotaRule + :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 VolumeQuotaRule or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.VolumeQuotaRule] + :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.VolumeQuotaRule"] + 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._update_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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('VolumeQuotaRule', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + 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: + 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_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # type: ignore + + + @distributed_trace + def begin_delete( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + volume_quota_rule_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a quota rule. + + Delete quota rule. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :param volume_quota_rule_name: The name of volume quota rule. + :type volume_quota_rule_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, + pool_name=pool_name, + volume_name=volume_name, + volume_quota_rule_name=volume_quota_rule_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, lro_options={'final-state-via': 'location'}, **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}/capacityPools/{poolName}/volumes/{volumeName}/volumeQuotaRules/{volumeQuotaRuleName}'} # 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 41122116f5da..075bf45161f7 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 @@ -36,7 +36,7 @@ def build_list_request( pool_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes') @@ -74,7 +74,7 @@ def build_get_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') @@ -118,7 +118,7 @@ def build_create_or_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') @@ -166,7 +166,7 @@ def build_update_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-01" accept = "application/json" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') @@ -211,7 +211,7 @@ def build_delete_request_initial( force_delete: Optional[bool] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-01" # Construct URL url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}') path_format_arguments = { @@ -251,7 +251,7 @@ def build_revert_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -284,6 +284,39 @@ def build_revert_request_initial( ) +def build_reset_cifs_password_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword') + 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_break_replication_request_initial( subscription_id: str, resource_group_name: str, @@ -297,7 +330,7 @@ def build_break_replication_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -338,7 +371,7 @@ def build_replication_status_request( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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') @@ -369,6 +402,45 @@ def build_replication_status_request( ) +def build_list_replications_request( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications') + 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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + **kwargs + ) + + def build_resync_replication_request_initial( subscription_id: str, resource_group_name: str, @@ -377,7 +449,7 @@ def build_resync_replication_request_initial( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -410,7 +482,7 @@ def build_delete_replication_request_initial( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -448,7 +520,7 @@ def build_authorize_replication_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -489,7 +561,7 @@ def build_re_initialize_replication_request_initial( volume_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -527,7 +599,7 @@ def build_pool_change_request_initial( ) -> HttpRequest: content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-10-01" + api_version = "2022-01-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 = { @@ -559,6 +631,105 @@ def build_pool_change_request_initial( **kwargs ) + +def build_relocate_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate') + 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_finalize_relocation_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation') + 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_revert_relocation_request_initial( + subscription_id: str, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-01-01" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation') + 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 + ) + class VolumesOperations(object): """VolumesOperations operations. @@ -1226,6 +1397,116 @@ def get_long_running_output(pipeline_response): begin_revert.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revert'} # type: ignore + def _reset_cifs_password_initial( + self, + 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', {})) + + + request = build_reset_cifs_password_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._reset_cifs_password_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]: + 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, {}) + + _reset_cifs_password_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword'} # type: ignore + + + @distributed_trace + def begin_reset_cifs_password( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Reset cifs password. + + Reset cifs password from volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._reset_cifs_password_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_reset_cifs_password.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/resetCifsPassword'} # type: ignore + def _break_replication_initial( self, resource_group_name: str, @@ -1412,6 +1693,67 @@ def replication_status( replication_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/replicationStatus'} # type: ignore + @distributed_trace + def list_replications( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> "_models.ListReplications": + """List replications for volume. + + List all replications for a specified volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :type volume_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ListReplications, or the result of cls(response) + :rtype: ~azure.mgmt.netapp.models.ListReplications + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ListReplications"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_list_replications_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_replications.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('ListReplications', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/listReplications'} # type: ignore + + def _resync_replication_initial( self, resource_group_name: str, @@ -1987,3 +2329,334 @@ def get_long_running_output(pipeline_response): 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 + + def _relocate_initial( + self, + 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', {})) + + + request = build_relocate_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._relocate_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]: + 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, {}) + + _relocate_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate'} # type: ignore + + + @distributed_trace + def begin_relocate( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Relocate volume. + + Relocates volume to a new stamp. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._relocate_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_relocate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/relocate'} # type: ignore + + def _finalize_relocation_initial( + self, + 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', {})) + + + request = build_finalize_relocation_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._finalize_relocation_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]: + 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, {}) + + _finalize_relocation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation'} # type: ignore + + + @distributed_trace + def begin_finalize_relocation( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Finalize volume relocation. + + Finalizes the relocation of the volume and cleans up the old volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._finalize_relocation_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_finalize_relocation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/finalizeRelocation'} # type: ignore + + def _revert_relocation_initial( + self, + 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', {})) + + + request = build_revert_relocation_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._revert_relocation_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]: + 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, {}) + + _revert_relocation_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation'} # type: ignore + + + @distributed_trace + def begin_revert_relocation( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Revert volume relocation. + + Reverts the volume relocation process, cleans up the new volume and starts using the + former-existing volume. + + :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 pool_name: The name of the capacity pool. + :type pool_name: str + :param volume_name: The name of the volume. + :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. + :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._revert_relocation_initial( + resource_group_name=resource_group_name, + account_name=account_name, + pool_name=pool_name, + volume_name=volume_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_revert_relocation.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/revertRelocation'} # type: ignore