Repository navigation
Expand file tree
/
Copy pathdashboards.go
More file actions
246 lines (226 loc) · 8.3 KB
/
Copy pathdashboards.go
File metadata and controls
246 lines (226 loc) · 8.3 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
// Code generated by internal/cmd/gen; DO NOT EDIT.
package flashduty
import "context"
// DashboardsService handles the "Monitors/Dashboards" API resource.
type DashboardsService service
// Preview draft panel.
//
// Execute a draft panel inline without saving a dashboard revision.
//
// API: POST /monit/dashboard/panel/preview (monit-dashboard-panel-read-preview).
func (s *DashboardsService) PanelReadPreview(ctx context.Context, req *DashboardPanelPreviewRequest) (*DashboardPanelPreviewResponse, *Response, error) {
out := new(DashboardPanelPreviewResponse)
resp, err := s.client.do(ctx, "/monit/dashboard/panel/preview", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Run dashboard panel.
//
// Execute one panel of a stored dashboard and return the datasource results.
//
// API: POST /monit/dashboard/panel/run (monit-dashboard-panel-read-run).
func (s *DashboardsService) PanelReadRun(ctx context.Context, req *DashboardPanelRunRequest) (*DashboardPanelRunResponse, *Response, error) {
out := new(DashboardPanelRunResponse)
resp, err := s.client.do(ctx, "/monit/dashboard/panel/run", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Resolve panel queries.
//
// Bind panel queries to datasources and substitute variables without executing them.
//
// API: POST /monit/dashboard/runtime/queries/resolve (monit-dashboard-query-read-resolve).
func (s *DashboardsService) QueryReadResolve(ctx context.Context, req *DashboardQueriesResolveRequest) (*DashboardQueriesResolveResponse, *Response, error) {
out := new(DashboardQueriesResolveResponse)
resp, err := s.client.do(ctx, "/monit/dashboard/runtime/queries/resolve", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Get dashboard detail.
//
// Fetch one dashboard with its full definition.
//
// API: POST /monit/dashboard/get (monit-dashboard-read-get).
func (s *DashboardsService) ReadGet(ctx context.Context, req *DashboardIDRequest) (*DashboardResource, *Response, error) {
out := new(DashboardResource)
resp, err := s.client.do(ctx, "/monit/dashboard/get", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List dashboards.
//
// List the dashboards in one folder.
//
// API: POST /monit/dashboard/list (monit-dashboard-read-list).
func (s *DashboardsService) ReadList(ctx context.Context, req *DashboardListRequest) (*DashboardListOutput, *Response, error) {
out := new(DashboardListOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Get dashboard outline.
//
// Get a dashboard's structure without queries or definitions.
//
// API: POST /monit/dashboard/outline (monit-dashboard-read-outline).
func (s *DashboardsService) ReadOutline(ctx context.Context, req *DashboardOutlineRequest) (*DashboardOutline, *Response, error) {
out := new(DashboardOutline)
resp, err := s.client.do(ctx, "/monit/dashboard/outline", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Search dashboards.
//
// Search dashboards across every readable folder.
//
// API: POST /monit/dashboard/search (monit-dashboard-read-search).
func (s *DashboardsService) ReadSearch(ctx context.Context, req *DashboardSearchRequest) (*DashboardListOutput, *Response, error) {
out := new(DashboardListOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/search", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Get dashboard revision.
//
// Fetch one historical revision with its full definition.
//
// API: POST /monit/dashboard/revisions/get (monit-dashboard-revision-read-get).
func (s *DashboardsService) RevisionReadGet(ctx context.Context, req *DashboardRevisionGetRequest) (*DashboardRevisionResource, *Response, error) {
out := new(DashboardRevisionResource)
resp, err := s.client.do(ctx, "/monit/dashboard/revisions/get", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List dashboard revisions.
//
// List a dashboard's revision history, newest first.
//
// API: POST /monit/dashboard/revisions/list (monit-dashboard-revision-read-list).
func (s *DashboardsService) RevisionReadList(ctx context.Context, req *DashboardIDRequest) (*DashboardRevisionListOutput, *Response, error) {
out := new(DashboardRevisionListOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/revisions/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// List trashed dashboards.
//
// List deleted dashboards still inside the 30-day retention window.
//
// API: POST /monit/dashboard/trash/list (monit-dashboard-trash-read-list).
func (s *DashboardsService) TrashReadList(ctx context.Context, req *DashboardTrashListRequest) (*DashboardTrashListOutput, *Response, error) {
out := new(DashboardTrashListOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/trash/list", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Preview draft variables.
//
// Resolve a draft variable set that is not stored in any dashboard.
//
// API: POST /monit/dashboard/runtime/variables/preview (monit-dashboard-variable-read-preview).
func (s *DashboardsService) VariableReadPreview(ctx context.Context, req *DashboardVariablesPreviewRequest) (*DashboardVariablesPreviewResponse, *Response, error) {
out := new(DashboardVariablesPreviewResponse)
resp, err := s.client.do(ctx, "/monit/dashboard/runtime/variables/preview", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Resolve dashboard variables.
//
// Resolve every variable of a stored dashboard for a time range.
//
// API: POST /monit/dashboard/runtime/variables/resolve (monit-dashboard-variable-read-resolve).
func (s *DashboardsService) VariableReadResolve(ctx context.Context, req *DashboardVariablesResolveRequest) (*DashboardVariablesResolveResponse, *Response, error) {
out := new(DashboardVariablesResolveResponse)
resp, err := s.client.do(ctx, "/monit/dashboard/runtime/variables/resolve", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Create dashboard.
//
// Create a dashboard from a full definition.
//
// API: POST /monit/dashboard/create (monit-dashboard-write-create).
func (s *DashboardsService) WriteCreate(ctx context.Context, req *DashboardCreateRequest) (*DashboardResource, *Response, error) {
out := new(DashboardResource)
resp, err := s.client.do(ctx, "/monit/dashboard/create", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Delete dashboard.
//
// Move a dashboard to the trash.
//
// API: POST /monit/dashboard/delete (monit-dashboard-write-delete).
func (s *DashboardsService) WriteDelete(ctx context.Context, req *DashboardDeleteRequest) (*DashboardDeleteOutput, *Response, error) {
out := new(DashboardDeleteOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/delete", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Move dashboard.
//
// Move a dashboard to another folder without changing its definition.
//
// API: POST /monit/dashboard/move (monit-dashboard-write-move).
func (s *DashboardsService) WriteMove(ctx context.Context, req *DashboardMoveRequest) (*DashboardUpdateOutput, *Response, error) {
out := new(DashboardUpdateOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/move", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Restore dashboard.
//
// Bring a trashed dashboard back, optionally into a different folder.
//
// API: POST /monit/dashboard/restore (monit-dashboard-write-restore).
func (s *DashboardsService) WriteRestore(ctx context.Context, req *DashboardRestoreRequest) (*DashboardResource, *Response, error) {
out := new(DashboardResource)
resp, err := s.client.do(ctx, "/monit/dashboard/restore", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}
// Update dashboard.
//
// Replace a dashboard definition with compare-and-swap on the revision counter.
//
// API: POST /monit/dashboard/update (monit-dashboard-write-update).
func (s *DashboardsService) WriteUpdate(ctx context.Context, req *DashboardUpdateRequest) (*DashboardUpdateOutput, *Response, error) {
out := new(DashboardUpdateOutput)
resp, err := s.client.do(ctx, "/monit/dashboard/update", req, out)
if err != nil {
return nil, resp, err
}
return out, resp, nil
}