diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py index ee0e81d07f73..b591ffdcaf0f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_client.py @@ -353,8 +353,12 @@ def list_deleted_keys(self, **kwargs): :dedent: 8 """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_deleted_keys(self._vault_url, maxresults=max_page_size, **kwargs) - return (DeletedKey._from_deleted_key_item(item) for item in pages) + return self._client.get_deleted_keys( + self._vault_url, + maxresults=max_page_size, + cls=lambda objs: [DeletedKey._from_deleted_key_item(x) for x in objs], + **kwargs + ) @distributed_trace def list_keys(self, **kwargs): @@ -381,8 +385,12 @@ def list_keys(self, **kwargs): :dedent: 8 """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_keys(self._vault_url, maxresults=max_page_size, **kwargs) - return (KeyBase._from_key_item(item) for item in pages) + return self._client.get_keys( + self._vault_url, + maxresults=max_page_size, + cls=lambda objs: [KeyBase._from_key_item(x) for x in objs], + **kwargs + ) @distributed_trace def list_key_versions(self, name, **kwargs): @@ -407,8 +415,13 @@ def list_key_versions(self, name, **kwargs): :dedent: 8 """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_key_versions(self._vault_url, name, maxresults=max_page_size, **kwargs) - return (KeyBase._from_key_item(item) for item in pages) + return self._client.get_key_versions( + self._vault_url, + name, + maxresults=max_page_size, + cls=lambda objs: [KeyBase._from_key_item(x) for x in objs], + **kwargs + ) @distributed_trace def purge_deleted_key(self, name, **kwargs): diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/__init__.py index beb24c202495..72fb27441900 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/__init__.py @@ -49,8 +49,8 @@ def parse_vault_id(url): try: from .async_challenge_auth_policy import AsyncChallengeAuthPolicy - from .async_client_base import AsyncKeyVaultClientBase, AsyncPagingAdapter + from .async_client_base import AsyncKeyVaultClientBase - __all__.extend(["AsyncChallengeAuthPolicy", "AsyncKeyVaultClientBase", "AsyncPagingAdapter"]) + __all__.extend(["AsyncChallengeAuthPolicy", "AsyncKeyVaultClientBase"]) except (SyntaxError, ImportError): pass diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py index 857e446e899c..b5cc965119ed 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py @@ -423,7 +423,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -494,7 +497,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1174,7 +1180,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1678,7 +1687,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1749,7 +1761,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1817,7 +1832,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2170,7 +2188,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2464,7 +2485,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3533,7 +3560,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3768,7 +3798,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4158,7 +4191,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models.py index e918a167f2dd..d1b025916b46 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models.py @@ -692,14 +692,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models_py3.py index 07d530b486f6..94ec3b96083e 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_models_py3.py @@ -692,14 +692,6 @@ def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags self.tags = tags -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py index 50a82e217aa9..0ae7fd5fb025 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py @@ -423,7 +423,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -494,7 +497,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1174,7 +1180,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1678,7 +1687,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1749,7 +1761,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1817,7 +1832,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2170,7 +2188,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2464,7 +2485,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3533,7 +3560,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3768,7 +3798,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4158,7 +4191,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py index d11b4bd0e615..08e45c2b44a7 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py @@ -422,7 +422,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -493,7 +496,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1173,7 +1179,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1675,7 +1684,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1746,7 +1758,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1814,7 +1829,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2172,7 +2190,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2466,7 +2487,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3657,7 +3684,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3892,7 +3922,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3960,7 +3993,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedStorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4634,7 +4670,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4706,7 +4745,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models.py index 24dfe4beb6a9..8b8ed5a83d62 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models.py @@ -753,14 +753,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models_py3.py index 52f4aa981815..59e6f039d4b6 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_models_py3.py @@ -753,14 +753,6 @@ def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags self.tags = tags -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/operations/_key_vault_client_operations.py index d52fb73651e7..b9ed6e10ea21 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/operations/_key_vault_client_operations.py @@ -422,7 +422,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -493,7 +496,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1173,7 +1179,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1675,7 +1684,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1746,7 +1758,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1814,7 +1829,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2172,7 +2190,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2466,7 +2487,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3657,7 +3684,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3892,7 +3922,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3960,7 +3993,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedStorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4634,7 +4670,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4706,7 +4745,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/async_client_base.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/async_client_base.py index 0714edabf420..4f5bb735ee4f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/async_client_base.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/async_client_base.py @@ -21,25 +21,6 @@ pass -class AsyncPagingAdapter: - """For each item in an AsyncIterator, returns the result of applying fn to that item. - Python 3.6 added syntax that could replace this (yield within async for).""" - - def __init__(self, pages: AsyncIterator, fn: Callable[[Model], Any]) -> None: - self._pages = pages - self._fn = fn - - def __aiter__(self): - return self - - async def __anext__(self) -> Any: - item = await self._pages.__anext__() - if not item: - raise StopAsyncIteration - return self._fn(item) - # TODO: expected type Model got Coroutine instead? - - class AsyncKeyVaultClientBase: """ :param credential: A credential or credential provider which can be used to authenticate to the vault, diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py index 51f916d2938f..28bccc61f053 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/aio/_client.py @@ -9,7 +9,7 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.keyvault.keys._models import Key, DeletedKey, KeyBase, KeyOperationResult -from azure.keyvault.keys._shared import AsyncKeyVaultClientBase, AsyncPagingAdapter +from azure.keyvault.keys._shared import AsyncKeyVaultClientBase class KeyClient(AsyncKeyVaultClientBase): @@ -354,9 +354,12 @@ def list_keys(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[KeyBase]: :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_keys(self.vault_url, maxresults=max_results, **kwargs) - iterable = AsyncPagingAdapter(pages, KeyBase._from_key_item) - return iterable + return self._client.get_keys( + self.vault_url, + maxresults=max_results, + cls=lambda objs: [KeyBase._from_key_item(x) for x in objs], + **kwargs + ) @distributed_trace def list_key_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncIterable[KeyBase]: @@ -380,9 +383,13 @@ def list_key_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncIter :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_key_versions(self.vault_url, name, maxresults=max_results, **kwargs) - iterable = AsyncPagingAdapter(pages, KeyBase._from_key_item) - return iterable + return self._client.get_key_versions( + self.vault_url, + name, + maxresults=max_results, + cls=lambda objs: [KeyBase._from_key_item(x) for x in objs], + **kwargs + ) @distributed_trace_async async def backup_key(self, name: str, **kwargs: Mapping[str, Any]) -> bytes: @@ -538,9 +545,12 @@ def list_deleted_keys(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[Delete :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_deleted_keys(self.vault_url, maxresults=max_results, **kwargs) - iterable = AsyncPagingAdapter(pages, DeletedKey._from_deleted_key_item) - return iterable + return self._client.get_deleted_keys( + self.vault_url, + maxresults=max_results, + cls=lambda objs: [DeletedKey._from_deleted_key_item(x) for x in objs], + **kwargs + ) @distributed_trace_async async def purge_deleted_key(self, name: str, **kwargs: Mapping[str, Any]) -> None: diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py index 1f0a670bf217..40678aabf7d4 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py @@ -179,8 +179,12 @@ def list_secrets(self, **kwargs): """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_secrets(self._vault_url, maxresults=max_page_size, **kwargs) - return (SecretAttributes._from_secret_item(item) for item in pages) + return self._client.get_secrets( + self._vault_url, + maxresults=max_page_size, + cls=lambda objs: [DeletedSecret._from_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace def list_secret_versions(self, name, **kwargs): @@ -206,8 +210,13 @@ def list_secret_versions(self, name, **kwargs): """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_secret_versions(self._vault_url, name, maxresults=max_page_size, **kwargs) - return (SecretAttributes._from_secret_item(item) for item in pages) + return self._client.get_secret_versions( + self._vault_url, + name, + maxresults=max_page_size, + cls=lambda objs: [DeletedSecret._from_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace def backup_secret(self, name, **kwargs): @@ -336,8 +345,12 @@ def list_deleted_secrets(self, **kwargs): """ max_page_size = kwargs.get("max_page_size", None) - pages = self._client.get_deleted_secrets(self._vault_url, maxresults=max_page_size, **kwargs) - return (DeletedSecret._from_deleted_secret_item(item) for item in pages) + return self._client.get_deleted_secrets( + self._vault_url, + maxresults=max_page_size, + cls=lambda objs: [DeletedSecret._from_deleted_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace def purge_deleted_secret(self, name, **kwargs): diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/__init__.py index beb24c202495..72fb27441900 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/__init__.py @@ -49,8 +49,8 @@ def parse_vault_id(url): try: from .async_challenge_auth_policy import AsyncChallengeAuthPolicy - from .async_client_base import AsyncKeyVaultClientBase, AsyncPagingAdapter + from .async_client_base import AsyncKeyVaultClientBase - __all__.extend(["AsyncChallengeAuthPolicy", "AsyncKeyVaultClientBase", "AsyncPagingAdapter"]) + __all__.extend(["AsyncChallengeAuthPolicy", "AsyncKeyVaultClientBase"]) except (SyntaxError, ImportError): pass diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py index 857e446e899c..b5cc965119ed 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/operations_async/_key_vault_client_operations_async.py @@ -423,7 +423,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -494,7 +497,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1174,7 +1180,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1678,7 +1687,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1749,7 +1761,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1817,7 +1832,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2170,7 +2188,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2464,7 +2485,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3533,7 +3560,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3768,7 +3798,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4158,7 +4191,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models.py index e918a167f2dd..d1b025916b46 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models.py @@ -692,14 +692,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models_py3.py index 07d530b486f6..94ec3b96083e 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_models_py3.py @@ -692,14 +692,6 @@ def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags self.tags = tags -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py index 50a82e217aa9..0ae7fd5fb025 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/operations/_key_vault_client_operations.py @@ -423,7 +423,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -494,7 +497,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1174,7 +1180,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1678,7 +1687,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1749,7 +1761,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1817,7 +1832,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2170,7 +2188,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2464,7 +2485,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3533,7 +3560,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3768,7 +3798,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4158,7 +4191,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py index d11b4bd0e615..08e45c2b44a7 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/operations_async/_key_vault_client_operations_async.py @@ -422,7 +422,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -493,7 +496,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1173,7 +1179,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1675,7 +1684,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1746,7 +1758,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -1814,7 +1829,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2172,7 +2190,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2466,7 +2487,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3657,7 +3684,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3892,7 +3922,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -3960,7 +3993,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedStorageListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4634,7 +4670,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) @@ -4706,7 +4745,10 @@ def prepare_request(next_link=None): async def extract_data_async(response): deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - return deserialized.next_link, AsyncList(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, AsyncList(list_of_elem) async def get_next_async(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models.py index 24dfe4beb6a9..8b8ed5a83d62 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models.py @@ -753,14 +753,6 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models_py3.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models_py3.py index 52f4aa981815..59e6f039d4b6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models_py3.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_models_py3.py @@ -753,14 +753,6 @@ def __init__(self, *, certificate_policy=None, certificate_attributes=None, tags self.tags = tags -class CloudError(Model): - """CloudError. - """ - - _attribute_map = { - } - - class Contact(Model): """The contact information for the vault certificates. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/operations/_key_vault_client_operations.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/operations/_key_vault_client_operations.py index d52fb73651e7..b9ed6e10ea21 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/operations/_key_vault_client_operations.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/operations/_key_vault_client_operations.py @@ -422,7 +422,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -493,7 +496,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('KeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1173,7 +1179,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedKeyListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1675,7 +1684,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1746,7 +1758,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -1814,7 +1829,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSecretListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2172,7 +2190,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2466,7 +2487,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateIssuerListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -2951,7 +2975,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('CertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3657,7 +3684,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedCertificateListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3892,7 +3922,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('StorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -3960,7 +3993,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedStorageListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4634,7 +4670,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('SasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) @@ -4706,7 +4745,10 @@ def prepare_request(next_link=None): def extract_data(response): deserialized = self._deserialize('DeletedSasDefinitionListResult', response) - return deserialized.next_link, iter(deserialized.value) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link, iter(list_of_elem) def get_next(next_link=None): request = prepare_request(next_link) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/async_client_base.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/async_client_base.py index dd2c6f0a9b95..d2e117608d71 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/async_client_base.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/async_client_base.py @@ -21,25 +21,6 @@ pass -class AsyncPagingAdapter: - """For each item in an AsyncIterator, returns the result of applying fn to that item. - Python 3.6 added syntax that could replace this (yield within async for).""" - - def __init__(self, pages: AsyncIterator, fn: Callable[[Model], Any]) -> None: - self._pages = pages - self._fn = fn - - def __aiter__(self): - return self - - async def __anext__(self) -> Any: - item = await self._pages.__anext__() - if not item: - raise StopAsyncIteration - return self._fn(item) - # TODO: expected type Model got Coroutine instead? - - class AsyncKeyVaultClientBase: """ :param credential: A credential or credential provider which can be used to authenticate to the vault, diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/aio/_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/aio/_client.py index 89a0fa98836e..9a4a92375ad9 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/aio/_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/aio/_client.py @@ -10,7 +10,7 @@ from azure.core.tracing.decorator_async import distributed_trace_async from azure.keyvault.secrets._models import Secret, DeletedSecret, SecretAttributes -from .._shared import AsyncKeyVaultClientBase, AsyncPagingAdapter +from .._shared import AsyncKeyVaultClientBase class SecretClient(AsyncKeyVaultClientBase): @@ -182,9 +182,12 @@ def list_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[SecretAttri :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_secrets(self.vault_url, maxresults=max_results) - iterable = AsyncPagingAdapter(pages, SecretAttributes._from_secret_item) - return iterable + return self._client.get_secrets( + self.vault_url, + maxresults=max_results, + cls=lambda objs: [SecretAttributes._from_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace def list_secret_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncIterable[SecretAttributes]: @@ -208,9 +211,13 @@ def list_secret_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncI :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_secret_versions(self.vault_url, name, maxresults=max_results) - iterable = AsyncPagingAdapter(pages, SecretAttributes._from_secret_item) - return iterable + return self._client.get_secret_versions( + self.vault_url, + name, + maxresults=max_results, + cls=lambda objs: [SecretAttributes._from_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace_async async def backup_secret(self, name: str, **kwargs: Mapping[str, Any]) -> bytes: @@ -335,9 +342,12 @@ def list_deleted_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[Del :dedent: 8 """ max_results = kwargs.get("max_page_size") - pages = self._client.get_deleted_secrets(self.vault_url, maxresults=max_results, **kwargs) - iterable = AsyncPagingAdapter(pages, DeletedSecret._from_deleted_secret_item) - return iterable + return self._client.get_deleted_secrets( + self.vault_url, + maxresults=max_results, + cls=lambda objs: [DeletedSecret._from_deleted_secret_item(x) for x in objs], + **kwargs + ) @distributed_trace_async async def purge_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> None: