communicate/events/event.go
2016-11-30 14:44:35 +09:00

48 lines
1.4 KiB
Go

package events
const (
CENTRAL_POLLING = "P"
CENTRAL_EVENT = "E"
)
const (
COLLECTOR_INSTALL = "/_api/collector/event/status/install"
COLLECTOR_INIT = "/_api/collector/event/status/initialize"
COLLECTOR_START = "/_api/collector/event/status/start"
COLLECTOR_STOP = "/_api/collector/event/status/stop"
DISCOVERY_START = "/_api/collector/event/discovery/status/start"
DISCOVERY_END = "/_api/collector/event/discovery/status/end"
HOST_START = "/_api/collector/event/discovery/host/status/start"
HOST_FOUND = "/_api/collector/event/discovery/host/status/found"
HOST_END = "/_api/collector/event/discovery/host/status/end"
PORT_START = "/_api/collector/event/discovery/port/status/start"
PORT_FOUND = "/_api/collector/event/discovery/port/status/found"
PORT_END = "/_api/collector/event/discovery/port/status/end"
SERVICE_END = "/_api/collector/event/discovery/service/status/end"
)
type URLMaker interface {
GetUrl() string
}
type Event struct {
Collector_id string
Time Timestamp
EventType string
Data interface{}
//Result chan Result `json:"-"`
}
//func (e *Event) GetResult() Result {
// return <-e.Result
//}
func NewEvent(dataType string, data interface{}) *Event {
return &Event{
Collector_id: "", // get this collector identity
Time: Now(),
EventType: dataType,
Data: data,
}
}