diff --git a/.docsettings.yml b/.docsettings.yml index 317e26b199cd..a8b9d07e4c40 100644 --- a/.docsettings.yml +++ b/.docsettings.yml @@ -9,7 +9,7 @@ omitted_paths: language: python root_check_enabled: True required_readme_sections: - - "Azure .+ client library for Python" + - ^Azure (.+ client library for Python|Smoke Test for Python) - ^Getting started$ - ^Key concepts$ - ^Examples$ diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e7da96b211dc..07d57ac48320 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -6,20 +6,20 @@ ########### # Catch all -# /sdk/ @mayurid +/sdk/ @mayurid # Core -/sdk/core/ @lmazuel +/sdk/core/ @lmazuel @xiangyan99 @johanste /sdk/core/azure-core/ @xiangyan99 @bryevdv # Service team -# /sdk/identity/ -# /sdk/eventhub/ +/sdk/identity/ @chlowell @schaabs +/sdk/eventhub/ @annatisch @yunhaoling @YijunXieMS /sdk/storage/ @zezha-msft @annatisch @rakshith91 /sdk/applicationinsights/ @alexeldeib /sdk/batch/ @bgklein @matthchr @xingwu1 /sdk/cognitiveservices/azure-cognitiveservices-vision-customvision/ @areddish -/sdk/keyvault/ @schaabs @chlowell +/sdk/keyvault/ @schaabs @chlowell @iscai-msft /sdk/loganalytics/ @alexeldeib /sdk/consumption/ @sandeepnl /sdk/containerinstance/ @samkreter @xizhamsft @@ -35,7 +35,10 @@ /sdk/recoveryservices/ @DheerendraRathor /sdk/servicefabric/ @QingChenmsft @samedder /sql/sql/ @jaredmoo -/sdk/servicebus/azure-servicebus/ @annatisch +/sdk/servicebus/azure-servicebus/ @annatisch @yunhaoling @YijunXieMS + +# Management Plane +/**/*mgmt*/ @zikalino ########### # Eng Sys diff --git a/samples/smoketest/Program.py b/samples/smoketest/Program.py new file mode 100644 index 000000000000..dd43a67f9287 --- /dev/null +++ b/samples/smoketest/Program.py @@ -0,0 +1,13 @@ +from key_vault_secrets import KeyVault +from storage_blob import StorageBlob +from event_hubs import EventHub +from cosmos_db import CosmosDB + +print("==========================================") +print(" AZURE TRACK 2 SDKs SMOKE TEST") +print("==========================================") + +KeyVault().Run() +StorageBlob().Run() +EventHub().Run() +CosmosDB().Run() diff --git a/samples/smoketest/README.md b/samples/smoketest/README.md new file mode 100644 index 000000000000..6e0a21c70235 --- /dev/null +++ b/samples/smoketest/README.md @@ -0,0 +1,116 @@ +# Azure Smoke Test for Python +This sample code is a smoke test to ensure that Azure Preview for Python work while loaded into the same process by performing 2 or more actions with them. + +Libraries tested: +* keyvault-secrets +* identity +* storage-blob +* event-hubs +* cosmos + +## Getting started +### Setup Azure resources +For this sample, it is necessary to create/have the following resources in the [Azure Portal](https://portal.azure.com/): +* **App registration**: Register a new app or use an existing one. + * Under _Certificates & secrets_ create a new **client secret** and store the value in a safe place. +* **Key Vaults**: Create a new Key Vault resource or use an existing one. + * Under _Access policies_, add the app registrated in the previous step. +* **Storage acounts**: Create a container in a new or existing storage account. The container in this sample is named "mycontainer", if you want to use other name you can change the value in `BlobStorage.ts` file: +`const containerName = "mycontainer";` +* **Event Hubs**: Create an event hub inside a new or existing Event Hubs Namespace. The container in this sample is named "myeventhub", if you want to use other name you can change the value in `EventHubsTest.ts` file: `let eventHubName = "myeventhub";` +* **Azure Cosmos DB**: Create a new account or use an existing one. + +### Azure credentials +The following environment variables are needed: +* From **App Registration**, in the _Overview_ section: + * AZURE_TENANT_ID: The directory tentant ID. + * AZURE_CLIENT_ID: The application ID. + * AZURE_CLIENT_SECRET: The client secret stored previusly when creating the _client secret_. + +* From **Key Vault**, in the _Overview_ section: + * AZURE_PROJECT_URL: The DNS Name + +* From **Event Hubs**, in _Shared access policies_ section: + * EVENT_HUBS_CONNECTION_STRING: Connection string from a policy + +* From **Storage Account**, in the _Access Keys_ section: + * STORAGE_CONNECTION_STRING : A connection strings. + +* From **Azure Cosmos DB**, in the _Keys_ section, select the _Read-Write Keys_ tab: + * COSMOS_ENDPOINT: URI. + * COSMOS_KEY: Primary or secondary key. + +``` +//Bash code to create the environment variables +export AZURE_CLIENT_ID="" +export AZURE_CLIENT_SECRET="" +export AZURE_TENANT_ID="" +export EVENT_HUBS_CONNECTION_STRING="" +export AZURE_PROJECT_URL="" +export STORAGE_CONNECTION_STRING="" +export COSMOS_ENDPOINT="" +export COSMOS_KEY="" +``` + +### Running the console app +[Python](https://www.python.org/downloads/) version 3.7.4 was used to run this sample. + +In the \SmokeTest\ directory, run Program.py +``` +python .\Program.py +``` + +## Key concepts + + +## Examples +All the classes in this sample has a `Run()` method as entry point, and do not depend on each other. + +It is possible to run them individually: +```python +from KeyVaultSecrets import KeyVault + +KeyVault().Run() +``` + +They can be included in other projects by moving the class in it: +```python +from KeyVaultSecrets import KeyVault + +... + +def myTests(): + console.log("Smoke Test imported from other project") + KeyVault().Run() + +myTests() +otherFunction() +... +``` + +The classes can be used as base code and be changed to satisfied specific needs. For example, the method `EventHub().SendAndReceiveEvents()` can be change to only send events from an array given from a parameter: +```python +def SendAndReceiveEvents(self, partitionID, events): + producer = self.client.create_producer(partition_id=partitionID) + producer.send(events) + producer.close() +``` + +**Note:** The methods in the classes are not necessary independent on each other, and the order matters. For example, in order to run `BlobStorage().DeleteBlob();`, the method `BlobStorage().UploadBLob();` must be run before, since in the other way it will fail because there is not going to be a blob to delete. + +## Troubleshooting + +### Authentication +Be sure to set the environment variables and credentials required before running the sample. + +## Next steps +Check the [Azure SDK for Python Repository](https://github.com/Azure/azure-sdk-for-python/tree/master/sdk) for more samples inside the sdk folder. + +## Contributing +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com. + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA. + +If you'd like to contribute to this library, please read the contributing guide to learn more about how to build and test the code. + +This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments. \ No newline at end of file diff --git a/samples/smoketest/cosmos_db.py b/samples/smoketest/cosmos_db.py new file mode 100644 index 000000000000..b4e2a56aa025 --- /dev/null +++ b/samples/smoketest/cosmos_db.py @@ -0,0 +1,84 @@ +import os +from azure.cosmos import CosmosClient +from azure.cosmos.partition_key import PartitionKey + + +class CosmosDB: + def __init__(self): + URL = os.environ["COSMOS_ENDPOINT"] + KEY = os.environ["COSMOS_KEY"] + self.client = CosmosClient(URL, {"masterKey": KEY}) + self.dbName = "pySolarSystem" + + def CreateDatabase(self): + print("Creating '{0}' database...".format(self.dbName)) + return self.client.create_database(self.dbName) + + def CreateContainer(self, db): + collectionName = "Planets" + print("Creating '{0}' collection...".format(collectionName)) + partition_key = PartitionKey(path="/id", kind="Hash") + return db.create_container(id="Planets", partition_key=partition_key) + + def CreateDocuments(self, container): + # Cosmos will look for an 'id' field in the items, if the 'id' is not specify Cosmos is going to assing a random key. + planets = [ + { + "id": "Earth", + "HasRings": False, + "Radius": 3959, + "Moons": [{"Name": "Moon"}], + }, + { + "id": "Mars", + "HasRings": False, + "Radius": 2106, + "Moons": [{"Name": "Phobos"}, {"Name": "Deimos"}], + }, + ] + + print("Inserting items in the collection...") + for planet in planets: + container.create_item(planet) + print("\t'{0}' created".format(planet["id"])) + print("\tdone") + + def SimpleQuery(self, container): + print("Quering the container...") + items = list( + container.query_items( + query="SELECT c.id FROM c", enable_cross_partition_query=True + ) + ) + print("\tdone: {0}".format(items)) + + def DeleteDatabase(self): + print("Cleaning up the resource...") + self.client.delete_database(self.dbName) + print("\tdone") + + def Run(self): + print() + print("------------------------") + print("Cosmos DB") + print("------------------------") + print("1) Create a Database") + print("2) Create a Container in the database") + print("3) Insert Documents (items) into the Container") + print("4) Delete Database (Clean up the resource)") + print() + + # Ensure that the database does not exists + try: + self.DeleteDatabase() + except: + pass + + try: + db = self.CreateDatabase() + container = self.CreateContainer(db=db) + self.CreateDocuments(container=container) + self.SimpleQuery(container=container) + finally: + # if something goes wrong, the resource should be cleaned anyway + self.DeleteDatabase() diff --git a/samples/smoketest/event_hubs.py b/samples/smoketest/event_hubs.py new file mode 100644 index 000000000000..9a0ed400b5c5 --- /dev/null +++ b/samples/smoketest/event_hubs.py @@ -0,0 +1,66 @@ +import os +from datetime import datetime +from azure.eventhub import EventHubClient, EventData, EventPosition + + +class EventHub: + def __init__(self): + # This test requires a previusly created Event Hub. + # In this example the name is "myeventhub", but it could be change below + connectionString = os.environ["EVENT_HUBS_CONNECTION_STRING"] + eventHubName = "myeventhub" + self.client = EventHubClient.from_connection_string( + connectionString, eventHubName + ) + + def GetPartitionIds(self): + print("Getting partitions id...") + partition_ids = self.client.get_partition_ids() + print("\tdone") + return partition_ids + + def SendAndReceiveEvents(self, partitionID): + with self.client.create_consumer( + consumer_group="$default", + partition_id=partitionID, + event_position=EventPosition(datetime.utcnow()), + ) as consumer: + + print("Sending events...") + with self.client.create_producer(partition_id=partitionID) as producer: + event_list = [ + EventData(b"Test Event 1 in Python"), + EventData(b"Test Event 2 in Python"), + EventData(b"Test Event 3 in Python"), + ] + producer.send(event_list) + print("\tdone") + + print("Receiving events...") + received = consumer.receive(max_batch_size=len(event_list), timeout=2) + for event_data in received: + print("\tEvent Received: " + event_data.body_as_str()) + + print("\tdone") + + if len(received) != len(event_list): + raise Exception( + "Error, expecting {0} events, but {1} were received.".format( + str(len(event_list)), str(len(received)) + ) + ) + + def Run(self): + print() + print("------------------------") + print("Event Hubs") + print("------------------------") + print("1) Get partition ID") + print("2) Send Events") + print("3) Consume Events") + print() + + partitionID = self.GetPartitionIds() + # In this sample the same partition id is going to be used for the producer and consumer, + # It is the first one, but it could be any (is not relevant as long as it is the same in both producer and consumer) + self.SendAndReceiveEvents(partitionID[0]) diff --git a/samples/smoketest/key_vault_secrets.py b/samples/smoketest/key_vault_secrets.py new file mode 100644 index 000000000000..7f27b02460f1 --- /dev/null +++ b/samples/smoketest/key_vault_secrets.py @@ -0,0 +1,46 @@ +import os +from azure.identity import DefaultAzureCredential +from azure.keyvault.secrets import SecretClient + + +class KeyVault: + def __init__(self): + # DefaultAzureCredential() expects the following environment variables: + # * AZURE_CLIENT_ID + # * AZURE_CLIENT_SECRET + # * AZURE_TENANT_ID + credential = DefaultAzureCredential() + self.secret_client = SecretClient( + vault_url=os.environ["AZURE_PROJECT_URL"], credential=credential + ) + + def SetSecret(self): + print("Setting a secret...") + self.secret_client.set_secret("secret-name", "secret-value") + print("\tdone") + + def GetSecret(self): + print("Getting a secret...") + secret = self.secret_client.get_secret("secret-name") + print("\tdone: " + secret.name) + + def DeleteSecret(self): + print("Deleting a secret...") + deleted_secret = self.secret_client.delete_secret("secret-name") + print("\tdone: " + deleted_secret.name) + + def Run(self): + print() + print("------------------------") + print("Key Vault - Secrets\nIdentity - Credential") + print("------------------------") + print("1) Set a secret") + print("2) Get that secret") + print("3) Delete that secret (Clean up the resource)") + print() + + try: + self.SetSecret() + self.GetSecret() + finally: + self.DeleteSecret() diff --git a/samples/smoketest/requirements.txt b/samples/smoketest/requirements.txt new file mode 100644 index 000000000000..eaf49d15335d --- /dev/null +++ b/samples/smoketest/requirements.txt @@ -0,0 +1,8 @@ +azure-common==1.1.23 +azure-core==1.0.0b1 +azure-cosmos==4.0.0b1 +azure-eventhub==5.0.0b1 +azure-identity==1.0.0b1 +azure-keyvault-secrets==4.0.0b1 +azure-storage-blob==12.0.0b1 +azure-storage-common==2.0.0 \ No newline at end of file diff --git a/samples/smoketest/storage_blob.py b/samples/smoketest/storage_blob.py new file mode 100644 index 000000000000..7e0c394f9580 --- /dev/null +++ b/samples/smoketest/storage_blob.py @@ -0,0 +1,51 @@ +import os +from azure.storage.blob import BlobClient +from azure.core import exceptions + + +class StorageBlob: + def __init__(self): + connectionString = os.environ["STORAGE_CONNECTION_STRING"] + self.blob = BlobClient.from_connection_string( + connectionString, container="mycontainer", blob="pyTestBlob.txt" + ) + + def UploadBLob(self): + print("uploading blob...") + self.data = "This is a sample data for Python Test" + self.blob.upload_blob(self.data) + print("\tdone") + + def DownloadBlob(self): + print("downloading blob...") + with open("./downloadedBlob.txt", "wb+") as my_blob: + my_blob.writelines(self.blob.download_blob()) + + print("\tdone") + + def DeleteBlob(self): + print("Cleaning up the resource...") + self.blob.delete_blob() + print("\tdone") + + def Run(self): + print() + print("------------------------") + print("Storage - Blob") + print("------------------------") + print("1) Upload a Blob") + print("2) Download a Blob") + print("3) Delete that Blob (Clean up the resource)") + print() + + # Ensure that the blob does not exists before the tests + try: + self.DeleteBlob() + except exceptions.AzureError: + pass + + try: + self.UploadBLob() + self.DownloadBlob() + finally: + self.DeleteBlob() diff --git a/sdk/core/azure-core/azure/core/async_paging.py b/sdk/core/azure-core/azure/core/async_paging.py index 4a4af4d28cc5..8a61c5b00ddc 100644 --- a/sdk/core/azure-core/azure/core/async_paging.py +++ b/sdk/core/azure-core/azure/core/async_paging.py @@ -23,44 +23,127 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- -from collections.abc import AsyncIterator +import collections.abc import logging +from typing import ( + Iterable, + AsyncIterator, + TypeVar, + Callable, + Tuple, + Optional, + Awaitable, +) + _LOGGER = logging.getLogger(__name__) -class AsyncPagedMixin(AsyncIterator): - """Bring async to Paging. - - **Keyword argument:** - - *async_command* - Mandatory keyword argument for this mixin to work. - """ - def __init__(self, *args, **kwargs): # pylint: disable=unused-argument - self._async_get_next = kwargs.get("async_command") - if not self._async_get_next: - _LOGGER.debug("Paging async iterator protocol is not available for %s", - self.__class__.__name__) - - async def _async_advance_page(self): - if not self._async_get_next: - raise NotImplementedError( - "The class {} does not support async paging.".format(self.__class__.__name__) - ) - if self.next_link is None: - raise StopAsyncIteration("End of paging") - self._current_page_iter_index = 0 - self._response = await self._async_get_next(self.next_link) - self._deserializer(self, self._response) - return self.current_page +ReturnType = TypeVar("ReturnType") +ResponseType = TypeVar("ResponseType") + + +class AsyncList(AsyncIterator[ReturnType]): + def __init__(self, iterable: Iterable[ReturnType]) -> None: + """Change an iterable into a fake async iterator. + + Coul be useful to fill the async iterator contract when you get a list. + + :param iterable: A sync iterable of T + """ + # Technically, if it's a real iterator, I don't need "iter" + # but that will cover iterable and list as well with no troubles created. + self._iterator = iter(iterable) + + async def __anext__(self) -> ReturnType: + try: + return next(self._iterator) + except StopIteration as err: + raise StopAsyncIteration() from err + + +class AsyncPageIterator(AsyncIterator[AsyncIterator[ReturnType]]): + def __init__( + self, + get_next: Callable[[Optional[str]], Awaitable[ResponseType]], + extract_data: Callable[ + [ResponseType], Awaitable[Tuple[str, AsyncIterator[ReturnType]]] + ], + continuation_token: Optional[str] = None, + ) -> None: + """Return an async iterator of pages. + + :param get_next: Callable that take the continuation token and return a HTTP response + :param extract_data: Callable that take an HTTP response and return a tuple continuation token, + list of ReturnType + :param str continuation_token: The continuation token needed by get_next + """ + self._get_next = get_next + self._extract_data = extract_data + self.continuation_token = continuation_token + self._did_a_call_already = False + self._response = None + self._current_page = None async def __anext__(self): - """Iterate through responses.""" - # Storing the list iterator might work out better, but there's no - # guarantee that some code won't replace the list entirely with a copy, - # invalidating an list iterator that might be saved between iterations. - if self.current_page and self._current_page_iter_index < len(self.current_page): - response = self.current_page[self._current_page_iter_index] - self._current_page_iter_index += 1 - return response - await self._async_advance_page() - return await self.__anext__() + if self.continuation_token is None and self._did_a_call_already: + raise StopAsyncIteration("End of paging") + + self._response = await self._get_next(self.continuation_token) + self._did_a_call_already = True + + self.continuation_token, self._current_page = await self._extract_data( + self._response + ) + + # If current_page was a sync list, wrap it async-like + if isinstance(self._current_page, collections.abc.Iterable): + self._current_page = AsyncList(self._current_page) + + return self._current_page + + +class AsyncItemPaged(AsyncIterator[ReturnType]): + def __init__(self, *args, **kwargs) -> None: + """Return an async iterator of items. + + args and kwargs will be passed to the AsyncPageIterator constructor directly, + except page_iterator_class + """ + self._args = args + self._kwargs = kwargs + self._page_iterator = ( + None + ) # type: Optional[AsyncIterator[AsyncIterator[ReturnType]]] + self._page = None # type: Optional[AsyncIterator[ReturnType]] + self._page_iterator_class = self._kwargs.pop( + "page_iterator_class", AsyncPageIterator + ) + + def by_page( + self, continuation_token: Optional[str] = None + ) -> AsyncIterator[AsyncIterator[ReturnType]]: + """Get an async iterator of pages of objects, instead of an async iterator of objects. + + :param str continuation_token: + An opaque continuation token. This value can be retrieved from the + continuation_token field of a previous generator object. If specified, + this generator will begin returning results from this point. + :returns: An async iterator of pages (themselves async iterator of objects) + """ + return self._page_iterator_class( + *self._args, **self._kwargs, continuation_token=continuation_token + ) + + async def __anext__(self) -> ReturnType: + if self._page_iterator is None: + self._page_iterator = self.by_page() + return await self.__anext__() + if self._page is None: + # Let it raise StopAsyncIteration + self._page = await self._page_iterator.__anext__() + return await self.__anext__() + try: + return await self._page.__anext__() + except StopAsyncIteration: + self._page = None + return await self.__anext__() diff --git a/sdk/core/azure-core/azure/core/paging.py b/sdk/core/azure-core/azure/core/paging.py index 9a04250dc932..9f4089d02099 100644 --- a/sdk/core/azure-core/azure/core/paging.py +++ b/sdk/core/azure-core/azure/core/paging.py @@ -23,86 +23,99 @@ # IN THE SOFTWARE. # # -------------------------------------------------------------------------- -import sys -try: - from collections.abc import Iterator - xrange = range -except ImportError: - from collections import Iterator - -from typing import Dict, Any, List, Callable, Optional, TYPE_CHECKING # pylint: disable=unused-import - -if TYPE_CHECKING: - from .pipeline.transport.base import HttpResponse - from msrest.serialization import Deserializer, Model # type: ignore # pylint: disable=unused-import - -if sys.version_info >= (3, 5, 2): - # Not executed on old Python, no syntax error - from .async_paging import AsyncPagedMixin # type: ignore -else: - class AsyncPagedMixin(object): # type: ignore - pass - -class Paged(AsyncPagedMixin, Iterator): - """A container for paged REST responses. - - :param response: server response object. - :type response: ~azure.core.pipeline.transport.HttpResponse - :param callable command: Function to retrieve the next page of items. - :param Deserializer deserializer: a Deserializer instance to use - """ - _validation = {} # type: Dict[str, Dict[str, Any]] - _attribute_map = {} # type: Dict[str, Dict[str, Any]] - - def __init__(self, command, deserializer, **kwargs): - # type: (Callable[[str], HttpResponse], Deserializer, Any) -> None - super(Paged, self).__init__(**kwargs) # type: ignore - # Sets next_link, current_page, and _current_page_iter_index. - self.next_link = "" - self.current_page = [] # type: List[Model] - self._current_page_iter_index = 0 - self._deserializer = deserializer - self._get_next = command - self._response = None # type: Optional[HttpResponse] +import itertools +from typing import ( + Callable, + Optional, + TypeVar, + Iterator, + Iterable, + Tuple, +) # pylint: disable=unused-import +import logging + + +_LOGGER = logging.getLogger(__name__) + +ReturnType = TypeVar("ReturnType") +ResponseType = TypeVar("ResponseType") + + +class PageIterator(Iterator[Iterator[ReturnType]]): + def __init__( + self, + get_next, # type: Callable[[Optional[str]], ResponseType] + extract_data, # type: Callable[[ResponseType], Tuple[str, Iterable[ReturnType]]] + continuation_token=None, # type: Optional[str] + ): + """Return an iterator of pages. + + :param get_next: Callable that take the continuation token and return a HTTP response + :param extract_data: Callable that take an HTTP response and return a tuple continuation token, + list of ReturnType + :param str continuation_token: The continuation token needed by get_next + """ + self._get_next = get_next + self._extract_data = extract_data + self.continuation_token = continuation_token + self._did_a_call_already = False + self._response = None # type: Optional[ResponseType] + self._current_page = None # type: Optional[Iterable[ReturnType]] def __iter__(self): """Return 'self'.""" - # Since iteration mutates this object, consider it an iterator in-and-of - # itself. return self - @classmethod - def _get_subtype_map(cls): - """Required for parity to Model object for deserialization.""" - return {} + def __next__(self): + # type: () -> Iterator[ReturnType] + if self.continuation_token is None and self._did_a_call_already: + raise StopIteration("End of paging") + + self._response = self._get_next(self.continuation_token) + self._did_a_call_already = True + + self.continuation_token, self._current_page = self._extract_data(self._response) - def _advance_page(self): - # type: () -> List[Model] - """Force moving the cursor to the next azure call. + return iter(self._current_page) - This method is for advanced usage, iterator protocol is prefered. + next = __next__ # Python 2 compatibility. + + +class ItemPaged(Iterator[ReturnType]): + def __init__(self, *args, **kwargs): + """Return an iterator of items. - :raises: StopIteration if no further page - :return: The current page list - :rtype: list + args and kwargs will be passed to the PageIterator constructor directly, + except page_iterator_class """ - if self.next_link is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 - self._response = self._get_next(self.next_link) - self._deserializer(self, self._response) - return self.current_page + self._args = args + self._kwargs = kwargs + self._page_iterator = None + self._page_iterator_class = self._kwargs.pop( + "page_iterator_class", PageIterator + ) + + def by_page(self, continuation_token=None): + # type: (Optional[str]) -> Iterator[Iterator[ReturnType]] + """Get an iterator of pages of objects, instead of an iterator of objects. + + :param str continuation_token: + An opaque continuation token. This value can be retrieved from the + continuation_token field of a previous generator object. If specified, + this generator will begin returning results from this point. + :returns: An iterator of pages (themselves iterator of objects) + """ + return self._page_iterator_class( + continuation_token=continuation_token, *self._args, **self._kwargs + ) + + def __iter__(self): + """Return 'self'.""" + return self def __next__(self): - """Iterate through responses.""" - # Storing the list iterator might work out better, but there's no - # guarantee that some code won't replace the list entirely with a copy, - # invalidating an list iterator that might be saved between iterations. - if self.current_page and self._current_page_iter_index < len(self.current_page): - response = self.current_page[self._current_page_iter_index] - self._current_page_iter_index += 1 - return response - self._advance_page() - return self.__next__() + if self._page_iterator is None: + self._page_iterator = itertools.chain.from_iterable(self.by_page()) + return next(self._page_iterator) next = __next__ # Python 2 compatibility. diff --git a/sdk/core/azure-core/tests/azure_core_asynctests/test_paging.py b/sdk/core/azure-core/tests/azure_core_asynctests/test_paging.py new file mode 100644 index 000000000000..88d8cbe147d1 --- /dev/null +++ b/sdk/core/azure-core/tests/azure_core_asynctests/test_paging.py @@ -0,0 +1,122 @@ +#-------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +#-------------------------------------------------------------------------- + +from typing import AsyncIterator, TypeVar, List + +from azure.core.async_paging import AsyncItemPaged, AsyncList + +import pytest + + +T = TypeVar("T") + + +async def _as_list(async_iter: AsyncIterator[T]) -> List[T]: + """Flatten an async iterator into a list. + + For testing purpose. + """ + # 3.6 only : result_iterated = [obj async for obj in deserialized] + result = [] + async for el in async_iter: + result.append(el) + return result + + +class TestPaging: + + @pytest.mark.asyncio + async def test_basic_paging(self): + + async def get_next(continuation_token=None): + """Simplify my life and return JSON and not response, but should be response. + """ + if not continuation_token: + return { + 'nextLink': 'page2', + 'value': ['value1.0', 'value1.1'] + } + else: + return { + 'nextLink': None, + 'value': ['value2.0', 'value2.1'] + } + + async def extract_data(response): + return response['nextLink'], AsyncList(response['value']) + + pager = AsyncItemPaged(get_next, extract_data) + result_iterated = await _as_list(pager) + + assert ['value1.0', 'value1.1', 'value2.0', 'value2.1'] == result_iterated + + @pytest.mark.asyncio + async def test_advance_paging(self): + + async def get_next(continuation_token=None): + """Simplify my life and return JSON and not response, but should be response. + """ + if not continuation_token: + return { + 'nextLink': 'page2', + 'value': ['value1.0', 'value1.1'] + } + else: + return { + 'nextLink': None, + 'value': ['value2.0', 'value2.1'] + } + + async def extract_data(response): + return response['nextLink'], AsyncList(response['value']) + + pager = AsyncItemPaged(get_next, extract_data).by_page() + + page1 = await pager.__anext__() + assert ['value1.0', 'value1.1'] == await _as_list(page1) + + page2 = await pager.__anext__() + assert ['value2.0', 'value2.1'] == await _as_list(page2) + + with pytest.raises(StopAsyncIteration): + await pager.__anext__() + + + @pytest.mark.asyncio + async def test_none_value(self): + async def get_next(continuation_token=None): + return { + 'nextLink': None, + 'value': None + } + + async def extract_data(response): + return response['nextLink'], AsyncList(response['value'] or []) + + pager = AsyncItemPaged(get_next, extract_data) + result_iterated = await _as_list(pager) + + assert len(result_iterated) == 0 diff --git a/sdk/core/azure-core/tests/test_paging.py b/sdk/core/azure-core/tests/test_paging.py index 41e00b0b86af..945f133cf7a9 100644 --- a/sdk/core/azure-core/tests/test_paging.py +++ b/sdk/core/azure-core/tests/test_paging.py @@ -1,6 +1,6 @@ #-------------------------------------------------------------------------- # -# Copyright (c) Microsoft Corporation. All rights reserved. +# Copyright (c) Microsoft Corporation. All rights reserved. # # The MIT License (MIT) # @@ -24,29 +24,43 @@ # #-------------------------------------------------------------------------- -import unittest +from azure.core.paging import ItemPaged -from azure.core.paging import Paged +import pytest -from msrest.serialization import Deserializer -class FakePaged(Paged): - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[str]'} - } +class TestPaging(object): - def __init__(self, *args, **kwargs): - super(FakePaged, self).__init__(*args, **kwargs) + def test_basic_paging(self): + + def get_next(continuation_token=None): + """Simplify my life and return JSON and not response, but should be response. + """ + if not continuation_token: + return { + 'nextLink': 'page2', + 'value': ['value1.0', 'value1.1'] + } + else: + return { + 'nextLink': None, + 'value': ['value2.0', 'value2.1'] + } -_test_deserializer = Deserializer({}) + def extract_data(response): + return response['nextLink'], iter(response['value']) -class TestPaging(unittest.TestCase): + pager = ItemPaged(get_next, extract_data) + result_iterated = list(pager) - def test_basic_paging(self): + assert ['value1.0', 'value1.1', 'value2.0', 'value2.1'] == result_iterated - def internal_paging(next_link=None, raw=False): - if not next_link: + def test_by_page_paging(self): + + def get_next(continuation_token=None): + """Simplify my life and return JSON and not response, but should be response. + """ + if not continuation_token: return { 'nextLink': 'page2', 'value': ['value1.0', 'value1.1'] @@ -57,17 +71,25 @@ def internal_paging(next_link=None, raw=False): 'value': ['value2.0', 'value2.1'] } - deserialized = FakePaged(internal_paging, _test_deserializer) - result_iterated = list(deserialized) - self.assertListEqual( - ['value1.0', 'value1.1', 'value2.0', 'value2.1'], - result_iterated - ) + def extract_data(response): + return response['nextLink'], iter(response['value']) + + pager = ItemPaged(get_next, extract_data).by_page() + page1 = next(pager) + assert list(page1) == ['value1.0', 'value1.1'] + + page2 = next(pager) + assert list(page2) == ['value2.0', 'value2.1'] + + with pytest.raises(StopIteration): + next(pager) def test_advance_paging(self): - def internal_paging(next_link=None, raw=False): - if not next_link: + def get_next(continuation_token=None): + """Simplify my life and return JSON and not response, but should be response. + """ + if not continuation_token: return { 'nextLink': 'page2', 'value': ['value1.0', 'value1.1'] @@ -78,27 +100,32 @@ def internal_paging(next_link=None, raw=False): 'value': ['value2.0', 'value2.1'] } - deserialized = FakePaged(internal_paging, _test_deserializer) - page1 = next(deserialized) + def extract_data(response): + return response['nextLink'], iter(response['value']) + + pager = ItemPaged(get_next, extract_data) + page1 = next(pager) assert page1 == 'value1.0' - page1 = next(deserialized) + page1 = next(pager) assert page1 == 'value1.1' - - page2 = next(deserialized) + + page2 = next(pager) assert page2 == 'value2.0' - page2 = next(deserialized) + page2 = next(pager) assert page2 == 'value2.1' - with self.assertRaises(StopIteration): - next(deserialized) + with pytest.raises(StopIteration): + next(pager) def test_none_value(self): - def internal_paging(next_link=None, raw=False): + def get_next(continuation_token=None): return { 'nextLink': None, 'value': None } + def extract_data(response): + return response['nextLink'], iter(response['value'] or []) - deserialized = FakePaged(internal_paging, _test_deserializer) - result_iterated = list(deserialized) - self.assertEqual(len(result_iterated), 0) + pager = ItemPaged(get_next, extract_data) + result_iterated = list(pager) + assert len(result_iterated) == 0 diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/__init__.py index d3fda25cc7ab..e913d4cf6c46 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/__init__.py @@ -9,9 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultClientConfiguration from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] from .version import VERSION diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_configuration.py index beb5eb930fa8..28cf75e3d2b4 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_configuration.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials @@ -45,4 +44,5 @@ def _configure(self, **kwargs): self.proxy_policy = policies.ProxyPolicy(**kwargs) self.logging_policy = policies.NetworkTraceLoggingPolicy(**kwargs) self.retry_policy = policies.RetryPolicy(**kwargs) + self.custom_hook_policy = policies.CustomHookPolicy(**kwargs) self.redirect_policy = policies.RedirectPolicy(**kwargs) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_key_vault_client.py index 0252b1e16a5e..e3ec609b6cd3 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/_key_vault_client.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/__init__.py index ffece9055d9b..fb2e6c3866fd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/__init__.py @@ -10,5 +10,4 @@ # -------------------------------------------------------------------------- from ._key_vault_client_async import KeyVaultClient -from ._configuration_async import KeyVaultClientConfiguration -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_configuration_async.py index 2144132ebe2d..a61d9eeff444 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_configuration_async.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py index 559d48da029a..ad4b8a97754f 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} 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 28ea64adc6a6..857e446e899c 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.async_paging import AsyncItemPaged, AsyncList from ... import models import uuid @@ -78,8 +79,6 @@ async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -154,8 +153,6 @@ async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attribut header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -218,8 +215,6 @@ async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -294,8 +289,6 @@ async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -360,8 +353,6 @@ async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -399,11 +390,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -412,60 +404,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -487,11 +462,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -499,60 +475,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_keys.metadata = {'url': '/keys'} async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -604,8 +563,6 @@ async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -677,8 +634,6 @@ async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kw header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -759,8 +714,6 @@ async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -838,8 +791,6 @@ async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -915,8 +866,6 @@ async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -998,8 +947,6 @@ async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1077,8 +1024,6 @@ async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1154,8 +1099,6 @@ async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, val header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1199,11 +1142,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedKeyItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1211,60 +1155,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -1305,8 +1232,6 @@ async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs) header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1364,8 +1289,6 @@ async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwarg header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1421,8 +1344,6 @@ async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1493,8 +1414,6 @@ async def set_secret(self, vault_base_url, secret_name, value, tags=None, conten header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1555,8 +1474,6 @@ async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1630,8 +1547,6 @@ async def update_secret(self, vault_base_url, secret_name, secret_version, conte header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1694,8 +1609,6 @@ async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=N header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1733,11 +1646,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1745,60 +1659,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1819,11 +1716,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1832,60 +1730,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1904,11 +1785,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedSecretItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1916,60 +1798,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): @@ -2009,8 +1874,6 @@ async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2068,8 +1931,6 @@ async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, * header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2122,8 +1983,6 @@ async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2181,8 +2040,6 @@ async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2242,8 +2099,6 @@ async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2283,11 +2138,12 @@ def get_certificates( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2295,60 +2151,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificates.metadata = {'url': '/certificates'} async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -2389,8 +2228,6 @@ async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2449,8 +2286,6 @@ async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2508,8 +2343,6 @@ async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2563,8 +2396,6 @@ async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2601,11 +2432,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateIssuerItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2613,60 +2445,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): @@ -2720,8 +2535,6 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2796,8 +2609,6 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2858,8 +2669,6 @@ async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2917,8 +2726,6 @@ async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=No header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2988,8 +2795,6 @@ async def create_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -3072,8 +2877,6 @@ async def import_certificate(self, vault_base_url, certificate_name, base64_enco header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3115,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3128,60 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3222,8 +3009,6 @@ async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3285,8 +3070,6 @@ async def update_certificate_policy(self, vault_base_url, certificate_name, cert header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3364,8 +3147,6 @@ async def update_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3429,8 +3210,6 @@ async def get_certificate(self, vault_base_url, certificate_name, certificate_ve header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3493,8 +3272,6 @@ async def update_certificate_operation(self, vault_base_url, certificate_name, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3554,8 +3331,6 @@ async def get_certificate_operation(self, vault_base_url, certificate_name, *, c header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3613,8 +3388,6 @@ async def delete_certificate_operation(self, vault_base_url, certificate_name, * header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3686,8 +3459,6 @@ async def merge_certificate(self, vault_base_url, certificate_name, x509_certifi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3730,11 +3501,12 @@ def get_deleted_certificates( :type maxresults: int :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedCertificateItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3742,60 +3514,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3836,8 +3591,6 @@ async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3895,8 +3648,6 @@ async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, c header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3952,8 +3703,6 @@ async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3987,11 +3736,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v2016_10_01.models.StorageAccountItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3999,60 +3749,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_storage_accounts.metadata = {'url': '/storage'} async def delete_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): @@ -4089,8 +3822,6 @@ async def delete_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4145,8 +3876,6 @@ async def get_storage_account(self, vault_base_url, storage_account_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4221,8 +3950,6 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4298,8 +4025,6 @@ async def update_storage_account(self, vault_base_url, storage_account_name, act header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4362,8 +4087,6 @@ async def regenerate_storage_account_key(self, vault_base_url, storage_account_n header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4402,11 +4125,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v2016_10_01.models.SasDefinitionItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4415,60 +4139,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): @@ -4508,8 +4215,6 @@ async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4567,8 +4272,6 @@ async def get_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4639,8 +4342,6 @@ async def set_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') @@ -4714,8 +4415,6 @@ async def update_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/__init__.py index 76f4bf1ab9bc..6f134becdbd3 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/__init__.py @@ -20,9 +20,11 @@ from ._models_py3 import CertificateCreateParameters from ._models_py3 import CertificateImportParameters from ._models_py3 import CertificateIssuerItem + from ._models_py3 import CertificateIssuerListResult from ._models_py3 import CertificateIssuerSetParameters from ._models_py3 import CertificateIssuerUpdateParameters from ._models_py3 import CertificateItem + from ._models_py3 import CertificateListResult from ._models_py3 import CertificateMergeParameters from ._models_py3 import CertificateOperation from ._models_py3 import CertificateOperationUpdateParameter @@ -32,10 +34,13 @@ from ._models_py3 import Contacts from ._models_py3 import DeletedCertificateBundle from ._models_py3 import DeletedCertificateItem + from ._models_py3 import DeletedCertificateListResult from ._models_py3 import DeletedKeyBundle from ._models_py3 import DeletedKeyItem + from ._models_py3 import DeletedKeyListResult from ._models_py3 import DeletedSecretBundle from ._models_py3 import DeletedSecretItem + from ._models_py3 import DeletedSecretListResult from ._models_py3 import Error from ._models_py3 import IssuerAttributes from ._models_py3 import IssuerBundle @@ -47,6 +52,7 @@ from ._models_py3 import KeyCreateParameters from ._models_py3 import KeyImportParameters from ._models_py3 import KeyItem + from ._models_py3 import KeyListResult from ._models_py3 import KeyOperationResult from ._models_py3 import KeyOperationsParameters from ._models_py3 import KeyProperties @@ -63,10 +69,12 @@ from ._models_py3 import SasDefinitionBundle from ._models_py3 import SasDefinitionCreateParameters from ._models_py3 import SasDefinitionItem + from ._models_py3 import SasDefinitionListResult from ._models_py3 import SasDefinitionUpdateParameters from ._models_py3 import SecretAttributes from ._models_py3 import SecretBundle from ._models_py3 import SecretItem + from ._models_py3 import SecretListResult from ._models_py3 import SecretProperties from ._models_py3 import SecretRestoreParameters from ._models_py3 import SecretSetParameters @@ -77,6 +85,7 @@ from ._models_py3 import StorageAccountRegenerteKeyParameters from ._models_py3 import StorageAccountUpdateParameters from ._models_py3 import StorageBundle + from ._models_py3 import StorageListResult from ._models_py3 import SubjectAlternativeNames from ._models_py3 import Trigger from ._models_py3 import X509CertificateProperties @@ -91,9 +100,11 @@ from ._models import CertificateCreateParameters from ._models import CertificateImportParameters from ._models import CertificateIssuerItem + from ._models import CertificateIssuerListResult from ._models import CertificateIssuerSetParameters from ._models import CertificateIssuerUpdateParameters from ._models import CertificateItem + from ._models import CertificateListResult from ._models import CertificateMergeParameters from ._models import CertificateOperation from ._models import CertificateOperationUpdateParameter @@ -103,10 +114,13 @@ from ._models import Contacts from ._models import DeletedCertificateBundle from ._models import DeletedCertificateItem + from ._models import DeletedCertificateListResult from ._models import DeletedKeyBundle from ._models import DeletedKeyItem + from ._models import DeletedKeyListResult from ._models import DeletedSecretBundle from ._models import DeletedSecretItem + from ._models import DeletedSecretListResult from ._models import Error from ._models import IssuerAttributes from ._models import IssuerBundle @@ -118,6 +132,7 @@ from ._models import KeyCreateParameters from ._models import KeyImportParameters from ._models import KeyItem + from ._models import KeyListResult from ._models import KeyOperationResult from ._models import KeyOperationsParameters from ._models import KeyProperties @@ -134,10 +149,12 @@ from ._models import SasDefinitionBundle from ._models import SasDefinitionCreateParameters from ._models import SasDefinitionItem + from ._models import SasDefinitionListResult from ._models import SasDefinitionUpdateParameters from ._models import SecretAttributes from ._models import SecretBundle from ._models import SecretItem + from ._models import SecretListResult from ._models import SecretProperties from ._models import SecretRestoreParameters from ._models import SecretSetParameters @@ -148,18 +165,10 @@ from ._models import StorageAccountRegenerteKeyParameters from ._models import StorageAccountUpdateParameters from ._models import StorageBundle + from ._models import StorageListResult from ._models import SubjectAlternativeNames from ._models import Trigger from ._models import X509CertificateProperties -from ._paged_models import CertificateIssuerItemPaged -from ._paged_models import CertificateItemPaged -from ._paged_models import DeletedCertificateItemPaged -from ._paged_models import DeletedKeyItemPaged -from ._paged_models import DeletedSecretItemPaged -from ._paged_models import KeyItemPaged -from ._paged_models import SasDefinitionItemPaged -from ._paged_models import SecretItemPaged -from ._paged_models import StorageAccountItemPaged from ._key_vault_client_enums import ( JsonWebKeyType, JsonWebKeyCurveName, @@ -182,9 +191,11 @@ 'CertificateCreateParameters', 'CertificateImportParameters', 'CertificateIssuerItem', + 'CertificateIssuerListResult', 'CertificateIssuerSetParameters', 'CertificateIssuerUpdateParameters', 'CertificateItem', + 'CertificateListResult', 'CertificateMergeParameters', 'CertificateOperation', 'CertificateOperationUpdateParameter', @@ -194,10 +205,13 @@ 'Contacts', 'DeletedCertificateBundle', 'DeletedCertificateItem', + 'DeletedCertificateListResult', 'DeletedKeyBundle', 'DeletedKeyItem', + 'DeletedKeyListResult', 'DeletedSecretBundle', 'DeletedSecretItem', + 'DeletedSecretListResult', 'Error', 'IssuerAttributes', 'IssuerBundle', @@ -209,6 +223,7 @@ 'KeyCreateParameters', 'KeyImportParameters', 'KeyItem', + 'KeyListResult', 'KeyOperationResult', 'KeyOperationsParameters', 'KeyProperties', @@ -225,10 +240,12 @@ 'SasDefinitionBundle', 'SasDefinitionCreateParameters', 'SasDefinitionItem', + 'SasDefinitionListResult', 'SasDefinitionUpdateParameters', 'SecretAttributes', 'SecretBundle', 'SecretItem', + 'SecretListResult', 'SecretProperties', 'SecretRestoreParameters', 'SecretSetParameters', @@ -239,18 +256,10 @@ 'StorageAccountRegenerteKeyParameters', 'StorageAccountUpdateParameters', 'StorageBundle', + 'StorageListResult', 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'KeyItemPaged', - 'DeletedKeyItemPaged', - 'SecretItemPaged', - 'DeletedSecretItemPaged', - 'CertificateItemPaged', - 'CertificateIssuerItemPaged', - 'DeletedCertificateItemPaged', - 'StorageAccountItemPaged', - 'SasDefinitionItemPaged', 'JsonWebKeyType', 'JsonWebKeyCurveName', 'DeletionRecoveryLevel', 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 f9caaf92c16e..e918a167f2dd 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 @@ -341,6 +341,37 @@ def __init__(self, **kwargs): self.provider = kwargs.get('provider', None) +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -435,6 +466,35 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -805,6 +865,36 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: + list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -975,6 +1065,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1176,6 +1295,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -1531,6 +1679,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2012,6 +2189,35 @@ def __init__(self, **kwargs): self.tags = None +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2084,6 +2290,35 @@ def __init__(self, **kwargs): self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2415,6 +2650,36 @@ def __init__(self, **kwargs): self.tags = None +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SubjectAlternativeNames(Model): """The subject alternate names of a X509 object. 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 4920c195ef89..07d530b486f6 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 @@ -341,6 +341,37 @@ def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: self.provider = provider +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -435,6 +466,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -805,6 +865,36 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: + list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -975,6 +1065,35 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: st self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1176,6 +1295,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -1531,6 +1679,35 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2012,6 +2189,35 @@ def __init__(self, **kwargs) -> None: self.tags = None +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2084,6 +2290,35 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2415,6 +2650,36 @@ def __init__(self, **kwargs) -> None: self.tags = None +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SubjectAlternativeNames(Model): """The subject alternate names of a X509 object. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_paged_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_paged_models.py deleted file mode 100644 index e5ddd1d7edc4..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v2016_10_01/models/_paged_models.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from azure.core.paging import Paged - - -class KeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`KeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[KeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(KeyItemPaged, self).__init__(*args, **kwargs) -class DeletedKeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedKeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedKeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedKeyItemPaged, self).__init__(*args, **kwargs) -class SecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SecretItemPaged, self).__init__(*args, **kwargs) -class DeletedSecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSecretItemPaged, self).__init__(*args, **kwargs) -class CertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateItemPaged, self).__init__(*args, **kwargs) -class CertificateIssuerItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateIssuerItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateIssuerItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateIssuerItemPaged, self).__init__(*args, **kwargs) -class DeletedCertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedCertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedCertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedCertificateItemPaged, self).__init__(*args, **kwargs) -class StorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`StorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(StorageAccountItemPaged, self).__init__(*args, **kwargs) -class SasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SasDefinitionItemPaged, self).__init__(*args, **kwargs) 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 40ad1ab95087..50a82e217aa9 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged from .. import models import uuid @@ -78,8 +79,6 @@ def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -154,8 +153,6 @@ def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -218,8 +215,6 @@ def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -294,8 +289,6 @@ def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_at header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -360,8 +353,6 @@ def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -399,11 +390,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -412,46 +404,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -473,11 +462,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -485,46 +475,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_keys.metadata = {'url': '/keys'} def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -576,8 +563,6 @@ def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -649,8 +634,6 @@ def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -731,8 +714,6 @@ def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -810,8 +791,6 @@ def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -887,8 +866,6 @@ def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -970,8 +947,6 @@ def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signa header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1049,8 +1024,6 @@ def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1126,8 +1099,6 @@ def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cl header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1171,11 +1142,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedKeyItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1183,46 +1155,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -1263,8 +1232,6 @@ def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1322,8 +1289,6 @@ def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1379,8 +1344,6 @@ def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1451,8 +1414,6 @@ def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1513,8 +1474,6 @@ def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1588,8 +1547,6 @@ def update_secret(self, vault_base_url, secret_name, secret_version, content_typ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1652,8 +1609,6 @@ def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1691,11 +1646,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1703,46 +1659,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1763,11 +1716,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1776,46 +1730,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1834,11 +1785,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedSecretItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1846,46 +1798,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): @@ -1925,8 +1874,6 @@ def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1984,8 +1931,6 @@ def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2038,8 +1983,6 @@ def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2097,8 +2040,6 @@ def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2158,8 +2099,6 @@ def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwarg header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2199,11 +2138,12 @@ def get_certificates( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2211,46 +2151,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificates.metadata = {'url': '/certificates'} def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -2291,8 +2228,6 @@ def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2351,8 +2286,6 @@ def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2410,8 +2343,6 @@ def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2465,8 +2396,6 @@ def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2503,11 +2432,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateIssuerItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2515,46 +2445,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): @@ -2608,8 +2535,6 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2684,8 +2609,6 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2746,8 +2669,6 @@ def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2805,8 +2726,6 @@ def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2876,8 +2795,6 @@ def create_certificate(self, vault_base_url, certificate_name, certificate_polic header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -2960,8 +2877,6 @@ def import_certificate(self, vault_base_url, certificate_name, base64_encoded_ce header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3003,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3016,46 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3096,8 +3009,6 @@ def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3159,8 +3070,6 @@ def update_certificate_policy(self, vault_base_url, certificate_name, certificat header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3238,8 +3147,6 @@ def update_certificate(self, vault_base_url, certificate_name, certificate_versi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3303,8 +3210,6 @@ def get_certificate(self, vault_base_url, certificate_name, certificate_version, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3367,8 +3272,6 @@ def update_certificate_operation(self, vault_base_url, certificate_name, cancell header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3428,8 +3331,6 @@ def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3487,8 +3388,6 @@ def delete_certificate_operation(self, vault_base_url, certificate_name, cls=Non header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3560,8 +3459,6 @@ def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3604,11 +3501,12 @@ def get_deleted_certificates( :type maxresults: int :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedCertificateItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3616,46 +3514,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3696,8 +3591,6 @@ def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3755,8 +3648,6 @@ def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3812,8 +3703,6 @@ def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3847,11 +3736,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v2016_10_01.models.StorageAccountItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3859,46 +3749,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_storage_accounts.metadata = {'url': '/storage'} def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): @@ -3935,8 +3822,6 @@ def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3991,8 +3876,6 @@ def get_storage_account(self, vault_base_url, storage_account_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4067,8 +3950,6 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4144,8 +4025,6 @@ def update_storage_account(self, vault_base_url, storage_account_name, active_ke header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4208,8 +4087,6 @@ def regenerate_storage_account_key(self, vault_base_url, storage_account_name, k header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4248,11 +4125,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v2016_10_01.models.SasDefinitionItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4261,46 +4139,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): @@ -4340,8 +4215,6 @@ def delete_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4399,8 +4272,6 @@ def get_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4471,8 +4342,6 @@ def set_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') @@ -4546,8 +4415,6 @@ def update_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/__init__.py index d3fda25cc7ab..e913d4cf6c46 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/__init__.py @@ -9,9 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultClientConfiguration from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] from .version import VERSION diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_configuration.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_configuration.py index beb5eb930fa8..28cf75e3d2b4 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_configuration.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_configuration.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials @@ -45,4 +44,5 @@ def _configure(self, **kwargs): self.proxy_policy = policies.ProxyPolicy(**kwargs) self.logging_policy = policies.NetworkTraceLoggingPolicy(**kwargs) self.retry_policy = policies.RetryPolicy(**kwargs) + self.custom_hook_policy = policies.CustomHookPolicy(**kwargs) self.redirect_policy = policies.RedirectPolicy(**kwargs) diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_key_vault_client.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_key_vault_client.py index 699433682e60..a1a1eb19328b 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/_key_vault_client.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/__init__.py index ffece9055d9b..fb2e6c3866fd 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/__init__.py @@ -10,5 +10,4 @@ # -------------------------------------------------------------------------- from ._key_vault_client_async import KeyVaultClient -from ._configuration_async import KeyVaultClientConfiguration -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_configuration_async.py index 2144132ebe2d..a61d9eeff444 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_configuration_async.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_key_vault_client_async.py index 739ab6ea407d..482d6336ab1a 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/aio/_key_vault_client_async.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} 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 a97144221c6a..d11b4bd0e615 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.async_paging import AsyncItemPaged, AsyncList from ... import models import uuid @@ -77,8 +78,6 @@ async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -153,8 +152,6 @@ async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attribut header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -217,8 +214,6 @@ async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -293,8 +288,6 @@ async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -359,8 +352,6 @@ async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -398,11 +389,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -411,60 +403,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -486,11 +461,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -498,60 +474,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_keys.metadata = {'url': '/keys'} async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -603,8 +562,6 @@ async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -676,8 +633,6 @@ async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kw header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -758,8 +713,6 @@ async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -837,8 +790,6 @@ async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -914,8 +865,6 @@ async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -997,8 +946,6 @@ async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1076,8 +1023,6 @@ async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1153,8 +1098,6 @@ async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, val header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1198,11 +1141,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v7_0.models.DeletedKeyItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1210,60 +1154,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -1304,8 +1231,6 @@ async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs) header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1363,8 +1288,6 @@ async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwarg header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1420,8 +1343,6 @@ async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1491,8 +1412,6 @@ async def set_secret(self, vault_base_url, secret_name, value, tags=None, conten header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1553,8 +1472,6 @@ async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1627,8 +1544,6 @@ async def update_secret(self, vault_base_url, secret_name, secret_version, conte header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1691,8 +1606,6 @@ async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=N header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1730,11 +1643,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1742,60 +1656,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1816,11 +1713,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1829,60 +1727,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1901,11 +1782,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSecretItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1913,60 +1795,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): @@ -2006,8 +1871,6 @@ async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2065,8 +1928,6 @@ async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, * header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2119,8 +1980,6 @@ async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2178,8 +2037,6 @@ async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2239,8 +2096,6 @@ async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2283,11 +2138,12 @@ def get_certificates( :type include_pending: bool :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2295,9 +2151,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -2306,51 +2159,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificates.metadata = {'url': '/certificates'} async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -2391,8 +2230,6 @@ async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2451,8 +2288,6 @@ async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2510,8 +2345,6 @@ async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2565,8 +2398,6 @@ async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2603,11 +2434,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v7_0.models.CertificateIssuerItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2615,60 +2447,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): @@ -2721,8 +2536,6 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2796,8 +2609,6 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2858,8 +2669,6 @@ async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2917,8 +2726,6 @@ async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=No header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2988,8 +2795,6 @@ async def create_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -3072,8 +2877,6 @@ async def import_certificate(self, vault_base_url, certificate_name, base64_enco header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3115,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3128,60 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3222,8 +3009,6 @@ async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3285,8 +3070,6 @@ async def update_certificate_policy(self, vault_base_url, certificate_name, cert header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3364,8 +3147,6 @@ async def update_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3429,8 +3210,6 @@ async def get_certificate(self, vault_base_url, certificate_name, certificate_ve header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3493,8 +3272,6 @@ async def update_certificate_operation(self, vault_base_url, certificate_name, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3554,8 +3331,6 @@ async def get_certificate_operation(self, vault_base_url, certificate_name, *, c header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3613,8 +3388,6 @@ async def delete_certificate_operation(self, vault_base_url, certificate_name, * header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3686,8 +3459,6 @@ async def merge_certificate(self, vault_base_url, certificate_name, x509_certifi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3748,8 +3519,6 @@ async def backup_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3809,8 +3578,6 @@ async def restore_certificate(self, vault_base_url, certificate_bundle_backup, * header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') @@ -3856,11 +3623,12 @@ def get_deleted_certificates( :type include_pending: bool :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v7_0.models.DeletedCertificateItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3868,9 +3636,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -3879,51 +3644,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3964,8 +3715,6 @@ async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4023,8 +3772,6 @@ async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, c header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4080,8 +3827,6 @@ async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4115,11 +3860,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.StorageAccountItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -4127,60 +3873,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_storage_accounts.metadata = {'url': '/storage'} def get_deleted_storage_accounts( @@ -4199,11 +3928,12 @@ def get_deleted_storage_accounts( :type maxresults: int :return: An iterator like instance of DeletedStorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.DeletedStorageAccountItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_storage_accounts.metadata['url'] @@ -4211,60 +3941,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('DeletedStorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedStorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} async def get_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): @@ -4304,8 +4017,6 @@ async def get_deleted_storage_account(self, vault_base_url, storage_account_name header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4363,8 +4074,6 @@ async def purge_deleted_storage_account(self, vault_base_url, storage_account_na header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4417,8 +4126,6 @@ async def recover_deleted_storage_account(self, vault_base_url, storage_account_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4475,8 +4182,6 @@ async def backup_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4536,8 +4241,6 @@ async def restore_storage_account(self, vault_base_url, storage_bundle_backup, * header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageRestoreParameters') @@ -4595,8 +4298,6 @@ async def delete_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4651,8 +4352,6 @@ async def get_storage_account(self, vault_base_url, storage_account_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4727,8 +4426,6 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4804,8 +4501,6 @@ async def update_storage_account(self, vault_base_url, storage_account_name, act header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4868,8 +4563,6 @@ async def regenerate_storage_account_key(self, vault_base_url, storage_account_n header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4908,11 +4601,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.SasDefinitionItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4921,60 +4615,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def get_deleted_sas_definitions( @@ -4996,11 +4673,12 @@ def get_deleted_sas_definitions( :type maxresults: int :return: An iterator like instance of DeletedSasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSasDefinitionItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_sas_definitions.metadata['url'] @@ -5009,60 +4687,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): @@ -5105,8 +4766,6 @@ async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5167,8 +4826,6 @@ async def recover_deleted_sas_definition(self, vault_base_url, storage_account_n header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -5226,8 +4883,6 @@ async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -5285,8 +4940,6 @@ async def get_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5364,8 +5017,6 @@ async def set_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') @@ -5446,8 +5097,6 @@ async def update_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/__init__.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/__init__.py index 4debdd0f3d13..5e72f49a73f6 100644 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/__init__.py @@ -22,9 +22,11 @@ from ._models_py3 import CertificateCreateParameters from ._models_py3 import CertificateImportParameters from ._models_py3 import CertificateIssuerItem + from ._models_py3 import CertificateIssuerListResult from ._models_py3 import CertificateIssuerSetParameters from ._models_py3 import CertificateIssuerUpdateParameters from ._models_py3 import CertificateItem + from ._models_py3 import CertificateListResult from ._models_py3 import CertificateMergeParameters from ._models_py3 import CertificateOperation from ._models_py3 import CertificateOperationUpdateParameter @@ -35,14 +37,19 @@ from ._models_py3 import Contacts from ._models_py3 import DeletedCertificateBundle from ._models_py3 import DeletedCertificateItem + from ._models_py3 import DeletedCertificateListResult from ._models_py3 import DeletedKeyBundle from ._models_py3 import DeletedKeyItem + from ._models_py3 import DeletedKeyListResult from ._models_py3 import DeletedSasDefinitionBundle from ._models_py3 import DeletedSasDefinitionItem + from ._models_py3 import DeletedSasDefinitionListResult from ._models_py3 import DeletedSecretBundle from ._models_py3 import DeletedSecretItem + from ._models_py3 import DeletedSecretListResult from ._models_py3 import DeletedStorageAccountItem from ._models_py3 import DeletedStorageBundle + from ._models_py3 import DeletedStorageListResult from ._models_py3 import Error from ._models_py3 import IssuerAttributes from ._models_py3 import IssuerBundle @@ -54,6 +61,7 @@ from ._models_py3 import KeyCreateParameters from ._models_py3 import KeyImportParameters from ._models_py3 import KeyItem + from ._models_py3 import KeyListResult from ._models_py3 import KeyOperationResult from ._models_py3 import KeyOperationsParameters from ._models_py3 import KeyProperties @@ -70,10 +78,12 @@ from ._models_py3 import SasDefinitionBundle from ._models_py3 import SasDefinitionCreateParameters from ._models_py3 import SasDefinitionItem + from ._models_py3 import SasDefinitionListResult from ._models_py3 import SasDefinitionUpdateParameters from ._models_py3 import SecretAttributes from ._models_py3 import SecretBundle from ._models_py3 import SecretItem + from ._models_py3 import SecretListResult from ._models_py3 import SecretProperties from ._models_py3 import SecretRestoreParameters from ._models_py3 import SecretSetParameters @@ -84,6 +94,7 @@ from ._models_py3 import StorageAccountRegenerteKeyParameters from ._models_py3 import StorageAccountUpdateParameters from ._models_py3 import StorageBundle + from ._models_py3 import StorageListResult from ._models_py3 import StorageRestoreParameters from ._models_py3 import SubjectAlternativeNames from ._models_py3 import Trigger @@ -101,9 +112,11 @@ from ._models import CertificateCreateParameters from ._models import CertificateImportParameters from ._models import CertificateIssuerItem + from ._models import CertificateIssuerListResult from ._models import CertificateIssuerSetParameters from ._models import CertificateIssuerUpdateParameters from ._models import CertificateItem + from ._models import CertificateListResult from ._models import CertificateMergeParameters from ._models import CertificateOperation from ._models import CertificateOperationUpdateParameter @@ -114,14 +127,19 @@ from ._models import Contacts from ._models import DeletedCertificateBundle from ._models import DeletedCertificateItem + from ._models import DeletedCertificateListResult from ._models import DeletedKeyBundle from ._models import DeletedKeyItem + from ._models import DeletedKeyListResult from ._models import DeletedSasDefinitionBundle from ._models import DeletedSasDefinitionItem + from ._models import DeletedSasDefinitionListResult from ._models import DeletedSecretBundle from ._models import DeletedSecretItem + from ._models import DeletedSecretListResult from ._models import DeletedStorageAccountItem from ._models import DeletedStorageBundle + from ._models import DeletedStorageListResult from ._models import Error from ._models import IssuerAttributes from ._models import IssuerBundle @@ -133,6 +151,7 @@ from ._models import KeyCreateParameters from ._models import KeyImportParameters from ._models import KeyItem + from ._models import KeyListResult from ._models import KeyOperationResult from ._models import KeyOperationsParameters from ._models import KeyProperties @@ -149,10 +168,12 @@ from ._models import SasDefinitionBundle from ._models import SasDefinitionCreateParameters from ._models import SasDefinitionItem + from ._models import SasDefinitionListResult from ._models import SasDefinitionUpdateParameters from ._models import SecretAttributes from ._models import SecretBundle from ._models import SecretItem + from ._models import SecretListResult from ._models import SecretProperties from ._models import SecretRestoreParameters from ._models import SecretSetParameters @@ -163,21 +184,11 @@ from ._models import StorageAccountRegenerteKeyParameters from ._models import StorageAccountUpdateParameters from ._models import StorageBundle + from ._models import StorageListResult from ._models import StorageRestoreParameters from ._models import SubjectAlternativeNames from ._models import Trigger from ._models import X509CertificateProperties -from ._paged_models import CertificateIssuerItemPaged -from ._paged_models import CertificateItemPaged -from ._paged_models import DeletedCertificateItemPaged -from ._paged_models import DeletedKeyItemPaged -from ._paged_models import DeletedSasDefinitionItemPaged -from ._paged_models import DeletedSecretItemPaged -from ._paged_models import DeletedStorageAccountItemPaged -from ._paged_models import KeyItemPaged -from ._paged_models import SasDefinitionItemPaged -from ._paged_models import SecretItemPaged -from ._paged_models import StorageAccountItemPaged from ._key_vault_client_enums import ( JsonWebKeyType, JsonWebKeyCurveName, @@ -203,9 +214,11 @@ 'CertificateCreateParameters', 'CertificateImportParameters', 'CertificateIssuerItem', + 'CertificateIssuerListResult', 'CertificateIssuerSetParameters', 'CertificateIssuerUpdateParameters', 'CertificateItem', + 'CertificateListResult', 'CertificateMergeParameters', 'CertificateOperation', 'CertificateOperationUpdateParameter', @@ -216,14 +229,19 @@ 'Contacts', 'DeletedCertificateBundle', 'DeletedCertificateItem', + 'DeletedCertificateListResult', 'DeletedKeyBundle', 'DeletedKeyItem', + 'DeletedKeyListResult', 'DeletedSasDefinitionBundle', 'DeletedSasDefinitionItem', + 'DeletedSasDefinitionListResult', 'DeletedSecretBundle', 'DeletedSecretItem', + 'DeletedSecretListResult', 'DeletedStorageAccountItem', 'DeletedStorageBundle', + 'DeletedStorageListResult', 'Error', 'IssuerAttributes', 'IssuerBundle', @@ -235,6 +253,7 @@ 'KeyCreateParameters', 'KeyImportParameters', 'KeyItem', + 'KeyListResult', 'KeyOperationResult', 'KeyOperationsParameters', 'KeyProperties', @@ -251,10 +270,12 @@ 'SasDefinitionBundle', 'SasDefinitionCreateParameters', 'SasDefinitionItem', + 'SasDefinitionListResult', 'SasDefinitionUpdateParameters', 'SecretAttributes', 'SecretBundle', 'SecretItem', + 'SecretListResult', 'SecretProperties', 'SecretRestoreParameters', 'SecretSetParameters', @@ -265,21 +286,11 @@ 'StorageAccountRegenerteKeyParameters', 'StorageAccountUpdateParameters', 'StorageBundle', + 'StorageListResult', 'StorageRestoreParameters', 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'KeyItemPaged', - 'DeletedKeyItemPaged', - 'SecretItemPaged', - 'DeletedSecretItemPaged', - 'CertificateItemPaged', - 'CertificateIssuerItemPaged', - 'DeletedCertificateItemPaged', - 'StorageAccountItemPaged', - 'DeletedStorageAccountItemPaged', - 'SasDefinitionItemPaged', - 'DeletedSasDefinitionItemPaged', 'JsonWebKeyType', 'JsonWebKeyCurveName', 'DeletionRecoveryLevel', 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 e02ddd417cdb..24dfe4beb6a9 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 @@ -385,6 +385,36 @@ def __init__(self, **kwargs): self.provider = kwargs.get('provider', None) +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -479,6 +509,35 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -867,6 +926,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -1037,6 +1125,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionBundle(Model): """A SAS definition bundle consists of key vault SAS definition details plus its attributes. @@ -1251,6 +1368,36 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSasDefinitionListResult(Model): + """The deleted SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted SAS + definitions in the vault along with a link to the next page of deleted sas + definitions + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :ivar next_link: The URL to get the next set of deleted SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1452,6 +1599,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageAccountItem(Model): """The storage account item containing storage account metadata. @@ -1662,6 +1838,37 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedStorageListResult(Model): + """The deleted storage account list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted storage + accounts in the vault along with a link to the next page of deleted + storage accounts + :vartype value: + list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar next_link: The URL to get the next set of deleted storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedStorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -2023,6 +2230,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2451,6 +2687,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2534,6 +2799,35 @@ def __init__(self, **kwargs): self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2779,6 +3073,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageRestoreParameters(Model): """The secret restore parameters. 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 1f394c8f5f38..52f4aa981815 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 @@ -385,6 +385,36 @@ def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: self.provider = provider +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -479,6 +509,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -867,6 +926,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -1037,6 +1125,35 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: st self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionBundle(Model): """A SAS definition bundle consists of key vault SAS definition details plus its attributes. @@ -1251,6 +1368,36 @@ def __init__(self, *, recovery_id: str=None, **kwargs) -> None: self.deleted_date = None +class DeletedSasDefinitionListResult(Model): + """The deleted SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted SAS + definitions in the vault along with a link to the next page of deleted sas + definitions + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :ivar next_link: The URL to get the next set of deleted SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1452,6 +1599,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageAccountItem(Model): """The storage account item containing storage account metadata. @@ -1662,6 +1838,37 @@ def __init__(self, *, recovery_id: str=None, **kwargs) -> None: self.deleted_date = None +class DeletedStorageListResult(Model): + """The deleted storage account list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted storage + accounts in the vault along with a link to the next page of deleted + storage accounts + :vartype value: + list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar next_link: The URL to get the next set of deleted storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedStorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -2023,6 +2230,35 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2451,6 +2687,35 @@ def __init__(self, *, template_uri: str, sas_type, validity_period: str, sas_def self.tags = tags +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2534,6 +2799,35 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2779,6 +3073,35 @@ def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, self.tags = tags +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageRestoreParameters(Model): """The secret restore parameters. diff --git a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_paged_models.py b/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_paged_models.py deleted file mode 100644 index 0fbf874da2a7..000000000000 --- a/sdk/keyvault/azure-keyvault-keys/azure/keyvault/keys/_shared/_generated/v7_0/models/_paged_models.py +++ /dev/null @@ -1,157 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from azure.core.paging import Paged - - -class KeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`KeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[KeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(KeyItemPaged, self).__init__(*args, **kwargs) -class DeletedKeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedKeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedKeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedKeyItemPaged, self).__init__(*args, **kwargs) -class SecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SecretItemPaged, self).__init__(*args, **kwargs) -class DeletedSecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSecretItemPaged, self).__init__(*args, **kwargs) -class CertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateItemPaged, self).__init__(*args, **kwargs) -class CertificateIssuerItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateIssuerItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateIssuerItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateIssuerItemPaged, self).__init__(*args, **kwargs) -class DeletedCertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedCertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedCertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedCertificateItemPaged, self).__init__(*args, **kwargs) -class StorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`StorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(StorageAccountItemPaged, self).__init__(*args, **kwargs) -class DeletedStorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedStorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedStorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedStorageAccountItemPaged, self).__init__(*args, **kwargs) -class SasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SasDefinitionItemPaged, self).__init__(*args, **kwargs) -class DeletedSasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSasDefinitionItemPaged, self).__init__(*args, **kwargs) 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 c0e15566f02e..d52fb73651e7 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged from .. import models import uuid @@ -77,8 +78,6 @@ def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -153,8 +152,6 @@ def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -217,8 +214,6 @@ def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -293,8 +288,6 @@ def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_at header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -359,8 +352,6 @@ def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -398,11 +389,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -411,46 +403,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -472,11 +461,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -484,46 +474,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_keys.metadata = {'url': '/keys'} def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -575,8 +562,6 @@ def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -648,8 +633,6 @@ def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -730,8 +713,6 @@ def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -809,8 +790,6 @@ def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -886,8 +865,6 @@ def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -969,8 +946,6 @@ def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signa header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1048,8 +1023,6 @@ def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1125,8 +1098,6 @@ def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cl header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1170,11 +1141,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v7_0.models.DeletedKeyItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1182,46 +1154,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -1262,8 +1231,6 @@ def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1321,8 +1288,6 @@ def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1378,8 +1343,6 @@ def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1449,8 +1412,6 @@ def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1511,8 +1472,6 @@ def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1585,8 +1544,6 @@ def update_secret(self, vault_base_url, secret_name, secret_version, content_typ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1649,8 +1606,6 @@ def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1688,11 +1643,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1700,46 +1656,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1760,11 +1713,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1773,46 +1727,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1831,11 +1782,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSecretItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1843,46 +1795,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): @@ -1922,8 +1871,6 @@ def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1981,8 +1928,6 @@ def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2035,8 +1980,6 @@ def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2094,8 +2037,6 @@ def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2155,8 +2096,6 @@ def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwarg header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2199,11 +2138,12 @@ def get_certificates( :type include_pending: bool :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2211,9 +2151,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -2222,37 +2159,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificates.metadata = {'url': '/certificates'} def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -2293,8 +2230,6 @@ def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2353,8 +2288,6 @@ def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2412,8 +2345,6 @@ def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2467,8 +2398,6 @@ def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2505,11 +2434,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v7_0.models.CertificateIssuerItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2517,46 +2447,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): @@ -2609,8 +2536,6 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2684,8 +2609,6 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2746,8 +2669,6 @@ def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2805,8 +2726,6 @@ def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2876,8 +2795,6 @@ def create_certificate(self, vault_base_url, certificate_name, certificate_polic header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -2960,8 +2877,6 @@ def import_certificate(self, vault_base_url, certificate_name, base64_encoded_ce header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3003,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3016,46 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3096,8 +3009,6 @@ def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3159,8 +3070,6 @@ def update_certificate_policy(self, vault_base_url, certificate_name, certificat header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3238,8 +3147,6 @@ def update_certificate(self, vault_base_url, certificate_name, certificate_versi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3303,8 +3210,6 @@ def get_certificate(self, vault_base_url, certificate_name, certificate_version, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3367,8 +3272,6 @@ def update_certificate_operation(self, vault_base_url, certificate_name, cancell header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3428,8 +3331,6 @@ def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3487,8 +3388,6 @@ def delete_certificate_operation(self, vault_base_url, certificate_name, cls=Non header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3560,8 +3459,6 @@ def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3622,8 +3519,6 @@ def backup_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3683,8 +3578,6 @@ def restore_certificate(self, vault_base_url, certificate_bundle_backup, cls=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') @@ -3730,11 +3623,12 @@ def get_deleted_certificates( :type include_pending: bool :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v7_0.models.DeletedCertificateItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3742,9 +3636,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -3753,37 +3644,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3824,8 +3715,6 @@ def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3883,8 +3772,6 @@ def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3940,8 +3827,6 @@ def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3975,11 +3860,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.StorageAccountItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3987,46 +3873,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_storage_accounts.metadata = {'url': '/storage'} def get_deleted_storage_accounts( @@ -4045,11 +3928,12 @@ def get_deleted_storage_accounts( :type maxresults: int :return: An iterator like instance of DeletedStorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.DeletedStorageAccountItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_storage_accounts.metadata['url'] @@ -4057,46 +3941,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedStorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedStorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): @@ -4136,8 +4017,6 @@ def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4195,8 +4074,6 @@ def purge_deleted_storage_account(self, vault_base_url, storage_account_name, cl header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4249,8 +4126,6 @@ def recover_deleted_storage_account(self, vault_base_url, storage_account_name, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4307,8 +4182,6 @@ def backup_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4368,8 +4241,6 @@ def restore_storage_account(self, vault_base_url, storage_bundle_backup, cls=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageRestoreParameters') @@ -4427,8 +4298,6 @@ def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4483,8 +4352,6 @@ def get_storage_account(self, vault_base_url, storage_account_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4559,8 +4426,6 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4636,8 +4501,6 @@ def update_storage_account(self, vault_base_url, storage_account_name, active_ke header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4700,8 +4563,6 @@ def regenerate_storage_account_key(self, vault_base_url, storage_account_name, k header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4740,11 +4601,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.SasDefinitionItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4753,46 +4615,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def get_deleted_sas_definitions( @@ -4814,11 +4673,12 @@ def get_deleted_sas_definitions( :type maxresults: int :return: An iterator like instance of DeletedSasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSasDefinitionItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_sas_definitions.metadata['url'] @@ -4827,46 +4687,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): @@ -4909,8 +4766,6 @@ def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_d header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4971,8 +4826,6 @@ def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, s header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -5030,8 +4883,6 @@ def delete_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -5089,8 +4940,6 @@ def get_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5168,8 +5017,6 @@ def set_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') @@ -5250,8 +5097,6 @@ def update_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') 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 56148a5820ef..0714edabf420 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 @@ -2,8 +2,7 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -from typing import Any, Callable, Mapping, TYPE_CHECKING -from azure.core.async_paging import AsyncPagedMixin +from typing import Any, Callable, Mapping, AsyncIterator, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy @@ -23,10 +22,10 @@ class AsyncPagingAdapter: - """For each item in an AsyncPagedMixin, returns the result of applying fn to that item. + """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: AsyncPagedMixin, fn: Callable[[Model], Any]) -> None: + def __init__(self, pages: AsyncIterator, fn: Callable[[Model], Any]) -> None: self._pages = pages self._fn = fn diff --git a/sdk/keyvault/azure-keyvault-keys/tests/keys_vault_client_async.py b/sdk/keyvault/azure-keyvault-keys/tests/keys_vault_client_async.py index b95fd1aa7ad4..a09d581eb39a 100644 --- a/sdk/keyvault/azure-keyvault-keys/tests/keys_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-keys/tests/keys_vault_client_async.py @@ -3,7 +3,6 @@ # Licensed under the MIT License. # ------------------------------------ from typing import Any, Callable, Mapping, TYPE_CHECKING -from azure.core.async_paging import AsyncPagedMixin from azure.core.configuration import Configuration from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy 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 f15b6779b9d3..1f0a670bf217 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_client.py @@ -13,6 +13,7 @@ from typing import Any, Dict, Generator, Mapping, Optional from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError +from azure.core.tracing.decorator import distributed_trace from ._shared import KeyVaultClientBase from ._models import Secret, DeletedSecret, SecretAttributes @@ -32,6 +33,7 @@ class SecretClient(KeyVaultClientBase): # pylint:disable=protected-access + @distributed_trace def get_secret(self, name, version=None, **kwargs): # type: (str, str, Mapping[str, Any]) -> Secret """Get a specified secret from the vault. @@ -59,6 +61,7 @@ def get_secret(self, name, version=None, **kwargs): ) return Secret._from_secret_bundle(bundle) + @distributed_trace def set_secret( self, name, value, content_type=None, enabled=None, not_before=None, expires=None, tags=None, **kwargs ): @@ -101,6 +104,7 @@ def set_secret( ) return Secret._from_secret_bundle(bundle) + @distributed_trace def update_secret( self, name, version=None, content_type=None, enabled=None, not_before=None, expires=None, tags=None, **kwargs ): @@ -151,6 +155,7 @@ def update_secret( ) return SecretAttributes._from_secret_bundle(bundle) # pylint: disable=protected-access + @distributed_trace def list_secrets(self, **kwargs): # type: (Mapping[str, Any]) -> Generator[SecretAttributes] """List secrets in the vault. @@ -177,6 +182,7 @@ def list_secrets(self, **kwargs): pages = self._client.get_secrets(self._vault_url, maxresults=max_page_size, **kwargs) return (SecretAttributes._from_secret_item(item) for item in pages) + @distributed_trace def list_secret_versions(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> Generator[SecretAttributes] """List all versions of the specified secret. @@ -203,6 +209,7 @@ def list_secret_versions(self, name, **kwargs): 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) + @distributed_trace def backup_secret(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> bytes """Backs up the specified secret. @@ -230,6 +237,7 @@ def backup_secret(self, name, **kwargs): ) return backup_result.value + @distributed_trace def restore_secret(self, backup, **kwargs): # type: (bytes, Mapping[str, Any]) -> SecretAttributes """Restore a backed up secret to the vault. @@ -254,6 +262,7 @@ def restore_secret(self, backup, **kwargs): bundle = self._client.restore_secret(self.vault_url, backup, error_map={409: ResourceExistsError}, **kwargs) return SecretAttributes._from_secret_bundle(bundle) + @distributed_trace def delete_secret(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> DeletedSecret """Deletes a secret from the vault. @@ -279,6 +288,7 @@ def delete_secret(self, name, **kwargs): bundle = self._client.delete_secret(self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs) return DeletedSecret._from_deleted_secret_bundle(bundle) + @distributed_trace def get_deleted_secret(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> DeletedSecret """Gets the specified deleted secret. @@ -303,6 +313,7 @@ def get_deleted_secret(self, name, **kwargs): bundle = self._client.get_deleted_secret(self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs) return DeletedSecret._from_deleted_secret_bundle(bundle) + @distributed_trace def list_deleted_secrets(self, **kwargs): # type: (Mapping[str, Any]) -> Generator[DeletedSecret] """Lists deleted secrets of the vault. @@ -328,6 +339,7 @@ def list_deleted_secrets(self, **kwargs): 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) + @distributed_trace def purge_deleted_secret(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> None """Permanently deletes the specified secret. @@ -350,6 +362,7 @@ def purge_deleted_secret(self, name, **kwargs): """ self._client.purge_deleted_secret(self.vault_url, name, **kwargs) + @distributed_trace def recover_deleted_secret(self, name, **kwargs): # type: (str, Mapping[str, Any]) -> SecretAttributes """Recovers the deleted secret to the latest version. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/key_vault_client.py index afec64f70804..6221dd5e7bec 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/key_vault_client.py @@ -50,14 +50,14 @@ def get_configuration_class(api_version, aio=False): """ if api_version == V7_0_VERSION: if aio: - from .v7_0.aio import KeyVaultClientConfiguration as ImplConfig + from .v7_0.aio._configuration_async import KeyVaultClientConfiguration as ImplConfig else: - from .v7_0 import KeyVaultClientConfiguration as ImplConfig + from .v7_0._configuration import KeyVaultClientConfiguration as ImplConfig elif api_version == V2016_10_01_VERSION: if aio: - from .v2016_10_01.aio import KeyVaultClientConfiguration as ImplConfig + from .v2016_10_01.aio._configuration_async import KeyVaultClientConfiguration as ImplConfig else: - from .v2016_10_01 import KeyVaultClientConfiguration as ImplConfig + from .v2016_10_01._configuration import KeyVaultClientConfiguration as ImplConfig else: raise NotImplementedError("API version {} is not available".format(api_version)) return ImplConfig diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/__init__.py index d3fda25cc7ab..e913d4cf6c46 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/__init__.py @@ -9,9 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultClientConfiguration from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] from .version import VERSION diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_configuration.py index beb5eb930fa8..28cf75e3d2b4 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_configuration.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials @@ -45,4 +44,5 @@ def _configure(self, **kwargs): self.proxy_policy = policies.ProxyPolicy(**kwargs) self.logging_policy = policies.NetworkTraceLoggingPolicy(**kwargs) self.retry_policy = policies.RetryPolicy(**kwargs) + self.custom_hook_policy = policies.CustomHookPolicy(**kwargs) self.redirect_policy = policies.RedirectPolicy(**kwargs) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_key_vault_client.py index 0252b1e16a5e..e3ec609b6cd3 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/_key_vault_client.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/__init__.py index ffece9055d9b..fb2e6c3866fd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/__init__.py @@ -10,5 +10,4 @@ # -------------------------------------------------------------------------- from ._key_vault_client_async import KeyVaultClient -from ._configuration_async import KeyVaultClientConfiguration -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_configuration_async.py index 2144132ebe2d..a61d9eeff444 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_configuration_async.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py index 559d48da029a..ad4b8a97754f 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/aio/_key_vault_client_async.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} 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 28ea64adc6a6..857e446e899c 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.async_paging import AsyncItemPaged, AsyncList from ... import models import uuid @@ -78,8 +79,6 @@ async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -154,8 +153,6 @@ async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attribut header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -218,8 +215,6 @@ async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -294,8 +289,6 @@ async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -360,8 +353,6 @@ async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -399,11 +390,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -412,60 +404,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -487,11 +462,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -499,60 +475,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_keys.metadata = {'url': '/keys'} async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -604,8 +563,6 @@ async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -677,8 +634,6 @@ async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kw header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -759,8 +714,6 @@ async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -838,8 +791,6 @@ async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -915,8 +866,6 @@ async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -998,8 +947,6 @@ async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1077,8 +1024,6 @@ async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1154,8 +1099,6 @@ async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, val header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1199,11 +1142,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedKeyItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1211,60 +1155,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -1305,8 +1232,6 @@ async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs) header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1364,8 +1289,6 @@ async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwarg header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1421,8 +1344,6 @@ async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1493,8 +1414,6 @@ async def set_secret(self, vault_base_url, secret_name, value, tags=None, conten header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1555,8 +1474,6 @@ async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1630,8 +1547,6 @@ async def update_secret(self, vault_base_url, secret_name, secret_version, conte header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1694,8 +1609,6 @@ async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=N header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1733,11 +1646,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1745,60 +1659,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1819,11 +1716,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1832,60 +1730,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1904,11 +1785,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedSecretItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1916,60 +1798,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): @@ -2009,8 +1874,6 @@ async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2068,8 +1931,6 @@ async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, * header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2122,8 +1983,6 @@ async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2181,8 +2040,6 @@ async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2242,8 +2099,6 @@ async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2283,11 +2138,12 @@ def get_certificates( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2295,60 +2151,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificates.metadata = {'url': '/certificates'} async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -2389,8 +2228,6 @@ async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2449,8 +2286,6 @@ async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2508,8 +2343,6 @@ async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2563,8 +2396,6 @@ async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2601,11 +2432,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateIssuerItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2613,60 +2445,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): @@ -2720,8 +2535,6 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2796,8 +2609,6 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2858,8 +2669,6 @@ async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2917,8 +2726,6 @@ async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=No header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2988,8 +2795,6 @@ async def create_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -3072,8 +2877,6 @@ async def import_certificate(self, vault_base_url, certificate_name, base64_enco header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3115,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3128,60 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3222,8 +3009,6 @@ async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3285,8 +3070,6 @@ async def update_certificate_policy(self, vault_base_url, certificate_name, cert header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3364,8 +3147,6 @@ async def update_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3429,8 +3210,6 @@ async def get_certificate(self, vault_base_url, certificate_name, certificate_ve header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3493,8 +3272,6 @@ async def update_certificate_operation(self, vault_base_url, certificate_name, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3554,8 +3331,6 @@ async def get_certificate_operation(self, vault_base_url, certificate_name, *, c header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3613,8 +3388,6 @@ async def delete_certificate_operation(self, vault_base_url, certificate_name, * header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3686,8 +3459,6 @@ async def merge_certificate(self, vault_base_url, certificate_name, x509_certifi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3730,11 +3501,12 @@ def get_deleted_certificates( :type maxresults: int :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedCertificateItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3742,60 +3514,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3836,8 +3591,6 @@ async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3895,8 +3648,6 @@ async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, c header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3952,8 +3703,6 @@ async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3987,11 +3736,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v2016_10_01.models.StorageAccountItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3999,60 +3749,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_storage_accounts.metadata = {'url': '/storage'} async def delete_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): @@ -4089,8 +3822,6 @@ async def delete_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4145,8 +3876,6 @@ async def get_storage_account(self, vault_base_url, storage_account_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4221,8 +3950,6 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4298,8 +4025,6 @@ async def update_storage_account(self, vault_base_url, storage_account_name, act header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4362,8 +4087,6 @@ async def regenerate_storage_account_key(self, vault_base_url, storage_account_n header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4402,11 +4125,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v2016_10_01.models.SasDefinitionItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4415,60 +4139,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): @@ -4508,8 +4215,6 @@ async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4567,8 +4272,6 @@ async def get_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4639,8 +4342,6 @@ async def set_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') @@ -4714,8 +4415,6 @@ async def update_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/__init__.py index 76f4bf1ab9bc..6f134becdbd3 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/__init__.py @@ -20,9 +20,11 @@ from ._models_py3 import CertificateCreateParameters from ._models_py3 import CertificateImportParameters from ._models_py3 import CertificateIssuerItem + from ._models_py3 import CertificateIssuerListResult from ._models_py3 import CertificateIssuerSetParameters from ._models_py3 import CertificateIssuerUpdateParameters from ._models_py3 import CertificateItem + from ._models_py3 import CertificateListResult from ._models_py3 import CertificateMergeParameters from ._models_py3 import CertificateOperation from ._models_py3 import CertificateOperationUpdateParameter @@ -32,10 +34,13 @@ from ._models_py3 import Contacts from ._models_py3 import DeletedCertificateBundle from ._models_py3 import DeletedCertificateItem + from ._models_py3 import DeletedCertificateListResult from ._models_py3 import DeletedKeyBundle from ._models_py3 import DeletedKeyItem + from ._models_py3 import DeletedKeyListResult from ._models_py3 import DeletedSecretBundle from ._models_py3 import DeletedSecretItem + from ._models_py3 import DeletedSecretListResult from ._models_py3 import Error from ._models_py3 import IssuerAttributes from ._models_py3 import IssuerBundle @@ -47,6 +52,7 @@ from ._models_py3 import KeyCreateParameters from ._models_py3 import KeyImportParameters from ._models_py3 import KeyItem + from ._models_py3 import KeyListResult from ._models_py3 import KeyOperationResult from ._models_py3 import KeyOperationsParameters from ._models_py3 import KeyProperties @@ -63,10 +69,12 @@ from ._models_py3 import SasDefinitionBundle from ._models_py3 import SasDefinitionCreateParameters from ._models_py3 import SasDefinitionItem + from ._models_py3 import SasDefinitionListResult from ._models_py3 import SasDefinitionUpdateParameters from ._models_py3 import SecretAttributes from ._models_py3 import SecretBundle from ._models_py3 import SecretItem + from ._models_py3 import SecretListResult from ._models_py3 import SecretProperties from ._models_py3 import SecretRestoreParameters from ._models_py3 import SecretSetParameters @@ -77,6 +85,7 @@ from ._models_py3 import StorageAccountRegenerteKeyParameters from ._models_py3 import StorageAccountUpdateParameters from ._models_py3 import StorageBundle + from ._models_py3 import StorageListResult from ._models_py3 import SubjectAlternativeNames from ._models_py3 import Trigger from ._models_py3 import X509CertificateProperties @@ -91,9 +100,11 @@ from ._models import CertificateCreateParameters from ._models import CertificateImportParameters from ._models import CertificateIssuerItem + from ._models import CertificateIssuerListResult from ._models import CertificateIssuerSetParameters from ._models import CertificateIssuerUpdateParameters from ._models import CertificateItem + from ._models import CertificateListResult from ._models import CertificateMergeParameters from ._models import CertificateOperation from ._models import CertificateOperationUpdateParameter @@ -103,10 +114,13 @@ from ._models import Contacts from ._models import DeletedCertificateBundle from ._models import DeletedCertificateItem + from ._models import DeletedCertificateListResult from ._models import DeletedKeyBundle from ._models import DeletedKeyItem + from ._models import DeletedKeyListResult from ._models import DeletedSecretBundle from ._models import DeletedSecretItem + from ._models import DeletedSecretListResult from ._models import Error from ._models import IssuerAttributes from ._models import IssuerBundle @@ -118,6 +132,7 @@ from ._models import KeyCreateParameters from ._models import KeyImportParameters from ._models import KeyItem + from ._models import KeyListResult from ._models import KeyOperationResult from ._models import KeyOperationsParameters from ._models import KeyProperties @@ -134,10 +149,12 @@ from ._models import SasDefinitionBundle from ._models import SasDefinitionCreateParameters from ._models import SasDefinitionItem + from ._models import SasDefinitionListResult from ._models import SasDefinitionUpdateParameters from ._models import SecretAttributes from ._models import SecretBundle from ._models import SecretItem + from ._models import SecretListResult from ._models import SecretProperties from ._models import SecretRestoreParameters from ._models import SecretSetParameters @@ -148,18 +165,10 @@ from ._models import StorageAccountRegenerteKeyParameters from ._models import StorageAccountUpdateParameters from ._models import StorageBundle + from ._models import StorageListResult from ._models import SubjectAlternativeNames from ._models import Trigger from ._models import X509CertificateProperties -from ._paged_models import CertificateIssuerItemPaged -from ._paged_models import CertificateItemPaged -from ._paged_models import DeletedCertificateItemPaged -from ._paged_models import DeletedKeyItemPaged -from ._paged_models import DeletedSecretItemPaged -from ._paged_models import KeyItemPaged -from ._paged_models import SasDefinitionItemPaged -from ._paged_models import SecretItemPaged -from ._paged_models import StorageAccountItemPaged from ._key_vault_client_enums import ( JsonWebKeyType, JsonWebKeyCurveName, @@ -182,9 +191,11 @@ 'CertificateCreateParameters', 'CertificateImportParameters', 'CertificateIssuerItem', + 'CertificateIssuerListResult', 'CertificateIssuerSetParameters', 'CertificateIssuerUpdateParameters', 'CertificateItem', + 'CertificateListResult', 'CertificateMergeParameters', 'CertificateOperation', 'CertificateOperationUpdateParameter', @@ -194,10 +205,13 @@ 'Contacts', 'DeletedCertificateBundle', 'DeletedCertificateItem', + 'DeletedCertificateListResult', 'DeletedKeyBundle', 'DeletedKeyItem', + 'DeletedKeyListResult', 'DeletedSecretBundle', 'DeletedSecretItem', + 'DeletedSecretListResult', 'Error', 'IssuerAttributes', 'IssuerBundle', @@ -209,6 +223,7 @@ 'KeyCreateParameters', 'KeyImportParameters', 'KeyItem', + 'KeyListResult', 'KeyOperationResult', 'KeyOperationsParameters', 'KeyProperties', @@ -225,10 +240,12 @@ 'SasDefinitionBundle', 'SasDefinitionCreateParameters', 'SasDefinitionItem', + 'SasDefinitionListResult', 'SasDefinitionUpdateParameters', 'SecretAttributes', 'SecretBundle', 'SecretItem', + 'SecretListResult', 'SecretProperties', 'SecretRestoreParameters', 'SecretSetParameters', @@ -239,18 +256,10 @@ 'StorageAccountRegenerteKeyParameters', 'StorageAccountUpdateParameters', 'StorageBundle', + 'StorageListResult', 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'KeyItemPaged', - 'DeletedKeyItemPaged', - 'SecretItemPaged', - 'DeletedSecretItemPaged', - 'CertificateItemPaged', - 'CertificateIssuerItemPaged', - 'DeletedCertificateItemPaged', - 'StorageAccountItemPaged', - 'SasDefinitionItemPaged', 'JsonWebKeyType', 'JsonWebKeyCurveName', 'DeletionRecoveryLevel', 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 f9caaf92c16e..e918a167f2dd 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 @@ -341,6 +341,37 @@ def __init__(self, **kwargs): self.provider = kwargs.get('provider', None) +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -435,6 +466,35 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -805,6 +865,36 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: + list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -975,6 +1065,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1176,6 +1295,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -1531,6 +1679,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2012,6 +2189,35 @@ def __init__(self, **kwargs): self.tags = None +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2084,6 +2290,35 @@ def __init__(self, **kwargs): self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2415,6 +2650,36 @@ def __init__(self, **kwargs): self.tags = None +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SubjectAlternativeNames(Model): """The subject alternate names of a X509 object. 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 4920c195ef89..07d530b486f6 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 @@ -341,6 +341,37 @@ def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: self.provider = provider +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -435,6 +466,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v2016_10_01.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -805,6 +865,36 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: + list[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -975,6 +1065,35 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: st self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1176,6 +1295,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -1531,6 +1679,35 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v2016_10_01.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2012,6 +2189,35 @@ def __init__(self, **kwargs) -> None: self.tags = None +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2084,6 +2290,35 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v2016_10_01.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2415,6 +2650,36 @@ def __init__(self, **kwargs) -> None: self.tags = None +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: + list[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SubjectAlternativeNames(Model): """The subject alternate names of a X509 object. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_paged_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_paged_models.py deleted file mode 100644 index e5ddd1d7edc4..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v2016_10_01/models/_paged_models.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from azure.core.paging import Paged - - -class KeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`KeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[KeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(KeyItemPaged, self).__init__(*args, **kwargs) -class DeletedKeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedKeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedKeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedKeyItemPaged, self).__init__(*args, **kwargs) -class SecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SecretItemPaged, self).__init__(*args, **kwargs) -class DeletedSecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSecretItemPaged, self).__init__(*args, **kwargs) -class CertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateItemPaged, self).__init__(*args, **kwargs) -class CertificateIssuerItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateIssuerItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateIssuerItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateIssuerItemPaged, self).__init__(*args, **kwargs) -class DeletedCertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedCertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedCertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedCertificateItemPaged, self).__init__(*args, **kwargs) -class StorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`StorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(StorageAccountItemPaged, self).__init__(*args, **kwargs) -class SasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SasDefinitionItemPaged, self).__init__(*args, **kwargs) 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 40ad1ab95087..50a82e217aa9 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged from .. import models import uuid @@ -78,8 +79,6 @@ def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -154,8 +153,6 @@ def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -218,8 +215,6 @@ def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -294,8 +289,6 @@ def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_at header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -360,8 +353,6 @@ def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -399,11 +390,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -412,46 +404,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -473,11 +462,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.KeyItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -485,46 +475,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_keys.metadata = {'url': '/keys'} def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -576,8 +563,6 @@ def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -649,8 +634,6 @@ def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -731,8 +714,6 @@ def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -810,8 +791,6 @@ def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -887,8 +866,6 @@ def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -970,8 +947,6 @@ def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signa header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1049,8 +1024,6 @@ def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1126,8 +1099,6 @@ def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cl header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1171,11 +1142,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedKeyItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1183,46 +1155,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -1263,8 +1232,6 @@ def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1322,8 +1289,6 @@ def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1379,8 +1344,6 @@ def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1451,8 +1414,6 @@ def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1513,8 +1474,6 @@ def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1588,8 +1547,6 @@ def update_secret(self, vault_base_url, secret_name, secret_version, content_typ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1652,8 +1609,6 @@ def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1691,11 +1646,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1703,46 +1659,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1763,11 +1716,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.SecretItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1776,46 +1730,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1834,11 +1785,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedSecretItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1846,46 +1798,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): @@ -1925,8 +1874,6 @@ def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1984,8 +1931,6 @@ def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2038,8 +1983,6 @@ def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2097,8 +2040,6 @@ def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2158,8 +2099,6 @@ def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwarg header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2199,11 +2138,12 @@ def get_certificates( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2211,46 +2151,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificates.metadata = {'url': '/certificates'} def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -2291,8 +2228,6 @@ def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2351,8 +2286,6 @@ def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2410,8 +2343,6 @@ def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2465,8 +2396,6 @@ def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2503,11 +2432,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateIssuerItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2515,46 +2445,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): @@ -2608,8 +2535,6 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2684,8 +2609,6 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2746,8 +2669,6 @@ def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2805,8 +2726,6 @@ def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2876,8 +2795,6 @@ def create_certificate(self, vault_base_url, certificate_name, certificate_polic header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -2960,8 +2877,6 @@ def import_certificate(self, vault_base_url, certificate_name, base64_encoded_ce header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3003,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.CertificateItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3016,46 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3096,8 +3009,6 @@ def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3159,8 +3070,6 @@ def update_certificate_policy(self, vault_base_url, certificate_name, certificat header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3238,8 +3147,6 @@ def update_certificate(self, vault_base_url, certificate_name, certificate_versi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3303,8 +3210,6 @@ def get_certificate(self, vault_base_url, certificate_name, certificate_version, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3367,8 +3272,6 @@ def update_certificate_operation(self, vault_base_url, certificate_name, cancell header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3428,8 +3331,6 @@ def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3487,8 +3388,6 @@ def delete_certificate_operation(self, vault_base_url, certificate_name, cls=Non header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3560,8 +3459,6 @@ def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3604,11 +3501,12 @@ def get_deleted_certificates( :type maxresults: int :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v2016_10_01.models.DeletedCertificateItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3616,46 +3514,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3696,8 +3591,6 @@ def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3755,8 +3648,6 @@ def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3812,8 +3703,6 @@ def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3847,11 +3736,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v2016_10_01.models.StorageAccountItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3859,46 +3749,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_storage_accounts.metadata = {'url': '/storage'} def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): @@ -3935,8 +3822,6 @@ def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3991,8 +3876,6 @@ def get_storage_account(self, vault_base_url, storage_account_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4067,8 +3950,6 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4144,8 +4025,6 @@ def update_storage_account(self, vault_base_url, storage_account_name, active_ke header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4208,8 +4087,6 @@ def regenerate_storage_account_key(self, vault_base_url, storage_account_name, k header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4248,11 +4125,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v2016_10_01.models.SasDefinitionItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v2016_10_01.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4261,46 +4139,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def delete_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): @@ -4340,8 +4215,6 @@ def delete_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4399,8 +4272,6 @@ def get_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4471,8 +4342,6 @@ def set_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionCreateParameters') @@ -4546,8 +4415,6 @@ def update_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters1, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/__init__.py index d3fda25cc7ab..e913d4cf6c46 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/__init__.py @@ -9,9 +9,8 @@ # regenerated. # -------------------------------------------------------------------------- -from ._configuration import KeyVaultClientConfiguration from ._key_vault_client import KeyVaultClient -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] from .version import VERSION diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_configuration.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_configuration.py index beb5eb930fa8..28cf75e3d2b4 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_configuration.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_configuration.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials @@ -45,4 +44,5 @@ def _configure(self, **kwargs): self.proxy_policy = policies.ProxyPolicy(**kwargs) self.logging_policy = policies.NetworkTraceLoggingPolicy(**kwargs) self.retry_policy = policies.RetryPolicy(**kwargs) + self.custom_hook_policy = policies.CustomHookPolicy(**kwargs) self.redirect_policy = policies.RedirectPolicy(**kwargs) diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_key_vault_client.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_key_vault_client.py index 699433682e60..a1a1eb19328b 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_key_vault_client.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/_key_vault_client.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = PipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/__init__.py index ffece9055d9b..fb2e6c3866fd 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/__init__.py @@ -10,5 +10,4 @@ # -------------------------------------------------------------------------- from ._key_vault_client_async import KeyVaultClient -from ._configuration_async import KeyVaultClientConfiguration -__all__ = ['KeyVaultClient', 'KeyVaultClientConfiguration'] +__all__ = ['KeyVaultClient'] diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_configuration_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_configuration_async.py index 2144132ebe2d..a61d9eeff444 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_configuration_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_configuration_async.py @@ -34,7 +34,6 @@ def __init__(self, credentials, **kwargs): self.user_agent_policy.add_user_agent('azsdk-python-azure-keyvault/{}'.format(VERSION)) self.generate_client_request_id = True - self.accept_language = None self.credentials = credentials diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_key_vault_client_async.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_key_vault_client_async.py index 739ab6ea407d..482d6336ab1a 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_key_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/aio/_key_vault_client_async.py @@ -27,10 +27,10 @@ class KeyVaultClient(KeyVaultClientOperationsMixin): """ def __init__( - self, credentials, config=None, **kwargs): + self, credentials, **kwargs): base_url = '{vaultBaseUrl}' - self._config = config or KeyVaultClientConfiguration(credentials, **kwargs) + self._config = KeyVaultClientConfiguration(credentials, **kwargs) self._client = AsyncPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} 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 a97144221c6a..d11b4bd0e615 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.async_paging import AsyncItemPaged, AsyncList from ... import models import uuid @@ -77,8 +78,6 @@ async def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -153,8 +152,6 @@ async def import_key(self, vault_base_url, key_name, key, hsm=None, key_attribut header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -217,8 +214,6 @@ async def delete_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -293,8 +288,6 @@ async def update_key(self, vault_base_url, key_name, key_version, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -359,8 +352,6 @@ async def get_key(self, vault_base_url, key_name, key_version, *, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -398,11 +389,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -411,60 +403,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -486,11 +461,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -498,60 +474,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_keys.metadata = {'url': '/keys'} async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -603,8 +562,6 @@ async def backup_key(self, vault_base_url, key_name, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -676,8 +633,6 @@ async def restore_key(self, vault_base_url, key_bundle_backup, *, cls=None, **kw header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -758,8 +713,6 @@ async def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -837,8 +790,6 @@ async def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -914,8 +865,6 @@ async def sign(self, vault_base_url, key_name, key_version, algorithm, value, *, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -997,8 +946,6 @@ async def verify(self, vault_base_url, key_name, key_version, algorithm, digest, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1076,8 +1023,6 @@ async def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1153,8 +1098,6 @@ async def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, val header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1198,11 +1141,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v7_0.models.DeletedKeyItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1210,60 +1154,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs): @@ -1304,8 +1231,6 @@ async def get_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwargs) header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1363,8 +1288,6 @@ async def purge_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwarg header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1420,8 +1343,6 @@ async def recover_deleted_key(self, vault_base_url, key_name, *, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1491,8 +1412,6 @@ async def set_secret(self, vault_base_url, secret_name, value, tags=None, conten header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1553,8 +1472,6 @@ async def delete_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1627,8 +1544,6 @@ async def update_secret(self, vault_base_url, secret_name, secret_version, conte header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1691,8 +1606,6 @@ async def get_secret(self, vault_base_url, secret_name, secret_version, *, cls=N header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1730,11 +1643,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1742,60 +1656,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1816,11 +1713,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1829,60 +1727,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1901,11 +1782,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSecretItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1913,60 +1795,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs): @@ -2006,8 +1871,6 @@ async def get_deleted_secret(self, vault_base_url, secret_name, *, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2065,8 +1928,6 @@ async def purge_deleted_secret(self, vault_base_url, secret_name, *, cls=None, * header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2119,8 +1980,6 @@ async def recover_deleted_secret(self, vault_base_url, secret_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2178,8 +2037,6 @@ async def backup_secret(self, vault_base_url, secret_name, *, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2239,8 +2096,6 @@ async def restore_secret(self, vault_base_url, secret_bundle_backup, *, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2283,11 +2138,12 @@ def get_certificates( :type include_pending: bool :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2295,9 +2151,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -2306,51 +2159,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificates.metadata = {'url': '/certificates'} async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -2391,8 +2230,6 @@ async def delete_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2451,8 +2288,6 @@ async def set_certificate_contacts(self, vault_base_url, contact_list=None, *, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2510,8 +2345,6 @@ async def get_certificate_contacts(self, vault_base_url, *, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2565,8 +2398,6 @@ async def delete_certificate_contacts(self, vault_base_url, *, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2603,11 +2434,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v7_0.models.CertificateIssuerItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2615,60 +2447,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, *, cls=None, **kwargs): @@ -2721,8 +2536,6 @@ async def set_certificate_issuer(self, vault_base_url, issuer_name, provider, cr header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2796,8 +2609,6 @@ async def update_certificate_issuer(self, vault_base_url, issuer_name, provider= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2858,8 +2669,6 @@ async def get_certificate_issuer(self, vault_base_url, issuer_name, *, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2917,8 +2726,6 @@ async def delete_certificate_issuer(self, vault_base_url, issuer_name, *, cls=No header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2988,8 +2795,6 @@ async def create_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -3072,8 +2877,6 @@ async def import_certificate(self, vault_base_url, certificate_name, base64_enco header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3115,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3128,60 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3222,8 +3009,6 @@ async def get_certificate_policy(self, vault_base_url, certificate_name, *, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3285,8 +3070,6 @@ async def update_certificate_policy(self, vault_base_url, certificate_name, cert header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3364,8 +3147,6 @@ async def update_certificate(self, vault_base_url, certificate_name, certificate header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3429,8 +3210,6 @@ async def get_certificate(self, vault_base_url, certificate_name, certificate_ve header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3493,8 +3272,6 @@ async def update_certificate_operation(self, vault_base_url, certificate_name, c header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3554,8 +3331,6 @@ async def get_certificate_operation(self, vault_base_url, certificate_name, *, c header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3613,8 +3388,6 @@ async def delete_certificate_operation(self, vault_base_url, certificate_name, * header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3686,8 +3459,6 @@ async def merge_certificate(self, vault_base_url, certificate_name, x509_certifi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3748,8 +3519,6 @@ async def backup_certificate(self, vault_base_url, certificate_name, *, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3809,8 +3578,6 @@ async def restore_certificate(self, vault_base_url, certificate_bundle_backup, * header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') @@ -3856,11 +3623,12 @@ def get_deleted_certificates( :type include_pending: bool :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v7_0.models.DeletedCertificateItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3868,9 +3636,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -3879,51 +3644,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls=None, **kwargs): @@ -3964,8 +3715,6 @@ async def get_deleted_certificate(self, vault_base_url, certificate_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4023,8 +3772,6 @@ async def purge_deleted_certificate(self, vault_base_url, certificate_name, *, c header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4080,8 +3827,6 @@ async def recover_deleted_certificate(self, vault_base_url, certificate_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4115,11 +3860,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.StorageAccountItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -4127,60 +3873,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_storage_accounts.metadata = {'url': '/storage'} def get_deleted_storage_accounts( @@ -4199,11 +3928,12 @@ def get_deleted_storage_accounts( :type maxresults: int :return: An iterator like instance of DeletedStorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.DeletedStorageAccountItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_storage_accounts.metadata['url'] @@ -4211,60 +3941,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) + async def extract_data_async(response): + deserialized = self._deserialize('DeletedStorageListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - return response - - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedStorageAccountItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} async def get_deleted_storage_account(self, vault_base_url, storage_account_name, *, cls=None, **kwargs): @@ -4304,8 +4017,6 @@ async def get_deleted_storage_account(self, vault_base_url, storage_account_name header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4363,8 +4074,6 @@ async def purge_deleted_storage_account(self, vault_base_url, storage_account_na header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4417,8 +4126,6 @@ async def recover_deleted_storage_account(self, vault_base_url, storage_account_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4475,8 +4182,6 @@ async def backup_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4536,8 +4241,6 @@ async def restore_storage_account(self, vault_base_url, storage_bundle_backup, * header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageRestoreParameters') @@ -4595,8 +4298,6 @@ async def delete_storage_account(self, vault_base_url, storage_account_name, *, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4651,8 +4352,6 @@ async def get_storage_account(self, vault_base_url, storage_account_name, *, cls header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4727,8 +4426,6 @@ async def set_storage_account(self, vault_base_url, storage_account_name, resour header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4804,8 +4501,6 @@ async def update_storage_account(self, vault_base_url, storage_account_name, act header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4868,8 +4563,6 @@ async def regenerate_storage_account_key(self, vault_base_url, storage_account_n header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4908,11 +4601,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.SasDefinitionItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4921,60 +4615,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def get_deleted_sas_definitions( @@ -4996,11 +4673,12 @@ def get_deleted_sas_definitions( :type maxresults: int :return: An iterator like instance of DeletedSasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSasDefinitionItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_sas_definitions.metadata['url'] @@ -5009,60 +4687,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) - request = prepare_request(next_link) - - pipeline_response = self._client._pipeline.run(request) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - raise models.KeyVaultErrorException(response, self._deserialize) - - return response + async def extract_data_async(response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + return deserialized.next_link, AsyncList(deserialized.value) - async def internal_paging_async(next_link=None): - error_map = kwargs.pop('error_map', None) + async def get_next_async(next_link=None): request = prepare_request(next_link) pipeline_response = await self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSasDefinitionItemPaged( - internal_paging, self._deserialize, async_command=internal_paging_async) - - return deserialized + return AsyncItemPaged( + get_next_async, extract_data_async + ) get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, *, cls=None, **kwargs): @@ -5105,8 +4766,6 @@ async def get_deleted_sas_definition(self, vault_base_url, storage_account_name, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5167,8 +4826,6 @@ async def recover_deleted_sas_definition(self, vault_base_url, storage_account_n header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -5226,8 +4883,6 @@ async def delete_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -5285,8 +4940,6 @@ async def get_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5364,8 +5017,6 @@ async def set_sas_definition(self, vault_base_url, storage_account_name, sas_def header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') @@ -5446,8 +5097,6 @@ async def update_sas_definition(self, vault_base_url, storage_account_name, sas_ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/__init__.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/__init__.py index 4debdd0f3d13..5e72f49a73f6 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/__init__.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/__init__.py @@ -22,9 +22,11 @@ from ._models_py3 import CertificateCreateParameters from ._models_py3 import CertificateImportParameters from ._models_py3 import CertificateIssuerItem + from ._models_py3 import CertificateIssuerListResult from ._models_py3 import CertificateIssuerSetParameters from ._models_py3 import CertificateIssuerUpdateParameters from ._models_py3 import CertificateItem + from ._models_py3 import CertificateListResult from ._models_py3 import CertificateMergeParameters from ._models_py3 import CertificateOperation from ._models_py3 import CertificateOperationUpdateParameter @@ -35,14 +37,19 @@ from ._models_py3 import Contacts from ._models_py3 import DeletedCertificateBundle from ._models_py3 import DeletedCertificateItem + from ._models_py3 import DeletedCertificateListResult from ._models_py3 import DeletedKeyBundle from ._models_py3 import DeletedKeyItem + from ._models_py3 import DeletedKeyListResult from ._models_py3 import DeletedSasDefinitionBundle from ._models_py3 import DeletedSasDefinitionItem + from ._models_py3 import DeletedSasDefinitionListResult from ._models_py3 import DeletedSecretBundle from ._models_py3 import DeletedSecretItem + from ._models_py3 import DeletedSecretListResult from ._models_py3 import DeletedStorageAccountItem from ._models_py3 import DeletedStorageBundle + from ._models_py3 import DeletedStorageListResult from ._models_py3 import Error from ._models_py3 import IssuerAttributes from ._models_py3 import IssuerBundle @@ -54,6 +61,7 @@ from ._models_py3 import KeyCreateParameters from ._models_py3 import KeyImportParameters from ._models_py3 import KeyItem + from ._models_py3 import KeyListResult from ._models_py3 import KeyOperationResult from ._models_py3 import KeyOperationsParameters from ._models_py3 import KeyProperties @@ -70,10 +78,12 @@ from ._models_py3 import SasDefinitionBundle from ._models_py3 import SasDefinitionCreateParameters from ._models_py3 import SasDefinitionItem + from ._models_py3 import SasDefinitionListResult from ._models_py3 import SasDefinitionUpdateParameters from ._models_py3 import SecretAttributes from ._models_py3 import SecretBundle from ._models_py3 import SecretItem + from ._models_py3 import SecretListResult from ._models_py3 import SecretProperties from ._models_py3 import SecretRestoreParameters from ._models_py3 import SecretSetParameters @@ -84,6 +94,7 @@ from ._models_py3 import StorageAccountRegenerteKeyParameters from ._models_py3 import StorageAccountUpdateParameters from ._models_py3 import StorageBundle + from ._models_py3 import StorageListResult from ._models_py3 import StorageRestoreParameters from ._models_py3 import SubjectAlternativeNames from ._models_py3 import Trigger @@ -101,9 +112,11 @@ from ._models import CertificateCreateParameters from ._models import CertificateImportParameters from ._models import CertificateIssuerItem + from ._models import CertificateIssuerListResult from ._models import CertificateIssuerSetParameters from ._models import CertificateIssuerUpdateParameters from ._models import CertificateItem + from ._models import CertificateListResult from ._models import CertificateMergeParameters from ._models import CertificateOperation from ._models import CertificateOperationUpdateParameter @@ -114,14 +127,19 @@ from ._models import Contacts from ._models import DeletedCertificateBundle from ._models import DeletedCertificateItem + from ._models import DeletedCertificateListResult from ._models import DeletedKeyBundle from ._models import DeletedKeyItem + from ._models import DeletedKeyListResult from ._models import DeletedSasDefinitionBundle from ._models import DeletedSasDefinitionItem + from ._models import DeletedSasDefinitionListResult from ._models import DeletedSecretBundle from ._models import DeletedSecretItem + from ._models import DeletedSecretListResult from ._models import DeletedStorageAccountItem from ._models import DeletedStorageBundle + from ._models import DeletedStorageListResult from ._models import Error from ._models import IssuerAttributes from ._models import IssuerBundle @@ -133,6 +151,7 @@ from ._models import KeyCreateParameters from ._models import KeyImportParameters from ._models import KeyItem + from ._models import KeyListResult from ._models import KeyOperationResult from ._models import KeyOperationsParameters from ._models import KeyProperties @@ -149,10 +168,12 @@ from ._models import SasDefinitionBundle from ._models import SasDefinitionCreateParameters from ._models import SasDefinitionItem + from ._models import SasDefinitionListResult from ._models import SasDefinitionUpdateParameters from ._models import SecretAttributes from ._models import SecretBundle from ._models import SecretItem + from ._models import SecretListResult from ._models import SecretProperties from ._models import SecretRestoreParameters from ._models import SecretSetParameters @@ -163,21 +184,11 @@ from ._models import StorageAccountRegenerteKeyParameters from ._models import StorageAccountUpdateParameters from ._models import StorageBundle + from ._models import StorageListResult from ._models import StorageRestoreParameters from ._models import SubjectAlternativeNames from ._models import Trigger from ._models import X509CertificateProperties -from ._paged_models import CertificateIssuerItemPaged -from ._paged_models import CertificateItemPaged -from ._paged_models import DeletedCertificateItemPaged -from ._paged_models import DeletedKeyItemPaged -from ._paged_models import DeletedSasDefinitionItemPaged -from ._paged_models import DeletedSecretItemPaged -from ._paged_models import DeletedStorageAccountItemPaged -from ._paged_models import KeyItemPaged -from ._paged_models import SasDefinitionItemPaged -from ._paged_models import SecretItemPaged -from ._paged_models import StorageAccountItemPaged from ._key_vault_client_enums import ( JsonWebKeyType, JsonWebKeyCurveName, @@ -203,9 +214,11 @@ 'CertificateCreateParameters', 'CertificateImportParameters', 'CertificateIssuerItem', + 'CertificateIssuerListResult', 'CertificateIssuerSetParameters', 'CertificateIssuerUpdateParameters', 'CertificateItem', + 'CertificateListResult', 'CertificateMergeParameters', 'CertificateOperation', 'CertificateOperationUpdateParameter', @@ -216,14 +229,19 @@ 'Contacts', 'DeletedCertificateBundle', 'DeletedCertificateItem', + 'DeletedCertificateListResult', 'DeletedKeyBundle', 'DeletedKeyItem', + 'DeletedKeyListResult', 'DeletedSasDefinitionBundle', 'DeletedSasDefinitionItem', + 'DeletedSasDefinitionListResult', 'DeletedSecretBundle', 'DeletedSecretItem', + 'DeletedSecretListResult', 'DeletedStorageAccountItem', 'DeletedStorageBundle', + 'DeletedStorageListResult', 'Error', 'IssuerAttributes', 'IssuerBundle', @@ -235,6 +253,7 @@ 'KeyCreateParameters', 'KeyImportParameters', 'KeyItem', + 'KeyListResult', 'KeyOperationResult', 'KeyOperationsParameters', 'KeyProperties', @@ -251,10 +270,12 @@ 'SasDefinitionBundle', 'SasDefinitionCreateParameters', 'SasDefinitionItem', + 'SasDefinitionListResult', 'SasDefinitionUpdateParameters', 'SecretAttributes', 'SecretBundle', 'SecretItem', + 'SecretListResult', 'SecretProperties', 'SecretRestoreParameters', 'SecretSetParameters', @@ -265,21 +286,11 @@ 'StorageAccountRegenerteKeyParameters', 'StorageAccountUpdateParameters', 'StorageBundle', + 'StorageListResult', 'StorageRestoreParameters', 'SubjectAlternativeNames', 'Trigger', 'X509CertificateProperties', - 'KeyItemPaged', - 'DeletedKeyItemPaged', - 'SecretItemPaged', - 'DeletedSecretItemPaged', - 'CertificateItemPaged', - 'CertificateIssuerItemPaged', - 'DeletedCertificateItemPaged', - 'StorageAccountItemPaged', - 'DeletedStorageAccountItemPaged', - 'SasDefinitionItemPaged', - 'DeletedSasDefinitionItemPaged', 'JsonWebKeyType', 'JsonWebKeyCurveName', 'DeletionRecoveryLevel', 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 e02ddd417cdb..24dfe4beb6a9 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 @@ -385,6 +385,36 @@ def __init__(self, **kwargs): self.provider = kwargs.get('provider', None) +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -479,6 +509,35 @@ def __init__(self, **kwargs): self.x509_thumbprint = kwargs.get('x509_thumbprint', None) +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -867,6 +926,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -1037,6 +1125,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionBundle(Model): """A SAS definition bundle consists of key vault SAS definition details plus its attributes. @@ -1251,6 +1368,36 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSasDefinitionListResult(Model): + """The deleted SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted SAS + definitions in the vault along with a link to the next page of deleted sas + definitions + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :ivar next_link: The URL to get the next set of deleted SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1452,6 +1599,35 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageAccountItem(Model): """The storage account item containing storage account metadata. @@ -1662,6 +1838,37 @@ def __init__(self, **kwargs): self.deleted_date = None +class DeletedStorageListResult(Model): + """The deleted storage account list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted storage + accounts in the vault along with a link to the next page of deleted + storage accounts + :vartype value: + list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar next_link: The URL to get the next set of deleted storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(DeletedStorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -2023,6 +2230,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2451,6 +2687,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2534,6 +2799,35 @@ def __init__(self, **kwargs): self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2779,6 +3073,35 @@ def __init__(self, **kwargs): self.tags = kwargs.get('tags', None) +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs): + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageRestoreParameters(Model): """The secret restore parameters. 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 1f394c8f5f38..52f4aa981815 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 @@ -385,6 +385,36 @@ def __init__(self, *, id: str=None, provider: str=None, **kwargs) -> None: self.provider = provider +class CertificateIssuerListResult(Model): + """The certificate issuer list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificate issuers + in the key vault along with a link to the next page of certificate + issuers. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateIssuerItem] + :ivar next_link: The URL to get the next set of certificate issuers. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateIssuerItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateIssuerListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateIssuerSetParameters(Model): """The certificate issuer set parameters. @@ -479,6 +509,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.x509_thumbprint = x509_thumbprint +class CertificateListResult(Model): + """The certificate list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of certificates in the + key vault along with a link to the next page of certificates. + :vartype value: list[~azure.keyvault.v7_0.models.CertificateItem] + :ivar next_link: The URL to get the next set of certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[CertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(CertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class CertificateMergeParameters(Model): """The certificate merge parameters. @@ -867,6 +926,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, x509_thumbprint: self.deleted_date = None +class DeletedCertificateListResult(Model): + """A list of certificates that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted certificates + in the vault along with a link to the next page of deleted certificates + :vartype value: list[~azure.keyvault.v7_0.models.DeletedCertificateItem] + :ivar next_link: The URL to get the next set of deleted certificates. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedCertificateItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedCertificateListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyBundle(Model): """A KeyBundle consisting of a WebKey plus its attributes. @@ -1037,6 +1125,35 @@ def __init__(self, *, kid: str=None, attributes=None, tags=None, recovery_id: st self.deleted_date = None +class DeletedKeyListResult(Model): + """A list of keys that have been deleted in this vault. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of deleted keys in the + vault along with a link to the next page of deleted keys + :vartype value: list[~azure.keyvault.v7_0.models.DeletedKeyItem] + :ivar next_link: The URL to get the next set of deleted keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedKeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedKeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionBundle(Model): """A SAS definition bundle consists of key vault SAS definition details plus its attributes. @@ -1251,6 +1368,36 @@ def __init__(self, *, recovery_id: str=None, **kwargs) -> None: self.deleted_date = None +class DeletedSasDefinitionListResult(Model): + """The deleted SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted SAS + definitions in the vault along with a link to the next page of deleted sas + definitions + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + :ivar next_link: The URL to get the next set of deleted SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretBundle(Model): """A secret consisting of a value, id and its attributes. @@ -1452,6 +1599,35 @@ def __init__(self, *, id: str=None, attributes=None, tags=None, content_type: st self.deleted_date = None +class DeletedSecretListResult(Model): + """The deleted secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted secrets + in the vault along with a link to the next page of deleted secrets + :vartype value: list[~azure.keyvault.v7_0.models.DeletedSecretItem] + :ivar next_link: The URL to get the next set of deleted secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedSecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedSecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageAccountItem(Model): """The storage account item containing storage account metadata. @@ -1662,6 +1838,37 @@ def __init__(self, *, recovery_id: str=None, **kwargs) -> None: self.deleted_date = None +class DeletedStorageListResult(Model): + """The deleted storage account list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of the deleted storage + accounts in the vault along with a link to the next page of deleted + storage accounts + :vartype value: + list[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + :ivar next_link: The URL to get the next set of deleted storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DeletedStorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(DeletedStorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class Error(Model): """The key vault server error. @@ -2023,6 +2230,35 @@ def __init__(self, *, key, hsm: bool=None, key_attributes=None, tags=None, **kwa self.tags = tags +class KeyListResult(Model): + """The key list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of keys in the key vault + along with a link to the next page of keys. + :vartype value: list[~azure.keyvault.v7_0.models.KeyItem] + :ivar next_link: The URL to get the next set of keys. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[KeyItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(KeyListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class KeyOperationResult(Model): """The key operation result. @@ -2451,6 +2687,35 @@ def __init__(self, *, template_uri: str, sas_type, validity_period: str, sas_def self.tags = tags +class SasDefinitionListResult(Model): + """The storage account SAS definition list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of SAS definitions along + with a link to the next page of SAS definitions. + :vartype value: list[~azure.keyvault.v7_0.models.SasDefinitionItem] + :ivar next_link: The URL to get the next set of SAS definitions. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SasDefinitionItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SasDefinitionListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SasDefinitionUpdateParameters(Model): """The SAS definition update parameters. @@ -2534,6 +2799,35 @@ def __init__(self, *, enabled: bool=None, not_before=None, expires=None, **kwarg self.recovery_level = None +class SecretListResult(Model): + """The secret list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of secrets in the key + vault along with a link to the next page of secrets. + :vartype value: list[~azure.keyvault.v7_0.models.SecretItem] + :ivar next_link: The URL to get the next set of secrets. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SecretItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(SecretListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class SecretProperties(Model): """Properties of the key backing a certificate. @@ -2779,6 +3073,35 @@ def __init__(self, *, active_key_name: str=None, auto_regenerate_key: bool=None, self.tags = tags +class StorageListResult(Model): + """The storage accounts list result. + + Variables are only populated by the server, and will be ignored when + sending a request. + + :ivar value: A response message containing a list of storage accounts in + the key vault along with a link to the next page of storage accounts. + :vartype value: list[~azure.keyvault.v7_0.models.StorageAccountItem] + :ivar next_link: The URL to get the next set of storage accounts. + :vartype next_link: str + """ + + _validation = { + 'value': {'readonly': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[StorageAccountItem]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__(self, **kwargs) -> None: + super(StorageListResult, self).__init__(**kwargs) + self.value = None + self.next_link = None + + class StorageRestoreParameters(Model): """The secret restore parameters. diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_paged_models.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_paged_models.py deleted file mode 100644 index 0fbf874da2a7..000000000000 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/_generated/v7_0/models/_paged_models.py +++ /dev/null @@ -1,157 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. -# -------------------------------------------------------------------------- - -from azure.core.paging import Paged - - -class KeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`KeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[KeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(KeyItemPaged, self).__init__(*args, **kwargs) -class DeletedKeyItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedKeyItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedKeyItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedKeyItemPaged, self).__init__(*args, **kwargs) -class SecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SecretItemPaged, self).__init__(*args, **kwargs) -class DeletedSecretItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSecretItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSecretItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSecretItemPaged, self).__init__(*args, **kwargs) -class CertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateItemPaged, self).__init__(*args, **kwargs) -class CertificateIssuerItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`CertificateIssuerItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[CertificateIssuerItem]'} - } - - def __init__(self, *args, **kwargs): - - super(CertificateIssuerItemPaged, self).__init__(*args, **kwargs) -class DeletedCertificateItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedCertificateItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedCertificateItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedCertificateItemPaged, self).__init__(*args, **kwargs) -class StorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`StorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[StorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(StorageAccountItemPaged, self).__init__(*args, **kwargs) -class DeletedStorageAccountItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedStorageAccountItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedStorageAccountItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedStorageAccountItemPaged, self).__init__(*args, **kwargs) -class SasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`SasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[SasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(SasDefinitionItemPaged, self).__init__(*args, **kwargs) -class DeletedSasDefinitionItemPaged(Paged): - """ - A paging container for iterating over a list of :class:`DeletedSasDefinitionItem ` object - """ - - _attribute_map = { - 'next_link': {'key': 'nextLink', 'type': 'str'}, - 'current_page': {'key': 'value', 'type': '[DeletedSasDefinitionItem]'} - } - - def __init__(self, *args, **kwargs): - - super(DeletedSasDefinitionItemPaged, self).__init__(*args, **kwargs) 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 c0e15566f02e..d52fb73651e7 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 @@ -10,6 +10,7 @@ # -------------------------------------------------------------------------- from azure.core.exceptions import map_error +from azure.core.paging import ItemPaged from .. import models import uuid @@ -77,8 +78,6 @@ def create_key(self, vault_base_url, key_name, kty, key_size=None, key_ops=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyCreateParameters') @@ -153,8 +152,6 @@ def import_key(self, vault_base_url, key_name, key, hsm=None, key_attributes=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyImportParameters') @@ -217,8 +214,6 @@ def delete_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -293,8 +288,6 @@ def update_key(self, vault_base_url, key_name, key_version, key_ops=None, key_at header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyUpdateParameters') @@ -359,8 +352,6 @@ def get_key(self, vault_base_url, key_name, key_version, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -398,11 +389,12 @@ def get_key_versions( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_key_versions.metadata['url'] @@ -411,46 +403,43 @@ def prepare_request(next_link=None): 'key-name': self._serialize.url("key_name", key_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_key_versions.metadata = {'url': '/keys/{key-name}/versions'} def get_keys( @@ -472,11 +461,12 @@ def get_keys( :type maxresults: int :return: An iterator like instance of KeyItem :rtype: - ~azure.keyvault.v7_0.models.KeyItemPaged[~azure.keyvault.v7_0.models.KeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.KeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_keys.metadata['url'] @@ -484,46 +474,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('KeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.KeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_keys.metadata = {'url': '/keys'} def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -575,8 +562,6 @@ def backup_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -648,8 +633,6 @@ def restore_key(self, vault_base_url, key_bundle_backup, cls=None, **kwargs): header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyRestoreParameters') @@ -730,8 +713,6 @@ def encrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -809,8 +790,6 @@ def decrypt(self, vault_base_url, key_name, key_version, algorithm, value, cls=N header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -886,8 +865,6 @@ def sign(self, vault_base_url, key_name, key_version, algorithm, value, cls=None header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeySignParameters') @@ -969,8 +946,6 @@ def verify(self, vault_base_url, key_name, key_version, algorithm, digest, signa header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyVerifyParameters') @@ -1048,8 +1023,6 @@ def wrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cls= header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1125,8 +1098,6 @@ def unwrap_key(self, vault_base_url, key_name, key_version, algorithm, value, cl header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'KeyOperationsParameters') @@ -1170,11 +1141,12 @@ def get_deleted_keys( :type maxresults: int :return: An iterator like instance of DeletedKeyItem :rtype: - ~azure.keyvault.v7_0.models.DeletedKeyItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedKeyItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_keys.metadata['url'] @@ -1182,46 +1154,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedKeyListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedKeyItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_keys.metadata = {'url': '/deletedkeys'} def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): @@ -1262,8 +1231,6 @@ def get_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1321,8 +1288,6 @@ def purge_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1378,8 +1343,6 @@ def recover_deleted_key(self, vault_base_url, key_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -1449,8 +1412,6 @@ def set_secret(self, vault_base_url, secret_name, value, tags=None, content_type header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretSetParameters') @@ -1511,8 +1472,6 @@ def delete_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -1585,8 +1544,6 @@ def update_secret(self, vault_base_url, secret_name, secret_version, content_typ header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretUpdateParameters') @@ -1649,8 +1606,6 @@ def get_secret(self, vault_base_url, secret_name, secret_version, cls=None, **kw header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1688,11 +1643,12 @@ def get_secrets( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secrets.metadata['url'] @@ -1700,46 +1656,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secrets.metadata = {'url': '/secrets'} def get_secret_versions( @@ -1760,11 +1713,12 @@ def get_secret_versions( :type maxresults: int :return: An iterator like instance of SecretItem :rtype: - ~azure.keyvault.v7_0.models.SecretItemPaged[~azure.keyvault.v7_0.models.SecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_secret_versions.metadata['url'] @@ -1773,46 +1727,43 @@ def prepare_request(next_link=None): 'secret-name': self._serialize.url("secret_name", secret_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_secret_versions.metadata = {'url': '/secrets/{secret-name}/versions'} def get_deleted_secrets( @@ -1831,11 +1782,12 @@ def get_deleted_secrets( :type maxresults: int :return: An iterator like instance of DeletedSecretItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSecretItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSecretItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_secrets.metadata['url'] @@ -1843,46 +1795,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSecretListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSecretItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_secrets.metadata = {'url': '/deletedsecrets'} def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): @@ -1922,8 +1871,6 @@ def get_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -1981,8 +1928,6 @@ def purge_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2035,8 +1980,6 @@ def recover_deleted_secret(self, vault_base_url, secret_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2094,8 +2037,6 @@ def backup_secret(self, vault_base_url, secret_name, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -2155,8 +2096,6 @@ def restore_secret(self, vault_base_url, secret_bundle_backup, cls=None, **kwarg header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SecretRestoreParameters') @@ -2199,11 +2138,12 @@ def get_certificates( :type include_pending: bool :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificates.metadata['url'] @@ -2211,9 +2151,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -2222,37 +2159,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificates.metadata = {'url': '/certificates'} def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -2293,8 +2230,6 @@ def delete_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2353,8 +2288,6 @@ def set_certificate_contacts(self, vault_base_url, contact_list=None, cls=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(contacts, 'Contacts') @@ -2412,8 +2345,6 @@ def get_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2467,8 +2398,6 @@ def delete_certificate_contacts(self, vault_base_url, cls=None, **kwargs): header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2505,11 +2434,12 @@ def get_certificate_issuers( :type maxresults: int :return: An iterator like instance of CertificateIssuerItem :rtype: - ~azure.keyvault.v7_0.models.CertificateIssuerItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateIssuerItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_issuers.metadata['url'] @@ -2517,46 +2447,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateIssuerListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateIssuerItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_issuers.metadata = {'url': '/certificates/issuers'} def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credentials=None, organization_details=None, attributes=None, cls=None, **kwargs): @@ -2609,8 +2536,6 @@ def set_certificate_issuer(self, vault_base_url, issuer_name, provider, credenti header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerSetParameters') @@ -2684,8 +2609,6 @@ def update_certificate_issuer(self, vault_base_url, issuer_name, provider=None, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameter, 'CertificateIssuerUpdateParameters') @@ -2746,8 +2669,6 @@ def get_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwargs header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -2805,8 +2726,6 @@ def delete_certificate_issuer(self, vault_base_url, issuer_name, cls=None, **kwa header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -2876,8 +2795,6 @@ def create_certificate(self, vault_base_url, certificate_name, certificate_polic header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateCreateParameters') @@ -2960,8 +2877,6 @@ def import_certificate(self, vault_base_url, certificate_name, base64_encoded_ce header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateImportParameters') @@ -3003,11 +2918,12 @@ def get_certificate_versions( :type maxresults: int :return: An iterator like instance of CertificateItem :rtype: - ~azure.keyvault.v7_0.models.CertificateItemPaged[~azure.keyvault.v7_0.models.CertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.CertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_certificate_versions.metadata['url'] @@ -3016,46 +2932,43 @@ def prepare_request(next_link=None): 'certificate-name': self._serialize.url("certificate_name", certificate_name, 'str') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('CertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.CertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_certificate_versions.metadata = {'url': '/certificates/{certificate-name}/versions'} def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3096,8 +3009,6 @@ def get_certificate_policy(self, vault_base_url, certificate_name, cls=None, **k header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3159,8 +3070,6 @@ def update_certificate_policy(self, vault_base_url, certificate_name, certificat header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_policy, 'CertificatePolicy') @@ -3238,8 +3147,6 @@ def update_certificate(self, vault_base_url, certificate_name, certificate_versi header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateUpdateParameters') @@ -3303,8 +3210,6 @@ def get_certificate(self, vault_base_url, certificate_name, certificate_version, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3367,8 +3272,6 @@ def update_certificate_operation(self, vault_base_url, certificate_name, cancell header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(certificate_operation, 'CertificateOperationUpdateParameter') @@ -3428,8 +3331,6 @@ def get_certificate_operation(self, vault_base_url, certificate_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3487,8 +3388,6 @@ def delete_certificate_operation(self, vault_base_url, certificate_name, cls=Non header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3560,8 +3459,6 @@ def merge_certificate(self, vault_base_url, certificate_name, x509_certificates, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateMergeParameters') @@ -3622,8 +3519,6 @@ def backup_certificate(self, vault_base_url, certificate_name, cls=None, **kwarg header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3683,8 +3578,6 @@ def restore_certificate(self, vault_base_url, certificate_bundle_backup, cls=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'CertificateRestoreParameters') @@ -3730,11 +3623,12 @@ def get_deleted_certificates( :type include_pending: bool :return: An iterator like instance of DeletedCertificateItem :rtype: - ~azure.keyvault.v7_0.models.DeletedCertificateItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedCertificateItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_certificates.metadata['url'] @@ -3742,9 +3636,6 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) if include_pending is not None: @@ -3753,37 +3644,37 @@ def prepare_request(next_link=None): else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedCertificateListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedCertificateItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_certificates.metadata = {'url': '/deletedcertificates'} def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, **kwargs): @@ -3824,8 +3715,6 @@ def get_deleted_certificate(self, vault_base_url, certificate_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -3883,8 +3772,6 @@ def purge_deleted_certificate(self, vault_base_url, certificate_name, cls=None, header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -3940,8 +3827,6 @@ def recover_deleted_certificate(self, vault_base_url, certificate_name, cls=None header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -3975,11 +3860,12 @@ def get_storage_accounts( :type maxresults: int :return: An iterator like instance of StorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.StorageAccountItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.StorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_storage_accounts.metadata['url'] @@ -3987,46 +3873,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('StorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.StorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_storage_accounts.metadata = {'url': '/storage'} def get_deleted_storage_accounts( @@ -4045,11 +3928,12 @@ def get_deleted_storage_accounts( :type maxresults: int :return: An iterator like instance of DeletedStorageAccountItem :rtype: - ~azure.keyvault.v7_0.models.DeletedStorageAccountItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedStorageAccountItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_storage_accounts.metadata['url'] @@ -4057,46 +3941,43 @@ def prepare_request(next_link=None): 'vaultBaseUrl': self._serialize.url("vault_base_url", vault_base_url, 'str', skip_quote=True) } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedStorageListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedStorageAccountItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_storage_accounts.metadata = {'url': '/deletedstorage'} def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls=None, **kwargs): @@ -4136,8 +4017,6 @@ def get_deleted_storage_account(self, vault_base_url, storage_account_name, cls= header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4195,8 +4074,6 @@ def purge_deleted_storage_account(self, vault_base_url, storage_account_name, cl header_parameters = {} if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4249,8 +4126,6 @@ def recover_deleted_storage_account(self, vault_base_url, storage_account_name, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4307,8 +4182,6 @@ def backup_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -4368,8 +4241,6 @@ def restore_storage_account(self, vault_base_url, storage_bundle_backup, cls=Non header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageRestoreParameters') @@ -4427,8 +4298,6 @@ def delete_storage_account(self, vault_base_url, storage_account_name, cls=None, header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -4483,8 +4352,6 @@ def get_storage_account(self, vault_base_url, storage_account_name, cls=None, ** header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4559,8 +4426,6 @@ def set_storage_account(self, vault_base_url, storage_account_name, resource_id, header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountCreateParameters') @@ -4636,8 +4501,6 @@ def update_storage_account(self, vault_base_url, storage_account_name, active_ke header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountUpdateParameters') @@ -4700,8 +4563,6 @@ def regenerate_storage_account_key(self, vault_base_url, storage_account_name, k header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'StorageAccountRegenerteKeyParameters') @@ -4740,11 +4601,12 @@ def get_sas_definitions( :type maxresults: int :return: An iterator like instance of SasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.SasDefinitionItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.SasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_sas_definitions.metadata['url'] @@ -4753,46 +4615,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('SasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.SasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_sas_definitions.metadata = {'url': '/storage/{storage-account-name}/sas'} def get_deleted_sas_definitions( @@ -4814,11 +4673,12 @@ def get_deleted_sas_definitions( :type maxresults: int :return: An iterator like instance of DeletedSasDefinitionItem :rtype: - ~azure.keyvault.v7_0.models.DeletedSasDefinitionItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] + ~azure.core.paging.ItemPaged[~azure.keyvault.v7_0.models.DeletedSasDefinitionItem] :raises: :class:`KeyVaultErrorException` """ def prepare_request(next_link=None): + query_parameters = {} if not next_link: # Construct URL url = self.get_deleted_sas_definitions.metadata['url'] @@ -4827,46 +4687,43 @@ def prepare_request(next_link=None): 'storage-account-name': self._serialize.url("storage_account_name", storage_account_name, 'str', pattern=r'^[0-9a-zA-Z]+$') } url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} if maxresults is not None: query_parameters['maxresults'] = self._serialize.query("maxresults", maxresults, 'int', maximum=25, minimum=1) query_parameters['api-version'] = self._serialize.query("self.api_version", self.api_version, 'str') else: url = next_link - query_parameters = {} # Construct headers header_parameters = {} header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) return request - def internal_paging(next_link=None): - error_map = kwargs.pop('error_map', None) + def extract_data(response): + deserialized = self._deserialize('DeletedSasDefinitionListResult', response) + return deserialized.next_link, iter(deserialized.value) + + def get_next(next_link=None): request = prepare_request(next_link) pipeline_response = self._client._pipeline.run(request) response = pipeline_response.http_response + error_map = kwargs.pop('error_map', None) if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) raise models.KeyVaultErrorException(response, self._deserialize) - return response # Deserialize response - deserialized = models.DeletedSasDefinitionItemPaged(internal_paging, self._deserialize) - - return deserialized + return ItemPaged( + get_next, extract_data + ) get_deleted_sas_definitions.metadata = {'url': '/deletedstorage/{storage-account-name}/sas'} def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_definition_name, cls=None, **kwargs): @@ -4909,8 +4766,6 @@ def get_deleted_sas_definition(self, vault_base_url, storage_account_name, sas_d header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -4971,8 +4826,6 @@ def recover_deleted_sas_definition(self, vault_base_url, storage_account_name, s header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.post(url, query_parameters, header_parameters) @@ -5030,8 +4883,6 @@ def delete_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.delete(url, query_parameters, header_parameters) @@ -5089,8 +4940,6 @@ def get_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Accept'] = 'application/json' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct and send request request = self._client.get(url, query_parameters, header_parameters) @@ -5168,8 +5017,6 @@ def set_sas_definition(self, vault_base_url, storage_account_name, sas_definitio header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionCreateParameters') @@ -5250,8 +5097,6 @@ def update_sas_definition(self, vault_base_url, storage_account_name, sas_defini header_parameters['Content-Type'] = 'application/json; charset=utf-8' if self._config.generate_client_request_id: header_parameters['x-ms-client-request-id'] = str(uuid.uuid1()) - if self._config.accept_language is not None: - header_parameters['accept-language'] = self._serialize.header("self._config.accept_language", self._config.accept_language, 'str') # Construct body body_content = self._serialize.body(parameters, 'SasDefinitionUpdateParameters') 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 a24761a6afe6..dd2c6f0a9b95 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 @@ -2,10 +2,10 @@ # Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # ------------------------------------ -from typing import Any, Callable, Mapping, TYPE_CHECKING -from azure.core.async_paging import AsyncPagedMixin +from typing import Any, Callable, Mapping, AsyncIterator, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import AsyncPipeline +from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy from azure.core.pipeline.transport import AsyncioRequestsTransport, HttpTransport from msrest.serialization import Model @@ -22,10 +22,10 @@ class AsyncPagingAdapter: - """For each item in an AsyncPagedMixin, returns the result of applying fn to that item. + """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: AsyncPagedMixin, fn: Callable[[Model], Any]) -> None: + def __init__(self, pages: AsyncIterator, fn: Callable[[Model], Any]) -> None: self._pages = pages self._fn = fn @@ -100,6 +100,7 @@ def _build_pipeline(config: Configuration, transport: HttpTransport, **kwargs: A config.retry_policy, config.authentication_policy, config.logging_policy, + DistributedTracingPolicy(), ] if transport is None: diff --git a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/client_base.py b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/client_base.py index 6a3253c77655..dbde6d74f640 100644 --- a/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/client_base.py +++ b/sdk/keyvault/azure-keyvault-secrets/azure/keyvault/secrets/_shared/client_base.py @@ -15,6 +15,7 @@ from azure.core.pipeline.transport import HttpTransport from .challenge_auth_policy import ChallengeAuthPolicy +from azure.core.pipeline.policies.distributed_tracing import DistributedTracingPolicy KEY_VAULT_SCOPE = "https://vault.azure.net/.default" @@ -73,6 +74,7 @@ def _build_pipeline(self, config, transport, **kwargs): config.retry_policy, config.authentication_policy, config.logging_policy, + DistributedTracingPolicy(), ] if transport is None: 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 d7cf860c4309..89a0fa98836e 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 @@ -6,6 +6,8 @@ from typing import Any, AsyncIterable, Mapping, Optional, Dict from azure.core.exceptions import ResourceExistsError, ResourceNotFoundError +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.keyvault.secrets._models import Secret, DeletedSecret, SecretAttributes from .._shared import AsyncKeyVaultClientBase, AsyncPagingAdapter @@ -25,6 +27,7 @@ class SecretClient(AsyncKeyVaultClientBase): # pylint:disable=protected-access + @distributed_trace_async async def get_secret(self, name: str, version: Optional[str] = None, **kwargs: Mapping[str, Any]) -> Secret: """Get a specified secret from the vault. @@ -51,6 +54,7 @@ async def get_secret(self, name: str, version: Optional[str] = None, **kwargs: M ) return Secret._from_secret_bundle(bundle) + @distributed_trace_async async def set_secret( self, name: str, @@ -99,6 +103,7 @@ async def set_secret( ) return Secret._from_secret_bundle(bundle) + @distributed_trace_async async def update_secret( self, name: str, @@ -155,6 +160,7 @@ async def update_secret( ) return SecretAttributes._from_secret_bundle(bundle) # pylint: disable=protected-access + @distributed_trace def list_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[SecretAttributes]: """List secrets in the vault. @@ -180,6 +186,7 @@ def list_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[SecretAttri iterable = AsyncPagingAdapter(pages, SecretAttributes._from_secret_item) return iterable + @distributed_trace def list_secret_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncIterable[SecretAttributes]: """List all versions of the specified secret. @@ -205,6 +212,7 @@ def list_secret_versions(self, name: str, **kwargs: Mapping[str, Any]) -> AsyncI iterable = AsyncPagingAdapter(pages, SecretAttributes._from_secret_item) return iterable + @distributed_trace_async async def backup_secret(self, name: str, **kwargs: Mapping[str, Any]) -> bytes: """Backs up the specified secret. @@ -230,6 +238,7 @@ async def backup_secret(self, name: str, **kwargs: Mapping[str, Any]) -> bytes: ) return backup_result.value + @distributed_trace_async async def restore_secret(self, backup: bytes, **kwargs: Mapping[str, Any]) -> SecretAttributes: """Restores a backed up secret to a vault. @@ -254,6 +263,7 @@ async def restore_secret(self, backup: bytes, **kwargs: Mapping[str, Any]) -> Se ) return SecretAttributes._from_secret_bundle(bundle) + @distributed_trace_async async def delete_secret(self, name: str, **kwargs: Mapping[str, Any]) -> DeletedSecret: """Deletes a secret from the vault. @@ -279,6 +289,7 @@ async def delete_secret(self, name: str, **kwargs: Mapping[str, Any]) -> Deleted ) return DeletedSecret._from_deleted_secret_bundle(bundle) + @distributed_trace_async async def get_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> DeletedSecret: """Gets the specified deleted secret. @@ -303,6 +314,7 @@ async def get_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> De ) return DeletedSecret._from_deleted_secret_bundle(bundle) + @distributed_trace def list_deleted_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[DeletedSecret]: """Lists deleted secrets of the vault. @@ -327,6 +339,7 @@ def list_deleted_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[Del iterable = AsyncPagingAdapter(pages, DeletedSecret._from_deleted_secret_item) return iterable + @distributed_trace_async async def purge_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> None: """Permanently deletes the specified secret. @@ -347,6 +360,7 @@ async def purge_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> """ await self._client.purge_deleted_secret(self.vault_url, name, **kwargs) + @distributed_trace_async async def recover_deleted_secret(self, name: str, **kwargs: Mapping[str, Any]) -> SecretAttributes: """Recovers the deleted secret to the latest version. diff --git a/sdk/keyvault/azure-keyvault-secrets/tests/secrets_vault_client_async.py b/sdk/keyvault/azure-keyvault-secrets/tests/secrets_vault_client_async.py index 73578320e809..a374f9a3782c 100644 --- a/sdk/keyvault/azure-keyvault-secrets/tests/secrets_vault_client_async.py +++ b/sdk/keyvault/azure-keyvault-secrets/tests/secrets_vault_client_async.py @@ -3,7 +3,6 @@ # Licensed under the MIT License. # ------------------------------------ from typing import Any, Callable, Mapping, TYPE_CHECKING -from azure.core.async_paging import AsyncPagedMixin from azure.core.configuration import Configuration from azure.core.pipeline import AsyncPipeline from azure.core.pipeline.policies import AsyncBearerTokenCredentialPolicy diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py index a73f3696aaa4..cb9088a6035a 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/blob_service_client.py @@ -14,6 +14,8 @@ except ImportError: from urlparse import urlparse # type: ignore +from azure.core.paging import ItemPaged + from ._shared.shared_access_signature import SharedAccessSignature from ._shared.models import LocationMode, Services from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query @@ -382,12 +384,11 @@ def set_service_properties( def list_containers( self, name_starts_with=None, # type: Optional[str] include_metadata=False, # type: Optional[bool] - marker=None, # type: Optional[str] results_per_page=None, # type: Optional[int] timeout=None, # type: Optional[int] **kwargs ): - # type: (...) -> ContainerPropertiesPaged + # type: (...) -> ItemPaged[ContainerProperties] """Returns a generator to list the containers under the specified account. The generator will lazily follow the continuation tokens returned by @@ -399,17 +400,13 @@ def list_containers( :param bool include_metadata: Specifies that container metadata be returned in the response. The default value is `False`. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int results_per_page: The maximum number of container names to retrieve per API call. If the request does not specify the server will return up to 5,000 items. :param int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) of ContainerProperties. - :rtype: ~azure.core.blob.models.ContainerPropertiesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.core.blob.models.ContainerProperties] Example: .. literalinclude:: ../tests/test_blob_samples_service.py @@ -426,8 +423,8 @@ def list_containers( include=include, timeout=timeout, **kwargs) - return ContainerPropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, page_iterator_class=ContainerPropertiesPaged) @distributed_trace def create_container( diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py b/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py index 32711aceec3a..c3d5a549f4e2 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/container_client.py @@ -16,6 +16,8 @@ from urlparse import urlparse # type: ignore from urllib2 import quote, unquote # type: ignore +from azure.core.paging import ItemPaged + import six from ._shared.shared_access_signature import BlobSharedAccessSignature @@ -665,8 +667,8 @@ def set_container_access_policy( process_storage_error(error) @distributed_trace - def list_blobs(self, name_starts_with=None, include=None, marker=None, timeout=None, **kwargs): - # type: (Optional[str], Optional[Any], Optional[str], Optional[int], **Any) -> Iterable[BlobProperties] + def list_blobs(self, name_starts_with=None, include=None, timeout=None, **kwargs): + # type: (Optional[str], Optional[Any], Optional[int], **Any) -> ItemPaged[BlobProperties] """Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service. @@ -677,14 +679,10 @@ def list_blobs(self, name_starts_with=None, include=None, marker=None, timeout=N :param list[str] include: Specifies one or more additional datasets to include in the response. Options include: 'snapshots', 'metadata', 'uncommittedblobs', 'copy', 'deleted'. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) response of BlobProperties. - :rtype: ~azure.storage.blob.models.BlobPropertiesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.models.BlobProperties] Example: .. literalinclude:: ../tests/test_blob_samples_containers.py @@ -703,18 +701,20 @@ def list_blobs(self, name_starts_with=None, include=None, marker=None, timeout=N include=include, timeout=timeout, **kwargs) - return BlobPropertiesPaged(command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=BlobPropertiesPaged) + @distributed_trace def walk_blobs( self, name_starts_with=None, # type: Optional[str] include=None, # type: Optional[Any] delimiter="/", # type: str - marker=None, # type: Optional[str] timeout=None, # type: Optional[int] **kwargs # type: Optional[Any] ): - # type: (...) -> Iterable[BlobProperties] + # type: (...) -> ItemPaged[BlobProperties] """Returns a generator to list the blobs under the specified container. The generator will lazily follow the continuation tokens returned by the service. This operation will list blobs in accordance with a hierarchy, @@ -731,20 +731,15 @@ def walk_blobs( element in the response body that acts as a placeholder for all blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single character or a string. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) response of BlobProperties. - :rtype: ~azure.storage.blob.models.BlobPrefix + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.blob.models.BlobProperties] """ if include and not isinstance(include, list): include = [include] results_per_page = kwargs.pop('results_per_page', None) - marker = kwargs.pop('marker', "") command = functools.partial( self._client.container.list_blob_hierarchy_segment, delimiter=delimiter, @@ -755,7 +750,6 @@ def walk_blobs( command, prefix=name_starts_with, results_per_page=results_per_page, - marker=marker, delimiter=delimiter) @distributed_trace diff --git a/sdk/storage/azure-storage-blob/azure/storage/blob/models.py b/sdk/storage/azure-storage-blob/azure/storage/blob/models.py index e03ace31284b..d7c037d40931 100644 --- a/sdk/storage/azure-storage-blob/azure/storage/blob/models.py +++ b/sdk/storage/azure-storage-blob/azure/storage/blob/models.py @@ -9,7 +9,7 @@ from enum import Enum from typing import List, Any, TYPE_CHECKING # pylint: disable=unused-import -from azure.core.paging import Paged +from azure.core.paging import PageIterator, ItemPaged from ._shared import decode_base64_to_text from ._shared.response_handlers import return_context_and_deserialized, process_storage_error @@ -285,14 +285,14 @@ def _from_generated(cls, generated): return props -class ContainerPropertiesPaged(Paged): +class ContainerPropertiesPaged(PageIterator): """An Iterable of Container properties. :ivar str service_endpoint: The service URL. :ivar str prefix: A container name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -303,53 +303,45 @@ class ContainerPropertiesPaged(Paged): begin with the specified prefix. :param int results_per_page: The maximum number of container names to retrieve per call. - :param str marker: An opaque continuation token. - """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None): - super(ContainerPropertiesPaged, self).__init__(command, None) + :param str continuation_token: An opaque continuation token. + """ + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(ContainerPropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - def _advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( - marker=self.next_marker or None, + return self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results - self.current_page = self._response.container_items - self.next_marker = self._response.next_marker or None - return self.current_page + self.current_page = [self._build_item(item) for item in self._response.container_items] - def __next__(self): # type: ignore - item = super(ContainerPropertiesPaged, self).__next__() - if isinstance(item, ContainerProperties): - return item - return ContainerProperties._from_generated(item) # pylint: disable=protected-access + return self._response.next_marker or None, self.current_page - next = __next__ + @staticmethod + def _build_item(item): + return ContainerProperties._from_generated(item) # pylint: disable=protected-access class BlobProperties(DictMixin): @@ -467,14 +459,14 @@ def _from_generated(cls, generated): return blob -class BlobPropertiesPaged(Paged): +class BlobPropertiesPaged(PageIterator): """An Iterable of Blob properties. :ivar str service_endpoint: The service URL. :ivar str prefix: A blob name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -487,7 +479,7 @@ class BlobPropertiesPaged(Paged): begin with the specified prefix. :param int results_per_page: The maximum number of blobs to retrieve per call. - :param str marker: An opaque continuation token. + :param str continuation_token: An opaque continuation token. :param str delimiter: Used to capture blobs whose names begin with the same substring up to the appearance of the delimiter character. The delimiter may be a single @@ -501,55 +493,48 @@ def __init__( container=None, prefix=None, results_per_page=None, - marker=None, + continuation_token=None, delimiter=None, location_mode=None): - super(BlobPropertiesPaged, self).__init__(command, None) + super(BlobPropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.container = container self.delimiter = delimiter self.current_page = None self.location_mode = location_mode - def _advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 - + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( + return self._command( prefix=self.prefix, - marker=self.next_marker or None, + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results - self.current_page = self._response.segment.blob_items - self.next_marker = self._response.next_marker or None self.container = self._response.container_name + self.current_page = [self._build_item(item) for item in self._response.segment.blob_items] self.delimiter = self._response.delimiter - return self.current_page - def __next__(self): - item = super(BlobPropertiesPaged, self).__next__() + return self._response.next_marker or None, self.current_page + + def _build_item(self, item): if isinstance(item, BlobProperties): return item if isinstance(item, BlobItem): @@ -558,10 +543,8 @@ def __next__(self): return blob return item - next = __next__ - -class BlobPrefix(BlobPropertiesPaged, DictMixin): +class BlobPrefix(ItemPaged, DictMixin): """An Iterable of Blob properties. Returned from walk_blobs when a delimiter is used. @@ -570,7 +553,7 @@ class BlobPrefix(BlobPropertiesPaged, DictMixin): :ivar str name: The prefix, or "directory name" of the blob. :ivar str service_endpoint: The service URL. :ivar str prefix: A blob name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. :ivar str next_marker: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available @@ -595,51 +578,37 @@ class BlobPrefix(BlobPropertiesPaged, DictMixin): Options include 'primary' or 'secondary'. """ def __init__(self, *args, **kwargs): - super(BlobPrefix, self).__init__(*args, **kwargs) + super(BlobPrefix, self).__init__(*args, page_iterator_class=BlobPrefixPaged, **kwargs) + self.name = kwargs.get('prefix') + self.prefix = kwargs.get('prefix') + self.results_per_page = kwargs.get('results_per_page') + self.container = kwargs.get('container') + self.delimiter = kwargs.get('delimiter') + self.location_mode = kwargs.get('location_mode') + +class BlobPrefixPaged(BlobPropertiesPaged): + def __init__(self, *args, **kwargs): + super(BlobPrefixPaged, self).__init__(*args, **kwargs) self.name = self.prefix - def _advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 - self.location_mode, self._response = self._get_next( - prefix=self.prefix, - marker=self.next_marker or None, - maxresults=self.results_per_page, - cls=return_context_and_deserialized, - use_location=self.location_mode) - self.service_endpoint = self._response.service_endpoint - self.prefix = self._response.prefix - self.current_marker = self._response.marker - self.results_per_page = self._response.max_results - self.current_page = self._response.segment.blob_prefixes - self.current_page.extend(self._response.segment.blob_items) - self.next_marker = self._response.next_marker or None - self.container = self._response.container_name - self.delimiter = self._response.delimiter + def _extract_data_cb(self, get_next_return): + continuation_token, _ = super(BlobPrefixPaged, self)._extract_data_cb(get_next_return) + self.current_page = self._response.segment.blob_prefixes + self._response.segment.blob_items + self.current_page = [self._build_item(item) for item in self.current_page] - def __next__(self): - item = super(BlobPrefix, self).__next__() + return continuation_token, self.current_page + + def _build_item(self, item): + item = super(BlobPrefixPaged, self)._build_item(item) if isinstance(item, GenBlobPrefix): return BlobPrefix( - self._get_next, + self._command, container=self.container, prefix=item.name, results_per_page=self.results_per_page, location_mode=self.location_mode) return item - next = __next__ - - class LeaseProperties(DictMixin): """Blob Lease Properties. diff --git a/sdk/storage/azure-storage-blob/tests/test_container.py b/sdk/storage/azure-storage-blob/tests/test_container.py index 889e270dd662..a22b8e50f62a 100644 --- a/sdk/storage/azure-storage-blob/tests/test_container.py +++ b/sdk/storage/azure-storage-blob/tests/test_container.py @@ -120,7 +120,7 @@ def test_create_container_with_public_access_blob(self): blob = container.get_blob_client("blob1") blob.upload_blob(u'xyz') - + anonymous_service = BlobClient( self._get_account_url(), container=container_name, @@ -247,15 +247,12 @@ def test_list_containers_with_num_results_and_marker(self): container_names.sort() # Act - generator1 = self.bsc.list_containers(name_starts_with=prefix, results_per_page=2) - next(generator1) + generator1 = self.bsc.list_containers(name_starts_with=prefix, results_per_page=2).by_page() + containers1 = list(next(generator1)) generator2 = self.bsc.list_containers( - name_starts_with=prefix, marker=generator1.next_marker, results_per_page=2) - next(generator2) - - containers1 = list(generator1.current_page) - containers2 = list(generator2.current_page) + name_starts_with=prefix, results_per_page=2).by_page(generator1.continuation_token) + containers2 = list(next(generator2)) # Assert self.assertIsNotNone(containers1) @@ -817,14 +814,13 @@ def test_list_blobs_with_num_results(self): # Act - blobs = container.list_blobs(results_per_page=2) - next(blobs) + blobs = list(next(container.list_blobs(results_per_page=2).by_page())) # Assert self.assertIsNotNone(blobs) - self.assertEqual(len(blobs.current_page), 2) - self.assertNamedItemInContainer(blobs.current_page, 'blob_a1') - self.assertNamedItemInContainer(blobs.current_page, 'blob_a2') + self.assertEqual(len(blobs), 2) + self.assertNamedItemInContainer(blobs, 'blob_a1') + self.assertNamedItemInContainer(blobs, 'blob_a2') @record def test_list_blobs_with_include_snapshots(self): diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py index 2cd010abf3ea..1618293e17a3 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/directory_client_async.py @@ -10,6 +10,7 @@ ) from azure.core.polling import async_poller +from azure.core.async_paging import AsyncItemPaged from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async @@ -195,21 +196,17 @@ async def delete_directory(self, timeout=None, **kwargs): process_storage_error(error) @distributed_trace - def list_directories_and_files(self, name_starts_with=None, marker=None, timeout=None, **kwargs): - # type: (Optional[str], Optional[str], Optional[int], **Any) -> DirectoryProperties + def list_directories_and_files(self, name_starts_with=None, timeout=None, **kwargs): + # type: (Optional[str], Optional[int], **Any) -> AsyncItemPaged """Lists all the directories and files under the directory. :param str name_starts_with: Filters the results to return only entities whose names begin with the specified prefix. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties - :rtype: ~azure.storage.file.models.DirectoryPropertiesPaged + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.file.models.DirectoryProperties] Example: .. literalinclude:: ../tests/test_file_samples_directory.py @@ -225,17 +222,14 @@ def list_directories_and_files(self, name_starts_with=None, marker=None, timeout sharesnapshot=self.snapshot, timeout=timeout, **kwargs) - return DirectoryPropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return AsyncItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=DirectoryPropertiesPaged) @distributed_trace - def list_handles(self, marker=None, recursive=False, timeout=None, **kwargs): + def list_handles(self, recursive=False, timeout=None, **kwargs) -> AsyncItemPaged: """Lists opened handles on a directory or a file under the directory. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param bool recursive: Boolean that specifies if operation should apply to the directory specified by the client, its files, its subdirectories and their files. Default value is False. @@ -251,8 +245,9 @@ def list_handles(self, marker=None, recursive=False, timeout=None, **kwargs): timeout=timeout, recursive=recursive, **kwargs) - return HandlesPaged( - command, results_per_page=results_per_page, marker=marker) + return AsyncItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=HandlesPaged) @distributed_trace_async async def close_handles( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py index 57610f00e1cb..38c31964e863 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_client_async.py @@ -10,6 +10,7 @@ import six from azure.core.polling import async_poller +from azure.core.async_paging import AsyncItemPaged from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async @@ -668,22 +669,23 @@ async def resize_file(self, size, timeout=None, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def list_handles(self, marker=None, timeout=None, **kwargs): + def list_handles(self, timeout=None, **kwargs) -> AsyncItemPaged: """Lists handles for file. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of HandleItems + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.file.models.Handle] """ results_per_page = kwargs.pop("results_per_page", None) command = functools.partial( - self._client.file.list_handles, sharesnapshot=self.snapshot, timeout=timeout, **kwargs - ) - return HandlesPaged(command, results_per_page=results_per_page, marker=marker) + self._client.file.list_handles, + sharesnapshot=self.snapshot, + timeout=timeout, + **kwargs) + return AsyncItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=HandlesPaged) @distributed_trace_async async def close_handles( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py index 6311a44afc55..c10e9c2cc557 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/file_service_client_async.py @@ -10,6 +10,7 @@ TYPE_CHECKING ) +from azure.core.async_paging import AsyncItemPaged from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async @@ -164,11 +165,9 @@ def list_shares( self, name_starts_with=None, # type: Optional[str] include_metadata=False, # type: Optional[bool] include_snapshots=False, # type: Optional[bool] - marker=None, timeout=None, # type: Optional[int] **kwargs - ): - # type: (...) -> SharePropertiesPaged + ) -> AsyncItemPaged: """Returns auto-paging iterable of dict-like ShareProperties under the specified account. The generator will lazily follow the continuation tokens returned by the service and stop when all shares have been returned. @@ -180,14 +179,10 @@ def list_shares( Specifies that share metadata be returned in the response. :param bool include_snapshots: Specifies that share snapshot be returned in the response. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) of ShareProperties. - :rtype: ~azure.storage.file.models.SharePropertiesPaged + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.file.models.ShareProperties] Example: .. literalinclude:: ../tests/test_file_samples_service.py @@ -208,8 +203,9 @@ def list_shares( include=include, timeout=timeout, **kwargs) - return SharePropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return AsyncItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=SharePropertiesPaged) @distributed_trace_async async def create_share( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py b/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py index 468eb076c2ce..6a47adb59187 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/aio/models.py @@ -6,7 +6,7 @@ # pylint: disable=too-few-public-methods, too-many-instance-attributes # pylint: disable=super-init-not-called, too-many-lines -from azure.core.paging import Paged +from azure.core.async_paging import AsyncPageIterator from .._shared.response_handlers import return_context_and_deserialized, process_storage_error from .._generated.models import StorageErrorException @@ -20,14 +20,14 @@ def _wrap_item(item): return {'name': item.name, 'size': item.properties.content_length, 'is_directory': False} -class SharePropertiesPaged(Paged): +class SharePropertiesPaged(AsyncPageIterator): """An iterable of Share properties. :ivar str service_endpoint: The service URL. :ivar str prefix: A file name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -40,49 +40,46 @@ class SharePropertiesPaged(Paged): call. :param str marker: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None, **kwargs): - super(SharePropertiesPaged, self).__init__(None, None, async_command=command) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(SharePropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - async def _async_advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopAsyncIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopAsyncIteration("End of paging") - self._current_page_iter_index = 0 + async def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = await self._async_get_next( - marker=self.next_marker or None, + return await self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results self.current_page = [ShareProperties._from_generated(i) for i in self._response.share_items] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.continuation_token or None, self.current_page -class HandlesPaged(Paged): +class HandlesPaged(AsyncPageIterator): """An iterable of Handles. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -93,37 +90,35 @@ class HandlesPaged(Paged): call. :param str marker: An opaque continuation token. """ - def __init__(self, command, results_per_page=None, marker=None, **kwargs): - super(HandlesPaged, self).__init__(None, None, async_command=command) - self.current_marker = None + def __init__(self, command, results_per_page=None, continuation_token=None): + super(HandlesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - async def _async_advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopAsyncIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopAsyncIteration("End of paging") - self._current_page_iter_index = 0 + async def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = await self._async_get_next( - marker=self.next_marker or None, + return await self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.current_page = [Handle._from_generated(h) for h in self._response.handle_list] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.continuation_token or None, self.current_page -class DirectoryPropertiesPaged(Paged): +class DirectoryPropertiesPaged(AsyncPageIterator): """An iterable for the contents of a directory. This iterable will yield dicts for the contents of the directory. The dicts @@ -132,9 +127,9 @@ class DirectoryPropertiesPaged(Paged): :ivar str service_endpoint: The service URL. :ivar str prefix: A file name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -147,28 +142,24 @@ class DirectoryPropertiesPaged(Paged): call. :param str marker: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None, **kwargs): - super(DirectoryPropertiesPaged, self).__init__(None, None, async_command=command) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(DirectoryPropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - async def _async_advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopAsyncIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopAsyncIteration("End of paging") - self._current_page_iter_index = 0 + async def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = await self._async_get_next( - marker=self.next_marker or None, + return await self._command( + marker=continuation_token or None, prefix=self.prefix, maxresults=self.results_per_page, cls=return_context_and_deserialized, @@ -176,11 +167,12 @@ async def _async_advance_page(self): except StorageErrorException as error: process_storage_error(error) + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results self.current_page = [_wrap_item(i) for i in self._response.segment.directory_items] self.current_page.extend([_wrap_item(i) for i in self._response.segment.file_items]) - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.continuation_token or None, self.current_page diff --git a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py b/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py index 63f0fbf493d0..8e34eb96d8f9 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/directory_client.py @@ -16,6 +16,7 @@ import six from azure.core.polling import LROPoller +from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace from ._generated import AzureFileStorage @@ -267,21 +268,17 @@ def delete_directory(self, timeout=None, **kwargs): process_storage_error(error) @distributed_trace - def list_directories_and_files(self, name_starts_with=None, marker=None, timeout=None, **kwargs): - # type: (Optional[str], Optional[str], Optional[int], **Any) -> DirectoryProperties + def list_directories_and_files(self, name_starts_with=None, timeout=None, **kwargs): + # type: (Optional[str], Optional[int], **Any) -> DirectoryProperties """Lists all the directories and files under the directory. :param str name_starts_with: Filters the results to return only entities whose names begin with the specified prefix. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of dict-like DirectoryProperties and FileProperties - :rtype: ~azure.storage.file.models.DirectoryPropertiesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.DirectoryProperties] Example: .. literalinclude:: ../tests/test_file_samples_directory.py @@ -297,24 +294,21 @@ def list_directories_and_files(self, name_starts_with=None, marker=None, timeout sharesnapshot=self.snapshot, timeout=timeout, **kwargs) - return DirectoryPropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=DirectoryPropertiesPaged) @distributed_trace - def list_handles(self, marker=None, recursive=False, timeout=None, **kwargs): + def list_handles(self, recursive=False, timeout=None, **kwargs): """Lists opened handles on a directory or a file under the directory. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param bool recursive: Boolean that specifies if operation should apply to the directory specified by the client, its files, its subdirectories and their files. Default value is False. :param int timeout: The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of HandleItems - :rtype: ~azure.storage.file.models.HandlesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.Handles] """ results_per_page = kwargs.pop('results_per_page', None) command = functools.partial( @@ -323,8 +317,9 @@ def list_handles(self, marker=None, recursive=False, timeout=None, **kwargs): timeout=timeout, recursive=recursive, **kwargs) - return HandlesPaged( - command, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=HandlesPaged) @distributed_trace def close_handles( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py b/sdk/storage/azure-storage-file/azure/storage/file/file_client.py index 5c11c5c5e8b4..9ff3cf9b22e1 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/file_client.py @@ -18,6 +18,7 @@ import six from azure.core.polling import LROPoller +from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace from ._generated import AzureFileStorage @@ -857,16 +858,14 @@ def resize_file(self, size, timeout=None, **kwargs): # type: ignore process_storage_error(error) @distributed_trace - def list_handles(self, marker=None, timeout=None, **kwargs): + def list_handles(self, timeout=None, **kwargs): + # type: (int, Any) -> ItemPaged[Handle] """Lists handles for file. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An auto-paging iterable of HandleItems + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.Handle] """ results_per_page = kwargs.pop('results_per_page', None) command = functools.partial( @@ -874,8 +873,9 @@ def list_handles(self, marker=None, timeout=None, **kwargs): sharesnapshot=self.snapshot, timeout=timeout, **kwargs) - return HandlesPaged( - command, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, results_per_page=results_per_page, + page_iterator_class=HandlesPaged) @distributed_trace def close_handles( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py b/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py index d064d5294517..48b38754661c 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/file_service_client.py @@ -6,7 +6,7 @@ import functools from typing import ( # pylint: disable=unused-import - Union, Optional, Any, Iterable, Dict, List, + Union, Optional, Any, Dict, List, TYPE_CHECKING ) try: @@ -14,7 +14,9 @@ except ImportError: from urlparse import urlparse # type: ignore +from azure.core.paging import ItemPaged from azure.core.tracing.decorator import distributed_trace + from ._shared.shared_access_signature import SharedAccessSignature from ._shared.models import Services from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query @@ -271,11 +273,10 @@ def list_shares( self, name_starts_with=None, # type: Optional[str] include_metadata=False, # type: Optional[bool] include_snapshots=False, # type: Optional[bool] - marker=None, timeout=None, # type: Optional[int] **kwargs ): - # type: (...) -> SharePropertiesPaged + # type: (...) -> ItemPaged[ShareProperties] """Returns auto-paging iterable of dict-like ShareProperties under the specified account. The generator will lazily follow the continuation tokens returned by the service and stop when all shares have been returned. @@ -287,14 +288,10 @@ def list_shares( Specifies that share metadata be returned in the response. :param bool include_snapshots: Specifies that share snapshot be returned in the response. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int timeout: The timeout parameter is expressed in seconds. :returns: An iterable (auto-paging) of ShareProperties. - :rtype: ~azure.storage.file.models.SharePropertiesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.file.models.ShareProperties] Example: .. literalinclude:: ../tests/test_file_samples_service.py @@ -315,8 +312,9 @@ def list_shares( include=include, timeout=timeout, **kwargs) - return SharePropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=SharePropertiesPaged) @distributed_trace def create_share( diff --git a/sdk/storage/azure-storage-file/azure/storage/file/models.py b/sdk/storage/azure-storage-file/azure/storage/file/models.py index 019be036c739..61a9815966e6 100644 --- a/sdk/storage/azure-storage-file/azure/storage/file/models.py +++ b/sdk/storage/azure-storage-file/azure/storage/file/models.py @@ -6,8 +6,7 @@ # pylint: disable=too-few-public-methods, too-many-instance-attributes # pylint: disable=super-init-not-called, too-many-lines -from azure.core.paging import Paged - +from azure.core.paging import PageIterator from ._shared.response_handlers import return_context_and_deserialized, process_storage_error from ._shared.models import DictMixin, get_enum_value from ._generated.models import StorageErrorException @@ -241,14 +240,14 @@ def _from_generated(cls, generated): return props -class SharePropertiesPaged(Paged): +class SharePropertiesPaged(PageIterator): """An iterable of Share properties. :ivar str service_endpoint: The service URL. :ivar str prefix: A file name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -259,43 +258,40 @@ class SharePropertiesPaged(Paged): begin with the specified prefix. :param int results_per_page: The maximum number of share names to retrieve per call. - :param str marker: An opaque continuation token. + :param str continuation_token: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None, **kwargs): - super(SharePropertiesPaged, self).__init__(command, None) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(SharePropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - def _advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( - marker=self.next_marker or None, + return self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results self.current_page = [ShareProperties._from_generated(i) for i in self._response.share_items] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.next_marker or None, self.current_page class Handle(DictMixin): @@ -350,12 +346,12 @@ def _from_generated(cls, generated): return handle -class HandlesPaged(Paged): +class HandlesPaged(PageIterator): """An iterable of Handles. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -364,36 +360,34 @@ class HandlesPaged(Paged): :param callable command: Function to retrieve the next page of items. :param int results_per_page: The maximum number of share names to retrieve per call. - :param str marker: An opaque continuation token. + :param str continuation_token: An opaque continuation token. """ - def __init__(self, command, results_per_page=None, marker=None, **kwargs): - super(HandlesPaged, self).__init__(command, None) - self.current_marker = None + def __init__(self, command, results_per_page=None, continuation_token=None): + super(HandlesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - def _advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( - marker=self.next_marker or None, + return self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.current_page = [Handle._from_generated(h) for h in self._response.handle_list] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.next_marker or None, self.current_page class DirectoryProperties(DictMixin): @@ -430,7 +424,7 @@ def _from_generated(cls, generated): return props -class DirectoryPropertiesPaged(Paged): +class DirectoryPropertiesPaged(PageIterator): """An iterable for the contents of a directory. This iterable will yield dicts for the contents of the directory. The dicts @@ -439,9 +433,9 @@ class DirectoryPropertiesPaged(Paged): :ivar str service_endpoint: The service URL. :ivar str prefix: A file name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. - :ivar str next_marker: The continuation token to retrieve the next page of results. + :ivar str continuation_token: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available options include "primary" and "secondary". :ivar current_page: The current page of listed results. @@ -452,30 +446,26 @@ class DirectoryPropertiesPaged(Paged): begin with the specified prefix. :param int results_per_page: The maximum number of share names to retrieve per call. - :param str marker: An opaque continuation token. + :param str continuation_token: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None, **kwargs): - super(DirectoryPropertiesPaged, self).__init__(command, None) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(DirectoryPropertiesPaged, self).__init__( + get_next=self._get_next_cb, + extract_data=self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None + self.current_page = [] - def _advance_page(self): - """Force moving the cursor to the next azure call. - This method is for advanced usage, iterator protocol is prefered. - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( - marker=self.next_marker or None, + return self._command( + marker=continuation_token or None, prefix=self.prefix, maxresults=self.results_per_page, cls=return_context_and_deserialized, @@ -483,14 +473,15 @@ def _advance_page(self): except StorageErrorException as error: process_storage_error(error) + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results self.current_page = [_wrap_item(i) for i in self._response.segment.directory_items] self.current_page.extend([_wrap_item(i) for i in self._response.segment.file_items]) - self.next_marker = self._response.next_marker or None - return self.current_page + return self._response.next_marker or None, self.current_page class FileProperties(DictMixin): diff --git a/sdk/storage/azure-storage-file/tests/test_handle.py b/sdk/storage/azure-storage-file/tests/test_handle.py index 7fe3d3a5e3d4..220e71d679c2 100644 --- a/sdk/storage/azure-storage-file/tests/test_handle.py +++ b/sdk/storage/azure-storage-file/tests/test_handle.py @@ -114,20 +114,21 @@ def test_list_handles_with_marker(self): root = share.get_directory_client() # Act - handle_generator = root.list_handles(recursive=True, results_per_page=1) - next(handle_generator) + handle_generator = root.list_handles(recursive=True, results_per_page=1).by_page() + handles = list(next(handle_generator)) # Assert - self.assertIsNotNone(handle_generator.next_marker) - handles = handle_generator.current_page + self.assertIsNotNone(handle_generator.continuation_token) self._validate_handles(handles) # Note down a handle that we saw old_handle = handles[0] # Continue listing - remaining_handles = list( - root.list_handles(recursive=True, marker=handle_generator.next_marker)) + remaining_handles = list(next( + root.list_handles(recursive=True).by_page( + continuation_token=handle_generator.continuation_token) + )) self._validate_handles(handles) # Make sure the old handle did not appear diff --git a/sdk/storage/azure-storage-file/tests/test_share.py b/sdk/storage/azure-storage-file/tests/test_share.py index 4eabf312d3f4..cc134be6c710 100644 --- a/sdk/storage/azure-storage-file/tests/test_share.py +++ b/sdk/storage/azure-storage-file/tests/test_share.py @@ -341,14 +341,12 @@ def test_list_shares_with_num_results_and_marker(self): share_names.sort() # Act - generator1 = self.fsc.list_shares(prefix, results_per_page=2) - next(generator1) - generator2 = self.fsc.list_shares( - prefix, marker=generator1.next_marker, results_per_page=2) - next(generator2) + generator1 = self.fsc.list_shares(prefix, results_per_page=2).by_page() + shares1 = list(next(generator1)) - shares1 = generator1.current_page - shares2 = generator2.current_page + generator2 = self.fsc.list_shares( + prefix, results_per_page=2).by_page(continuation_token=generator1.continuation_token) + shares2 = list(next(generator2)) # Assert self.assertIsNotNone(shares1) @@ -606,14 +604,14 @@ def test_list_directories_and_files_with_num_results(self): root.upload_file('fileb1', '1024') # Act - result = share_name.list_directories_and_files(results_per_page=2) - next(result) + result = share_name.list_directories_and_files(results_per_page=2).by_page() + result = list(next(result)) # Assert self.assertIsNotNone(result) - self.assertEqual(len(result.current_page), 2) - self.assertNamedItemInContainer(result.current_page, 'dir1') - self.assertNamedItemInContainer(result.current_page, 'filea1') + self.assertEqual(len(result), 2) + self.assertNamedItemInContainer(result, 'dir1') + self.assertNamedItemInContainer(result, 'filea1') @record def test_list_directories_and_files_with_num_results_and_marker(self): @@ -627,14 +625,13 @@ def test_list_directories_and_files_with_num_results_and_marker(self): dir1.upload_file('fileb1', '1024') # Act - generator1 = share_name.list_directories_and_files('dir1', results_per_page=2) - next(generator1) - generator2 = share_name.list_directories_and_files( - 'dir1', marker=generator1.next_marker, results_per_page=2) - next(generator2) + generator1 = share_name.list_directories_and_files( + 'dir1', results_per_page=2).by_page() + result1 = list(next(generator1)) - result1 = generator1.current_page - result2 = generator2.current_page + generator2 = share_name.list_directories_and_files( + 'dir1', results_per_page=2).by_page(continuation_token=generator1.continuation_token) + result2 = list(next(generator2)) # Assert self.assertEqual(len(result1), 2) @@ -643,7 +640,7 @@ def test_list_directories_and_files_with_num_results_and_marker(self): self.assertNamedItemInContainer(result1, 'filea2') self.assertNamedItemInContainer(result2, 'filea3') self.assertNamedItemInContainer(result2, 'fileb1') - self.assertEqual(generator2.next_marker, None) + self.assertEqual(generator2.continuation_token, None) @record def test_list_directories_and_files_with_prefix(self): diff --git a/sdk/storage/azure-storage-file/tests/test_share_async.py b/sdk/storage/azure-storage-file/tests/test_share_async.py index 684cc7c72d78..f1a6b21db759 100644 --- a/sdk/storage/azure-storage-file/tests/test_share_async.py +++ b/sdk/storage/azure-storage-file/tests/test_share_async.py @@ -441,14 +441,11 @@ async def _test_list_shares_with_num_results_and_marker_async(self): share_names.sort() # Act - generator1 = self.fsc.list_shares(prefix, results_per_page=2) - await generator1.__anext__() + generator1 = self.fsc.list_shares(prefix, results_per_page=2).by_page() + shares1 = list(await generator1.__anext__()) generator2 = self.fsc.list_shares( - prefix, marker=generator1.next_marker, results_per_page=2) - await generator2.__anext__() - - shares1 = generator1.current_page - shares2 = generator2.current_page + prefix, results_per_page=2).by_page(continuation_token=generator1.continuation_token) + shares2 = list(await generator2.__anext__()) # Assert self.assertIsNotNone(shares1) @@ -791,14 +788,14 @@ async def _test_list_directories_and_files_with_num_results_async(self): await root.upload_file('fileb1', '1024') # Act - result = share_name.list_directories_and_files(results_per_page=2) - await result.__anext__() + result = share_name.list_directories_and_files(results_per_page=2).by_page() + result = list(await result.__anext__()) # Assert self.assertIsNotNone(result) - self.assertEqual(len(result.current_page), 2) - self.assertNamedItemInContainer(result.current_page, 'dir1') - self.assertNamedItemInContainer(result.current_page, 'filea1') + self.assertEqual(len(result), 2) + self.assertNamedItemInContainer(result, 'dir1') + self.assertNamedItemInContainer(result, 'filea1') def test_list_directories_and_files_with_num_results_async(self): if TestMode.need_recording_file(self.test_mode): @@ -817,14 +814,13 @@ async def _test_list_directories_and_files_with_num_results_and_marker_async(sel await dir1.upload_file('fileb1', '1024') # Act - generator1 = share_name.list_directories_and_files('dir1', results_per_page=2) - await generator1.__anext__() - generator2 = share_name.list_directories_and_files( - 'dir1', marker=generator1.next_marker, results_per_page=2) - await generator2.__anext__() + generator1 = share_name.list_directories_and_files( + 'dir1', results_per_page=2).by_page() + result1 = list(await generator1.__anext__()) - result1 = generator1.current_page - result2 = generator2.current_page + generator2 = share_name.list_directories_and_files( + 'dir1', results_per_page=2).by_page(continuation_token=generator1.continuation_token) + result2 = list(await generator2.__anext__()) # Assert self.assertEqual(len(result1), 2) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py index 047f34204085..f56f5e9172e9 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/models.py @@ -7,7 +7,7 @@ # pylint: disable=super-init-not-called from typing import List # pylint: disable=unused-import -from azure.core.paging import Paged +from azure.core.async_paging import AsyncPageIterator from .._shared.response_handlers import ( process_storage_error, return_context_and_deserialized) @@ -15,7 +15,7 @@ from ..models import QueueMessage, QueueProperties -class MessagesPaged(Paged): +class MessagesPaged(AsyncPageIterator): """An iterable of Queue Messages. :ivar int results_per_page: The maximum number of results retrieved per API call. @@ -26,31 +26,31 @@ class MessagesPaged(Paged): :param int results_per_page: The maximum number of messages to retrieve per call. """ - def __init__(self, command, results_per_page=None): - super(MessagesPaged, self).__init__(None, None, async_command=command) - self.results_per_page = results_per_page - - async def _async_advance_page(self): - """Force moving the cursor to the next azure call. + def __init__(self, command, results_per_page=None, continuation_token=None): + if continuation_token is not None: + raise ValueError("This operation does not support continuation token") - This method is for advanced usage, iterator protocol is prefered. + super(MessagesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + ) + self._command = command + self.results_per_page = results_per_page - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - self._current_page_iter_index = 0 + async def _get_next_cb(self, continuation_token): try: - messages = await self._async_get_next(number_of_messages=self.results_per_page) - if not messages: - raise StopAsyncIteration() + return await self._command(number_of_messages=self.results_per_page) except StorageErrorException as error: process_storage_error(error) - self.current_page = [QueueMessage._from_generated(q) for q in messages] # pylint: disable=protected-access - return self.current_page + + async def _extract_data_cb(self, messages): + # There is no concept of continuation token, so raising on my own condition + if not messages: + raise StopAsyncIteration("End of paging") + return "TOKEN_IGNORED", [QueueMessage._from_generated(q) for q in messages] # pylint: disable=protected-access -class QueuePropertiesPaged(Paged): +class QueuePropertiesPaged(AsyncPageIterator): """An iterable of Queue properties. :ivar str service_endpoint: The service URL. @@ -70,39 +70,34 @@ class QueuePropertiesPaged(Paged): call. :param str marker: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None): - super(QueuePropertiesPaged, self).__init__(None, None, async_command=command) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(QueuePropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None - async def _async_advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopAsyncIteration("End of paging") - self._current_page_iter_index = 0 + async def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = await self._async_get_next( - marker=self.next_marker or None, + return await self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + + async def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results - self.current_page = [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + + return self._response.next_marker or None, [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py index ea5f3b4ee031..f8e251e8a2fe 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_client_async.py @@ -27,6 +27,8 @@ from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.async_paging import AsyncItemPaged + from azure.storage.queue._shared.base_client_async import AsyncStorageAccountHostsMixin from azure.storage.queue._shared.request_handlers import add_metadata_headers, serialize_iso from azure.storage.queue._shared.response_handlers import ( @@ -380,8 +382,8 @@ async def enqueue_message( # type: ignore process_storage_error(error) @distributed_trace - def receive_messages(self, messages_per_page=None, visibility_timeout=None, timeout=None, **kwargs): # type: ignore - # type: (Optional[int], Optional[int], Optional[int], Optional[Any]) -> QueueMessage + def receive_messages(self, messages_per_page=None, visibility_timeout=None, timeout=None, **kwargs): # type: ignore + # type: (Optional[int], Optional[int], Optional[int], Optional[Any]) -> AsyncItemPaged[Message] """Removes one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message @@ -409,7 +411,7 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time The server timeout, expressed in seconds. :return: Returns a message iterator of dict-like Message objects. - :rtype: ~azure.storage.queue.models.MessagesPaged + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.storage.queue.models.Message] Example: .. literalinclude:: ../tests/test_queue_samples_message.py @@ -430,7 +432,7 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time cls=self._config.message_decode_policy, **kwargs ) - return MessagesPaged(command, results_per_page=messages_per_page) + return AsyncItemPaged(command, results_per_page=messages_per_page, page_iterator_class=MessagesPaged) except StorageErrorException as error: process_storage_error(error) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py index a79a8ca9b874..409888af1146 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/aio/queue_service_client_async.py @@ -13,6 +13,7 @@ except ImportError: from urlparse import urlparse # type: ignore +from azure.core.async_paging import AsyncItemPaged from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async @@ -212,12 +213,10 @@ async def set_service_properties( # type: ignore def list_queues( self, name_starts_with=None, # type: Optional[str] include_metadata=False, # type: Optional[bool] - marker=None, # type: Optional[str] results_per_page=None, # type: Optional[int] timeout=None, # type: Optional[int] **kwargs - ): - # type: (...) -> QueuePropertiesPaged + ) -> AsyncItemPaged: """Returns a generator to list the queues under the specified account. The generator will lazily follow the continuation tokens returned by @@ -228,10 +227,6 @@ def list_queues( begin with the specified prefix. :param bool include_metadata: Specifies that queue metadata be returned in the response. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int results_per_page: The maximum number of queue names to retrieve per API call. If the request does not specify the server will return up to 5,000 items. @@ -240,7 +235,7 @@ def list_queues( calls to the service in which case the timeout value specified will be applied to each individual call. :returns: An iterable (auto-paging) of QueueProperties. - :rtype: ~azure.core.queue.models.QueuePropertiesPaged + :rtype: ~azure.core.paging.AsyncItemPaged[~azure.core.queue.models.QueueProperties] Example: .. literalinclude:: ../tests/test_queue_samples_service.py @@ -257,8 +252,10 @@ def list_queues( include=include, timeout=timeout, **kwargs) - return QueuePropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return AsyncItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=QueuePropertiesPaged + ) @distributed_trace_async async def create_queue( # type: ignore diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/models.py b/sdk/storage/azure-storage-queue/azure/storage/queue/models.py index 043ff06ad8cd..79391fe05a8c 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/models.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/models.py @@ -7,10 +7,8 @@ # pylint: disable=super-init-not-called from typing import List # pylint: disable=unused-import -from azure.core.paging import Paged -from ._shared.response_handlers import ( - process_storage_error, - return_context_and_deserialized) +from azure.core.paging import PageIterator +from ._shared.response_handlers import return_context_and_deserialized, process_storage_error from ._shared.models import DictMixin from ._generated.models import StorageErrorException from ._generated.models import AccessPolicy as GenAccessPolicy @@ -220,7 +218,7 @@ def _from_generated(cls, generated): return message -class MessagesPaged(Paged): +class MessagesPaged(PageIterator): """An iterable of Queue Messages. :ivar int results_per_page: The maximum number of results retrieved per API call. @@ -231,28 +229,28 @@ class MessagesPaged(Paged): :param int results_per_page: The maximum number of messages to retrieve per call. """ - def __init__(self, command, results_per_page=None): - super(MessagesPaged, self).__init__(command, None) + def __init__(self, command, results_per_page=None, continuation_token=None): + if continuation_token is not None: + raise ValueError("This operation does not support continuation token") + + super(MessagesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + ) + self._command = command self.results_per_page = results_per_page - def _advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - messages = self._get_next(number_of_messages=self.results_per_page) - if not messages: - raise StopIteration() + return self._command(number_of_messages=self.results_per_page) except StorageErrorException as error: process_storage_error(error) - self.current_page = [QueueMessage._from_generated(q) for q in messages] # pylint: disable=protected-access - return self.current_page + + def _extract_data_cb(self, messages): + # There is no concept of continuation token, so raising on my own condition + if not messages: + raise StopIteration("End of paging") + return "TOKEN_IGNORED", [QueueMessage._from_generated(q) for q in messages] # pylint: disable=protected-access class QueueProperties(DictMixin): @@ -280,12 +278,12 @@ def _from_generated(cls, generated): return props -class QueuePropertiesPaged(Paged): +class QueuePropertiesPaged(PageIterator): """An iterable of Queue properties. :ivar str service_endpoint: The service URL. :ivar str prefix: A queue name prefix being used to filter the list. - :ivar str current_marker: The continuation token of the current page of results. + :ivar str marker: The continuation token of the current page of results. :ivar int results_per_page: The maximum number of results retrieved per API call. :ivar str next_marker: The continuation token to retrieve the next page of results. :ivar str location_mode: The location mode being used to list results. The available @@ -298,44 +296,39 @@ class QueuePropertiesPaged(Paged): begin with the specified prefix. :param int results_per_page: The maximum number of queue names to retrieve per call. - :param str marker: An opaque continuation token. + :param str continuation_token: An opaque continuation token. """ - def __init__(self, command, prefix=None, results_per_page=None, marker=None): - super(QueuePropertiesPaged, self).__init__(command, None) + def __init__(self, command, prefix=None, results_per_page=None, continuation_token=None): + super(QueuePropertiesPaged, self).__init__( + self._get_next_cb, + self._extract_data_cb, + continuation_token=continuation_token or "" + ) + self._command = command self.service_endpoint = None self.prefix = prefix - self.current_marker = None + self.marker = None self.results_per_page = results_per_page - self.next_marker = marker or "" self.location_mode = None - def _advance_page(self): - """Force moving the cursor to the next azure call. - - This method is for advanced usage, iterator protocol is prefered. - - :raises: StopIteration if no further page - :return: The current page list - :rtype: list - """ - if self.next_marker is None: - raise StopIteration("End of paging") - self._current_page_iter_index = 0 + def _get_next_cb(self, continuation_token): try: - self.location_mode, self._response = self._get_next( - marker=self.next_marker or None, + return self._command( + marker=continuation_token or None, maxresults=self.results_per_page, cls=return_context_and_deserialized, use_location=self.location_mode) except StorageErrorException as error: process_storage_error(error) + + def _extract_data_cb(self, get_next_return): + self.location_mode, self._response = get_next_return self.service_endpoint = self._response.service_endpoint self.prefix = self._response.prefix - self.current_marker = self._response.marker + self.marker = self._response.marker self.results_per_page = self._response.max_results - self.current_page = [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access - self.next_marker = self._response.next_marker or None - return self.current_page + + return self._response.next_marker or None, [QueueProperties._from_generated(q) for q in self._response.queue_items] # pylint: disable=protected-access class QueuePermissions(object): diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py index 40220c2805ad..78bf7b86d430 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_client.py @@ -16,6 +16,8 @@ import six +from azure.core.paging import ItemPaged + from ._shared.shared_access_signature import QueueSharedAccessSignature from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query from ._shared.request_handlers import add_metadata_headers, serialize_iso @@ -514,7 +516,7 @@ def enqueue_message( # type: ignore @distributed_trace def receive_messages(self, messages_per_page=None, visibility_timeout=None, timeout=None, **kwargs): # type: ignore - # type: (Optional[int], Optional[int], Optional[int], Optional[Any]) -> QueueMessage + # type: (Optional[int], Optional[int], Optional[int], Optional[Any]) -> ItemPaged[Message] """Removes one or more messages from the front of the queue. When a message is retrieved from the queue, the response includes the message @@ -542,7 +544,7 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time The server timeout, expressed in seconds. :return: Returns a message iterator of dict-like Message objects. - :rtype: ~azure.storage.queue.models.MessagesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.storage.queue.models.Message] Example: .. literalinclude:: ../tests/test_queue_samples_message.py @@ -564,7 +566,7 @@ def receive_messages(self, messages_per_page=None, visibility_timeout=None, time cls=self._config.message_decode_policy, **kwargs ) - return MessagesPaged(command, results_per_page=messages_per_page) + return ItemPaged(command, results_per_page=messages_per_page, page_iterator_class=MessagesPaged) except StorageErrorException as error: process_storage_error(error) diff --git a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py index 882325631350..4bc760091a56 100644 --- a/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py +++ b/sdk/storage/azure-storage-queue/azure/storage/queue/queue_service_client.py @@ -13,6 +13,8 @@ except ImportError: from urlparse import urlparse # type: ignore +from azure.core.paging import ItemPaged + from ._shared.shared_access_signature import SharedAccessSignature from ._shared.models import LocationMode, Services from ._shared.base_client import StorageAccountHostsMixin, parse_connection_str, parse_query @@ -304,12 +306,11 @@ def set_service_properties( # type: ignore def list_queues( self, name_starts_with=None, # type: Optional[str] include_metadata=False, # type: Optional[bool] - marker=None, # type: Optional[str] results_per_page=None, # type: Optional[int] timeout=None, # type: Optional[int] **kwargs ): - # type: (...) -> QueuePropertiesPaged + # type: (...) -> ItemPaged[QueueProperties] """Returns a generator to list the queues under the specified account. The generator will lazily follow the continuation tokens returned by @@ -320,10 +321,6 @@ def list_queues( begin with the specified prefix. :param bool include_metadata: Specifies that queue metadata be returned in the response. - :param str marker: - An opaque continuation token. This value can be retrieved from the - next_marker field of a previous generator object. If specified, - this generator will begin returning results from this point. :param int results_per_page: The maximum number of queue names to retrieve per API call. If the request does not specify the server will return up to 5,000 items. @@ -332,7 +329,7 @@ def list_queues( calls to the service in which case the timeout value specified will be applied to each individual call. :returns: An iterable (auto-paging) of QueueProperties. - :rtype: ~azure.core.queue.models.QueuePropertiesPaged + :rtype: ~azure.core.paging.ItemPaged[~azure.core.queue.models.QueueProperties] Example: .. literalinclude:: ../tests/test_queue_samples_service.py @@ -349,8 +346,10 @@ def list_queues( include=include, timeout=timeout, **kwargs) - return QueuePropertiesPaged( - command, prefix=name_starts_with, results_per_page=results_per_page, marker=marker) + return ItemPaged( + command, prefix=name_starts_with, results_per_page=results_per_page, + page_iterator_class=QueuePropertiesPaged + ) @distributed_trace def create_queue( diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_delete_message.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_delete_message.yaml index 51d38817ff39..7b9a2fe78803 100644 --- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_delete_message.yaml +++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_delete_message.yaml @@ -2,1441 +2,246 @@ interactions: - request: body: null headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1b7a7e3a-952a-11e9-bd27-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49 - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - fd4a8222-9003-00c8-3c36-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1b9a01c6-952a-11e9-8b0c-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF442e2d59-b9ee-4fc1-b57f-1eede999ed26Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAAZ71f3TYp1QE=Sat,\ - \ 22 Jun 2019 20:12:49 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - fd4a822e-9003-00c8-4436-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1ba2cc3e-952a-11e9-84a6-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF4b1f4b61-a5c0-48fa-8473-231196864687Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAAayNo3TYp1QE=Sat,\ - \ 22 Jun 2019 20:12:49 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - fd4a8238-9003-00c8-4e36-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1bab46ca-952a-11e9-8a40-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFFbc529b8c-9f40-41ef-96f3-354cb25025b7Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAAkNdw3TYp1QE=Sat,\ - \ 22 Jun 2019 20:12:49 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - fd4a8241-9003-00c8-5536-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1bb3e9c6-952a-11e9-b2c0-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF635425fc-8557-4a2c-81fb-14a27d8b1c50Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAApmR53TYp1QE=Sat,\ - \ 22 Jun 2019 20:12:49 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - fd4a8249-9003-00c8-5c36-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1bbc4aba-952a-11e9-9d3a-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF442e2d59-b9ee-4fc1-b57f-1eede999ed26Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAAhkZj7zYp1QE=Sat,\ - \ 22 Jun 2019 20:13:19 GMT1message1" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - fd4a8253-9003-00c8-6536-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1bc4c398-952a-11e9-9d06-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: DELETE - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages/442e2d59-b9ee-4fc1-b57f-1eede999ed26?popreceipt=AgAAAAMAAAAAAAAAhkZj7zYp1QE%3D - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - fd4a825b-9003-00c8-6c36-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 204 - message: No Content -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1bcd588c-952a-11e9-895b-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:49 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://remotestoragename.queue.core.windows.net/pythonqueuebf910c49/messages?numofmessages=32 - response: - body: - string: "\uFEFF4b1f4b61-a5c0-48fa-8473-231196864687Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAA16507zYp1QE=Sat,\ - \ 22 Jun 2019 20:13:19 GMT1message2bc529b8c-9f40-41ef-96f3-354cb25025b7Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAA16507zYp1QE=Sat,\ - \ 22 Jun 2019 20:13:19 GMT1message3635425fc-8557-4a2c-81fb-14a27d8b1c50Sat,\ - \ 22 Jun 2019 20:12:49 GMTSat, 29 Jun 2019\ - \ 20:12:49 GMTAgAAAAMAAAAAAAAA16507zYp1QE=Sat,\ - \ 22 Jun 2019 20:13:19 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:49 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - fd4a8261-9003-00c8-7236-29f537000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dcd5898c-952a-11e9-806a-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:13 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49 - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 0b5f410d-2003-0070-7d37-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dcf60022-952a-11e9-954d-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:13 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF1208b99d-12bd-4073-a3c8-9b0ad6bfdf33Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAASC69njcp1QE=Sat,\ - \ 22 Jun 2019 20:18:14 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 0b5f411d-2003-0070-0a37-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dcff4f9c-952a-11e9-83d3-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF3de1106c-a4cf-4a5f-a7dc-d5f70ad5c8b0Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAAzn7Gnjcp1QE=Sat,\ - \ 22 Jun 2019 20:18:14 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 0b5f412a-2003-0070-1637-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dd08b014-952a-11e9-aee4-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF4ec3ee4b-b0f3-48e9-a5d1-8b7fc1e2180aSat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAA+DLPnjcp1QE=Sat,\ - \ 22 Jun 2019 20:18:14 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 0b5f4137-2003-0070-1f37-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dd11436e-952a-11e9-8240-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFFea4ee1a4-2c09-42d5-bad1-210be95e91c7Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAATzXYnjcp1QE=Sat,\ - \ 22 Jun 2019 20:18:14 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 0b5f4149-2003-0070-2e37-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dd1a7bd2-952a-11e9-95d1-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF1208b99d-12bd-4073-a3c8-9b0ad6bfdf33Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAAkLPCsDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:44 GMT1message1" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:13 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 0b5f4151-2003-0070-3637-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dd23aae8-952a-11e9-b0bf-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: DELETE - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages/1208b99d-12bd-4073-a3c8-9b0ad6bfdf33?popreceipt=AgAAAAMAAAAAAAAAkLPCsDcp1QE%3D - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:18:14 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 0b5f4164-2003-0070-4737-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 204 - message: No Content -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - dd2c7de6-952a-11e9-9262-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:14 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages?numofmessages=32 - response: - body: - string: "\uFEFF3de1106c-a4cf-4a5f-a7dc-d5f70ad5c8b0Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAAV9/UsDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:44 GMT1message24ec3ee4b-b0f3-48e9-a5d1-8b7fc1e2180aSat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAAV9/UsDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:44 GMT1message3ea4ee1a4-2c09-42d5-bad1-210be95e91c7Sat,\ - \ 22 Jun 2019 20:18:14 GMTSat, 29 Jun 2019\ - \ 20:18:14 GMTAgAAAAMAAAAAAAAAV9/UsDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:44 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:14 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 0b5f4172-2003-0070-5337-2917c4000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 740b52d2-952b-11e9-9d3a-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b7b05c9c-ad96-11e9-ab10-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:44 GMT'] + x-ms-version: ['2018-03-28'] method: PUT uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49 response: - body: - string: '' + body: {string: ''} headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:22:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - f5f43da9-6003-0099-3638-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Length: ['0'] + Date: ['Tue, 23 Jul 2019 22:10:44 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + x-ms-request-id: [b462afff-6003-00dd-0ba3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message1' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 742c9034-952b-11e9-95de-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b81371ae-ad96-11e9-923b-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages response: - body: - string: "\uFEFF193f415e-aabc-46e0-9209-48d6f7dad682Sat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAxCb0NTgp1QE=Sat,\ - \ 22 Jun 2019 20:22:27 GMT" + body: {string: "\uFEFF8c67a6da-dc58-453c-a32c-2357250782d6Tue, + 23 Jul 2019 22:10:45 GMTTue, 30 Jul 2019 22:10:45 + GMTAgAAAAMAAAAAAAAASa7peaNB1QE=Tue, + 23 Jul 2019 22:10:45 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - f5f43db1-6003-0099-3a38-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [b462b023-6003-00dd-25a3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message2' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 7435d566-952b-11e9-a739-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b82af13e-ad96-11e9-89e9-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages response: - body: - string: "\uFEFF5b8f5b8c-25ca-42c2-a759-8feeba150f7cSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAGyn9NTgp1QE=Sat,\ - \ 22 Jun 2019 20:22:27 GMT" + body: {string: "\uFEFF53352c13-0ace-4405-a299-848592033386Tue, + 23 Jul 2019 22:10:45 GMTTue, 30 Jul 2019 22:10:45 + GMTAgAAAAMAAAAAAAAA9DX/eaNB1QE=Tue, + 23 Jul 2019 22:10:45 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - f5f43db7-6003-0099-3f38-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [b462b041-6003-00dd-3fa3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message3' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 743eee58-952b-11e9-8745-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b84060c8-ad96-11e9-89c5-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages response: - body: - string: "\uFEFFd867e71b-a641-4b87-b534-4659d5016cfdSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAcysGNjgp1QE=Sat,\ - \ 22 Jun 2019 20:22:27 GMT" + body: {string: "\uFEFF831f51e4-bdae-46c9-8085-7eb7ddf44022Tue, + 23 Jul 2019 22:10:46 GMTTue, 30 Jul 2019 22:10:46 + GMTAgAAAAMAAAAAAAAAow8TeqNB1QE=Tue, + 23 Jul 2019 22:10:46 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - f5f43dba-6003-0099-4238-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [b462b055-6003-00dd-51a3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message4' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 74482aa4-952b-11e9-9902-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b85423be-ad96-11e9-ad5e-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:46 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages response: - body: - string: "\uFEFF1cafa96b-c8b4-41b7-8dcf-407fffd8661cSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAA+XsPNjgp1QE=Sat,\ - \ 22 Jun 2019 20:22:27 GMT" + body: {string: "\uFEFF415e7230-45f9-423d-9090-b53936c23314Tue, + 23 Jul 2019 22:10:46 GMTTue, 30 Jul 2019 22:10:46 + GMTAgAAAAMAAAAAAAAAfeUoeqNB1QE=Tue, + 23 Jul 2019 22:10:46 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:26 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - f5f43dbe-6003-0099-4538-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [b462b073-6003-00dd-67a3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: null headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 74515192-952b-11e9-be15-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b86961c6-ad96-11e9-9926-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:46 GMT'] + x-ms-version: ['2018-03-28'] method: GET uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages response: - body: - string: "\uFEFF193f415e-aabc-46e0-9209-48d6f7dad682Sat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAl5b6Rzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:57 GMT1message1" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:27 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - f5f43dbf-6003-0099-4638-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 745b1524-952b-11e9-b3c4-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:27 GMT - x-ms-version: - - '2018-03-28' + body: {string: "\uFEFF8c67a6da-dc58-453c-a32c-2357250782d6Tue, + 23 Jul 2019 22:10:45 GMTTue, 30 Jul 2019 22:10:45 + GMTAgAAAAMAAAAAAAAAA7gajKNB1QE=Tue, + 23 Jul 2019 22:11:16 GMT1message1"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + Vary: [Origin] + x-ms-request-id: [b462b090-6003-00dd-7ca3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b879b574-ad96-11e9-8ec6-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:46 GMT'] + x-ms-version: ['2018-03-28'] method: DELETE - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages/193f415e-aabc-46e0-9209-48d6f7dad682?popreceipt=AgAAAAMAAAAAAAAAl5b6Rzgp1QE%3D + uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages/8c67a6da-dc58-453c-a32c-2357250782d6?popreceipt=AgAAAAMAAAAAAAAAA7gajKNB1QE%3D response: - body: - string: '' + body: {string: ''} headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:22:27 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - f5f43dc3-6003-0099-4a38-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 204 - message: No Content + Content-Length: ['0'] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + x-ms-request-id: [b462b0b7-6003-00dd-1ba3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 204, message: No Content} - request: body: null headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 74643122-952b-11e9-b8fb-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:28 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b88a0908-ad96-11e9-9586-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:46 GMT'] + x-ms-version: ['2018-03-28'] method: GET uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages?numofmessages=32 response: - body: - string: "\uFEFF5b8f5b8c-25ca-42c2-a759-8feeba150f7cSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAul4NSDgp1QE=Sat,\ - \ 22 Jun 2019 20:22:58 GMT1message2d867e71b-a641-4b87-b534-4659d5016cfdSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAul4NSDgp1QE=Sat,\ - \ 22 Jun 2019 20:22:58 GMT1message31cafa96b-c8b4-41b7-8dcf-407fffd8661cSat,\ - \ 22 Jun 2019 20:22:27 GMTSat, 29 Jun 2019\ - \ 20:22:27 GMTAgAAAAMAAAAAAAAAul4NSDgp1QE=Sat,\ - \ 22 Jun 2019 20:22:58 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:27 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - f5f43dc5-6003-0099-4c38-29ebc2000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - aee1db86-952d-11e9-9f94-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49 - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 24506b4c-4003-00ca-6e3a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af02a3ac-952d-11e9-bdc7-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF914e12cd-da29-4d7f-828a-393828adfbbeSat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAeuTKcDop1QE=Sat,\ - \ 22 Jun 2019 20:38:25 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 24506b5e-4003-00ca-7e3a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af0bd666-952d-11e9-a81d-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFFcd560872-1500-4081-9887-44a67792f515Sat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAzubTcDop1QE=Sat,\ - \ 22 Jun 2019 20:38:25 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 24506b71-4003-00ca-103a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af14a5f4-952d-11e9-bfa3-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFFa047b162-8bd6-4ca3-8393-245d7af6dd90Sat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAA3HPccDop1QE=Sat,\ - \ 22 Jun 2019 20:38:25 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 24506b7f-4003-00ca-1d3a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af1d518c-952d-11e9-bc94-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFFcb60022d-89e1-4c86-afdb-627d48e3250fSat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAAijlcDop1QE=Sat,\ - \ 22 Jun 2019 20:38:25 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 24506b9c-4003-00ca-363a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af261bca-952d-11e9-8a6d-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages - response: - body: - string: "\uFEFF914e12cd-da29-4d7f-828a-393828adfbbeSat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAVs3Pgjop1QE=Sat,\ - \ 22 Jun 2019 20:38:55 GMT1message1" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 24506baa-4003-00ca-443a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af2f5190-952d-11e9-a222-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' - method: DELETE - uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages/914e12cd-da29-4d7f-828a-393828adfbbe?popreceipt=AgAAAAMAAAAAAAAAVs3Pgjop1QE%3D - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 24506bc9-4003-00ca-5e3a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 204 - message: No Content -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - af389908-952d-11e9-9591-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:25 GMT - x-ms-version: - - '2018-03-28' + body: {string: "\uFEFF53352c13-0ace-4405-a299-848592033386Tue, + 23 Jul 2019 22:10:45 GMTTue, 30 Jul 2019 22:10:45 + GMTAgAAAAMAAAAAAAAAl689jKNB1QE=Tue, + 23 Jul 2019 22:11:16 GMT1message2831f51e4-bdae-46c9-8085-7eb7ddf44022Tue, + 23 Jul 2019 22:10:46 GMTTue, 30 Jul 2019 22:10:46 + GMTAgAAAAMAAAAAAAAAl689jKNB1QE=Tue, + 23 Jul 2019 22:11:16 GMT1message3415e7230-45f9-423d-9090-b53936c23314Tue, + 23 Jul 2019 22:10:46 GMTTue, 30 Jul 2019 22:10:46 + GMTAgAAAAMAAAAAAAAAl689jKNB1QE=Tue, + 23 Jul 2019 22:11:16 GMT1message4"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + Vary: [Origin] + x-ms-request-id: [b462b0e0-6003-00dd-3da3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 200, message: OK} +- request: + body: null + headers: + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [b89de61a-ad96-11e9-94f2-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 22:10:46 GMT'] + x-ms-version: ['2018-03-28'] method: GET uri: https://storagename.queue.core.windows.net/pythonqueuebf910c49/messages?numofmessages=32 response: - body: - string: "\uFEFFcd560872-1500-4081-9887-44a67792f515Sat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAX27igjop1QE=Sat,\ - \ 22 Jun 2019 20:38:55 GMT1message2a047b162-8bd6-4ca3-8393-245d7af6dd90Sat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAX27igjop1QE=Sat,\ - \ 22 Jun 2019 20:38:55 GMT1message3cb60022d-89e1-4c86-afdb-627d48e3250fSat,\ - \ 22 Jun 2019 20:38:25 GMTSat, 29 Jun 2019\ - \ 20:38:25 GMTAgAAAAMAAAAAAAAAX27igjop1QE=Sat,\ - \ 22 Jun 2019 20:38:55 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:24 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 24506bd7-4003-00ca-6b3a-29f7cd000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK + body: {string: "\uFEFF"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 22:10:45 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + Vary: [Origin] + x-ms-request-id: [b462b112-6003-00dd-66a3-4137ae000000] + x-ms-version: ['2018-03-28'] + status: {code: 200, message: OK} version: 1 diff --git a/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_get_messages_with_options.yaml b/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_get_messages_with_options.yaml index 4f79ec258033..cb18246850ef 100644 --- a/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_get_messages_with_options.yaml +++ b/sdk/storage/azure-storage-queue/tests/recordings/test_queue.test_get_messages_with_options.yaml @@ -2,1121 +2,200 @@ interactions: - request: body: null headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1cb5f240-952a-11e9-8690-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 4ce61f8f-6003-0033-1436-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1cdbdadc-952a-11e9-908b-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFc07a14fe-0248-49ac-84ef-9183eec8c1f9Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAyXih3jYp1QE=Sat,\ - \ 22 Jun 2019 20:12:51 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 4ce61f99-6003-0033-1b36-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1ce4762e-952a-11e9-9f63-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF8c47bcca-e16f-4b92-92b1-15e94379eb52Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAwd6p3jYp1QE=Sat,\ - \ 22 Jun 2019 20:12:51 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 4ce61f9a-6003-0033-1c36-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1cecec34-952a-11e9-a5e2-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFee5ab552-39a9-40a8-ad63-d94e3b486906Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAtESy3jYp1QE=Sat,\ - \ 22 Jun 2019 20:12:51 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 4ce61f9f-6003-0033-2136-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1cf568ee-952a-11e9-bb36-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFd1646c72-1aa6-423b-a070-0cfc5d649668Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAmYO63jYp1QE=Sat,\ - \ 22 Jun 2019 20:12:51 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 4ce61fab-6003-0033-2c36-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 1cfd9dfa-952a-11e9-896e-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:12:51 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://remotestoragename.queue.core.windows.net/pythonqueue6405110f/messages?numofmessages=4&visibilitytimeout=20 - response: - body: - string: "\uFEFFc07a14fe-0248-49ac-84ef-9183eec8c1f9Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAkquu6jYp1QE=Sat,\ - \ 22 Jun 2019 20:13:11 GMT1message18c47bcca-e16f-4b92-92b1-15e94379eb52Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAkquu6jYp1QE=Sat,\ - \ 22 Jun 2019 20:13:11 GMT1message2ee5ab552-39a9-40a8-ad63-d94e3b486906Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAkquu6jYp1QE=Sat,\ - \ 22 Jun 2019 20:13:11 GMT1message3d1646c72-1aa6-423b-a070-0cfc5d649668Sat,\ - \ 22 Jun 2019 20:12:51 GMTSat, 29 Jun 2019\ - \ 20:12:51 GMTAgAAAAMAAAAAAAAAkquu6jYp1QE=Sat,\ - \ 22 Jun 2019 20:13:11 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:12:51 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 4ce61fb4-6003-0033-3536-293d2d000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de5c3670-952a-11e9-837b-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: ['*/*'] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['0'] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [eb8b0f92-ad90-11e9-ad43-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + x-ms-version: ['2018-03-28'] method: PUT uri: https://storagename.queue.core.windows.net/pythonqueue6405110f response: - body: - string: '' + body: {string: ''} headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:18:15 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - e1a897ac-1003-0073-2a37-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Length: ['0'] + Date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + x-ms-request-id: [ab763224-9003-000f-719d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message1' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de7c09d2-952a-11e9-a68c-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ebe04322-ad90-11e9-90d1-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages response: - body: - string: "\uFEFF4a3e7e24-0f9b-488d-a93e-8f6c52511bd4Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAG91CoDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:16 GMT" + body: {string: "\uFEFF1aea519c-55e7-4613-a635-11e894f3f1cdTue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAiP6wrZ1B1QE=Tue, + 23 Jul 2019 21:29:15 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:16 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - e1a897b4-1003-0073-2e37-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [ab763242-9003-000f-099d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message2' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de8504a6-952a-11e9-b42e-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ebf1ec6c-ad90-11e9-a1a9-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages response: - body: - string: "\uFEFF6382f360-4bb2-4635-bbb0-0a2bdb1bc21bSat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAhwZMoDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:16 GMT" + body: {string: "\uFEFFfcc1b957-6743-4cd8-9a37-561f4e76a694Tue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAtJHArZ1B1QE=Tue, + 23 Jul 2019 21:29:15 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:16 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - e1a897bc-1003-0073-3337-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [ab76324f-9003-000f-159d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message3' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de8e1458-952a-11e9-8ed7-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ec017d92-ad90-11e9-9118-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages response: - body: - string: "\uFEFF4aa83d39-8722-46ab-a654-897fc8ff05b4Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAxOFUoDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:16 GMT" + body: {string: "\uFEFFb6cf0c16-2d49-40fc-93bb-29e45e32ec5bTue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAbA/RrZ1B1QE=Tue, + 23 Jul 2019 21:29:15 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:16 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - e1a897c8-1003-0073-3a37-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [ab76325c-9003-000f-209d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: ' message4' headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de96f262-952a-11e9-b5f5-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + Content-Length: ['103'] + Content-Type: [application/xml; charset=utf-8] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ec129446-ad90-11e9-9a37-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + x-ms-version: ['2018-03-28'] method: POST uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages response: - body: - string: "\uFEFF5425bc84-4683-47e1-bfe0-f38ddb517178Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAA6ZVdoDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:16 GMT" + body: {string: "\uFEFFee1fb3f0-9d97-49bf-87d6-46e6403847cfTue, + 23 Jul 2019 21:29:16 GMTTue, 30 Jul 2019 21:29:16 + GMTAgAAAAMAAAAAAAAAwPDgrZ1B1QE=Tue, + 23 Jul 2019 21:29:16 GMT"} headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:16 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - e1a897cf-1003-0073-3f37-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:15 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + x-ms-request-id: [ab76326e-9003-000f-309d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 201, message: Created} - request: body: null headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - de9f9886-952a-11e9-bd95-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:18:16 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ec21afd2-ad90-11e9-b00f-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:16 GMT'] + x-ms-version: ['2018-03-28'] method: GET uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages?numofmessages=4&visibilitytimeout=20 response: - body: - string: "\uFEFF4a3e7e24-0f9b-488d-a93e-8f6c52511bd4Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAVYFSrDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:36 GMT1message16382f360-4bb2-4635-bbb0-0a2bdb1bc21bSat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAVYFSrDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:36 GMT1message24aa83d39-8722-46ab-a654-897fc8ff05b4Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAVYFSrDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:36 GMT1message35425bc84-4683-47e1-bfe0-f38ddb517178Sat,\ - \ 22 Jun 2019 20:18:16 GMTSat, 29 Jun 2019\ - \ 20:18:16 GMTAgAAAAMAAAAAAAAAVYFSrDcp1QE=Sat,\ - \ 22 Jun 2019 20:18:36 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:18:16 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - e1a897d5-1003-0073-4437-2914c3000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK + body: {string: "\uFEFF1aea519c-55e7-4613-a635-11e894f3f1cdTue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAXQnduZ1B1QE=Tue, + 23 Jul 2019 21:29:36 GMT1message1fcc1b957-6743-4cd8-9a37-561f4e76a694Tue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAXQnduZ1B1QE=Tue, + 23 Jul 2019 21:29:36 GMT1message2b6cf0c16-2d49-40fc-93bb-29e45e32ec5bTue, + 23 Jul 2019 21:29:15 GMTTue, 30 Jul 2019 21:29:15 + GMTAgAAAAMAAAAAAAAAXQnduZ1B1QE=Tue, + 23 Jul 2019 21:29:36 GMT1message3ee1fb3f0-9d97-49bf-87d6-46e6403847cfTue, + 23 Jul 2019 21:29:16 GMTTue, 30 Jul 2019 21:29:16 + GMTAgAAAAMAAAAAAAAAXQnduZ1B1QE=Tue, + 23 Jul 2019 21:29:36 GMT1message4"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:16 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + Vary: [Origin] + x-ms-request-id: [ab763281-9003-000f-3f9d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 200, message: OK} - request: body: null headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 75ccf3fa-952b-11e9-aff5-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - 7df02fa6-3003-00ec-1538-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 75ed5910-952b-11e9-be2b-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF75b37bc0-c7e6-48e8-9ce3-94d914932dabSat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAqu20Nzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:30 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 7df02faf-3003-00ec-1b38-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 75f69162-952b-11e9-bff9-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFf4e91262-01c6-48ae-bc09-7af40ee60c6bSat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAA58i9Nzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:30 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 7df02fb3-3003-00ec-1f38-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 75ff663a-952b-11e9-adab-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF7001b035-8d54-406a-82b5-69753b3448e6Sat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAADX3GNzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:30 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 7df02fba-3003-00ec-2638-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 76087c36-952b-11e9-9eae-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF1ab76e0f-1d96-42d7-999c-3accd5230ee2Sat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAYX/PNzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:30 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - 7df02fbd-3003-00ec-2938-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - 76115afe-952b-11e9-8512-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:22:30 GMT - x-ms-version: - - '2018-03-28' + Accept: [application/xml] + Accept-Encoding: ['gzip, deflate'] + Connection: [keep-alive] + User-Agent: [azsdk-python-storage-queue/12.0.0b1 Python/3.7.0 (Windows-10-10.0.18362-SP0)] + x-ms-client-request-id: [ec33efd0-ad90-11e9-a453-ecb1d756380e] + x-ms-date: ['Tue, 23 Jul 2019 21:29:16 GMT'] + x-ms-version: ['2018-03-28'] method: GET uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages?numofmessages=4&visibilitytimeout=20 response: - body: - string: "\uFEFF75b37bc0-c7e6-48e8-9ce3-94d914932dabSat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAtUPEQzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:50 GMT1message1f4e91262-01c6-48ae-bc09-7af40ee60c6bSat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAtUPEQzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:50 GMT1message27001b035-8d54-406a-82b5-69753b3448e6Sat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAtUPEQzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:50 GMT1message31ab76e0f-1d96-42d7-999c-3accd5230ee2Sat,\ - \ 22 Jun 2019 20:22:30 GMTSat, 29 Jun 2019\ - \ 20:22:30 GMTAgAAAAMAAAAAAAAAtUPEQzgp1QE=Sat,\ - \ 22 Jun 2019 20:22:50 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:22:29 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - 7df02fc2-3003-00ec-2e38-296c79000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK -- request: - body: null - headers: - Accept: - - '*/*' - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '0' - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b0efd498-952d-11e9-a770-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:28 GMT - x-ms-version: - - '2018-03-28' - method: PUT - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f - response: - body: - string: '' - headers: - Content-Length: - - '0' - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - x-ms-request-id: - - abd1b919-4003-0006-193a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message1' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b11061ac-952d-11e9-b8b8-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:28 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFe2a1644d-981b-4c48-8b4c-fc8b539037f3Sat,\ - \ 22 Jun 2019 20:38:28 GMTSat, 29 Jun 2019\ - \ 20:38:28 GMTAgAAAAMAAAAAAAAA2cfYcjop1QE=Sat,\ - \ 22 Jun 2019 20:38:28 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - abd1b924-4003-0006-213a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message2' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b1198976-952d-11e9-a7a0-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:28 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF26981b56-716f-4f72-af1e-301773a26c92Sat,\ - \ 22 Jun 2019 20:38:28 GMTSat, 29 Jun 2019\ - \ 20:38:28 GMTAgAAAAMAAAAAAAAAAnzhcjop1QE=Sat,\ - \ 22 Jun 2019 20:38:28 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - abd1b929-4003-0006-263a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message3' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b1222c70-952d-11e9-ab5a-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:28 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFFdebf68ee-14a5-4669-a34b-3e8092fe04a1Sat,\ - \ 22 Jun 2019 20:38:29 GMTSat, 29 Jun 2019\ - \ 20:38:29 GMTAgAAAAMAAAAAAAAAQ1fqcjop1QE=Sat,\ - \ 22 Jun 2019 20:38:29 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - abd1b932-4003-0006-2d3a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: ' - - message4' - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - Content-Length: - - '103' - Content-Type: - - application/xml; charset=utf-8 - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b12b1240-952d-11e9-afa4-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:28 GMT - x-ms-version: - - '2018-03-28' - method: POST - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages - response: - body: - string: "\uFEFF103e9ae6-f20c-4d69-aede-b0d740fba873Sat,\ - \ 22 Jun 2019 20:38:29 GMTSat, 29 Jun 2019\ - \ 20:38:29 GMTAgAAAAMAAAAAAAAA+PXzcjop1QE=Sat,\ - \ 22 Jun 2019 20:38:29 GMT" - headers: - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - x-ms-request-id: - - abd1b93b-4003-0006-343a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 201 - message: Created -- request: - body: null - headers: - Accept: - - application/xml - Accept-Encoding: - - gzip, deflate - Connection: - - keep-alive - User-Agent: - - python/3.6.5 (Darwin-16.7.0-x86_64-i386-64bit) azure-core/0.0.1 - x-ms-client-request-id: - - b134a7ec-952d-11e9-a776-f45c89a7d159 - x-ms-date: - - Sat, 22 Jun 2019 20:38:29 GMT - x-ms-version: - - '2018-03-28' - method: GET - uri: https://storagename.queue.core.windows.net/pythonqueue6405110f/messages?numofmessages=4&visibilitytimeout=20 - response: - body: - string: "\uFEFFe2a1644d-981b-4c48-8b4c-fc8b539037f3Sat,\ - \ 22 Jun 2019 20:38:28 GMTSat, 29 Jun 2019\ - \ 20:38:28 GMTAgAAAAMAAAAAAAAAIWzofjop1QE=Sat,\ - \ 22 Jun 2019 20:38:49 GMT1message126981b56-716f-4f72-af1e-301773a26c92Sat,\ - \ 22 Jun 2019 20:38:28 GMTSat, 29 Jun 2019\ - \ 20:38:28 GMTAgAAAAMAAAAAAAAAIWzofjop1QE=Sat,\ - \ 22 Jun 2019 20:38:49 GMT1message2debf68ee-14a5-4669-a34b-3e8092fe04a1Sat,\ - \ 22 Jun 2019 20:38:29 GMTSat, 29 Jun 2019\ - \ 20:38:29 GMTAgAAAAMAAAAAAAAAIWzofjop1QE=Sat,\ - \ 22 Jun 2019 20:38:49 GMT1message3103e9ae6-f20c-4d69-aede-b0d740fba873Sat,\ - \ 22 Jun 2019 20:38:29 GMTSat, 29 Jun 2019\ - \ 20:38:29 GMTAgAAAAMAAAAAAAAAIWzofjop1QE=Sat,\ - \ 22 Jun 2019 20:38:49 GMT1message4" - headers: - Cache-Control: - - no-cache - Content-Type: - - application/xml - Date: - - Sat, 22 Jun 2019 20:38:28 GMT - Server: - - Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0 - Transfer-Encoding: - - chunked - Vary: - - Origin - x-ms-request-id: - - abd1b940-4003-0006-383a-299378000000 - x-ms-version: - - '2018-03-28' - status: - code: 200 - message: OK + body: {string: "\uFEFF"} + headers: + Cache-Control: [no-cache] + Content-Type: [application/xml] + Date: ['Tue, 23 Jul 2019 21:29:16 GMT'] + Server: [Windows-Azure-Queue/1.0 Microsoft-HTTPAPI/2.0] + Transfer-Encoding: [chunked] + Vary: [Origin] + x-ms-request-id: [ab763289-9003-000f-479d-4189f6000000] + x-ms-version: ['2018-03-28'] + status: {code: 200, message: OK} version: 1 diff --git a/sdk/storage/azure-storage-queue/tests/test_queue.py b/sdk/storage/azure-storage-queue/tests/test_queue.py index 8df7fc472476..1aa1e14536ba 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue.py @@ -158,16 +158,13 @@ def test_list_queues_with_options(self): # Action generator1 = self.qsc.list_queues( name_starts_with=prefix, - results_per_page=3) - next(generator1) - queues1 = generator1.current_page + results_per_page=3).by_page() + queues1 = list(next(generator1)) generator2 = self.qsc.list_queues( name_starts_with=prefix, - marker=generator1.next_marker, - include_metadata=True) - next(generator2) - queues2 = generator2.current_page + include_metadata=True).by_page(generator1.continuation_token) + queues2 = list(next(generator2)) # Asserts self.assertIsNotNone(queues1) @@ -175,6 +172,7 @@ def test_list_queues_with_options(self): self.assertIsNotNone(queues1[0]) self.assertIsNone(queues1[0].metadata) self.assertNotEqual('', queues1[0].name) + assert generator1.location_mode is not None # Asserts self.assertIsNotNone(queues2) self.assertTrue(len(self.test_queues) - 3 <= len(queues2)) @@ -317,14 +315,14 @@ def test_get_messages_with_options(self): queue_client.enqueue_message(u'message2') queue_client.enqueue_message(u'message3') queue_client.enqueue_message(u'message4') - result = queue_client.receive_messages(messages_per_page=4, visibility_timeout=20) - next(result) + pager = queue_client.receive_messages(messages_per_page=4, visibility_timeout=20) + result = list(pager) # Asserts self.assertIsNotNone(result) - self.assertEqual(4, len(result.current_page)) + self.assertEqual(4, len(result)) - for message in result.current_page: + for message in result: self.assertIsNotNone(message) self.assertNotEqual('', message.id) self.assertNotEqual('', message.content) @@ -406,12 +404,12 @@ def test_delete_message(self): message = next(queue_client.receive_messages()) queue_client.delete_message(message) - messages = queue_client.receive_messages(messages_per_page=32) - next(messages) + messages_pager = queue_client.receive_messages(messages_per_page=32) + messages = list(messages_pager) # Asserts - self.assertIsNotNone(messages) - self.assertEqual(3, len(messages.current_page)) + assert messages is not None + assert len(messages) == 3 @record def test_update_message(self): diff --git a/sdk/storage/azure-storage-queue/tests/test_queue_async.py b/sdk/storage/azure-storage-queue/tests/test_queue_async.py index 718839c670f0..ccc13646b66a 100644 --- a/sdk/storage/azure-storage-queue/tests/test_queue_async.py +++ b/sdk/storage/azure-storage-queue/tests/test_queue_async.py @@ -193,16 +193,16 @@ async def _test_list_queues_with_options(self): await self._create_queue(prefix + str(i)) # Action - generator1 = self.qsc.list_queues(name_starts_with=prefix, results_per_page=3) + generator1 = self.qsc.list_queues( + name_starts_with=prefix, + results_per_page=3).by_page() await generator1.__anext__() - queues1 = generator1.current_page + queues1 = list(await generator1.__anext__()) generator2 = self.qsc.list_queues( name_starts_with=prefix, - marker=generator1.next_marker, - include_metadata=True) - await generator2.__anext__() - queues2 = generator2.current_page + include_metadata=True).by_page(generator1.continuation_token) + queues2 = list(await generator2.__anext__()) # Asserts self.assertIsNotNone(queues1) @@ -410,14 +410,16 @@ async def _test_get_messages_with_options(self): await queue_client.enqueue_message(u'message2') await queue_client.enqueue_message(u'message3') await queue_client.enqueue_message(u'message4') - result = queue_client.receive_messages(messages_per_page=4, visibility_timeout=20) - await result.__anext__() + pager = queue_client.receive_messages(messages_per_page=4, visibility_timeout=20) + result = [] + async for el in pager: + result.append(el) # Asserts self.assertIsNotNone(result) - self.assertEqual(4, len(result.current_page)) + self.assertEqual(4, len(result)) - for message in result.current_page: + for message in result: self.assertIsNotNone(message) self.assertNotEqual('', message.id) self.assertNotEqual('', message.content)