Revert "Remove vendored libjuju"
This reverts commit 9d18c22a0dc9e295adda50601fc5e2f45d2c9b8a.
Change-Id: I7dbf291ccd750c5f836ff80c642be492434ab3ac
Signed-off-by: Adam Israel <adam.israel@canonical.com>
diff --git a/modules/libjuju/examples/allwatcher.py b/modules/libjuju/examples/allwatcher.py
new file mode 100644
index 0000000..884230b
--- /dev/null
+++ b/modules/libjuju/examples/allwatcher.py
@@ -0,0 +1,31 @@
+"""
+This example:
+
+1. Connects to the current model
+2. Starts an AllWatcher
+3. Prints all changes received from the AllWatcher
+4. Runs forever (kill with Ctrl-C)
+
+"""
+import asyncio
+import logging
+
+from juju.client.connection import Connection
+from juju.client import client
+from juju import loop
+
+
+async def watch():
+ conn = await Connection.connect()
+ allwatcher = client.AllWatcherFacade.from_connection(conn)
+ while True:
+ change = await allwatcher.Next()
+ for delta in change.deltas:
+ print(delta.deltas)
+
+
+if __name__ == '__main__':
+ logging.basicConfig(level=logging.DEBUG)
+ # Run loop until the process is manually stopped (watch will loop
+ # forever).
+ loop.run(watch())