summaryrefslogtreecommitdiff
path: root/pkg/api/handlers
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-04-15 18:37:18 +0200
committerGitHub <noreply@github.com>2020-04-15 18:37:18 +0200
commit9b78bf9293bd7920b60aa0bf41fa40f9200f54ff (patch)
tree10fc513e65d5aa0fb6818674478549c121330e8b /pkg/api/handlers
parentcc9b78f07ca9941260b74ad07f3b94357e138286 (diff)
parent165aef7766953cd0c0589ffa1abc25022a905adb (diff)
downloadpodman-9b78bf9293bd7920b60aa0bf41fa40f9200f54ff.tar.gz
podman-9b78bf9293bd7920b60aa0bf41fa40f9200f54ff.tar.bz2
podman-9b78bf9293bd7920b60aa0bf41fa40f9200f54ff.zip
Merge pull request #5770 from baude/v2events
podmanv2 events
Diffstat (limited to 'pkg/api/handlers')
-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(),