From 483480a4eb49d01c79b6f230015125ff54310e0e Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Sat, 26 Jan 2019 12:33:18 -0800 Subject: [PATCH] Use new influx db lib path. Make Points() work with an interface. --- core/unifi/Gopkg.lock | 22 ++++++---------------- core/unifi/Gopkg.toml | 4 ++-- core/unifi/clients.go | 4 ++-- core/unifi/uap.go | 4 ++-- core/unifi/unidev_test.go | 2 +- core/unifi/usg.go | 4 ++-- core/unifi/usw.go | 4 ++-- 7 files changed, 17 insertions(+), 27 deletions(-) diff --git a/core/unifi/Gopkg.lock b/core/unifi/Gopkg.lock index 54395b3b..92114921 100644 --- a/core/unifi/Gopkg.lock +++ b/core/unifi/Gopkg.lock @@ -10,26 +10,16 @@ version = "v1.1.1" [[projects]] - digest = "1:718c57979a9197414a044fff2028e57cb9fe145069e4f507059755bfe87f1bfe" - name = "github.com/influxdata/influxdb" - packages = [ - "client/v2", - "models", - "pkg/escape", - ] - pruneopts = "UT" - revision = "698dbc789aff13c2678357a6b93ff73dd7136571" - version = "v1.7.3" - -[[projects]] - digest = "1:937258f1293bc9295b4789b0abea5b4ec030e3caecb65a4e1dc0b6999957a5ed" - name = "github.com/influxdata/platform" + branch = "master" + digest = "1:50708c8fc92aec981df5c446581cf9f90ba9e2a5692118e0ce75d4534aaa14a2" + name = "github.com/influxdata/influxdb1-client" packages = [ "models", "pkg/escape", + "v2", ] pruneopts = "UT" - revision = "0f79e4ea3248354c789cba274542e0a8e55971db" + revision = "16c852ea613fa2d42fcdccc9a8b0802a8bdc6140" [[projects]] digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" @@ -59,7 +49,7 @@ analyzer-name = "dep" analyzer-version = 1 input-imports = [ - "github.com/influxdata/influxdb/client/v2", + "github.com/influxdata/influxdb1-client/v2", "github.com/pkg/errors", "github.com/stretchr/testify/assert", ] diff --git a/core/unifi/Gopkg.toml b/core/unifi/Gopkg.toml index 94dee33a..b38356cd 100644 --- a/core/unifi/Gopkg.toml +++ b/core/unifi/Gopkg.toml @@ -26,8 +26,8 @@ [[constraint]] - name = "github.com/influxdata/influxdb" - version = "1.7.3" + branch = "master" + name = "github.com/influxdata/influxdb1-client" [[constraint]] name = "github.com/pkg/errors" diff --git a/core/unifi/clients.go b/core/unifi/clients.go index 1a87c9cd..51e0c8e2 100644 --- a/core/unifi/clients.go +++ b/core/unifi/clients.go @@ -4,12 +4,12 @@ import ( "strconv" "time" - influx "github.com/influxdata/influxdb/client/v2" + influx "github.com/influxdata/influxdb1-client/v2" ) // Points generates Unifi Client datapoints for InfluxDB. // These points can be passed directly to influx. -func (c *UCL) Points() ([]*influx.Point, error) { +func (c UCL) Points() ([]*influx.Point, error) { var points []*influx.Point // Fix name and hostname fields. Sometimes one or the other is blank. if c.Name == "" && c.Hostname != "" { diff --git a/core/unifi/uap.go b/core/unifi/uap.go index 6f62a107..81039f6e 100644 --- a/core/unifi/uap.go +++ b/core/unifi/uap.go @@ -4,12 +4,12 @@ import ( "strconv" "time" - influx "github.com/influxdata/influxdb/client/v2" + influx "github.com/influxdata/influxdb1-client/v2" ) // Points generates Wireless-Access-Point datapoints for InfluxDB. // These points can be passed directly to influx. -func (u *UAP) Points() ([]*influx.Point, error) { +func (u UAP) Points() ([]*influx.Point, error) { /* I generally suck at InfluxDB, so if I got the tags/fields wrong, please send me a PR or open an Issue to address my faults. Thanks! */ diff --git a/core/unifi/unidev_test.go b/core/unifi/unidev_test.go index 32f3d266..35b31704 100644 --- a/core/unifi/unidev_test.go +++ b/core/unifi/unidev_test.go @@ -72,7 +72,7 @@ func TestAuthController(t *testing.T) { t.Parallel() a := assert.New(t) url := "http://127.0.0.1:64431" - authReq, err := AuthController("user1", "pass2", url, false) + authReq, err := GetController("user1", "pass2", url, false) a.NotNil(err) a.EqualValues(url, authReq.baseURL) a.Contains(err.Error(), "authReq.Do(req):", "an invalid destination should product a .Do(req) error.") diff --git a/core/unifi/usg.go b/core/unifi/usg.go index 1794d6c2..9f41646a 100644 --- a/core/unifi/usg.go +++ b/core/unifi/usg.go @@ -4,12 +4,12 @@ import ( "strconv" "time" - influx "github.com/influxdata/influxdb/client/v2" + influx "github.com/influxdata/influxdb1-client/v2" ) // Points generates Unifi Gateway datapoints for InfluxDB. // These points can be passed directly to influx. -func (u *USG) Points() ([]*influx.Point, error) { +func (u USG) Points() ([]*influx.Point, error) { var points []*influx.Point tags := map[string]string{ "id": u.ID, diff --git a/core/unifi/usw.go b/core/unifi/usw.go index b6b4bc25..760ba833 100644 --- a/core/unifi/usw.go +++ b/core/unifi/usw.go @@ -4,12 +4,12 @@ import ( "strconv" "time" - influx "github.com/influxdata/influxdb/client/v2" + influx "github.com/influxdata/influxdb1-client/v2" ) // Points generates Unifi Switch datapoints for InfluxDB. // These points can be passed directly to influx. -func (u *USW) Points() ([]*influx.Point, error) { +func (u USW) Points() ([]*influx.Point, error) { var points []*influx.Point tags := map[string]string{ "id": u.ID,