-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathevent.go
More file actions
35 lines (32 loc) · 1.02 KB
/
event.go
File metadata and controls
35 lines (32 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"github.com/docker/docker/api/types"
log "github.com/sirupsen/logrus"
)
type event struct {
ServiceName string `json:"service_name,omitempty"`
ServiceDescription string `json:"service_description,omitempty"`
ServiceDeployStatus string `json:"service_deploy_status,omitempty"`
Repository string `json:"repository,omitempty"`
LogsURL string `json:"logs_url,omitempty"`
ImageName string `json:"image_name,omitempty"`
Experts []string `json:"experts,omitempty"`
Logs string `json:"logs,omitempty"`
ExitCode string `json:"exit_code,omitempty"`
EventType string `json:"event_type,omitempty"`
}
func (d *daemon) collectEvents() {
events, errChan := d.client.Events(d.ctx, types.EventsOptions{})
for {
select {
case e := <-events:
if e.Type == "container" {
d.eventContainer(e)
} else if e.Type == "service" {
d.eventService(e)
}
case err := <-errChan:
log.Error(err)
}
}
}