@@ -351,7 +351,7 @@ def get_long_running_output(pipeline_response):
351351 return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
352352 begin_create .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}' } # type: ignore
353353
354- async def update (
354+ async def _update_initial (
355355 self ,
356356 resource_group_name : str ,
357357 account_name : str ,
@@ -361,27 +361,6 @@ async def update(
361361 body : Optional ["_models.BackupPatch" ] = None ,
362362 ** kwargs
363363 ) -> "_models.Backup" :
364- """Patch a backup.
365-
366- Patch a backup for the volume.
367-
368- :param resource_group_name: The name of the resource group.
369- :type resource_group_name: str
370- :param account_name: The name of the NetApp account.
371- :type account_name: str
372- :param pool_name: The name of the capacity pool.
373- :type pool_name: str
374- :param volume_name: The name of the volume.
375- :type volume_name: str
376- :param backup_name: The name of the backup.
377- :type backup_name: str
378- :param body: Backup object supplied in the body of the operation.
379- :type body: ~azure.mgmt.netapp.models.BackupPatch
380- :keyword callable cls: A custom type or function that will be passed the direct response
381- :return: Backup, or the result of cls(response)
382- :rtype: ~azure.mgmt.netapp.models.Backup
383- :raises: ~azure.core.exceptions.HttpResponseError
384- """
385364 cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.Backup"]
386365 error_map = {
387366 401 : ClientAuthenticationError , 404 : ResourceNotFoundError , 409 : ResourceExistsError
@@ -392,7 +371,7 @@ async def update(
392371 accept = "application/json"
393372
394373 # Construct URL
395- url = self .update .metadata ['url' ] # type: ignore
374+ url = self ._update_initial .metadata ['url' ] # type: ignore
396375 path_format_arguments = {
397376 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
398377 '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(
422401 pipeline_response = await self ._client ._pipeline .run (request , stream = False , ** kwargs )
423402 response = pipeline_response .http_response
424403
425- if response .status_code not in [200 ]:
404+ if response .status_code not in [200 , 202 ]:
426405 map_error (status_code = response .status_code , response = response , error_map = error_map )
427406 raise HttpResponseError (response = response , error_format = ARMErrorFormat )
428407
429- deserialized = self ._deserialize ('Backup' , pipeline_response )
408+ if response .status_code == 200 :
409+ deserialized = self ._deserialize ('Backup' , pipeline_response )
410+
411+ if response .status_code == 202 :
412+ deserialized = self ._deserialize ('Backup' , pipeline_response )
430413
431414 if cls :
432415 return cls (pipeline_response , deserialized , {})
433416
434417 return deserialized
435- update .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}' } # type: ignore
418+ _update_initial .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}' } # type: ignore
419+
420+ async def begin_update (
421+ self ,
422+ resource_group_name : str ,
423+ account_name : str ,
424+ pool_name : str ,
425+ volume_name : str ,
426+ backup_name : str ,
427+ body : Optional ["_models.BackupPatch" ] = None ,
428+ ** kwargs
429+ ) -> AsyncLROPoller ["_models.Backup" ]:
430+ """Patch a backup.
431+
432+ Patch a backup for the volume.
433+
434+ :param resource_group_name: The name of the resource group.
435+ :type resource_group_name: str
436+ :param account_name: The name of the NetApp account.
437+ :type account_name: str
438+ :param pool_name: The name of the capacity pool.
439+ :type pool_name: str
440+ :param volume_name: The name of the volume.
441+ :type volume_name: str
442+ :param backup_name: The name of the backup.
443+ :type backup_name: str
444+ :param body: Backup object supplied in the body of the operation.
445+ :type body: ~azure.mgmt.netapp.models.BackupPatch
446+ :keyword callable cls: A custom type or function that will be passed the direct response
447+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
448+ :keyword polling: True for ARMPolling, False for no polling, or a
449+ polling object for personal polling strategy
450+ :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
451+ :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present.
452+ :return: An instance of AsyncLROPoller that returns either Backup or the result of cls(response)
453+ :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.netapp.models.Backup]
454+ :raises ~azure.core.exceptions.HttpResponseError:
455+ """
456+ polling = kwargs .pop ('polling' , True ) # type: Union[bool, AsyncPollingMethod]
457+ cls = kwargs .pop ('cls' , None ) # type: ClsType["_models.Backup"]
458+ lro_delay = kwargs .pop (
459+ 'polling_interval' ,
460+ self ._config .polling_interval
461+ )
462+ cont_token = kwargs .pop ('continuation_token' , None ) # type: Optional[str]
463+ if cont_token is None :
464+ raw_result = await self ._update_initial (
465+ resource_group_name = resource_group_name ,
466+ account_name = account_name ,
467+ pool_name = pool_name ,
468+ volume_name = volume_name ,
469+ backup_name = backup_name ,
470+ body = body ,
471+ cls = lambda x ,y ,z : x ,
472+ ** kwargs
473+ )
474+
475+ kwargs .pop ('error_map' , None )
476+ kwargs .pop ('content_type' , None )
477+
478+ def get_long_running_output (pipeline_response ):
479+ deserialized = self ._deserialize ('Backup' , pipeline_response )
480+
481+ if cls :
482+ return cls (pipeline_response , deserialized , {})
483+ return deserialized
484+
485+ path_format_arguments = {
486+ 'subscriptionId' : self ._serialize .url ("self._config.subscription_id" , self ._config .subscription_id , 'str' ),
487+ 'resourceGroupName' : self ._serialize .url ("resource_group_name" , resource_group_name , 'str' , max_length = 90 , min_length = 1 , pattern = r'^[-\w\._\(\)]+$' ),
488+ 'accountName' : self ._serialize .url ("account_name" , account_name , 'str' ),
489+ '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}$' ),
490+ '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}$' ),
491+ 'backupName' : self ._serialize .url ("backup_name" , backup_name , 'str' ),
492+ }
493+
494+ if polling is True : polling_method = AsyncARMPolling (lro_delay , lro_options = {'final-state-via' : 'location' }, path_format_arguments = path_format_arguments , ** kwargs )
495+ elif polling is False : polling_method = AsyncNoPolling ()
496+ else : polling_method = polling
497+ if cont_token :
498+ return AsyncLROPoller .from_continuation_token (
499+ polling_method = polling_method ,
500+ continuation_token = cont_token ,
501+ client = self ._client ,
502+ deserialization_callback = get_long_running_output
503+ )
504+ else :
505+ return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
506+ begin_update .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetApp/netAppAccounts/{accountName}/capacityPools/{poolName}/volumes/{volumeName}/backups/{backupName}' } # type: ignore
436507
437508 async def _delete_initial (
438509 self ,
0 commit comments