forked from influxdata/telegraf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This reverts commit 86961cc.
- Loading branch information
Showing
4 changed files
with
89 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
plugins/inputs/webhooks/particle/particle_webhooks_events.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package particle | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type DummyData struct { | ||
Event string `json:"event"` | ||
Data string `json:"data"` | ||
Ttl int `json:"ttl"` | ||
PublishedAt string `json:"published_at"` | ||
InfluxDB string `json:"influx_db"` | ||
} | ||
type ParticleData struct { | ||
Event string `json:"event"` | ||
Tags map[string]string `json:"tags"` | ||
Fields map[string]interface{} `json:"values"` | ||
} | ||
|
||
func (d *DummyData) Time() (time.Time, error) { | ||
return time.Parse("2006-01-02T15:04:05Z", d.PublishedAt) | ||
} |
39 changes: 39 additions & 0 deletions
39
plugins/inputs/webhooks/particle/particle_webhooks_events_json_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package particle | ||
|
||
func NewItemJSON() string { | ||
return ` | ||
{ | ||
"event": "temperature", | ||
"data": "{ | ||
"tags": { | ||
"id": "230035001147343438323536", | ||
"location": "TravelingWilbury" | ||
}, | ||
"values": { | ||
"temp_c": 26.680000, | ||
"temp_f": 80.024001, | ||
"humidity": 44.937500, | ||
"pressure": 998.998901, | ||
"altitude": 119.331436, | ||
"broadband": 1266, | ||
"infrared": 528, | ||
"lux": 0 | ||
} | ||
}", | ||
"ttl": 60, | ||
"published_at": "2017-09-28T21:54:10.897Z", | ||
"coreid": "123456789938323536", | ||
"userid": "1234ee123ac8e5ec1231a123d", | ||
"version": 10, | ||
"public": false, | ||
"productID": 1234, | ||
"name": "sensor" | ||
"influx_db": "mydata" | ||
}` | ||
} | ||
func UnknowJSON() string { | ||
return ` | ||
{ | ||
"event": "roger" | ||
}` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters