cleanup
This commit is contained in:
parent
9cac7db859
commit
cec0cfec60
|
|
@ -1,5 +1,10 @@
|
||||||
package unifi
|
package unifi
|
||||||
|
|
||||||
|
// Clients contains a list that contains all of the unifi clients from a controller.
|
||||||
|
type Clients struct {
|
||||||
|
UCLs []UCL
|
||||||
|
}
|
||||||
|
|
||||||
// UCL defines all the data a connected-network client contains.
|
// UCL defines all the data a connected-network client contains.
|
||||||
type UCL struct {
|
type UCL struct {
|
||||||
ID string `json:"_id"`
|
ID string `json:"_id"`
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import (
|
||||||
// Points generates Unifi Sites' datapoints for InfluxDB.
|
// Points generates Unifi Sites' datapoints for InfluxDB.
|
||||||
// These points can be passed directly to influx.
|
// These points can be passed directly to influx.
|
||||||
func (u Site) Points() ([]*influx.Point, error) {
|
func (u Site) Points() ([]*influx.Point, error) {
|
||||||
points := make([]*influx.Point, 1)
|
var points []*influx.Point
|
||||||
for _, s := range u.Health {
|
for _, s := range u.Health {
|
||||||
tags := map[string]string{
|
tags := map[string]string{
|
||||||
"id": u.ID,
|
"id": u.ID,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package unifi
|
package unifi
|
||||||
|
|
||||||
|
// Sites is a struct to match Devices and Clients.
|
||||||
|
type Sites []Site
|
||||||
|
|
||||||
// Site represents a site's data.
|
// Site represents a site's data.
|
||||||
type Site struct {
|
type Site struct {
|
||||||
ID string `json:"_id"`
|
ID string `json:"_id"`
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,6 @@ type Devices struct {
|
||||||
USWs []USW
|
USWs []USW
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clients contains a list that contains all of the unifi clients from a controller.
|
|
||||||
type Clients struct {
|
|
||||||
UCLs []UCL
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unifi is what you get in return for providing a password! Unifi represents
|
// Unifi is what you get in return for providing a password! Unifi represents
|
||||||
// a controller that you can make authenticated requests to. Use this to make
|
// a controller that you can make authenticated requests to. Use this to make
|
||||||
// additional requests for devices, clients or other custom data.
|
// additional requests for devices, clients or other custom data.
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ func (u *Unifi) GetDevices(sites []Site) (*Devices, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSites returns a list of configured sites on the Unifi controller.
|
// GetSites returns a list of configured sites on the Unifi controller.
|
||||||
func (u *Unifi) GetSites() ([]Site, error) {
|
func (u *Unifi) GetSites() (Sites, error) {
|
||||||
var response struct {
|
var response struct {
|
||||||
Data []Site `json:"data"`
|
Data []Site `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue