| 1 | |
| 2 | |
| 3 | |
| 4 | package events |
| 5 | |
| 6 | import ( |
| 7 | "time" |
| 8 | ) |
| 9 | |
| 10 | type Status struct { |
| 11 | Running bool `json:"running,omitempty"` |
| 12 | |
| 13 | Degraded bool `json:"degraded,omitempty"` |
| 14 | |
| 15 | Exiting bool `json:"exiting,omitempty"` |
| 16 | |
| 17 | Errors []string `json:"errors,omitempty"` |
| 18 | |
| 19 | SSHLocalPort int `json:"sshLocalPort,omitempty"` |
| 20 | |
| 21 | |
| 22 | CloudInitProgress *CloudInitProgress `json:"cloudInitProgress,omitempty"` |
| 23 | |
| 24 | |
| 25 | PortForward *PortForwardEvent `json:"portForward,omitempty"` |
| 26 | |
| 27 | |
| 28 | Vsock *VsockEvent `json:"vsock,omitempty"` |
| 29 | } |
| 30 | |
| 31 | type CloudInitProgress struct { |
| 32 | |
| 33 | LogLine string `json:"logLine,omitempty"` |
| 34 | |
| 35 | Completed bool `json:"completed,omitempty"` |
| 36 | |
| 37 | Active bool `json:"active,omitempty"` |
| 38 | } |
| 39 | |
| 40 | type PortForwardEventType string |
| 41 | |
| 42 | const ( |
| 43 | PortForwardEventForwarding PortForwardEventType = "forwarding" |
| 44 | PortForwardEventNotForwarding PortForwardEventType = "not-forwarding" |
| 45 | PortForwardEventStopping PortForwardEventType = "stopping" |
| 46 | PortForwardEventFailed PortForwardEventType = "failed" |
| 47 | ) |
| 48 | |
| 49 | type PortForwardEvent struct { |
| 50 | Type PortForwardEventType `json:"type"` |
| 51 | Protocol string `json:"protocol,omitempty"` |
| 52 | GuestAddr string `json:"guestAddr,omitempty"` |
| 53 | HostAddr string `json:"hostAddr,omitempty"` |
| 54 | Error string `json:"error,omitempty"` |
| 55 | } |
| 56 | |
| 57 | type VsockEventType string |
| 58 | |
| 59 | const ( |
| 60 | VsockEventStarted VsockEventType = "started" |
| 61 | VsockEventSkipped VsockEventType = "skipped" |
| 62 | VsockEventFailed VsockEventType = "failed" |
| 63 | ) |
| 64 | |
| 65 | type VsockEvent struct { |
| 66 | Type VsockEventType `json:"type"` |
| 67 | HostAddr string `json:"hostAddr,omitempty"` |
| 68 | VsockPort int `json:"vsockPort,omitempty"` |
| 69 | Reason string `json:"reason,omitempty"` |
| 70 | } |
| 71 | |
| 72 | type Event struct { |
| 73 | Time time.Time `json:"time,omitempty"` |
| 74 | Status Status `json:"status,omitempty"` |
| 75 | } |