Use new influx db lib path. Make Points() work with an interface.
This commit is contained in:
		
							parent
							
								
									a6afe62ff2
								
							
						
					
					
						commit
						483480a4eb
					
				|  | @ -10,26 +10,16 @@ | ||||||
|   version = "v1.1.1" |   version = "v1.1.1" | ||||||
| 
 | 
 | ||||||
| [[projects]] | [[projects]] | ||||||
|   digest = "1:718c57979a9197414a044fff2028e57cb9fe145069e4f507059755bfe87f1bfe" |   branch = "master" | ||||||
|   name = "github.com/influxdata/influxdb" |   digest = "1:50708c8fc92aec981df5c446581cf9f90ba9e2a5692118e0ce75d4534aaa14a2" | ||||||
|   packages = [ |   name = "github.com/influxdata/influxdb1-client" | ||||||
|     "client/v2", |  | ||||||
|     "models", |  | ||||||
|     "pkg/escape", |  | ||||||
|   ] |  | ||||||
|   pruneopts = "UT" |  | ||||||
|   revision = "698dbc789aff13c2678357a6b93ff73dd7136571" |  | ||||||
|   version = "v1.7.3" |  | ||||||
| 
 |  | ||||||
| [[projects]] |  | ||||||
|   digest = "1:937258f1293bc9295b4789b0abea5b4ec030e3caecb65a4e1dc0b6999957a5ed" |  | ||||||
|   name = "github.com/influxdata/platform" |  | ||||||
|   packages = [ |   packages = [ | ||||||
|     "models", |     "models", | ||||||
|     "pkg/escape", |     "pkg/escape", | ||||||
|  |     "v2", | ||||||
|   ] |   ] | ||||||
|   pruneopts = "UT" |   pruneopts = "UT" | ||||||
|   revision = "0f79e4ea3248354c789cba274542e0a8e55971db" |   revision = "16c852ea613fa2d42fcdccc9a8b0802a8bdc6140" | ||||||
| 
 | 
 | ||||||
| [[projects]] | [[projects]] | ||||||
|   digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" |   digest = "1:cf31692c14422fa27c83a05292eb5cbe0fb2775972e8f1f8446a71549bd8980b" | ||||||
|  | @ -59,7 +49,7 @@ | ||||||
|   analyzer-name = "dep" |   analyzer-name = "dep" | ||||||
|   analyzer-version = 1 |   analyzer-version = 1 | ||||||
|   input-imports = [ |   input-imports = [ | ||||||
|     "github.com/influxdata/influxdb/client/v2", |     "github.com/influxdata/influxdb1-client/v2", | ||||||
|     "github.com/pkg/errors", |     "github.com/pkg/errors", | ||||||
|     "github.com/stretchr/testify/assert", |     "github.com/stretchr/testify/assert", | ||||||
|   ] |   ] | ||||||
|  |  | ||||||
|  | @ -26,8 +26,8 @@ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| [[constraint]] | [[constraint]] | ||||||
|   name = "github.com/influxdata/influxdb" |   branch = "master" | ||||||
|   version = "1.7.3" |   name = "github.com/influxdata/influxdb1-client" | ||||||
| 
 | 
 | ||||||
| [[constraint]] | [[constraint]] | ||||||
|   name = "github.com/pkg/errors" |   name = "github.com/pkg/errors" | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	influx "github.com/influxdata/influxdb/client/v2" | 	influx "github.com/influxdata/influxdb1-client/v2" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Points generates Unifi Client datapoints for InfluxDB.
 | // Points generates Unifi Client datapoints for InfluxDB.
 | ||||||
| // These points can be passed directly to influx.
 | // 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 | 	var points []*influx.Point | ||||||
| 	// Fix name and hostname fields. Sometimes one or the other is blank.
 | 	// Fix name and hostname fields. Sometimes one or the other is blank.
 | ||||||
| 	if c.Name == "" && c.Hostname != "" { | 	if c.Name == "" && c.Hostname != "" { | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	influx "github.com/influxdata/influxdb/client/v2" | 	influx "github.com/influxdata/influxdb1-client/v2" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Points generates Wireless-Access-Point datapoints for InfluxDB.
 | // Points generates Wireless-Access-Point datapoints for InfluxDB.
 | ||||||
| // These points can be passed directly to influx.
 | // 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, | 	/* 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! | 	   please send me a PR or open an Issue to address my faults. Thanks! | ||||||
| 	*/ | 	*/ | ||||||
|  |  | ||||||
|  | @ -72,7 +72,7 @@ func TestAuthController(t *testing.T) { | ||||||
| 	t.Parallel() | 	t.Parallel() | ||||||
| 	a := assert.New(t) | 	a := assert.New(t) | ||||||
| 	url := "http://127.0.0.1:64431" | 	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.NotNil(err) | ||||||
| 	a.EqualValues(url, authReq.baseURL) | 	a.EqualValues(url, authReq.baseURL) | ||||||
| 	a.Contains(err.Error(), "authReq.Do(req):", "an invalid destination should product a .Do(req) error.") | 	a.Contains(err.Error(), "authReq.Do(req):", "an invalid destination should product a .Do(req) error.") | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	influx "github.com/influxdata/influxdb/client/v2" | 	influx "github.com/influxdata/influxdb1-client/v2" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Points generates Unifi Gateway datapoints for InfluxDB.
 | // Points generates Unifi Gateway datapoints for InfluxDB.
 | ||||||
| // These points can be passed directly to influx.
 | // 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 | 	var points []*influx.Point | ||||||
| 	tags := map[string]string{ | 	tags := map[string]string{ | ||||||
| 		"id":                     u.ID, | 		"id":                     u.ID, | ||||||
|  |  | ||||||
|  | @ -4,12 +4,12 @@ import ( | ||||||
| 	"strconv" | 	"strconv" | ||||||
| 	"time" | 	"time" | ||||||
| 
 | 
 | ||||||
| 	influx "github.com/influxdata/influxdb/client/v2" | 	influx "github.com/influxdata/influxdb1-client/v2" | ||||||
| ) | ) | ||||||
| 
 | 
 | ||||||
| // Points generates Unifi Switch datapoints for InfluxDB.
 | // Points generates Unifi Switch datapoints for InfluxDB.
 | ||||||
| // These points can be passed directly to influx.
 | // 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 | 	var points []*influx.Point | ||||||
| 	tags := map[string]string{ | 	tags := map[string]string{ | ||||||
| 		"id":                     u.ID, | 		"id":                     u.ID, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue