11package com .github .dockerjava .api .model ;
22
3+ import org .apache .commons .lang .builder .EqualsBuilder ;
4+ import org .apache .commons .lang .builder .HashCodeBuilder ;
35import org .apache .commons .lang .builder .ToStringBuilder ;
46
57import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
68import com .fasterxml .jackson .annotation .JsonInclude ;
79import com .fasterxml .jackson .annotation .JsonInclude .Include ;
10+ import com .fasterxml .jackson .annotation .JsonProperty ;
11+
12+ import javax .annotation .CheckForNull ;
13+
14+ import static org .apache .commons .lang .builder .ToStringStyle .SHORT_PREFIX_STYLE ;
815
916/**
1017 * Representation of a Docker event.
1118 */
1219@ JsonIgnoreProperties (ignoreUnknown = true )
1320@ JsonInclude (Include .NON_NULL )
1421public class Event {
22+
23+ /**
24+ * @since 1.16
25+ */
26+ @ JsonProperty ("status" )
1527 private String status ;
1628
29+ /**
30+ * @since 1.16
31+ */
32+ @ JsonProperty ("id" )
1733 private String id ;
1834
35+ /**
36+ * @since 1.16
37+ */
38+ @ JsonProperty ("from" )
1939 private String from ;
2040
41+ /**
42+ * ??
43+ */
44+ @ JsonProperty ("node" )
45+ private Node node ;
46+
47+ /*
48+ * @since 1.
49+ */
50+ @ JsonProperty ("Type" )
51+ private EventType type ;
52+
53+ /**
54+ * @since 1.22
55+ */
56+ @ JsonProperty ("Action" )
57+ private String action ;
58+
59+ /**
60+ * @since 1.22
61+ */
62+ @ JsonProperty ("Actor" )
63+ private EventActor actor ;
64+
65+ /**
66+ * @since 1.16
67+ */
68+ @ JsonProperty ("time" )
2169 private Long time ;
2270
23- @ JsonIgnoreProperties
24- private Node node ;
71+ /**
72+ * @since 1.21
73+ */
74+ @ JsonProperty ("timeNano" )
75+ private Long timeNano ;
2576
2677 /**
2778 * Default constructor for the deserialization.
@@ -32,16 +83,12 @@ public Event() {
3283 /**
3384 * Constructor.
3485 *
35- * @param id
36- * Container ID
37- * @param status
38- * Status string. List of statuses is available in <a
39- * href="https://docs.docker.com/reference/api/docker_remote_api_v1.16/#monitor-dockers-events">Docker API v.1.16</a>
40- * @param from
41- * Image, from which the container has been created
42- * @param time
43- * Event time The time is specified in milliseconds since January 1, 1970, 00:00:00 GMT
44- * @since TODO
86+ * @param id Container ID
87+ * @param status Status string. List of statuses is available in <a
88+ * href="https://docs.docker.com/reference/api/docker_remote_api_v1.16/#monitor-dockers-events">Docker API v.1.16</a>
89+ * @param from Image, from which the container has been created
90+ * @param time Event time The time is specified in milliseconds since January 1, 1970, 00:00:00 GMT
91+ * @since 1.16
4592 */
4693 public Event (String status , String id , String from , Long time ) {
4794 this .status = status ;
@@ -60,6 +107,14 @@ public String getStatus() {
60107 return status ;
61108 }
62109
110+ /**
111+ * @see #status
112+ */
113+ public Event withStatus (String status ) {
114+ this .status = status ;
115+ return this ;
116+ }
117+
63118 /**
64119 * Get ID of docker container.
65120 *
@@ -69,6 +124,14 @@ public String getId() {
69124 return id ;
70125 }
71126
127+ /**
128+ * @see #id
129+ */
130+ public Event withId (String id ) {
131+ this .id = id ;
132+ return this ;
133+ }
134+
72135 /**
73136 * Get source image of the container.
74137 *
@@ -78,6 +141,14 @@ public String getFrom() {
78141 return from ;
79142 }
80143
144+ /**
145+ * @see #from
146+ */
147+ public Event withFrom (String from ) {
148+ this .from = from ;
149+ return this ;
150+ }
151+
81152 /**
82153 * Get the event time. The time is specified in milliseconds since January 1, 1970, 00:00:00 GMT
83154 *
@@ -87,15 +158,102 @@ public Long getTime() {
87158 return time ;
88159 }
89160
161+ /**
162+ * @see #time
163+ */
164+ public Event withTime (Long time ) {
165+ this .time = time ;
166+ return this ;
167+ }
168+
169+ /**
170+ * @see #timeNano
171+ */
172+ @ CheckForNull
173+ public Long getTimeNano () {
174+ return timeNano ;
175+ }
176+
177+ /**
178+ * @see #timeNano
179+ */
180+ public Event withTimenano (Long timenano ) {
181+ this .timeNano = timenano ;
182+ return this ;
183+ }
184+
90185 /**
91186 * Returns the node when working against docker swarm
92187 */
93188 public Node getNode () {
94189 return node ;
95190 }
96191
192+ /**
193+ * @see #node
194+ */
195+ public Event withNode (Node node ) {
196+ this .node = node ;
197+ return this ;
198+ }
199+
200+ @ CheckForNull
201+ public EventType getType () {
202+ return type ;
203+ }
204+
205+ /**
206+ * @see #type
207+ */
208+ public Event withType (EventType type ) {
209+ this .type = type ;
210+ return this ;
211+ }
212+
213+ /**
214+ * @see #action
215+ */
216+ @ CheckForNull
217+ public String getAction () {
218+ return action ;
219+ }
220+
221+ /**
222+ * @see #action
223+ */
224+ public Event withAction (String action ) {
225+ this .action = action ;
226+ return this ;
227+ }
228+
229+ /**
230+ * @see #actor
231+ */
232+ @ CheckForNull
233+ public EventActor getActor () {
234+ return actor ;
235+ }
236+
237+ /**
238+ * @see #actor
239+ */
240+ public Event withEventActor (EventActor actor ) {
241+ this .actor = actor ;
242+ return this ;
243+ }
244+
97245 @ Override
98246 public String toString () {
99- return ToStringBuilder .reflectionToString (this );
247+ return ToStringBuilder .reflectionToString (this , SHORT_PREFIX_STYLE );
248+ }
249+
250+ @ Override
251+ public boolean equals (Object o ) {
252+ return EqualsBuilder .reflectionEquals (this , o );
253+ }
254+
255+ @ Override
256+ public int hashCode () {
257+ return HashCodeBuilder .reflectionHashCode (this );
100258 }
101259}
0 commit comments