Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileMsgItem ¶
type FileMsgItem struct {
ID uuid.UUID `json:"ID" gorm:"primaryKey;type:uuid"`
Name string `json:"Name"`
Type mime.Type
Size int `json:"Size"`
Payload []byte
}
FileMsgItem contains a file
func NewFileMsgItem ¶
func NewFileMsgItem(name string, mtype mime.Type, payload []byte) *FileMsgItem
NewFileMsgItem creates a new FileMsgItem
func (*FileMsgItem) CalculateID ¶
func (fmi *FileMsgItem) CalculateID()
CalculateID calculates the uuid from the file hash if needed
type IncidentMsg ¶
type IncidentMsg struct {
*SzenarioEvtMsg
Type IncidentMsgType
Start time.Time
End time.Time
IntLevel int `json:"Level" gorm:"column:Level"`
ByteState []byte `json:"State" gorm:"column:State"`
}
IncidentMsg communicates the state of the incident
func NewIncidentMsg ¶
func NewIncidentMsg(t IncidentMsgType, m *SzenarioEvtMsg) *IncidentMsg
NewIncidentMsg creates a incident message
type IncidentMsgType ¶
type IncidentMsgType int
IncidentMsgType idicates what type of msg it is
const ( // OpenIncident a new incident OpenIncident IncidentMsgType = iota // UpdateIncident a existing incident UpdateIncident // CloseIncident the incident CloseIncident )
func (IncidentMsgType) String ¶
func (i IncidentMsgType) String() string
type SzenarioEvtMsg ¶
type SzenarioEvtMsg struct {
ID uuid.UUID `json:"ID"`
IncidentID string `json:"Incident"`
Name string `json:"Name"`
Time time.Time `json:"Time"`
Username string `json:"Username"`
Region string `json:"Region"`
Errors []string
Counters map[string]float64 `json:"Counters"`
Stati map[string]string
Files []FileMsgItem `json:"Files"`
ProbeOS string `json:"OS"`
ProbeHost string `json:"Host"`
// contains filtered or unexported fields
}
SzenarioEvtMsg contains all typicall fields
func NewSzenarioEvtMsg ¶
func NewSzenarioEvtMsg(name string, username string, now time.Time) *SzenarioEvtMsg
NewSzenarioEvtMsg creates a SzenarioEvtMsg
func SzenarioEvtMsgFromJSON ¶
func SzenarioEvtMsgFromJSON(b []byte) (*SzenarioEvtMsg, error)
SzenarioEvtMsgFromJSON creates a SzenarioEvtMsg
func (*SzenarioEvtMsg) AddErr ¶
func (m *SzenarioEvtMsg) AddErr(e error)
AddErr adds a non nil error to the message
func (*SzenarioEvtMsg) AddFile ¶
func (m *SzenarioEvtMsg) AddFile(f *FileMsgItem)
AddFile adds a file
func (*SzenarioEvtMsg) Err ¶
func (m *SzenarioEvtMsg) Err() error
Err returns nil if there are no error and the last non nil error otherwise
func (*SzenarioEvtMsg) Errs ¶
func (m *SzenarioEvtMsg) Errs() []string
Errs returns a slice of errors
func (*SzenarioEvtMsg) SetCounter ¶
func (m *SzenarioEvtMsg) SetCounter(key string, val float64)
SetCounter adds or replaces a counter a counter must be int or float
func (*SzenarioEvtMsg) SetStatus ¶
func (m *SzenarioEvtMsg) SetStatus(key string, val string)
SetStatus sets a status