File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
src/main/java/com/amihaiemil/docker Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 2626package com .amihaiemil .docker ;
2727
2828import java .io .IOException ;
29+ import java .io .Reader ;
2930
3031/**
3132 * Docker System API entry point.
@@ -45,4 +46,13 @@ public interface DockerSystem {
4546 DiskSpaceInfo diskUsage ()
4647 throws IOException , UnexpectedResponseException ;
4748
49+ /**
50+ * Follow the events on the server in real time.
51+ * @return The events {@link Reader}.
52+ * @throws IOException If an I/O error occurs.
53+ * @throws UnexpectedResponseException If the API responds with an
54+ * unexpected status.
55+ */
56+ Reader events ()
57+ throws IOException , UnexpectedResponseException ;
4858}
Original file line number Diff line number Diff line change 3030import org .apache .http .client .methods .HttpGet ;
3131
3232import java .io .IOException ;
33+ import java .io .Reader ;
3334import java .net .URI ;
3435
3536/**
@@ -91,4 +92,20 @@ public DiskSpaceInfo diskUsage()
9192 }
9293 }
9394
95+ @ Override
96+ public Reader events () throws IOException , UnexpectedResponseException {
97+ final HttpGet monitor = new HttpGet (
98+ this .baseUri .toString () + "/events"
99+ );
100+ return this .client .execute (
101+ monitor ,
102+ new ReadStream (
103+ new MatchStatus (
104+ monitor .getURI (),
105+ HttpStatus .SC_OK
106+ )
107+ )
108+ );
109+ }
110+
94111}
You can’t perform that action at this time.
0 commit comments