events.go 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. package events // import "github.com/docker/docker/api/types/events"
  2. // Type is used for event-types.
  3. type Type string
  4. // List of known event types.
  5. const (
  6. BuilderEventType Type = "builder" // BuilderEventType is the event type that the builder generates.
  7. ConfigEventType Type = "config" // ConfigEventType is the event type that configs generate.
  8. ContainerEventType Type = "container" // ContainerEventType is the event type that containers generate.
  9. DaemonEventType Type = "daemon" // DaemonEventType is the event type that daemon generate.
  10. ImageEventType Type = "image" // ImageEventType is the event type that images generate.
  11. NetworkEventType Type = "network" // NetworkEventType is the event type that networks generate.
  12. NodeEventType Type = "node" // NodeEventType is the event type that nodes generate.
  13. PluginEventType Type = "plugin" // PluginEventType is the event type that plugins generate.
  14. SecretEventType Type = "secret" // SecretEventType is the event type that secrets generate.
  15. ServiceEventType Type = "service" // ServiceEventType is the event type that services generate.
  16. VolumeEventType Type = "volume" // VolumeEventType is the event type that volumes generate.
  17. )
  18. // Action is used for event-actions.
  19. type Action string
  20. const (
  21. ActionCreate Action = "create"
  22. ActionStart Action = "start"
  23. ActionRestart Action = "restart"
  24. ActionStop Action = "stop"
  25. ActionCheckpoint Action = "checkpoint"
  26. ActionPause Action = "pause"
  27. ActionUnPause Action = "unpause"
  28. ActionAttach Action = "attach"
  29. ActionDetach Action = "detach"
  30. ActionResize Action = "resize"
  31. ActionUpdate Action = "update"
  32. ActionRename Action = "rename"
  33. ActionKill Action = "kill"
  34. ActionDie Action = "die"
  35. ActionOOM Action = "oom"
  36. ActionDestroy Action = "destroy"
  37. ActionRemove Action = "remove"
  38. ActionCommit Action = "commit"
  39. ActionTop Action = "top"
  40. ActionCopy Action = "copy"
  41. ActionArchivePath Action = "archive-path"
  42. ActionExtractToDir Action = "extract-to-dir"
  43. ActionExport Action = "export"
  44. ActionImport Action = "import"
  45. ActionSave Action = "save"
  46. ActionLoad Action = "load"
  47. ActionTag Action = "tag"
  48. ActionUnTag Action = "untag"
  49. ActionPush Action = "push"
  50. ActionPull Action = "pull"
  51. ActionPrune Action = "prune"
  52. ActionDelete Action = "delete"
  53. ActionEnable Action = "enable"
  54. ActionDisable Action = "disable"
  55. ActionConnect Action = "connect"
  56. ActionDisconnect Action = "disconnect"
  57. ActionReload Action = "reload"
  58. ActionMount Action = "mount"
  59. ActionUnmount Action = "unmount"
  60. // ActionExecCreate is the prefix used for exec_create events. These
  61. // event-actions are commonly followed by a colon and space (": "),
  62. // and the command that's defined for the exec, for example:
  63. //
  64. // exec_create: /bin/sh -c 'echo hello'
  65. //
  66. // This is far from ideal; it's a compromise to allow filtering and
  67. // to preserve backward-compatibility.
  68. ActionExecCreate Action = "exec_create"
  69. // ActionExecStart is the prefix used for exec_create events. These
  70. // event-actions are commonly followed by a colon and space (": "),
  71. // and the command that's defined for the exec, for example:
  72. //
  73. // exec_start: /bin/sh -c 'echo hello'
  74. //
  75. // This is far from ideal; it's a compromise to allow filtering and
  76. // to preserve backward-compatibility.
  77. ActionExecStart Action = "exec_start"
  78. ActionExecDie Action = "exec_die"
  79. ActionExecDetach Action = "exec_detach"
  80. // ActionHealthStatus is the prefix to use for health_status events.
  81. //
  82. // Health-status events can either have a pre-defined status, in which
  83. // case the "health_status" action is followed by a colon, or can be
  84. // "free-form", in which case they're followed by the output of the
  85. // health-check output.
  86. //
  87. // This is far form ideal, and a compromise to allow filtering, and
  88. // to preserve backward-compatibility.
  89. ActionHealthStatus Action = "health_status"
  90. ActionHealthStatusRunning Action = "health_status: running"
  91. ActionHealthStatusHealthy Action = "health_status: healthy"
  92. ActionHealthStatusUnhealthy Action = "health_status: unhealthy"
  93. )
  94. // Actor describes something that generates events,
  95. // like a container, or a network, or a volume.
  96. // It has a defined name and a set of attributes.
  97. // The container attributes are its labels, other actors
  98. // can generate these attributes from other properties.
  99. type Actor struct {
  100. ID string
  101. Attributes map[string]string
  102. }
  103. // Message represents the information an event contains
  104. type Message struct {
  105. // Deprecated information from JSONMessage.
  106. // With data only in container events.
  107. Status string `json:"status,omitempty"` // Deprecated: use Action instead.
  108. ID string `json:"id,omitempty"` // Deprecated: use Actor.ID instead.
  109. From string `json:"from,omitempty"` // Deprecated: use Actor.Attributes["image"] instead.
  110. Type Type
  111. Action Action
  112. Actor Actor
  113. // Engine events are local scope. Cluster events are swarm scope.
  114. Scope string `json:"scope,omitempty"`
  115. Time int64 `json:"time,omitempty"`
  116. TimeNano int64 `json:"timeNano,omitempty"`
  117. }