-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathjson.go
46 lines (40 loc) · 1.35 KB
/
json.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import "time"
// AnnotationsReq encodes the information provided by Grafana in its requests.
type AnnotationsReq struct {
Range Range `json:"range"`
Annotation Annotation `json:"annotation"`
}
// Range specifies the time range the request is valid for.
type Range struct {
From time.Time `json:"from"`
To time.Time `json:"to"`
}
// Annotation is the object passed by Grafana when it fetches annotations.
//
// http://docs.grafana.org/plugins/developing/datasources/#annotation-query
type Annotation struct {
// Name must match in the request and response
Name string `json:"name"`
Datasource string `json:"datasource"`
IconColor string `json:"iconColor"`
Enable bool `json:"enable"`
ShowLine bool `json:"showLine"`
Query string `json:"query"`
}
// AnnotationResponse contains all the information needed to render an
// annotation event.
//
// https://github.com/grafana/simple-json-datasource#annotation-api
type AnnotationResponse struct {
// The original annotation sent from Grafana.
Annotation Annotation `json:"annotation"`
// Time since UNIX Epoch in milliseconds. (required)
Time int64 `json:"time"`
// The title for the annotation tooltip. (required)
Title string `json:"title"`
// Tags for the annotation. (optional)
Tags string `json:"tags"`
// Text for the annotation. (optional)
Text string `json:"text"`
}