events.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. // ConfigEventType is the event type that configs generate
  22. ConfigEventType = "config"
  23. )
  24. // Actor describes something that generates events,
  25. // like a container, or a network, or a volume.
  26. // It has a defined name and a set or attributes.
  27. // The container attributes are its labels, other actors
  28. // can generate these attributes from other properties.
  29. type Actor struct {
  30. ID string
  31. Attributes map[string]string
  32. }
  33. // Message represents the information an event contains
  34. type Message struct {
  35. // Deprecated information from JSONMessage.
  36. // With data only in container events.
  37. Status string `json:"status,omitempty"`
  38. ID string `json:"id,omitempty"`
  39. From string `json:"from,omitempty"`
  40. Type string
  41. Action string
  42. Actor Actor
  43. // Engine events are local scope. Cluster events are swarm scope.
  44. Scope string `json:"scope,omitempty"`
  45. Time int64 `json:"time,omitempty"`
  46. TimeNano int64 `json:"timeNano,omitempty"`
  47. }