events.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. package events
  2. const (
  3. // ContainerEventType is the event type that containers generate
  4. ContainerEventType = "container"
  5. // DaemonEventType is the event type that daemon generate
  6. DaemonEventType = "daemon"
  7. // ImageEventType is the event type that images generate
  8. ImageEventType = "image"
  9. // NetworkEventType is the event type that networks generate
  10. NetworkEventType = "network"
  11. // PluginEventType is the event type that plugins generate
  12. PluginEventType = "plugin"
  13. // VolumeEventType is the event type that volumes generate
  14. VolumeEventType = "volume"
  15. // ServiceEventType is the event type that services generate
  16. ServiceEventType = "service"
  17. // NodeEventType is the event type that nodes generate
  18. NodeEventType = "node"
  19. // SecretEventType is the event type that secrets generate
  20. SecretEventType = "secret"
  21. )
  22. // Actor describes something that generates events,
  23. // like a container, or a network, or a volume.
  24. // It has a defined name and a set or attributes.
  25. // The container attributes are its labels, other actors
  26. // can generate these attributes from other properties.
  27. type Actor struct {
  28. ID string
  29. Attributes map[string]string
  30. }
  31. // Message represents the information an event contains
  32. type Message struct {
  33. // Deprecated information from JSONMessage.
  34. // With data only in container events.
  35. Status string `json:"status,omitempty"`
  36. ID string `json:"id,omitempty"`
  37. From string `json:"from,omitempty"`
  38. Type string
  39. Action string
  40. Actor Actor
  41. // Engine events are local scope. Cluster events are swarm scope.
  42. Scope string `json:"scope,omitempty"`
  43. Time int64 `json:"time,omitempty"`
  44. TimeNano int64 `json:"timeNano,omitempty"`
  45. }