async def get_deleted_key(self, name: str, **kwargs: "**Any") -> DeletedKey: """Get a deleted key. This is only possible in a vault with soft-delete enabled. Requires the keys/get permission. :param str name: The name of the key :returns: The deleted key :rtype: ~azure.keyvault.keys.models.DeletedKey :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` if the key doesn't exist, :class:`~azure.core.exceptions.HttpResponseError` for other errors Example: .. literalinclude:: ../tests/test_samples_keys_async.py :start-after: [START get_deleted_key] :end-before: [END get_deleted_key] :language: python :caption: Get a deleted key :dedent: 8 """ bundle = await self._client.get_deleted_key(self.vault_endpoint, name, error_map=_error_map, **kwargs) return DeletedKey._from_deleted_key_bundle(bundle)
async def delete_key(self, name: str, **kwargs: "Any") -> DeletedKey: """Delete all versions of a key and its cryptographic material. Requires the keys/delete permission. :param str name: The name of the key to delete. :returns: The deleted key :rtype: ~azure.keyvault.keys.models.DeletedKey :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` if the key doesn't exist, :class:`~azure.core.exceptions.HttpResponseError` for other errors Example: .. literalinclude:: ../tests/test_samples_keys_async.py :start-after: [START delete_key] :end-before: [END delete_key] :language: python :caption: Delete a key :dedent: 8 """ bundle = await self._client.delete_key(self.vault_endpoint, name, error_map=_error_map, **kwargs) return DeletedKey._from_deleted_key_bundle(bundle)
def list_deleted_keys(self, **kwargs: "Any") -> "AsyncIterable[DeletedKey]": """List all deleted keys, including the public part of each. This is only possible in a vault with soft-delete enabled. Requires the keys/list permission. :returns: An iterator of deleted keys :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.keys.models.DeletedKey] Example: .. literalinclude:: ../tests/test_samples_keys_async.py :start-after: [START list_deleted_keys] :end-before: [END list_deleted_keys] :language: python :caption: List all the deleted keys :dedent: 8 """ max_results = kwargs.get("max_page_size") return self._client.get_deleted_keys( self.vault_endpoint, maxresults=max_results, cls=lambda objs: [DeletedKey._from_deleted_key_item(x) for x in objs], **kwargs, )
async def get_deleted_key(self, name: str, **kwargs: Mapping[str, Any]) -> DeletedKey: """Get a deleted key. This is only possible in a vault with soft-delete enabled. Requires the keys/get permission. :param str name: The name of the key :returns: The deleted key :rtype: ~azure.keyvault.keys.models.DeletedKey Example: .. literalinclude:: ../tests/test_samples_keys_async.py :start-after: [START get_deleted_key] :end-before: [END get_deleted_key] :language: python :caption: Get a deleted key :dedent: 8 """ bundle = await self._client.get_deleted_key( self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs) return DeletedKey._from_deleted_key_bundle(bundle)