@@ -32,6 +32,30 @@ const (
3232 Error
3333)
3434
35+ const (
36+ StatusError = "Error"
37+ StatusCreating = "Creating"
38+ StatusStarting = "Starting"
39+ StatusStarted = "Started"
40+ StatusWaiting = "Waiting"
41+ StatusHealthy = "Healthy"
42+ StatusExited = "Exited"
43+ StatusRestarting = "Restarting"
44+ StatusRestarted = "Restarted"
45+ StatusRunning = "Running"
46+ StatusCreated = "Created"
47+ StatusStopping = "Stopping"
48+ StatusStopped = "Stopped"
49+ StatusKilling = "Killing"
50+ StatusKilled = "Killed"
51+ StatusRemoving = "Removing"
52+ StatusRemoved = "Removed"
53+ StatusBuilding = "Building"
54+ StatusBuilt = "Built"
55+ StatusPulling = "Pulling"
56+ StatusPulled = "Pulled"
57+ )
58+
3559// Event represents a progress event.
3660type Event struct {
3761 ID string
@@ -51,97 +75,107 @@ func ErrorMessageEvent(id string, msg string) Event {
5175
5276// ErrorEvent creates a new Error Event
5377func ErrorEvent (id string ) Event {
54- return NewEvent (id , Error , "Error" )
78+ return NewEvent (id , Error , StatusError )
5579}
5680
5781// CreatingEvent creates a new Create in progress Event
5882func CreatingEvent (id string ) Event {
59- return NewEvent (id , Working , "Creating" )
83+ return NewEvent (id , Working , StatusCreating )
6084}
6185
6286// StartingEvent creates a new Starting in progress Event
6387func StartingEvent (id string ) Event {
64- return NewEvent (id , Working , "Starting" )
88+ return NewEvent (id , Working , StatusStarting )
6589}
6690
6791// StartedEvent creates a new Started in progress Event
6892func StartedEvent (id string ) Event {
69- return NewEvent (id , Done , "Started" )
93+ return NewEvent (id , Done , StatusStarted )
7094}
7195
7296// Waiting creates a new waiting event
7397func Waiting (id string ) Event {
74- return NewEvent (id , Working , "Waiting" )
98+ return NewEvent (id , Working , StatusWaiting )
7599}
76100
77101// Healthy creates a new healthy event
78102func Healthy (id string ) Event {
79- return NewEvent (id , Done , "Healthy" )
103+ return NewEvent (id , Done , StatusHealthy )
80104}
81105
82106// Exited creates a new exited event
83107func Exited (id string ) Event {
84- return NewEvent (id , Done , "Exited" )
108+ return NewEvent (id , Done , StatusExited )
85109}
86110
87111// RestartingEvent creates a new Restarting in progress Event
88112func RestartingEvent (id string ) Event {
89- return NewEvent (id , Working , "Restarting" )
113+ return NewEvent (id , Working , StatusRestarting )
90114}
91115
92116// RestartedEvent creates a new Restarted in progress Event
93117func RestartedEvent (id string ) Event {
94- return NewEvent (id , Done , "Restarted" )
118+ return NewEvent (id , Done , StatusRestarted )
95119}
96120
97121// RunningEvent creates a new Running in progress Event
98122func RunningEvent (id string ) Event {
99- return NewEvent (id , Done , "Running" )
123+ return NewEvent (id , Done , StatusRunning )
100124}
101125
102126// CreatedEvent creates a new Created (done) Event
103127func CreatedEvent (id string ) Event {
104- return NewEvent (id , Done , "Created" )
128+ return NewEvent (id , Done , StatusCreated )
105129}
106130
107131// StoppingEvent creates a new Stopping in progress Event
108132func StoppingEvent (id string ) Event {
109- return NewEvent (id , Working , "Stopping" )
133+ return NewEvent (id , Working , StatusStopping )
110134}
111135
112136// StoppedEvent creates a new Stopping in progress Event
113137func StoppedEvent (id string ) Event {
114- return NewEvent (id , Done , "Stopped" )
138+ return NewEvent (id , Done , StatusStopped )
115139}
116140
117141// KillingEvent creates a new Killing in progress Event
118142func KillingEvent (id string ) Event {
119- return NewEvent (id , Working , "Killing" )
143+ return NewEvent (id , Working , StatusKilling )
120144}
121145
122146// KilledEvent creates a new Killed in progress Event
123147func KilledEvent (id string ) Event {
124- return NewEvent (id , Done , "Killed" )
148+ return NewEvent (id , Done , StatusKilled )
125149}
126150
127151// RemovingEvent creates a new Removing in progress Event
128152func RemovingEvent (id string ) Event {
129- return NewEvent (id , Working , "Removing" )
153+ return NewEvent (id , Working , StatusRemoving )
130154}
131155
132156// RemovedEvent creates a new removed (done) Event
133157func RemovedEvent (id string ) Event {
134- return NewEvent (id , Done , "Removed" )
158+ return NewEvent (id , Done , StatusRemoved )
135159}
136160
137161// BuildingEvent creates a new Building in progress Event
138162func BuildingEvent (id string ) Event {
139- return NewEvent (id , Working , "Building" )
163+ return NewEvent ("Image " + id , Working , StatusBuilding )
140164}
141165
142166// BuiltEvent creates a new built (done) Event
143167func BuiltEvent (id string ) Event {
144- return NewEvent (id , Done , "Built" )
168+ return NewEvent ("Image " + id , Done , StatusBuilt )
169+ }
170+
171+ // PullingEvent creates a new pulling (in progress) Event
172+ func PullingEvent (id string ) Event {
173+ return NewEvent ("Image " + id , Working , StatusPulling )
174+ }
175+
176+ // PulledEvent creates a new pulled (done) Event
177+ func PulledEvent (id string ) Event {
178+ return NewEvent ("Image " + id , Done , StatusPulled )
145179}
146180
147181// SkippedEvent creates a new Skipped Event
0 commit comments