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 ;
810import com .fasterxml .jackson .annotation .JsonProperty ;
11+ import org .apache .commons .lang .builder .ToStringStyle ;
912
1013import javax .annotation .CheckForNull ;
1114
15+ import static org .apache .commons .lang .builder .ToStringStyle .SHORT_PREFIX_STYLE ;
16+
1217/**
1318 * Representation of a Docker event.
1419 */
1520@ JsonIgnoreProperties (ignoreUnknown = true )
1621@ JsonInclude (Include .NON_NULL )
1722public class Event {
23+
24+ /**
25+ * @since 1.16
26+ */
27+ @ JsonProperty ("status" )
1828 private String status ;
1929
30+ /**
31+ * @since 1.16
32+ */
33+ @ JsonProperty ("id" )
2034 private String id ;
2135
36+ /**
37+ * @since 1.16
38+ */
39+ @ JsonProperty ("from" )
2240 private String from ;
2341
24- private Long time ;
25-
26- @ JsonIgnoreProperties
42+ /**
43+ * ??
44+ */
45+ @ JsonProperty ("node" )
2746 private Node node ;
2847
2948 /*
30- * @since API Version 1.24
49+ * @since 1.
3150 */
3251 @ JsonProperty ("Type" )
33- private String type ;
52+ private EventType type ;
53+
54+ /**
55+ * @since 1.22
56+ */
57+ @ JsonProperty ("Action" )
58+ private String action ;
59+
60+ /**
61+ * @since 1.16
62+ */
63+ @ JsonProperty ("time" )
64+ private Long time ;
65+
66+ /**
67+ * @since 1.21
68+ */
69+ @ JsonProperty ("timenano" )
70+ private Long timenano ;
3471
3572 /**
3673 * Default constructor for the deserialization.
@@ -41,16 +78,12 @@ public Event() {
4178 /**
4279 * Constructor.
4380 *
44- * @param id
45- * Container ID
46- * @param status
47- * Status string. List of statuses is available in <a
48- * href="https://docs.docker.com/reference/api/docker_remote_api_v1.16/#monitor-dockers-events">Docker API v.1.16</a>
49- * @param from
50- * Image, from which the container has been created
51- * @param time
52- * Event time The time is specified in milliseconds since January 1, 1970, 00:00:00 GMT
53- * @since TODO
81+ * @param id Container ID
82+ * @param status Status string. List of statuses is available in <a
83+ * href="https://docs.docker.com/reference/api/docker_remote_api_v1.16/#monitor-dockers-events">Docker API v.1.16</a>
84+ * @param from Image, from which the container has been created
85+ * @param time Event time The time is specified in milliseconds since January 1, 1970, 00:00:00 GMT
86+ * @since 1.16
5487 */
5588 public Event (String status , String id , String from , Long time ) {
5689 this .status = status ;
@@ -96,25 +129,46 @@ public Long getTime() {
96129 return time ;
97130 }
98131
132+ /**
133+ * @see #timenano
134+ */
135+ @ CheckForNull
136+ public Long getTimenano () {
137+ return timenano ;
138+ }
139+
99140 /**
100141 * Returns the node when working against docker swarm
101142 */
102143 public Node getNode () {
103144 return node ;
104145 }
105146
106- /*
107- * Get type of event.
108- *
109- * @return type of event
110- */
111147 @ CheckForNull
112- public String getType () {
148+ public EventType getType () {
113149 return type ;
114150 }
115151
152+ /**
153+ * @see #action
154+ */
155+ @ CheckForNull
156+ public String getAction () {
157+ return action ;
158+ }
159+
116160 @ Override
117161 public String toString () {
118- return ToStringBuilder .reflectionToString (this );
162+ return ToStringBuilder .reflectionToString (this , SHORT_PREFIX_STYLE );
163+ }
164+
165+ @ Override
166+ public boolean equals (Object o ) {
167+ return EqualsBuilder .reflectionEquals (this , o );
168+ }
169+
170+ @ Override
171+ public int hashCode () {
172+ return HashCodeBuilder .reflectionHashCode (this );
119173 }
120174}
0 commit comments