summaryrefslogtreecommitdiff
path: root/pkg/api
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-03-27 13:21:51 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-15 09:38:04 -0500
commit165aef7766953cd0c0589ffa1abc25022a905adb (patch)
tree4ac195c5290dbd6ea9fbfb5b1aaa53d169a00899 /pkg/api
parenta756161e80cd32b705bb0dfe3ec4753f883ec929 (diff)
downloadpodman-165aef7766953cd0c0589ffa1abc25022a905adb.tar.gz
podman-165aef7766953cd0c0589ffa1abc25022a905adb.tar.bz2
podman-165aef7766953cd0c0589ffa1abc25022a905adb.zip
podmanv2 events
add the ability to monitor events Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/api')
-rw-r--r--pkg/api/handlers/types.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/pkg/api/handlers/types.go b/pkg/api/handlers/types.go
index f1c932ebc..0fe6ae6a7 100644
--- a/pkg/api/handlers/types.go
+++ b/pkg/api/handlers/types.go
@@ -180,6 +180,31 @@ type ExecCreateResponse struct {
docker.IDResponse
}
+func (e *Event) ToLibpodEvent() *events.Event {
+ exitCode, err := strconv.Atoi(e.Actor.Attributes["containerExitCode"])
+ if err != nil {
+ return nil
+ }
+ status, err := events.StringToStatus(e.Action)
+ if err != nil {
+ return nil
+ }
+ t, err := events.StringToType(e.Type)
+ if err != nil {
+ return nil
+ }
+ lp := events.Event{
+ ContainerExitCode: exitCode,
+ ID: e.Actor.ID,
+ Image: e.Actor.Attributes["image"],
+ Name: e.Actor.Attributes["name"],
+ Status: status,
+ Time: time.Unix(e.Time, e.TimeNano),
+ Type: t,
+ }
+ return &lp
+}
+
func EventToApiEvent(e *events.Event) *Event {
return &Event{dockerEvents.Message{
Type: e.Type.String(),