forked from suzuki-shunsuke/go-graylog
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.go
More file actions
48 lines (42 loc) · 1.9 KB
/
dashboard.go
File metadata and controls
48 lines (42 loc) · 1.9 KB
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
47
48
package graylog
// Dashboard represents a Graylog's Dashboard.
// http://docs.graylog.org/en/latest/pages/dashboards.html
type Dashboard struct {
// required
Title string `json:"title,omitempty" v-create:"required"`
Description string `json:"description,omitempty"`
// ex. "2018-02-20T11:37:19.305Z"
CreatedAt string `json:"created_at,omitempty"`
ID string `json:"id,omitempty" v-create:"isdefault"`
// TODO support positions
Widgets []Widget `json:"widgets,omitempty"`
}
// Widget represents a Graylog's Dashboard Widget.
type Widget struct {
// ex. "STREAM_SEARCH_RESULT_COUNT"
Type string `json:"type,omitempty" v-create:"required"`
Description string `json:"description,omitempty" v-create:"required"`
CreatorUserID string `json:"creator_user_id,omitempty" v-create:"isdefault"`
ID string `json:"id,omitempty" v-create:"isdefault"`
CacheTime *int `json:"cache_time,omitempty" v-create:"isdefault"`
Config *WidgetConfig `json:"config,omitempty" v-create:"required"`
}
// WidgetConfig represents a Graylog's Dashboard Widget configuration.
type WidgetConfig struct {
Timerange *Timerange `json:"timerange" v-create:"required"`
LowerIsBetter bool `json:"lower_is_better,omitempty"`
Trend bool `json:"trend,omitempty"`
StreamID string `json:"stream_id,omitempty" v-create:"isdefault"`
Query string `json:"query,omitempty" v-create:"isdefault"`
}
// Timerange represents a timerange.
type Timerange struct {
Type string `json:"type" v-create:"required"`
Range int `json:"range" v-create:"required"`
}
// DashboardsBody represents Get Dashboards API's response body.
// Basically users don't use this struct, but this struct is public because some sub packages use this struct.
type DashboardsBody struct {
Dashboards []Dashboard `json:"dashboards"`
Total int `json:"total"`
}