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 26
26
package com .amihaiemil .docker ;
27
27
28
28
import java .io .IOException ;
29
+ import java .io .Reader ;
29
30
30
31
/**
31
32
* Docker System API entry point.
@@ -45,4 +46,13 @@ public interface DockerSystem {
45
46
DiskSpaceInfo diskUsage ()
46
47
throws IOException , UnexpectedResponseException ;
47
48
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 ;
48
58
}
Original file line number Diff line number Diff line change 30
30
import org .apache .http .client .methods .HttpGet ;
31
31
32
32
import java .io .IOException ;
33
+ import java .io .Reader ;
33
34
import java .net .URI ;
34
35
35
36
/**
@@ -91,4 +92,20 @@ public DiskSpaceInfo diskUsage()
91
92
}
92
93
}
93
94
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
+
94
111
}
You can’t perform that action at this time.
0 commit comments