-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathevent.go
34 lines (30 loc) · 954 Bytes
/
event.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package umbrella
import (
"net/url"
"time"
)
// Event is a malware event that can be POST'ed to the Enforcement API.
type Event struct {
AlertTime time.Time `json:"alertTime"`
DeviceID string `json:"deviceId"`
DeviceVersion string `json:"deviceVersion"`
DstDomain string `json:"dstDomain"`
DstURL string `json:"dstUrl"`
EventTime time.Time `json:"eventTime"`
ProtocolVersion string `json:"protocolVersion"`
ProviderName string `json:"providerName"`
}
// PostEvent sends a single event to the Enforcement API.
func (c Enforcement) PostEvent(e Event) error {
u := &url.URL{
Path: "1.0/events",
}
return c.Post(c.BaseURL.ResolveReference(u).String(), &e, nil)
}
// PostEvents sends multiple events to the Enforcement API.
func (c Enforcement) PostEvents(e ...Event) error {
u := &url.URL{
Path: "1.0/events",
}
return c.Post(c.BaseURL.ResolveReference(u).String(), &e, nil)
}