From c47a639c2e52c5f4c7fc4ff5686351d791a80b90 Mon Sep 17 00:00:00 2001 From: Cody Lee <cody.lee@datadoghq.com> Date: Fri, 19 Apr 2024 15:29:57 -0500 Subject: [PATCH] catname on other types also changed to an arraystring --- alarms.go | 90 +++++++++++++++---------------- events.go | 126 +++++++++++++++++++++---------------------- examples/events.json | 2 +- 3 files changed, 109 insertions(+), 109 deletions(-) diff --git a/alarms.go b/alarms.go index b1b1f6f..d579dc1 100644 --- a/alarms.go +++ b/alarms.go @@ -7,51 +7,51 @@ import ( ) type Alarm struct { - AppProto string `json:"app_proto,omitempty"` - Archived FlexBool `json:"archived"` - Catname string `json:"catname"` - Datetime time.Time `fake:"{recent_time}" json:"datetime"` - DestIP string `fake:"{ipv4address}" json:"dest_ip"` - DestIPGeo IPGeo `json:"dstipGeo"` - DestPort int `fake:"{port}" json:"dest_port"` - DstIPASN string `json:"dstipASN,omitempty"` - DstIPCountry string `json:"dstipCountry,omitempty"` - DstMAC string `fake:"{macaddress}" json:"dst_mac"` - EventType string `json:"event_type"` - FlowID int64 `json:"flow_id"` - HandledAdminID string `json:"handled_admin_id,omitempty"` - HandledTime time.Time `json:"handled_time,omitempty"` - Host string `json:"host"` - ID string `fake:"{uuid}" json:"_id"` - InIface string `fake:"{randomstring:[eth0,eth1,lan1,wan1,wan2]}" json:"in_iface"` - InnerAlertAction string `json:"inner_alert_action"` - InnerAlertCategory string `json:"inner_alert_category"` - InnerAlertGID int64 `json:"inner_alert_gid"` - InnerAlertRev int64 `json:"inner_alert_rev"` - InnerAlertSeverity int64 `json:"inner_alert_severity"` - InnerAlertSignature string `json:"inner_alert_signature"` - InnerAlertSignatureID int64 `json:"inner_alert_signature_id"` - Key string `json:"key"` - Msg string `fake:"{sentence:5}" json:"msg"` - Proto string `json:"proto"` - SiteID string `fake:"{uuid}" json:"site_id"` - SiteName string `json:"-"` - SourceIPGeo IPGeo `json:"usgipGeo"` - SourceName string `json:"-"` - SrcIP string `fake:"{ipv4address}" json:"src_ip"` - SrcIPASN string `json:"srcipASN,omitempty"` - SrcIPCountry string `json:"srcipCountry,omitempty"` - SrcMAC string `fake:"{macaddress}" json:"src_mac"` - SrcPort int `fake:"{port}" json:"src_port"` - Subsystem string `json:"subsystem"` - Time int64 `fake:"{timestamp}" json:"time"` - Timestamp int64 `fake:"{timestamp}" json:"timestamp"` - TxID FlexInt `json:"tx_id,omitempty"` - USGIP string `fake:"{ipv4address}" json:"usgip"` - USGIPASN string `json:"usgipASN"` - USGIPCountry string `json:"usgipCountry"` - USGIPGeo IPGeo `json:"srcipGeo,omitempty"` - UniqueAlertID string `json:"unique_alertid"` + AppProto string `json:"app_proto,omitempty"` + Archived FlexBool `json:"archived"` + Catname FlexString `json:"catname"` + Datetime time.Time `fake:"{recent_time}" json:"datetime"` + DestIP string `fake:"{ipv4address}" json:"dest_ip"` + DestIPGeo IPGeo `json:"dstipGeo"` + DestPort int `fake:"{port}" json:"dest_port"` + DstIPASN string `json:"dstipASN,omitempty"` + DstIPCountry string `json:"dstipCountry,omitempty"` + DstMAC string `fake:"{macaddress}" json:"dst_mac"` + EventType string `json:"event_type"` + FlowID int64 `json:"flow_id"` + HandledAdminID string `json:"handled_admin_id,omitempty"` + HandledTime time.Time `json:"handled_time,omitempty"` + Host string `json:"host"` + ID string `fake:"{uuid}" json:"_id"` + InIface string `fake:"{randomstring:[eth0,eth1,lan1,wan1,wan2]}" json:"in_iface"` + InnerAlertAction string `json:"inner_alert_action"` + InnerAlertCategory string `json:"inner_alert_category"` + InnerAlertGID int64 `json:"inner_alert_gid"` + InnerAlertRev int64 `json:"inner_alert_rev"` + InnerAlertSeverity int64 `json:"inner_alert_severity"` + InnerAlertSignature string `json:"inner_alert_signature"` + InnerAlertSignatureID int64 `json:"inner_alert_signature_id"` + Key string `json:"key"` + Msg string `fake:"{sentence:5}" json:"msg"` + Proto string `json:"proto"` + SiteID string `fake:"{uuid}" json:"site_id"` + SiteName string `json:"-"` + SourceIPGeo IPGeo `json:"usgipGeo"` + SourceName string `json:"-"` + SrcIP string `fake:"{ipv4address}" json:"src_ip"` + SrcIPASN string `json:"srcipASN,omitempty"` + SrcIPCountry string `json:"srcipCountry,omitempty"` + SrcMAC string `fake:"{macaddress}" json:"src_mac"` + SrcPort int `fake:"{port}" json:"src_port"` + Subsystem string `json:"subsystem"` + Time int64 `fake:"{timestamp}" json:"time"` + Timestamp int64 `fake:"{timestamp}" json:"timestamp"` + TxID FlexInt `json:"tx_id,omitempty"` + USGIP string `fake:"{ipv4address}" json:"usgip"` + USGIPASN string `json:"usgipASN"` + USGIPCountry string `json:"usgipCountry"` + USGIPGeo IPGeo `json:"srcipGeo,omitempty"` + UniqueAlertID string `json:"unique_alertid"` } // GetAlarms returns Alarms for a list of Sites. diff --git a/events.go b/events.go index f902327..c7c961c 100644 --- a/events.go +++ b/events.go @@ -72,69 +72,69 @@ func (u *Unifi) GetSiteEvents(site *Site, hours time.Duration) ([]*Event, error) // Event describes a UniFi Event. // API Path: /api/s/default/stat/event. type Event struct { - Admin string `json:"admin"` - Ap string `json:"ap"` - ApFrom string `json:"ap_from"` - ApName string `json:"ap_name"` - ApTo string `json:"ap_to"` - AppProto string `json:"app_proto"` - Bytes FlexInt `json:"bytes"` - Catname string `json:"catname"` - Channel FlexInt `json:"channel"` - ChannelFrom FlexInt `json:"channel_from"` - ChannelTo FlexInt `json:"channel_to"` - Datetime time.Time `fake:"{recent_time}" json:"datetime"` - DestIP string `fake:"{ipv4address}" json:"dest_ip"` - DestIPGeo IPGeo `json:"dstipGeo"` - DestPort int `fake:"{port}" json:"dest_port"` - DstMAC string `fake:"{macaddress}" json:"dst_mac"` - Duration FlexInt `json:"duration"` - EventType string `json:"event_type"` - FlowID FlexInt `json:"flow_id"` - Guest string `json:"guest"` - Gw string `json:"gw"` - GwName string `json:"gw_name"` - Host string `json:"host"` - Hostname string `json:"hostname"` - ID string `fake:"{uuid}" json:"_id"` - IP string `fake:"{ipv4address}" json:"ip"` - InIface string `json:"in_iface"` - InnerAlertAction string `json:"inner_alert_action"` - InnerAlertCategory string `json:"inner_alert_category"` - InnerAlertGID FlexInt `json:"inner_alert_gid"` - InnerAlertRev FlexInt `json:"inner_alert_rev"` - InnerAlertSeverity FlexInt `json:"inner_alert_severity"` - InnerAlertSignature string `json:"inner_alert_signature"` - InnerAlertSignatureID FlexInt `json:"inner_alert_signature_id"` - IsAdmin FlexBool `json:"is_admin"` - Key string `fake:"{uuid}" json:"key"` - Msg string `fake:"{buzzword}" json:"msg"` - Network string `json:"network"` - Proto string `json:"proto"` - Radio string `json:"radio"` - RadioFrom string `json:"radio_from"` - RadioTo string `json:"radio_to"` - SSID string `fake:"{macaddress}" json:"ssid"` - SiteID string `fake:"{}" json:"site_id"` - SiteName string `json:"-"` - SourceIPGeo IPGeo `json:"srcipGeo"` - SourceName string `json:"-"` - SrcIP string `fake:"{ipv4address}" json:"src_ip"` - SrcIPASN string `fake:"{address}" json:"srcipASN"` - SrcIPCountry string `fake:"{country}" json:"srcipCountry"` - SrcMAC string `fake:"{macaddress}" json:"src_mac"` - SrcPort int `fake:"{port}" json:"src_port"` - Subsystem string `json:"subsystem"` - Sw string `json:"sw"` - SwName string `json:"sw_name"` - Time int64 `fake:"{timestamp}" json:"time"` - Timestamp int64 `fake:"{timestamp}" json:"timestamp"` - USGIP string `fake:"{ipv4address}" json:"usgip"` - USGIPASN string `fake:"{address}" json:"usgipASN"` - USGIPCountry string `fake:"{country}" json:"usgipCountry"` - USGIPGeo IPGeo `json:"usgipGeo"` - UniqueAlertID string `json:"unique_alertid"` - User string `json:"user"` + Admin string `json:"admin"` + Ap string `json:"ap"` + ApFrom string `json:"ap_from"` + ApName string `json:"ap_name"` + ApTo string `json:"ap_to"` + AppProto string `json:"app_proto"` + Bytes FlexInt `json:"bytes"` + Catname FlexString `json:"catname"` + Channel FlexInt `json:"channel"` + ChannelFrom FlexInt `json:"channel_from"` + ChannelTo FlexInt `json:"channel_to"` + Datetime time.Time `fake:"{recent_time}" json:"datetime"` + DestIP string `fake:"{ipv4address}" json:"dest_ip"` + DestIPGeo IPGeo `json:"dstipGeo"` + DestPort int `fake:"{port}" json:"dest_port"` + DstMAC string `fake:"{macaddress}" json:"dst_mac"` + Duration FlexInt `json:"duration"` + EventType string `json:"event_type"` + FlowID FlexInt `json:"flow_id"` + Guest string `json:"guest"` + Gw string `json:"gw"` + GwName string `json:"gw_name"` + Host string `json:"host"` + Hostname string `json:"hostname"` + ID string `fake:"{uuid}" json:"_id"` + IP string `fake:"{ipv4address}" json:"ip"` + InIface string `json:"in_iface"` + InnerAlertAction string `json:"inner_alert_action"` + InnerAlertCategory string `json:"inner_alert_category"` + InnerAlertGID FlexInt `json:"inner_alert_gid"` + InnerAlertRev FlexInt `json:"inner_alert_rev"` + InnerAlertSeverity FlexInt `json:"inner_alert_severity"` + InnerAlertSignature string `json:"inner_alert_signature"` + InnerAlertSignatureID FlexInt `json:"inner_alert_signature_id"` + IsAdmin FlexBool `json:"is_admin"` + Key string `fake:"{uuid}" json:"key"` + Msg string `fake:"{buzzword}" json:"msg"` + Network string `json:"network"` + Proto string `json:"proto"` + Radio string `json:"radio"` + RadioFrom string `json:"radio_from"` + RadioTo string `json:"radio_to"` + SSID string `fake:"{macaddress}" json:"ssid"` + SiteID string `fake:"{}" json:"site_id"` + SiteName string `json:"-"` + SourceIPGeo IPGeo `json:"srcipGeo"` + SourceName string `json:"-"` + SrcIP string `fake:"{ipv4address}" json:"src_ip"` + SrcIPASN string `fake:"{address}" json:"srcipASN"` + SrcIPCountry string `fake:"{country}" json:"srcipCountry"` + SrcMAC string `fake:"{macaddress}" json:"src_mac"` + SrcPort int `fake:"{port}" json:"src_port"` + Subsystem string `json:"subsystem"` + Sw string `json:"sw"` + SwName string `json:"sw_name"` + Time int64 `fake:"{timestamp}" json:"time"` + Timestamp int64 `fake:"{timestamp}" json:"timestamp"` + USGIP string `fake:"{ipv4address}" json:"usgip"` + USGIPASN string `fake:"{address}" json:"usgipASN"` + USGIPCountry string `fake:"{country}" json:"usgipCountry"` + USGIPGeo IPGeo `json:"usgipGeo"` + UniqueAlertID string `json:"unique_alertid"` + User string `json:"user"` } // IPGeo is part of the UniFi Event data. Each event may have up to three of these. diff --git a/examples/events.json b/examples/events.json index 68a1684..e6d951a 100644 --- a/examples/events.json +++ b/examples/events.json @@ -70,7 +70,7 @@ }, "usgipCountry": "US", "usgipASN": "7922 COMCAST-7922", - "catname": "emerging-malware", + "catname": ["emerging-malware"], "inner_alert_action": "allowed", "inner_alert_gid": 1, "inner_alert_signature_id": 2003337,