github.com/influxdata/influxdb/v2@v2.7.6/telegraf/index.go (about) 1 package telegraf 2 3 import ( 4 "encoding/json" 5 6 "github.com/influxdata/influxdb/v2" 7 "github.com/influxdata/influxdb/v2/kv" 8 ) 9 10 var ( 11 // ByOrganizationIndexMapping is the mapping definition for fetching 12 // telegrafs by organization ID. 13 ByOrganizationIndexMapping = kv.NewIndexMapping( 14 []byte("telegrafv1"), 15 []byte("telegrafbyorgindexv1"), 16 func(v []byte) ([]byte, error) { 17 var telegraf influxdb.TelegrafConfig 18 if err := json.Unmarshal(v, &telegraf); err != nil { 19 return nil, err 20 } 21 22 id, _ := telegraf.OrgID.Encode() 23 return id, nil 24 }, 25 ) 26 )