From e550557ada12bcb1a9ce2379f603513958eba397 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 22 Feb 2021 14:32:24 +0000 Subject: [PATCH] CodeGen from PR 13094 in Azure/azure-rest-api-specs Merge c4dae091567a1b75f37ff081cb4036b9438a099f into 46748d2684b430f1286fda139eaedbbbcc73e924 --- .../azure/mgmt/netapp/_metadata.json | 2 +- .../mgmt/netapp/_net_app_management_client.py | 2 +- .../netapp/aio/_net_app_management_client.py | 2 +- .../aio/operations/_backups_operations.py | 123 +++++++++++++---- .../azure/mgmt/netapp/models/_models.py | 7 +- .../azure/mgmt/netapp/models/_models_py3.py | 7 +- .../netapp/operations/_backups_operations.py | 124 ++++++++++++++---- 7 files changed, 200 insertions(+), 67 deletions(-) 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 7dc68ab50c13..624dca8ef48e 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/_metadata.json @@ -4,7 +4,7 @@ "client": { "name": "NetAppManagementClient", "filename": "_net_app_management_client", - "description": "Microsoft NetApp Azure Resource Provider specification.", + "description": "Microsoft NetApp Files Azure Resource Provider specification.", "base_url": "\u0027https://management.azure.com\u0027", "custom_base_url": null, "azure_arm": true, 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 30f8ab1da59b..f5ec5ee058e7 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 @@ -33,7 +33,7 @@ class NetAppManagementClient(object): - """Microsoft NetApp Azure Resource Provider specification. + """Microsoft NetApp Files Azure Resource Provider specification. :ivar operations: Operations operations :vartype operations: azure.mgmt.netapp.operations.Operations 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 0bd52eb924a2..9a05810482d2 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 @@ -31,7 +31,7 @@ class NetAppManagementClient(object): - """Microsoft NetApp Azure Resource Provider specification. + """Microsoft NetApp Files Azure Resource Provider specification. :ivar operations: Operations operations :vartype operations: azure.mgmt.netapp.aio.operations.Operations diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py index 1ad7845de346..64d35f4f6026 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/aio/operations/_backups_operations.py @@ -351,7 +351,7 @@ def get_long_running_output(pipeline_response): return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore - async def update( + async def _update_initial( self, resource_group_name: str, account_name: str, @@ -361,27 +361,6 @@ async def update( body: Optional["_models.BackupPatch"] = None, **kwargs ) -> "_models.Backup": - """Patch a backup. - - Patch a backup for 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 - :param backup_name: The name of the backup. - :type backup_name: str - :param body: Backup object supplied in the body of the operation. - :type body: ~azure.mgmt.netapp.models.BackupPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Backup, or the result of cls(response) - :rtype: ~azure.mgmt.netapp.models.Backup - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -392,7 +371,7 @@ async def update( accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -422,17 +401,109 @@ async def update( pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('Backup', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('Backup', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Backup', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + async def begin_update( + self, + resource_group_name: str, + account_name: str, + pool_name: str, + volume_name: str, + backup_name: str, + body: Optional["_models.BackupPatch"] = None, + **kwargs + ) -> AsyncLROPoller["_models.Backup"]: + """Patch a backup. + + Patch a backup for 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 + :param backup_name: The name of the backup. + :type backup_name: str + :param body: Backup object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.BackupPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Backup or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Backup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] + 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, + backup_name=backup_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Backup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + 'backupName': self._serialize.url("backup_name", backup_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + 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}/backups/{backupName}'} # type: ignore async def _delete_initial( self, diff --git a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py index b76a8fd31918..e4a7a8fbeb24 100644 --- a/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py +++ b/sdk/netapp/azure-mgmt-netapp/azure/mgmt/netapp/models/_models.py @@ -1941,7 +1941,7 @@ class SystemData(msrest.serialization.Model): :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -2051,8 +2051,6 @@ class Volume(msrest.serialization.Model): :type tags: dict[str, str] :ivar file_system_id: Unique FileSystem Identifier. :vartype file_system_id: str - :ivar name_properties_name: Resource name. - :vartype name_properties_name: str :param creation_token: Required. A unique file path for the volume. Used when creating mount targets. :type creation_token: str @@ -2114,7 +2112,6 @@ class Volume(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'name_properties_name': {'readonly': True}, 'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'}, 'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400}, 'provisioning_state': {'readonly': True}, @@ -2133,7 +2130,6 @@ class Volume(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'creation_token': {'key': 'properties.creationToken', 'type': 'str'}, 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, 'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'}, @@ -2168,7 +2164,6 @@ def __init__( self.type = None self.tags = kwargs.get('tags', None) self.file_system_id = None - self.name_properties_name = None self.creation_token = kwargs['creation_token'] self.service_level = kwargs.get('service_level', None) self.usage_threshold = kwargs.get('usage_threshold', 107374182400) 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 cda4b6637e67..93250524398e 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 @@ -2162,7 +2162,7 @@ class SystemData(msrest.serialization.Model): :param last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". :type last_modified_by_type: str or ~azure.mgmt.netapp.models.CreatedByType - :param last_modified_at: The type of identity that last modified the resource. + :param last_modified_at: The timestamp of resource last modification (UTC). :type last_modified_at: ~datetime.datetime """ @@ -2284,8 +2284,6 @@ class Volume(msrest.serialization.Model): :type tags: dict[str, str] :ivar file_system_id: Unique FileSystem Identifier. :vartype file_system_id: str - :ivar name_properties_name: Resource name. - :vartype name_properties_name: str :param creation_token: Required. A unique file path for the volume. Used when creating mount targets. :type creation_token: str @@ -2347,7 +2345,6 @@ class Volume(msrest.serialization.Model): 'name': {'readonly': True}, 'type': {'readonly': True}, 'file_system_id': {'readonly': True, 'max_length': 36, 'min_length': 36, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'name_properties_name': {'readonly': True}, 'creation_token': {'required': True, 'max_length': 80, 'min_length': 1, 'pattern': r'^[a-zA-Z][a-zA-Z0-9\-]{0,79}$'}, 'usage_threshold': {'required': True, 'maximum': 109951162777600, 'minimum': 107374182400}, 'provisioning_state': {'readonly': True}, @@ -2366,7 +2363,6 @@ class Volume(msrest.serialization.Model): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'file_system_id': {'key': 'properties.fileSystemId', 'type': 'str'}, - 'name_properties_name': {'key': 'properties.name', 'type': 'str'}, 'creation_token': {'key': 'properties.creationToken', 'type': 'str'}, 'service_level': {'key': 'properties.serviceLevel', 'type': 'str'}, 'usage_threshold': {'key': 'properties.usageThreshold', 'type': 'long'}, @@ -2422,7 +2418,6 @@ def __init__( self.type = None self.tags = tags self.file_system_id = None - self.name_properties_name = None self.creation_token = creation_token self.service_level = service_level self.usage_threshold = usage_threshold 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 49e891d252be..3ddc0444ab0f 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 @@ -359,7 +359,7 @@ def get_long_running_output(pipeline_response): return LROPoller(self._client, raw_result, get_long_running_output, polling_method) begin_create.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore - def update( + def _update_initial( self, resource_group_name, # type: str account_name, # type: str @@ -370,27 +370,6 @@ def update( **kwargs # type: Any ): # type: (...) -> "_models.Backup" - """Patch a backup. - - Patch a backup for 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 - :param backup_name: The name of the backup. - :type backup_name: str - :param body: Backup object supplied in the body of the operation. - :type body: ~azure.mgmt.netapp.models.BackupPatch - :keyword callable cls: A custom type or function that will be passed the direct response - :return: Backup, or the result of cls(response) - :rtype: ~azure.mgmt.netapp.models.Backup - :raises: ~azure.core.exceptions.HttpResponseError - """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -401,7 +380,7 @@ def update( accept = "application/json" # Construct URL - url = self.update.metadata['url'] # type: ignore + url = self._update_initial.metadata['url'] # type: ignore path_format_arguments = { 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), @@ -431,17 +410,110 @@ def update( pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) response = pipeline_response.http_response - if response.status_code not in [200]: + 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 = self._deserialize('Backup', pipeline_response) + if response.status_code == 200: + deserialized = self._deserialize('Backup', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('Backup', pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}'} # type: ignore + + def begin_update( + self, + resource_group_name, # type: str + account_name, # type: str + pool_name, # type: str + volume_name, # type: str + backup_name, # type: str + body=None, # type: Optional["_models.BackupPatch"] + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.Backup"] + """Patch a backup. + + Patch a backup for 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 + :param backup_name: The name of the backup. + :type backup_name: str + :param body: Backup object supplied in the body of the operation. + :type body: ~azure.mgmt.netapp.models.BackupPatch + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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 Backup or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.netapp.models.Backup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.Backup"] + 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, + backup_name=backup_name, + body=body, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('Backup', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1, pattern=r'^[-\w\._\(\)]+$'), + 'accountName': self._serialize.url("account_name", account_name, 'str'), + 'poolName': self._serialize.url("pool_name", pool_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z0-9][a-zA-Z0-9\-_]{0,63}$'), + 'volumeName': self._serialize.url("volume_name", volume_name, 'str', max_length=64, min_length=1, pattern=r'^[a-zA-Z][a-zA-Z0-9\-_]{0,63}$'), + 'backupName': self._serialize.url("backup_name", backup_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + 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}/backups/{backupName}'} # type: ignore def _delete_initial( self,