Skip to content

Commit e6616b9

Browse files
author
Zim Kalinowski
committed
5.1.0-preview.1
1 parent aa88ed1 commit e6616b9

File tree

10 files changed

+291
-131
lines changed

10 files changed

+291
-131
lines changed

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/aio/operations_async/_vaults_operations_async.py

+23-11
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
1313
from azure.core.pipeline import PipelineResponse
1414
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
1616
from azure.mgmt.core.exceptions import ARMErrorFormat
1717
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
1818

@@ -371,7 +371,8 @@ def list_by_resource_group(
371371
top: Optional[int] = None,
372372
**kwargs
373373
) -> AsyncIterable["models.VaultListResult"]:
374-
"""The List operation gets information about the vaults associated with the subscription and within the specified resource group.
374+
"""The List operation gets information about the vaults associated with the subscription and
375+
within the specified resource group.
375376
376377
:param resource_group_name: The name of the Resource Group to which the vault belongs.
377378
:type resource_group_name: str
@@ -665,7 +666,7 @@ async def _purge_deleted_initial(
665666

666667
_purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore
667668

668-
async def purge_deleted(
669+
async def begin_purge_deleted(
669670
self,
670671
vault_name: str,
671672
location: str,
@@ -678,6 +679,7 @@ async def purge_deleted(
678679
:param location: The location of the soft-deleted vault.
679680
:type location: str
680681
:keyword callable cls: A custom type or function that will be passed the direct response
682+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
681683
:keyword polling: True for ARMPolling, False for no polling, or a
682684
polling object for personal polling strategy
683685
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -692,12 +694,14 @@ async def purge_deleted(
692694
'polling_interval',
693695
self._config.polling_interval
694696
)
695-
raw_result = await self._purge_deleted_initial(
696-
vault_name=vault_name,
697-
location=location,
698-
cls=lambda x,y,z: x,
699-
**kwargs
700-
)
697+
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
698+
if cont_token is None:
699+
raw_result = await self._purge_deleted_initial(
700+
vault_name=vault_name,
701+
location=location,
702+
cls=lambda x,y,z: x,
703+
**kwargs
704+
)
701705

702706
kwargs.pop('error_map', None)
703707
kwargs.pop('content_type', None)
@@ -709,8 +713,16 @@ def get_long_running_output(pipeline_response):
709713
if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
710714
elif polling is False: polling_method = AsyncNoPolling()
711715
else: polling_method = polling
712-
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
713-
purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore
716+
if cont_token:
717+
return AsyncLROPoller.from_continuation_token(
718+
polling_method=polling_method,
719+
continuation_token=cont_token,
720+
client=self._client,
721+
deserialization_callback=get_long_running_output
722+
)
723+
else:
724+
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
725+
begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore
714726

715727
def list(
716728
self,

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2016_10_01/operations/_vaults_operations.py

+20-8
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,8 @@ def list_by_resource_group(
381381
**kwargs # type: Any
382382
):
383383
# type: (...) -> Iterable["models.VaultListResult"]
384-
"""The List operation gets information about the vaults associated with the subscription and within the specified resource group.
384+
"""The List operation gets information about the vaults associated with the subscription and
385+
within the specified resource group.
385386
386387
:param resource_group_name: The name of the Resource Group to which the vault belongs.
387388
:type resource_group_name: str
@@ -693,6 +694,7 @@ def begin_purge_deleted(
693694
:param location: The location of the soft-deleted vault.
694695
:type location: str
695696
:keyword callable cls: A custom type or function that will be passed the direct response
697+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
696698
:keyword polling: True for ARMPolling, False for no polling, or a
697699
polling object for personal polling strategy
698700
:paramtype polling: bool or ~azure.core.polling.PollingMethod
@@ -707,12 +709,14 @@ def begin_purge_deleted(
707709
'polling_interval',
708710
self._config.polling_interval
709711
)
710-
raw_result = self._purge_deleted_initial(
711-
vault_name=vault_name,
712-
location=location,
713-
cls=lambda x,y,z: x,
714-
**kwargs
715-
)
712+
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
713+
if cont_token is None:
714+
raw_result = self._purge_deleted_initial(
715+
vault_name=vault_name,
716+
location=location,
717+
cls=lambda x,y,z: x,
718+
**kwargs
719+
)
716720

717721
kwargs.pop('error_map', None)
718722
kwargs.pop('content_type', None)
@@ -724,7 +728,15 @@ def get_long_running_output(pipeline_response):
724728
if polling is True: polling_method = ARMPolling(lro_delay, **kwargs)
725729
elif polling is False: polling_method = NoPolling()
726730
else: polling_method = polling
727-
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
731+
if cont_token:
732+
return LROPoller.from_continuation_token(
733+
polling_method=polling_method,
734+
continuation_token=cont_token,
735+
client=self._client,
736+
deserialization_callback=get_long_running_output
737+
)
738+
else:
739+
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
728740
begin_purge_deleted.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore
729741

730742
def list(

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_private_endpoint_connections_operations_async.py

+22-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
1212
from azure.core.pipeline import PipelineResponse
1313
from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest
14-
from azure.core.polling import AsyncNoPolling, AsyncPollingMethod, async_poller
14+
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
1515
from azure.mgmt.core.exceptions import ARMErrorFormat
1616
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
1717

@@ -230,7 +230,7 @@ async def _delete_initial(
230230
return deserialized
231231
_delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore
232232

233-
async def delete(
233+
async def begin_delete(
234234
self,
235235
resource_group_name: str,
236236
vault_name: str,
@@ -247,6 +247,7 @@ async def delete(
247247
with the key vault.
248248
:type private_endpoint_connection_name: str
249249
:keyword callable cls: A custom type or function that will be passed the direct response
250+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
250251
:keyword polling: True for ARMPolling, False for no polling, or a
251252
polling object for personal polling strategy
252253
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -261,13 +262,15 @@ async def delete(
261262
'polling_interval',
262263
self._config.polling_interval
263264
)
264-
raw_result = await self._delete_initial(
265-
resource_group_name=resource_group_name,
266-
vault_name=vault_name,
267-
private_endpoint_connection_name=private_endpoint_connection_name,
268-
cls=lambda x,y,z: x,
269-
**kwargs
270-
)
265+
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
266+
if cont_token is None:
267+
raw_result = await self._delete_initial(
268+
resource_group_name=resource_group_name,
269+
vault_name=vault_name,
270+
private_endpoint_connection_name=private_endpoint_connection_name,
271+
cls=lambda x,y,z: x,
272+
**kwargs
273+
)
271274

272275
kwargs.pop('error_map', None)
273276
kwargs.pop('content_type', None)
@@ -282,5 +285,13 @@ def get_long_running_output(pipeline_response):
282285
if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
283286
elif polling is False: polling_method = AsyncNoPolling()
284287
else: polling_method = polling
285-
return await async_poller(self._client, raw_result, get_long_running_output, polling_method)
286-
delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore
288+
if cont_token:
289+
return AsyncLROPoller.from_continuation_token(
290+
polling_method=polling_method,
291+
continuation_token=cont_token,
292+
client=self._client,
293+
deserialization_callback=get_long_running_output
294+
)
295+
else:
296+
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method)
297+
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/aio/operations_async/_vaults_operations_async.py

+44-21
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from azure.core.exceptions import HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error
1313
from azure.core.pipeline import PipelineResponse
1414
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
1616
from azure.mgmt.core.exceptions import ARMErrorFormat
1717
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
1818

@@ -100,7 +100,7 @@ async def _create_or_update_initial(
100100
return deserialized
101101
_create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}'} # type: ignore
102102

103-
async def create_or_update(
103+
async def begin_create_or_update(
104104
self,
105105
resource_group_name: str,
106106
vault_name: str,
@@ -116,6 +116,7 @@ async def create_or_update(
116116
:param parameters: Parameters to create or update the vault.
117117
:type parameters: ~azure.mgmt.keyvault.v2018_02_14.models.VaultCreateOrUpdateParameters
118118
: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.
119120
:keyword polling: True for ARMPolling, False for no polling, or a
120121
polling object for personal polling strategy
121122
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -130,13 +131,15 @@ async def create_or_update(
130131
'polling_interval',
131132
self._config.polling_interval
132133
)
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+
)
140143

141144
kwargs.pop('error_map', None)
142145
kwargs.pop('content_type', None)
@@ -151,8 +154,16 @@ def get_long_running_output(pipeline_response):
151154
if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
152155
elif polling is False: polling_method = AsyncNoPolling()
153156
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
156167

157168
async def update(
158169
self,
@@ -412,7 +423,8 @@ def list_by_resource_group(
412423
top: Optional[int] = None,
413424
**kwargs
414425
) -> 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.
416428
417429
:param resource_group_name: The name of the Resource Group to which the vault belongs.
418430
:type resource_group_name: str
@@ -706,7 +718,7 @@ async def _purge_deleted_initial(
706718

707719
_purge_deleted_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.KeyVault/locations/{location}/deletedVaults/{vaultName}/purge'} # type: ignore
708720

709-
async def purge_deleted(
721+
async def begin_purge_deleted(
710722
self,
711723
vault_name: str,
712724
location: str,
@@ -719,6 +731,7 @@ async def purge_deleted(
719731
:param location: The location of the soft-deleted vault.
720732
:type location: str
721733
: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.
722735
:keyword polling: True for ARMPolling, False for no polling, or a
723736
polling object for personal polling strategy
724737
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
@@ -733,12 +746,14 @@ async def purge_deleted(
733746
'polling_interval',
734747
self._config.polling_interval
735748
)
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+
)
742757

743758
kwargs.pop('error_map', None)
744759
kwargs.pop('content_type', None)
@@ -750,8 +765,16 @@ def get_long_running_output(pipeline_response):
750765
if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs)
751766
elif polling is False: polling_method = AsyncNoPolling()
752767
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
755778

756779
def list(
757780
self,

sdk/keyvault/azure-mgmt-keyvault/azure/mgmt/keyvault/v2018_02_14/operations/_private_endpoint_connections_operations.py

+19-8
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def begin_delete(
255255
with the key vault.
256256
:type private_endpoint_connection_name: str
257257
:keyword callable cls: A custom type or function that will be passed the direct response
258+
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
258259
:keyword polling: True for ARMPolling, False for no polling, or a
259260
polling object for personal polling strategy
260261
:paramtype polling: bool or ~azure.core.polling.PollingMethod
@@ -269,13 +270,15 @@ def begin_delete(
269270
'polling_interval',
270271
self._config.polling_interval
271272
)
272-
raw_result = self._delete_initial(
273-
resource_group_name=resource_group_name,
274-
vault_name=vault_name,
275-
private_endpoint_connection_name=private_endpoint_connection_name,
276-
cls=lambda x,y,z: x,
277-
**kwargs
278-
)
273+
cont_token = kwargs.pop('continuation_token', None) # type: Optional[str]
274+
if cont_token is None:
275+
raw_result = self._delete_initial(
276+
resource_group_name=resource_group_name,
277+
vault_name=vault_name,
278+
private_endpoint_connection_name=private_endpoint_connection_name,
279+
cls=lambda x,y,z: x,
280+
**kwargs
281+
)
279282

280283
kwargs.pop('error_map', None)
281284
kwargs.pop('content_type', None)
@@ -290,5 +293,13 @@ def get_long_running_output(pipeline_response):
290293
if polling is True: polling_method = ARMPolling(lro_delay, **kwargs)
291294
elif polling is False: polling_method = NoPolling()
292295
else: polling_method = polling
293-
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
296+
if cont_token:
297+
return LROPoller.from_continuation_token(
298+
polling_method=polling_method,
299+
continuation_token=cont_token,
300+
client=self._client,
301+
deserialization_callback=get_long_running_output
302+
)
303+
else:
304+
return LROPoller(self._client, raw_result, get_long_running_output, polling_method)
294305
begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore

0 commit comments

Comments
 (0)