github.com/rish1988/moby@v25.0.2+incompatible/api/types/events/events.go (about)

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