-
-
Notifications
You must be signed in to change notification settings - Fork 72
/
openapi.yaml
470 lines (470 loc) · 16.5 KB
/
openapi.yaml
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
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
openapi: 3.0.3
info:
title: simPod JSON Datasource API
description: API definition for the Grafana plugin simpod json datasource
https://github.com/simPod/grafana-json-datasource
version: "0.1"
paths:
/:
get:
summary: "Test connection"
description: Used for "Test connection" on the datasource config page
operationId: api.endpoints.datasource_health
tags:
- Health Check
responses:
'200':
description: Positive health check
/metrics:
post:
summary: List available metrics
description: >-
In `Panel > Queries` page. It will send the request to obtain the available metrics.
The request body will carry the current metric and payload. In
the `Builder` mode, if the `reloadMetric` value in the load
configuration is true, the api will also be triggered when the value is
modified / switched.
operationId: api.endpoints.list_metrics
tags:
- Visualization
parameters: []
requestBody:
content:
application/json:
schema:
type: object
properties:
metric:
type: string
description: The currently selected Metric option.
payload:
type: object
properties: {}
description: >-
The currently selected/entered payload options and values.
Key is the name of the payload, and value is the value of
the payload.
example: {"metric": "DescribeCloudWatchDataList", "payload": {"namespace": "AWS/RDS"}}
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
type: object
properties:
label:
type: string
description: 'If the value is empty, use the value as the label'
value:
type: string
description: The value of the option.
payloads:
type: array
items:
type: object
properties:
label:
type: string
description: >-
The label of the payload. If the value is empty,
use the name as the label.
name:
type: string
description: 'The name of the payload. '
type:
type: string
description: |-
If the value is select, the UI of the payload is a radio box.
If the value is multi-select, the UI of the payload is a multi selection box.
if the value is input, the UI of the payload is an input box.
if the value is textarea, the UI of the payload is a multiline input box.
The default is input.
enum:
- select
- multi-select
- input
- textarea
default: input
placeholder:
type: string
description: Input box / selection box prompt information.
reloadMetric:
type: boolean
description: >-
Whether to overload the metrics API after
modifying the value of the payload.
default: false
width:
type: integer
description: >-
Set the input / selection box width to a multiple
of 8px.
options:
type: array
items:
type: object
properties:
label:
type: string
description: The label of the payload select option.
value:
type: string
description: The label of the payload value.
required:
- value
description: >-
If the payload type is select / multi-select, the
list is the configuration of the option list.
required:
- name
description: Configuration parameters of the payload.
required:
- value
- payloads
examples:
'1':
summary: Success
value:
- label: Describe cloudwatch data list
value: DescribeCloudWatchDataList
payloads:
- label: Namespace
name: namespace
type: select
placeholder: Please select namespace
reloadMetric: true
width: 10
options:
- label: EC2
value: AWS/EC2
- label: RDS
value: AWS/RDS
- name: metric
type: select
- name: instanceId
type: select
- value: DescribeCloudWatchDataLast
payloads:
- name: namespace
type: select
- name: metric
type: select
- name: instanceId
type: multi-select
/metric-payload-options:
post:
summary: List the available payload options.
description: >-
When the payload `type` is `select` or `multi-select` and the payload
`options` configuration is empty, expanding the drop-down menu will
trigger this API. The request body will carry the current metric and
payload.
operationId: api.endpoints.list_metric_payload_options
tags:
- Visualization
parameters: []
requestBody:
content:
application/json:
schema:
type: object
properties:
metric:
type: string
description: Current metric.
payload:
type: object
properties: {}
description: Current payload.
name:
type: string
description: The payload name of the option list needs to be obtained.
required:
- metric
- payload
- name
example:
metric: DescribeCloudWatchDataList
payload: {"namespace": "AWS/RDS"}
name: metric
responses:
'200':
description: Success
content:
application/json:
schema:
type: array
items:
type: object
properties:
label:
type: string
description: >-
The label of the option in the drop-down box. If the
value is empty, use the value as the label.
value:
type: string
description: The value of the option in the drop-down box.
required:
- value
examples:
'1':
summary: Success
value:
- {"label": "CPUUtilization", "value": "CPUUtilization"}
- {"label": "DiskReadIOPS", "value": "DiskReadIOPS"}
- {"label": "memory_freeutilization", "value": "memory_freeutilization"}
/query:
post:
summary: Query
description: Returns metrics data
operationId: api.endpoints.query
tags:
- Visualization
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
panelId:
oneOf:
- type: string
example: Q-1599986187842-0.164611811105138-0
- type: number
example: 1
range:
type: object
properties:
from:
type: string
format: date-time
to:
type: string
format: date-time
raw:
$ref: '#/components/schemas/raw-time-frame'
rangeRaw:
$ref: '#/components/schemas/raw-time-frame'
interval:
type: string
example: 30s
intervalMs:
type: number
example: 5500
maxDataPoints:
type: number
example: 50
targets:
type: array
items:
type: object
required: [target]
properties:
target:
type: string
example: "upper_25"
refId:
type: string
payload:
description: arbitrary "additional data" the user can pass in
type: object
scopedVars:
type: object
example:
__interval: {'text': '1s', 'value': '1s'}
__interval_ms: {'text': 1000, 'value': 1000}
adhocFilters:
type: array
items:
type: object
properties:
key:
type: string
example: City
operator:
type: string
example: "="
value:
type: string
example: Berlin
responses:
'200':
description: "Can be a 'timeseries' or 'table' response"
content:
application/json:
schema:
type: array
items:
anyOf:
- type: object
description: timeseries case
required: ["target", "datapoints"]
properties:
target:
type: string
example: "upper_25"
datapoints:
type: array
example: [ [2.5, 1557385723416], [3.5, 1557385731634] ]
items:
type: array
description: First value is Metric value as a float.
Second values is unix timestamp in milliseconds
minItems: 2
maxItems: 2
items:
type: number
- type: object
description: table case
required: ["type", "columns", "rows"]
properties:
type:
type: string
enum: ["table"]
columns:
type: array
items:
type: object
required: ["text"]
example:
- {"text": "Time", "type": "time"}
- {"text": "Country", "type": "string"}
- {"text": "Value", "type": "number"}
properties:
text:
type: string
type:
type: string
rows:
type: array
example: [[1557385723416,"SE",123], [1557385731634,"SE", 456]]
items:
anyOf:
- type: string
- type: number
/variable:
post:
summary: Variable
description: Returns data for Variable of type `Query`
operationId: api.endpoints.variable
tags:
- Variable
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
payload:
type: object
required: ["target"]
properties:
target:
type: string
variables:
type: object
range:
type: object
properties:
from:
type: string
format: date-time
to:
type: string
format: date-time
raw:
$ref: '#/components/schemas/raw-time-frame'
responses:
'200':
description: "Variable items"
content:
application/json:
schema:
oneOf:
- type: array
items:
type: object
required: ["text", "value"]
properties:
__text:
type: string
__value:
type: string
- $ref: '#/components/schemas/dataframe'
/tag-keys:
post:
summary: Keys for ad hoc filters
description: returns possible keys for ad hoc filters
operationId: api.endpoints.tag_keys
tags:
- Ad Hoc Filters
responses:
'200':
description: List of ad hoc filter keys
content:
application/json:
schema:
type: array
items:
type: object
properties:
type:
type: string
text:
type: string
example:
- {"type":"string","text":"City"}
- {"type":"string","text":"Country"}
/tag-values:
post:
summary: Values for ad hoc filters
description: returns possible values for ad hoc filters
operationId: api.endpoints.tag_values
tags:
- Ad Hoc Filters
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [key]
properties:
key:
type: string
responses:
'200':
description: A valid response
components:
schemas:
dataframe:
title: Dataframe
type: object
required: [fields]
properties:
fields:
type: array
items:
required: [name, values]
type: object
properties:
name:
type: string
values:
type: array
items: {}
raw-time-frame:
type: object
properties:
from:
type: string
example: now-1h
to:
type: string
example: now