12
12
from azure .core .exceptions import HttpResponseError , ResourceExistsError , ResourceNotFoundError , map_error
13
13
from azure .core .pipeline import PipelineResponse
14
14
from azure .core .pipeline .transport import AsyncHttpResponse , HttpRequest
15
- from azure .core .polling import AsyncNoPolling , AsyncPollingMethod , async_poller
15
+ from azure .core .polling import AsyncLROPoller , AsyncNoPolling , AsyncPollingMethod
16
16
from azure .mgmt .core .exceptions import ARMErrorFormat
17
17
from azure .mgmt .core .polling .async_arm_polling import AsyncARMPolling
18
18
@@ -100,7 +100,7 @@ async def _create_or_update_initial(
100
100
return deserialized
101
101
_create_or_update_initial .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}' } # type: ignore
102
102
103
- async def create_or_update (
103
+ async def begin_create_or_update (
104
104
self ,
105
105
resource_group_name : str ,
106
106
vault_name : str ,
@@ -116,6 +116,7 @@ async def create_or_update(
116
116
:param parameters: Parameters to create or update the vault.
117
117
:type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters
118
118
:keyword callable cls: A custom type or function that will be passed the direct response
119
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
119
120
:keyword polling: True for ARMPolling, False for no polling, or a
120
121
polling object for personal polling strategy
121
122
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -130,13 +131,15 @@ async def create_or_update(
130
131
'polling_interval' ,
131
132
self ._config .polling_interval
132
133
)
133
- raw_result = await self ._create_or_update_initial (
134
- resource_group_name = resource_group_name ,
135
- vault_name = vault_name ,
136
- parameters = parameters ,
137
- cls = lambda x ,y ,z : x ,
138
- ** kwargs
139
- )
134
+ cont_token = kwargs .pop ('continuation_token' , None ) # type: Optional[str]
135
+ if cont_token is None :
136
+ raw_result = await self ._create_or_update_initial (
137
+ resource_group_name = resource_group_name ,
138
+ vault_name = vault_name ,
139
+ parameters = parameters ,
140
+ cls = lambda x ,y ,z : x ,
141
+ ** kwargs
142
+ )
140
143
141
144
kwargs .pop ('error_map' , None )
142
145
kwargs .pop ('content_type' , None )
@@ -151,8 +154,16 @@ def get_long_running_output(pipeline_response):
151
154
if polling is True : polling_method = AsyncARMPolling (lro_delay , ** kwargs )
152
155
elif polling is False : polling_method = AsyncNoPolling ()
153
156
else : polling_method = polling
154
- return await async_poller (self ._client , raw_result , get_long_running_output , polling_method )
155
- create_or_update .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}' } # type: ignore
157
+ if cont_token :
158
+ return AsyncLROPoller .from_continuation_token (
159
+ polling_method = polling_method ,
160
+ continuation_token = cont_token ,
161
+ client = self ._client ,
162
+ deserialization_callback = get_long_running_output
163
+ )
164
+ else :
165
+ return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
166
+ begin_create_or_update .metadata = {'url' : '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}' } # type: ignore
156
167
157
168
async def update (
158
169
self ,
@@ -412,7 +423,8 @@ def list_by_resource_group(
412
423
top : Optional [int ] = None ,
413
424
** kwargs
414
425
) -> AsyncIterable ["models.VaultListResult" ]:
415
- """The List operation gets information about the vaults associated with the subscription and within the specified resource group.
426
+ """The List operation gets information about the vaults associated with the subscription and
427
+ within the specified resource group.
416
428
417
429
:param resource_group_name: The name of the Resource Group to which the vault belongs.
418
430
:type resource_group_name: str
@@ -706,7 +718,7 @@ async def _purge_deleted_initial(
706
718
707
719
_purge_deleted_initial .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge' } # type: ignore
708
720
709
- async def purge_deleted (
721
+ async def begin_purge_deleted (
710
722
self ,
711
723
vault_name : str ,
712
724
location : str ,
@@ -719,6 +731,7 @@ async def purge_deleted(
719
731
:param location: The location of the soft-deleted vault.
720
732
:type location: str
721
733
:keyword callable cls: A custom type or function that will be passed the direct response
734
+ :keyword str continuation_token: A continuation token to restart a poller from a saved state.
722
735
:keyword polling: True for ARMPolling, False for no polling, or a
723
736
polling object for personal polling strategy
724
737
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -733,12 +746,14 @@ async def purge_deleted(
733
746
'polling_interval' ,
734
747
self ._config .polling_interval
735
748
)
736
- raw_result = await self ._purge_deleted_initial (
737
- vault_name = vault_name ,
738
- location = location ,
739
- cls = lambda x ,y ,z : x ,
740
- ** kwargs
741
- )
749
+ cont_token = kwargs .pop ('continuation_token' , None ) # type: Optional[str]
750
+ if cont_token is None :
751
+ raw_result = await self ._purge_deleted_initial (
752
+ vault_name = vault_name ,
753
+ location = location ,
754
+ cls = lambda x ,y ,z : x ,
755
+ ** kwargs
756
+ )
742
757
743
758
kwargs .pop ('error_map' , None )
744
759
kwargs .pop ('content_type' , None )
@@ -750,8 +765,16 @@ def get_long_running_output(pipeline_response):
750
765
if polling is True : polling_method = AsyncARMPolling (lro_delay , ** kwargs )
751
766
elif polling is False : polling_method = AsyncNoPolling ()
752
767
else : polling_method = polling
753
- return await async_poller (self ._client , raw_result , get_long_running_output , polling_method )
754
- purge_deleted .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge' } # type: ignore
768
+ if cont_token :
769
+ return AsyncLROPoller .from_continuation_token (
770
+ polling_method = polling_method ,
771
+ continuation_token = cont_token ,
772
+ client = self ._client ,
773
+ deserialization_callback = get_long_running_output
774
+ )
775
+ else :
776
+ return AsyncLROPoller (self ._client , raw_result , get_long_running_output , polling_method )
777
+ begin_purge_deleted .metadata = {'url' : '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge' } # type: ignore
755
778
756
779
def list (
757
780
self ,
0 commit comments