Documentation
¶
Overview ¶
Package mistclient provides a client for interacting Juniper's MIST API.
It has been written with an initial focus on observability, with the currently supported endpoints chosen for integration with a Prometheus exporter to produce operational metrics.
The client currently supports the following root endpoint:
- /api/v1/self
The client currently supports the following Organization endpoints:
- /api/v1/orgs/:org_id/sites
- /api/v1/orgs/:org_id/tickets/count
- /api/v1/orgs/:org_id/alarms/count
The client currently supports the following Site endpoints:
- /api/v1/sites/:site_id/stats
- /api/v1/sites/:site_id/devices
- /api/v1/sites/:site_id/stats/devices
- /api/v1/sites/:site_id/stats/clients
Index ¶
- Constants
- Variables
- func NewTraceHandlerOptions() *slog.HandlerOptions
- type APIClient
- func (c *APIClient) ConnectWebSocket() (*websocket.Conn, error)
- func (c *APIClient) CountOrgAlarms(orgID string) (map[string]int, error)
- func (c *APIClient) CountOrgTickets(orgID string) (map[TicketStatus]int, error)
- func (c *APIClient) Delete(u *url.URL) (*http.Response, error)
- func (c *APIClient) Get(u *url.URL) (*http.Response, error)
- func (c *APIClient) GetOrgSites(orgID string) ([]Site, error)
- func (c *APIClient) GetSelf() (Self, error)
- func (c *APIClient) GetSiteClientStats(siteID string) ([]Client, error)
- func (c *APIClient) GetSiteDeviceStats(siteID string) ([]DeviceStat, error)
- func (c *APIClient) GetSiteDevices(siteID string) ([]Device, error)
- func (c *APIClient) GetSiteStats(siteID string) (SiteStat, error)
- func (c *APIClient) GetWebsocketURL() (*url.URL, error)
- func (c *APIClient) ListOrgDevices(orgID string) (map[string]string, error)
- func (c *APIClient) Post(u *url.URL, body interface{}) (*http.Response, error)
- func (c *APIClient) Put(u *url.URL, body interface{}) (*http.Response, error)
- func (c *APIClient) StreamSiteClientStats(ctx context.Context, siteID string) (<-chan StreamedClientStat, error)
- func (c *APIClient) StreamSiteDeviceStats(ctx context.Context, siteID string) (<-chan StreamedDeviceStat, error)
- func (c *APIClient) StreamSiteDevices(ctx context.Context, siteID string) (<-chan Device, error)
- func (c *APIClient) Subscribe(ctx context.Context, channel string) (<-chan WebsocketMessage, error)
- func (c *APIClient) Unsubscribe(conn *websocket.Conn, channel string) error
- type Airwatch
- type Alarm
- type Client
- type Config
- type Device
- type DeviceStat
- type DeviceStatus
- type DeviceType
- type Dot11Proto
- type EnvStat
- type Guest
- type Logger
- type Org
- type OrgStat
- type Privilege
- type Radio
- type RadioConfig
- type RadioStat
- type Seconds
- type Self
- type Site
- type SiteStat
- type StreamedClientStat
- type StreamedCpuStat
- type StreamedDeviceStat
- type StreamedIPStat
- type StreamedLldpStat
- type StreamedMemStat
- type StreamedPortStat
- type StreamedRadioStat
- type SubscriptionRequest
- type SubscriptionResponse
- type TicketStatus
- type UnixTime
- type UnsubscribeRequest
- type WebsocketMessage
Constants ¶
const LevelTrace = slog.Level(-8)
LevelTrace is a custom log level for verbose, trace-level logging, for example, to log API request and response bodies.
Variables ¶
var LevelNames = map[slog.Level]string{ LevelTrace: "TRACE", }
LevelNames is a map of custom log levels to their string representation.
Functions ¶
func NewTraceHandlerOptions ¶ added in v1.1.1
func NewTraceHandlerOptions() *slog.HandlerOptions
NewTraceHandlerOptions is a constructor for generating a handler options with TRACE logging enabled.
Types ¶
type APIClient ¶ added in v0.0.2
type APIClient struct {
// contains filtered or unexported fields
}
APIClient represents the API client.
func (*APIClient) ConnectWebSocket ¶ added in v0.0.6
ConnectWebSocket opens a websocket connection to the appropriate websocket endpoint.
func (*APIClient) CountOrgAlarms ¶ added in v0.0.2
CountOrgAlarms returns a map of counts of all alarms related to an organisation, keyed by their type.
func (*APIClient) CountOrgTickets ¶ added in v0.0.2
func (c *APIClient) CountOrgTickets(orgID string) (map[TicketStatus]int, error)
CountOrgTickets returns a map of counts of all tickets related to an organisation, keyed by their status.
func (*APIClient) Delete ¶ added in v0.0.2
Delete is a convenience function for performing HTTP DELETE requests using the API client.
func (*APIClient) Get ¶ added in v0.0.2
Get is a convenience function for performing HTTP GET requests using the API client.
func (*APIClient) GetOrgSites ¶ added in v0.0.2
GetOrgSites returns a list of all sites configured within an organisation.
func (*APIClient) GetSelf ¶ added in v0.0.2
GetSelf returns a ‘whoami’ and privileges of the account making the request
func (*APIClient) GetSiteClientStats ¶ added in v0.0.6
GetSiteClientStats fetches and returns a list of all clients configured at a site
func (*APIClient) GetSiteDeviceStats ¶ added in v0.0.2
func (c *APIClient) GetSiteDeviceStats(siteID string) ([]DeviceStat, error)
GetSiteDeviceStats fetches and returns a list of all devices configured at a site, supplemented with operational statistics
func (*APIClient) GetSiteDevices ¶ added in v0.0.2
GetSiteDevices fetches and returns a list of all devices configured at a site
func (*APIClient) GetSiteStats ¶ added in v0.0.6
GetSiteStats fetches a site's operational statistics
func (*APIClient) GetWebsocketURL ¶ added in v0.0.6
GetWebsocketURL maps the base API URL into the appropriate websocket endpoint. See https://www.juniper.net/documentation/us/en/software/mist/api/http/guides/websockets/hosts
func (*APIClient) ListOrgDevices ¶ added in v1.3.0
ListOrgDevices returns a map of device MAC addresses to names.
func (*APIClient) Post ¶ added in v0.0.2
Post is a convenience function for performing HTTP POST requests using the API client.
func (*APIClient) Put ¶ added in v0.0.2
Put is a convenience function for performing HTTP PUT requests using the API client.
func (*APIClient) StreamSiteClientStats ¶ added in v0.0.6
func (c *APIClient) StreamSiteClientStats(ctx context.Context, siteID string) (<-chan StreamedClientStat, error)
StreamSiteClientStats opens a websocket connection and subscribes to the client statistics stream
func (*APIClient) StreamSiteDeviceStats ¶ added in v0.0.6
func (c *APIClient) StreamSiteDeviceStats(ctx context.Context, siteID string) (<-chan StreamedDeviceStat, error)
StreamSiteDeviceStats opens a websocket connection and subscribes to the device statistics stream
func (*APIClient) StreamSiteDevices ¶ added in v0.0.6
StreamSiteDevices opens a websocket connection and subscribes to the site devices stream
type Airwatch ¶ added in v0.0.2
type Airwatch struct {
Authorized bool `json:"authorized,omitempty"`
}
Airwatch holds information regarding the 'airwatch` status of a Client
type Alarm ¶
type Alarm struct {
ID string `json:"id,omitempty"`
Timestamp UnixTime `json:"timestamp,omitzero"`
SiteID string `json:"site_id,omitempty"`
Type string `json:"type,omitempty"`
Count int `json:"count,omitempty"`
Acked bool `json:"acked,omitempty"`
AckedTime UnixTime `json:"acked_time,omitzero"`
AckedAdminName string `json:"ack_admin_name,omitempty"`
AckedAdminID string `json:"ack_admin_id,omitempty"`
Note string `json:"note,omitempty"`
}
Alarm represents an alarm created by an error condition
type Client ¶
type Client struct {
Mac string `json:"mac,omitempty"`
LastSeen UnixTime `json:"last_seen,omitzero"`
Username string `json:"username,omitempty"`
Hostname string `json:"hostname,omitempty"`
OS string `json:"os,omitempty"`
Manufacture string `json:"manufacture,omitempty"`
Family string `json:"family,omitempty"`
Model string `json:"model,omitempty"`
IP netip.Addr `json:"ip,omitempty"`
IP6 netip.Addr `json:"ip6,omitempty"`
APMac string `json:"ap_mac,omitempty"`
APID string `json:"ap_id,omitempty"`
SSID string `json:"ssid,omitempty"`
WLANID string `json:"wlan_id,omitempty"`
PSKID string `json:"psk_id,omitempty"`
Uptime Seconds `json:"uptime,omitempty"`
Idletime Seconds `json:"idle_time,omitempty"`
PowerSaving bool `json:"power_saving,omitempty"`
Band Radio `json:"band,omitempty"`
Proto Dot11Proto `json:"proto,omitempty"`
KeyMgmt string `json:"key_mgmt,omitempty"`
DualBand bool `json:"dual_band,omitempty"`
Channel int `json:"channel,omitempty"`
VLANID string `json:"vlan_id,omitempty"`
AirspaceIfname string `json:"airespace_ifname,omitempty"`
RSSI int `json:"rssi,omitempty"`
SNR int `json:"snr,omitempty"`
TxRate float32 `json:"tx_rate,omitempty"`
RxRate float32 `json:"rx_rate,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
TxBps int `json:"tx_bps,omitempty"`
TxPackets int `json:"tx_packets,omitempty"`
TxRetries int `json:"tx_retries,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
RxBps int `json:"rx_bps,omitempty"`
RxPackets int `json:"rx_packets,omitempty"`
RxRetries int `json:"rx_retries,omitempty"`
MapID string `json:"map_id,omitempty"`
X float32 `json:"x,omitempty"`
Y float32 `json:"y,omitempty"`
Xm float32 `json:"x_m,omitempty"`
Ym float32 `json:"y_m,omitempty"`
NumLocatingAPs int `json:"num_locating_aps,omitempty"`
IsGuest bool `json:"is_guest,omitempty"`
Guest Guest `json:"guest,omitempty"`
Airwatch Airwatch `json:"airwatch,omitempty"`
TTL int `json:"_ttl,omitempty"`
}
Client represents an end-user device connected to the radio of a Device
type Config ¶
type Config struct {
BaseURL string `yaml:"base_url,omitempty"`
APIKey string `yaml:"api_key,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
}
Config represents the API access parameters.
type Device ¶
type Device struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Type DeviceType `json:"type,omitempty"`
Model string `json:"model,omitempty"`
Serial string `json:"serial,omitempty"`
HwRev string `json:"hw_rev,omitempty"`
Mac string `json:"mac,omitempty"`
OrgID string `json:"org_id,omitempty"`
SiteID string `json:"site_id,omitempty"`
ModifiedTime UnixTime `json:"modified_time,omitzero"`
CreatedTime UnixTime `json:"created_time,omitzero"`
}
Device represents a physical piece of network equipment
type DeviceStat ¶
type DeviceStat struct {
Device
CPUUtil int `json:"cpu_util,omitempty"`
EnvStat EnvStat `json:"env_stat,omitempty"`
LastSeen UnixTime `json:"last_seen,omitzero"`
NumClients int `json:"num_clients,omitempty"`
Version string `json:"version,omitempty"`
Status DeviceStatus `json:"status,omitempty"`
IP netip.Addr `json:"ip,omitempty"`
ExtIP netip.Addr `json:"ext_ip,omitempty"`
NumWLANs int `json:"num_wlans,omitempty"`
Uptime Seconds `json:"uptime,omitempty"`
TxBps int `json:"tx_bps,omitempty"`
RxBps int `json:"rx_bps,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
TxPkts int `json:"tx_pkts,omitempty"`
RxPkts int `json:"rx_pkts,omitempty"`
PowerSrc string `json:"power_src,omitempty"`
PowerBudget int `json:"power_budget,omitempty"`
PowerOpMode string `json:"power_op_mode,omitempty"`
PowerConstrained bool `json:"power_constrained,omitempty"`
RadioStats map[RadioConfig]RadioStat `json:"radio_stat,omitempty"`
}
DeviceStat holds operational statistics and data relating to a Device
type DeviceStatus ¶
type DeviceStatus int
DeviceStatus defines the possible values for a device status.
const ( Connected DeviceStatus = iota + 1 Disconnected Restarting Upgrading )
func DeviceStatusFromString ¶
func DeviceStatusFromString(ds string) DeviceStatus
DeviceStatusFromString creates a DeviceStatus from the associated string representation.
func (DeviceStatus) MarshalJSON ¶ added in v0.0.6
func (ds DeviceStatus) MarshalJSON() ([]byte, error)
func (DeviceStatus) MarshalText ¶ added in v1.2.0
func (ds DeviceStatus) MarshalText() ([]byte, error)
func (DeviceStatus) String ¶
func (ds DeviceStatus) String() string
func (*DeviceStatus) UnmarshalJSON ¶
func (ds *DeviceStatus) UnmarshalJSON(b []byte) error
func (*DeviceStatus) UnmarshalText ¶ added in v1.2.0
func (ds *DeviceStatus) UnmarshalText(b []byte) error
type DeviceType ¶
type DeviceType int
DeviceType defines the possible values fo a device types.
const ( AP DeviceType = iota + 1 Switch Gateway )
func DeviceTypeFromString ¶
func DeviceTypeFromString(dt string) DeviceType
DeviceTypeFromString creates a DeviceType from the associated string representation.
func (DeviceType) MarshalJSON ¶ added in v0.0.6
func (dt DeviceType) MarshalJSON() ([]byte, error)
func (DeviceType) MarshalText ¶ added in v1.2.0
func (dt DeviceType) MarshalText() ([]byte, error)
func (DeviceType) String ¶
func (dt DeviceType) String() string
func (*DeviceType) UnmarshalJSON ¶
func (dt *DeviceType) UnmarshalJSON(b []byte) error
func (*DeviceType) UnmarshalText ¶ added in v1.2.0
func (dt *DeviceType) UnmarshalText(b []byte) error
type Dot11Proto ¶ added in v0.0.6
type Dot11Proto int
Dot11Proto defines the possible values for the dot11 protocol
const ( A Dot11Proto = iota + 1 AC AX B G N )
func Dot11ProtoFromString ¶ added in v0.0.6
func Dot11ProtoFromString(dp string) Dot11Proto
Dot11ProtoFromString creates a Dot11Proto from the associated string representation.
func (Dot11Proto) MarshalJSON ¶ added in v0.0.6
func (dp Dot11Proto) MarshalJSON() ([]byte, error)
func (Dot11Proto) MarshalText ¶ added in v1.2.0
func (dp Dot11Proto) MarshalText() ([]byte, error)
func (Dot11Proto) String ¶ added in v0.0.6
func (dp Dot11Proto) String() string
func (*Dot11Proto) UnmarshalJSON ¶ added in v0.0.6
func (dp *Dot11Proto) UnmarshalJSON(b []byte) error
func (*Dot11Proto) UnmarshalText ¶ added in v0.0.6
func (dp *Dot11Proto) UnmarshalText(b []byte) error
type EnvStat ¶ added in v0.0.6
type EnvStat struct {
AccelX float32 `json:"accel_x,omitempty"`
AccelY float32 `json:"accel_y,omitempty"`
AccelZ float32 `json:"accel_z,omitempty"`
AmbientTemp int `json:"ambient_temp,omitempty"`
Attitude int `json:"attitude,omitempty"`
CPUTemp int `json:"cpu_temp,omitempty"`
Humidity int `json:"humidity,omitempty"`
MagneX float32 `json:"magne_x,omitempty"`
MagneY float32 `json:"magne_y,omitempty"`
MagneZ float32 `json:"magne_z,omitempty"`
Pressure float32 `json:"pressure,omitempty"`
VcoreVoltage int `json:"vcore_voltage,omitempty"`
}
EnvStat holds operational data relating to a device's environment
type Guest ¶ added in v0.0.2
type Guest struct {
Authorized bool `json:"authorized,omitempty"`
AuthorizedTime UnixTime `json:"authorized_time,omitzero"`
AuthorizedExpiringTime UnixTime `json:"authorized_expiring_time,omitzero"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
Company string `json:"company,omitempty"`
Field1 string `json:"field1,omitempty"`
CrossSite bool `json:"cross_site,omitempty"`
}
Guest holds data relating to the `guest` status of a Client
type Logger ¶ added in v1.1.0
Logger is a wrapper around slog.Logger to provide custom logging methods.
type Org ¶ added in v0.0.6
type Org struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
MSPID string `json:"msp_id,omitempty"`
AllowMist bool `json:"allow_mist,omitempty"`
AlarmTemplateID string `json:"alarmtemplate_id,omitempty"`
OrgGroupIDs []string `json:"orggroup_ids,omitempty"`
SessionExpiry Seconds `json:"session_expiry,omitempty"`
ModifiedTime UnixTime `json:"modified_time,omitzero"`
CreatedTime UnixTime `json:"created_time,omitzero"`
}
Org represents an organization
type OrgStat ¶ added in v0.0.6
type OrgStat struct {
NumAps int `json:"num_aps,omitempty"`
NumGateways int `json:"num_gateways,omitempty"`
NumMxedges int `json:"num_mxedges,omitempty"`
NumSwitches int `json:"num_switches,omitempty"`
NumUnassignedAps int `json:"num_unassigned_aps,omitempty"`
NumUnassignedGateways int `json:"num_unassigned_gateways,omitempty"`
NumUnassignedSwitches int `json:"num_unassigned_switches,omitempty"`
}
OrgStat holds operational statistics and data relating to an org
type Privilege ¶ added in v0.0.2
type Privilege struct {
Scope string `json:"scope,omitempty"`
Name string `json:"name,omitempty"`
Role string `json:"role,omitempty"`
Views []string `json:"views,omitempty"`
OrgID string `json:"org_id,omitempty"`
OrgName string `json:"org_name,omitempty"`
SiteID string `json:"site_id,omitempty"`
SiteName string `json:"site_name,omitempty"`
MSPID string `json:"msp_id,omitempty"`
MSPName string `json:"msp_name,omitempty"`
MSPURL string `json:"msp_url,omitempty"`
MSPLogoURL string `json:"msp_logo_url,omitempty"`
OrgGroupIDs []string `json:"orggroup_ids,omitempty"`
SiteGroupIDs []string `json:"sitegroup_ids,omitempty"`
}
Privilege represents the permissions of the authenticated API user
type Radio ¶
type Radio int
Radio defines the possible values for a radio band.
func RadioFromString ¶
RadioFromString creates a Radio from the associated string representation.
func (Radio) MarshalJSON ¶ added in v0.0.6
func (Radio) MarshalText ¶ added in v1.2.0
func (*Radio) UnmarshalJSON ¶
func (*Radio) UnmarshalText ¶
type RadioConfig ¶ added in v0.0.2
type RadioConfig int
RadioConfig defines the possible values for a radio band configuration.
const ( Band6Config RadioConfig = iota + 1 Band5Config Band24Config )
func RadioConfigFromString ¶ added in v0.0.2
func RadioConfigFromString(r string) RadioConfig
RadioConfigFromString creates a RadioConfig from the associated string representation.
func (RadioConfig) MarshalJSON ¶ added in v0.0.6
func (rc RadioConfig) MarshalJSON() ([]byte, error)
func (RadioConfig) MarshalText ¶ added in v1.2.0
func (rc RadioConfig) MarshalText() ([]byte, error)
func (RadioConfig) String ¶ added in v0.0.2
func (rc RadioConfig) String() string
func (*RadioConfig) UnmarshalJSON ¶ added in v0.0.2
func (rc *RadioConfig) UnmarshalJSON(b []byte) error
func (*RadioConfig) UnmarshalText ¶ added in v0.0.2
func (rc *RadioConfig) UnmarshalText(b []byte) error
type RadioStat ¶
type RadioStat struct {
Mac string `json:"mac,omitempty"`
NumClients int `json:"num_clients,omitempty"`
NumWLANs int `json:"num_wlans,omitempty"`
Channel int `json:"channel,omitempty"`
Bandwidth int `json:"bandwidth,omitempty"`
DynamicChainingEnabled bool `json:"dynamic_chaining_enabled,omitempty"`
Power int `json:"power,omitempty"`
NoiseFloor int `json:"noise_floor,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
TxPkts int `json:"tx_pkts,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
RxPkts int `json:"rx_pkts,omitempty"`
Usage string `json:"usage,omitempty"`
UtilAll int `json:"util_all,omitempty"`
UtilTx int `json:"util_tx,omitempty"`
UtilRxInBSS int `json:"util_rx_in_bss,omitempty"`
UtilRxOtherBSS int `json:"util_rx_other_bss,omitempty"`
UtilUnknownWiFi int `json:"util_unknown_wifi,omitempty"`
UtilNonWiFi int `json:"util_non_wifi,omitempty"`
UtilUndecodableWiFi int `json:"util_undecodable_wifi,omitempty"`
}
RadioStat holds operational statistics and data relating to the radio connectivity of a Device
type Seconds ¶ added in v0.0.2
Seconds represents a time in seconds
func (Seconds) MarshalJSON ¶ added in v0.0.2
MarshalJSON implements the json.Marshaler interface.
func (*Seconds) UnmarshalJSON ¶ added in v0.0.2
type Self ¶ added in v0.0.2
type Self struct {
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Phone string `json:"phone,omitempty"`
SSO bool `json:"via_sso,omitempty"`
PasswordLastModified UnixTime `json:"password_modified_time,omitzero"`
Privileges []Privilege `json:"privileges,omitempty"`
Tags []string `json:"tags,omitempty"`
}
Self represents the account associated with the authenticated API user
type Site ¶
type Site struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Timezone string `json:"timezone,omitempty"`
CountryCode string `json:"country_code,omitempty"`
LatLng map[string]float32 `json:"latlng,omitempty"`
SiteGroupIDs []string `json:"sitegroup_ids,omitempty"`
Address string `json:"address,omitempty"`
OrgID string `json:"org_id,omitempty"`
ModifiedTime UnixTime `json:"modified_time,omitzero"`
CreatedTime UnixTime `json:"created_time,omitzero"`
Notes string `json:"notes,omitempty"`
AlarmTemplateID string `json:"alarmtemplate_id,omitempty"`
NetworkTemplateID string `json:"networktemplate_id,omitempty"`
RFTemplateID string `json:"rftemplate_id,omitempty"`
APTemplateID string `json:"aptemplate_id,omitempty"`
GatewayTemplateID string `json:"gatewaytemplate_id,omitempty"`
ApportTemplateID string `json:"apporttemplate_id,omitempty"`
SecPolicyID string `json:"secpolicy_id,omitempty"`
}
Site represents a physical location containing devices
type SiteStat ¶ added in v0.0.6
type SiteStat struct {
Site
Lat float32 `json:"lat,omitempty"`
Lng float32 `json:"lng,omitempty"`
MSPID string `json:"msp_id,omitempty"`
NumAP int `json:"num_ap,omitempty"`
NumAPConnected int `json:"num_ap_connected,omitempty"`
NumClients int `json:"num_clients,omitempty"`
NumDevices int `json:"num_devices,omitempty"`
NumDevicesConnected int `json:"num_devices_connected,omitempty"`
NumGateway int `json:"num_gateway,omitempty"`
NumGatewayConnected int `json:"num_gateway_connected,omitempty"`
NumSwitch int `json:"num_switch,omitempty"`
NumSwitchConnected int `json:"num_switch_connected,omitempty"`
TZOffset int `json:"tzoffset,omitempty"`
}
SiteStat holds operational statistics and data relating to a Site
type StreamedClientStat ¶ added in v1.2.0
type StreamedClientStat struct {
Client
}
StreamedClientStat holds information about a client returned by the websockets streaming stats API
type StreamedCpuStat ¶ added in v1.2.0
type StreamedCpuStat struct {
System int `json:"system,omitempty"`
Idle int `json:"idle,omitempty"`
Interrupt int `json:"interrupt,omitempty"`
User int `json:"user,omitempty"`
LoadAvg []float32 `json:"load_avg,omitempty"`
}
StreamedCpuStat holds the CPU statistics of a device returned by the websockets streaming stats API
type StreamedDeviceStat ¶ added in v1.2.0
type StreamedDeviceStat struct {
Mac string `json:"mac,omitempty"`
Version string `json:"version,omitempty"`
IP string `json:"ip,omitempty"`
ExtIP string `json:"ext_ip,omitempty"`
PowerSrc string `json:"power_src,omitempty"`
Uptime Seconds `json:"uptime,omitempty"`
LastSeen UnixTime `json:"last_seen,omitempty"`
NumClients int `json:"num_clients,omitempty"`
IPStat StreamedIPStat `json:"ip_stat,omitempty"`
RadioStats map[RadioConfig]StreamedRadioStat `json:"radio_stat,omitempty"`
PortStats map[string]StreamedPortStat `json:"port_stat,omitempty"`
LldpStat StreamedLldpStat `json:"lldp_stat,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
RxPkts int `json:"rx_pkts,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
TxPkts int `json:"tx_pkts,omitempty"`
TxBps int `json:"tx_bps,omitempty"`
RxBps int `json:"rx_bps,omitempty"`
CpuStat StreamedCpuStat `json:"cpu_stat,omitempty"`
MemStat StreamedMemStat `json:"memory_stat,omitempty"`
}
StreamedDeviceStat holds information regarding a device returned by the websockets streaming stats API
type StreamedIPStat ¶ added in v1.2.0
type StreamedIPStat struct {
IP netip.Addr `json:"ip,omitempty"`
Netmask netip.Addr `json:"netmask,omitempty"`
Gateway netip.Addr `json:"gateway,omitempty"`
IP6 netip.Addr `json:"ip6,omitempty"`
Netmask6 string `json:"netmask6,omitempty"`
Gateway6 netip.Addr `json:"gateway6,omitempty"`
DNS []string `json:"dns,omitempty"`
IPs map[string]string `json:"ips,omitempty"`
}
StreamedIPStat holds the IP addressing information of a device returned by the websockets streaming stats API
type StreamedLldpStat ¶ added in v1.2.0
type StreamedLldpStat struct {
SystemName string `json:"system_name,omitempty"`
SystemDesc string `json:"system_desc,omitempty"`
MgmtAddr string `json:"mgmt_addr,omitempty"`
LldpMedSupported bool `json:"lldp_med_supported,omitempty"`
PortDesc string `json:"port_desc,omitempty"`
PortID string `json:"port_id,omitempty"`
PowerRequestCount int `json:"power_request_count,omitempty"`
PowerAllocated int `json:"power_allocated,omitempty"`
PowerDraw int `json:"power_draw,omitempty"`
PowerRequested int `json:"power_requested,omitempty"`
}
StreamedLldpStat holds the LLDP information of a device returned by the websockets streaming stats API
type StreamedMemStat ¶ added in v1.2.0
type StreamedMemStat struct {
Usage int `json:"usage,omitempty"`
}
StreamedMemStat holds the memory statistics of a device returned by the websockets streaming stats API
type StreamedPortStat ¶ added in v1.2.0
type StreamedPortStat struct {
TxPkts int `json:"tx_pkts,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
RxPkts int `json:"rx_pkts,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
RxPeakBps int `json:"rx_peak_bps,omitempty"`
TxPeakBps int `json:"tx_peak_bps,omitempty"`
FullDuplex bool `json:"full_duplex,omitempty"`
Speed int `json:"speed,omitempty"`
Up bool `json:"up"`
RxErrors int `json:"rx_errors,omitempty"`
}
StreamedPortStat holds the wired port statistics of a device returned by the websockets streaming stats API
type StreamedRadioStat ¶ added in v1.2.0
type StreamedRadioStat struct {
Bandwidth int `json:"bandwidth,omitempty"`
Channel int `json:"channel,omitempty"`
Mac string `json:"mac,omitempty"`
NumClients int `json:"num_clients,omitempty"`
Power int `json:"power,omitempty"`
RxBytes int `json:"rx_bytes,omitempty"`
RxPkts int `json:"rx_pkts,omitempty"`
TxBytes int `json:"tx_bytes,omitempty"`
TxPkts int `json:"tx_pkts,omitempty"`
}
StreamedRadioStat holds the radio statistics of a device returned by the websockets streaming stats API
type SubscriptionRequest ¶ added in v0.0.6
type SubscriptionRequest struct {
Subscribe string `json:"subscribe"`
}
SubscriptionRequest represents a websocket subscription request
type SubscriptionResponse ¶ added in v0.0.6
SubscriptionResponse represents a websocket subscription response
type TicketStatus ¶
type TicketStatus int
TicketStatus defines the possible values for support ticket status.
const ( Open TicketStatus = iota + 1 Pending Solved Closed Hold )
func TicketStatusFromString ¶
func TicketStatusFromString(status string) TicketStatus
TicketStatusFromString creates a TicketStatus from the associated string representation.
func (TicketStatus) String ¶
func (ts TicketStatus) String() string
type UnixTime ¶ added in v0.0.2
UnixTime represents the number of seconds since the Eunix epoch
func (UnixTime) MarshalJSON ¶ added in v1.2.0
MarshalJSON implements the json.Marshaler interface.
func (*UnixTime) UnmarshalJSON ¶ added in v0.0.2
type UnsubscribeRequest ¶ added in v0.0.6
type UnsubscribeRequest struct {
Unsubscribe string `json:"unsubscribe"`
}
UnsubscribeRequest represents a websocket unsubscribe request
type WebsocketMessage ¶ added in v0.0.6
type WebsocketMessage struct {
Event string `json:"event"`
Channel string `json:"channel"`
Data string `json:"data"`
}
WebsocketMessage represents a message streamed by a websocket connection