async def get_deleted_secret(self, name: str, **kwargs: "**Any") -> DeletedSecret: """Get a deleted secret. This is only possible in vaults with soft-delete enabled. Requires the secrets/get permission. :param str name: Name of the secret :rtype: ~azure.keyvault.secrets.models.DeletedSecret :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` if the deleted secret doesn't exist, :class:`~azure.core.exceptions.HttpResponseError` for other errors Example: .. literalinclude:: ../tests/test_samples_secrets_async.py :start-after: [START get_deleted_secret] :end-before: [END get_deleted_secret] :language: python :caption: Get a deleted secret :dedent: 8 """ bundle = await self._client.get_deleted_secret( self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs) return DeletedSecret._from_deleted_secret_bundle(bundle)
async def delete_secret(self, name: str, **kwargs: Mapping[str, Any]) -> DeletedSecret: """Delete all versions of a secret. Requires the secrets/delete permission. :param str name: Name of the secret :rtype: ~azure.keyvault.secrets.models.DeletedSecret :raises: ~azure.core.exceptions.ResourceNotFoundError if the secret doesn't exist Example: .. literalinclude:: ../tests/test_samples_secrets_async.py :start-after: [START delete_secret] :end-before: [END delete_secret] :language: python :caption: Delete a secret :dedent: 8 """ bundle = await self._client.delete_secret( self.vault_url, name, error_map={404: ResourceNotFoundError}, **kwargs ) return DeletedSecret._from_deleted_secret_bundle(bundle)
async def delete_secret(self, name: str, **kwargs: "**Any") -> DeletedSecret: """Delete all versions of a secret. Requires the secrets/delete permission. :param str name: Name of the secret :rtype: ~azure.keyvault.secrets.models.DeletedSecret :raises: :class:`~azure.core.exceptions.ResourceNotFoundError` if the secret doesn't exist, :class:`~azure.core.exceptions.HttpResponseError` for other errors Example: .. literalinclude:: ../tests/test_samples_secrets_async.py :start-after: [START delete_secret] :end-before: [END delete_secret] :language: python :caption: Delete a secret :dedent: 8 """ bundle = await self._client.delete_secret(self.vault_endpoint, name, error_map=_error_map, **kwargs) return DeletedSecret._from_deleted_secret_bundle(bundle)
def list_deleted_secrets(self, **kwargs: Mapping[str, Any]) -> AsyncIterable[DeletedSecret]: """Lists all deleted secrets. This is only possible in vaults with soft-delete enabled. Requires the secrets/list permission. :returns: An iterator of deleted secrets :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.keyvault.secrets.models.DeletedSecret] Example: .. literalinclude:: ../tests/test_samples_secrets_async.py :start-after: [START list_deleted_secrets] :end-before: [END list_deleted_secrets] :language: python :caption: Lists deleted secrets :dedent: 8 """ max_results = kwargs.get("max_page_size") return self._client.get_deleted_secrets( self.vault_url, maxresults=max_results, cls=lambda objs: [DeletedSecret._from_deleted_secret_item(x) for x in objs], **kwargs )