-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathopenapi3_spec.yaml
More file actions
837 lines (815 loc) · 25.6 KB
/
Copy pathopenapi3_spec.yaml
File metadata and controls
837 lines (815 loc) · 25.6 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
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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
# yaml-language-server: $schema=https://spec.openapis.org/oas/3.0/schema/2024-10-18
openapi: "3.0.4"
info:
title: "nut_webgui JSON API"
version: "0.10.0"
description: "Simple JSON API for interfacing with nut_webgui."
license:
name: "Apache 2.0"
url: "https://raw.githubusercontent.com/SuperioOne/nut_webgui/refs/heads/master/LICENSE"
contact:
url: "https://github.com/SuperioOne/nut_webgui/issues"
email: "pm@smdd.dev"
servers:
- url: "{protocol}://{host}:{port}/{base_path}"
description: "nut_webgui server"
variables:
host:
default: localhost
base_path:
default: ""
port:
default: "9000"
protocol:
default: "http"
enum:
- http
- https
paths:
/api:
get:
operationId: "get_namespace_collection"
description: "Returns all available namespaces and connection information."
security:
- ApiToken: []
tags:
- namespace
responses:
"200":
description: "Collection of all existing namespace details."
content:
application/json:
schema:
$ref: "#/components/schemas/ArrayOfNamespaces"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error occured."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/api/{namespace}:
get:
operationId: "get_namespace"
description: "Returns information about a specific namespace."
security:
- ApiToken: []
tags:
- namespace
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
example: "default"
schema:
type: string
responses:
"200":
description: "Namespace details object."
content:
application/json:
schema:
$ref: "#/components/schemas/Namespace"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "Namespace does not exist."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error occured."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/api/{namespace}/devices:
get:
description: "List all UPS devices in a specific namespace."
tags:
- ups
security:
- ApiToken: []
operationId: "get_namespace_device_collection"
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
schema:
type: string
responses:
"200":
description: "Collection of UPS devices in the target namespace."
content:
application/json:
schema:
$ref: "#/components/schemas/ArrayOfDevices"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "Namespace does not exist."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/api/{namespace}/devices/{ups_name}:
patch:
operationId: "patch_namespace_device"
description: "Updates a specific device in the specified namespace."
requestBody:
description: "JSON object containing variable name to update and its new value."
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/SetVarRequest"
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
schema:
type: string
- name: ups_name
in: path
description: "UPS name"
required: true
allowEmptyValue: false
schema:
type: string
security:
- ApiToken: []
tags:
- ups
responses:
"202":
description: "SETVAR request accepted by the UPS driver."
"400":
description: "Invalid SETVAR request."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"403":
description: "It's either server cannot authenticate to NUT server due missing/invalid configuration or provided API token does not have the 'setvar' permission."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "UPS or namespace does not exists."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
get:
operationId: "get_namespace_device"
description: "Returns information about a specific UPS device."
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
schema:
type: string
- name: ups_name
in: path
description: "UPS name"
required: true
allowEmptyValue: false
schema:
type: string
security:
- ApiToken: []
tags:
- ups
responses:
"200":
description: "UPS device response."
content:
application/json:
schema:
$ref: "#/components/schemas/UpsDevice"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "UPS or namespace does not exists."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/api/{namespace}/devices/{ups_name}/instcmd:
post:
description: "Calls UPS INSTCMD command."
requestBody:
description: "JSON object containing INSTCMD name."
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/CommandRequest"
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
example: "default"
schema:
type: string
- name: ups_name
in: path
description: "UPS name"
required: true
allowEmptyValue: false
schema:
type: string
security:
- ApiToken: []
tags:
- ups
operationId: "post_namespace_device_instcmd"
responses:
"202":
description: "INSTCMD is accepted by UPS driver."
"400":
description: "Invalid INSTCMD"
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"403":
description: "It's either server cannot authenticate to NUT server due missing/invalid configuration or provided API token does not have the 'instcmd' permission."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "UPS or namespace does not exist."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/api/{namespace}/devices/{ups_name}/fsd:
post:
description: "Sets forced shutdown (FSD) on UPS."
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
example: "default"
schema:
type: string
- name: ups_name
in: path
description: "UPS name"
required: true
allowEmptyValue: false
schema:
type: string
security:
- ApiToken: []
tags:
- ups
operationId: "post_namespace_device_fsd"
responses:
"202":
description: "FSD is accepted by the UPS driver."
"401":
description: "Unauthorized if authentication is enabled and an invalid bearer token or no token is provided."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"403":
description: "It's either server cannot authenticate to NUT server due missing/invalid configuration or provided API token does not have the 'fsd' permission."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"404":
description: "UPS or namespace does not exist."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"500":
description: "Unexpected server error."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
"503":
description: "HTTP server is started but unable to serve requsted resource."
content:
application/json:
schema:
$ref: "#/components/schemas/ProblemDetails"
/probes/health:
get:
description: "Checks the overall health of the HTTP server and its UPSD connections."
tags:
- probes
operationId: "get_probe_health"
responses:
"200":
description: "HTTP server is ready and has at least one healthy UPSD connection."
content:
text/plain:
example: "READY"
schema:
enum:
- "READY"
- "DEGRADED"
"500":
description: "The HTTP server is not functioning properly or all UPSD connections are dead."
content:
text/plain:
schema:
type: string
example: "DEAD"
/probes/readiness:
get:
description: "Checks if the server is ready to respond."
tags:
- probes
operationId: "get_probe_readiness"
responses:
"200":
description: "Server is ready to response."
content:
text/plain:
schema:
type: string
example: "READY"
"503":
description: "Server is not ready to response."
content:
text/plain:
schema:
type: string
example: "NOT-READY"
/probes/health/{namespace}:
get:
operationId: "get_probe_health_namespace"
description: "Checks the health of a specific UPSD connection in the specified namespace."
tags:
- probes
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
example: "default"
schema:
type: string
responses:
"200":
description: "UPSD connection is healthy."
content:
text/plain:
example: "READY"
schema:
type: string
"404":
description: "Namespace does not exist."
content:
text/plain:
example: "UPSD NAMESPACE DOES NOT EXIST"
schema:
type: string
"500":
description: "UPSD connection is dead."
content:
text/plain:
schema:
type: string
example: "DEAD"
/probes/readiness/{namespace}:
get:
operationId: "get_probe_readiness_namespace"
description: "Checks if a specific UPSD connection in the specified namespace is ready to serve data."
tags:
- probes
parameters:
- name: namespace
in: path
description: "Target namespace"
required: true
allowEmptyValue: false
example: "default"
schema:
type: string
responses:
"200":
description: "UPSD connection is online and data is ready to be served."
content:
text/plain:
schema:
type: string
example: "READY"
"404":
description: "Namespace does not exist."
content:
text/plain:
example: "UPSD NAMESPACE DOES NOT EXIST"
schema:
type: string
"503":
description: "Data syncing from UPSD connection is not completed yet."
content:
text/plain:
schema:
type: string
example: "NOT-READY"
components:
securitySchemes:
ApiToken:
type: http
scheme: bearer
schemas:
Namespace:
type: object
required:
- address
- device_count
- last_sync_time
- namespace
- poll_freq
- poll_interval
- port
- protocol_version
- status
- tls_mode
- version
properties:
address:
type: string
description: "The hostname or IP address of the UPSD connection."
example: "localhost"
device_count:
type: integer
description: "Total number of UPS devices connected to the UPSD server."
example: 12
last_sync_time:
type: string
format: date-time
description: "UTC timestamp indicating when the last synchronization occurred."
example: "2025-11-04T19:13:01.205137806Z"
namespace:
type: string
description: "Name used to group related UPS devices for management purposes."
example: "kongou"
poll_freq:
type: integer
description: "Frequency at which the UPSD server is polled in seconds."
example: 30
poll_interval:
type: integer
description: "Interval at critical variables is polled in seconds."
example: 2
port:
type: integer
description: "Port number on which the UPSD service is running."
example: 3493
protocol_version:
type: string
description: "Version of the NUT (Network UPS Tools) protocol reported by the UPSD server."
example: "1.3"
status:
type: string
enum:
- "Online"
- "Dead"
- "Not Ready"
description: "Current operational status of the connection to the UPSD server."
example: "Online"
tls_mode:
type: string
enum:
- "disable"
- "skip"
- "strict"
description: "Mode for TLS encryption during connections to the UPSD server."
example: "disable"
version:
type: string
description: "Version information of the Network UPS Tools software."
example: "Network UPS Tools upsd 2.8.1 - https://www.networkupstools.org/"
ArrayOfNamespaces:
type: array
items:
"$ref": "#/components/schemas/Namespace"
UpsDevice:
type: object
description: "UPS device details including status, variables, and supported commands."
required:
- attached
- commands
- desc
- last_modified
- name
- rw_variables
- status
- variables
properties:
name:
type: string
description: "Unique identifier of the UPS device."
example: "lab-ups"
desc:
type: string
description: "Description of the UPS device."
example: "Secondary rack mounted ups"
status:
type: string
description: "Current operational status flags reported by the UPS device."
example: "OL TEST"
last_modified:
type: string
description: "UTC timestamp indicating when the device details were last updated."
format: date-time
example: "2025-11-04T22:46:12.354759505Z"
rw_variables:
type: object
description: "UPS variables that support read-write operations with their data types and constraints."
additionalProperties:
oneOf:
- type: object
required:
- type
properties:
type:
type: string
default: string
example: string
enum:
- string
max_len:
type: integer
example: 12
- type: object
required:
- type
properties:
type:
type: string
default: number
example: number
enum:
- number
- type: object
required:
- type
- options
properties:
type:
type: string
default: enum
example: enum
enum:
- enum
options:
type: array
example: ["high", "low"]
items:
type: string
- type: object
required:
- type
- min
- max
properties:
type:
type: string
default: range
example: range
enum:
- range
min:
type: number
example: 140
max:
type: number
example: 240
example:
"battery.mfr.date":
type: string,
max_len: 10
"battery.charge.low":
type: "number"
"input.sensitivity":
type: "enum"
options:
- high
- low
"battery.runtime.low":
type: range
min: 5
max: 75
variables:
type: object
description: "Variables collected from the UPS device via the NUT protocol."
example:
"battery.mfr.date": "2023/02/25"
"battery.type": "PbAc"
"battery.voltage": 27.3
"device.mfr": "American Power Conversion"
"device.model": "Back-UPS BX1600MI"
"device.serial": "999999999999"
"driver.flag.allow_killpower": 0
"driver.parameter.pollinterval": 2
"driver.parameter.vendorid": "051D"
"driver.version.data": "APC HID 0.100"
"driver.version.internal": 0.52
"driver.version.usb": "libusb-1.0.27 (API: 0x100010a)"
"input.sensitivity": "medium"
"input.transfer.high": 295
"input.transfer.low": 145
"input.voltage": 230.0
"ups.load": 26
"ups.mfr.date": "2023/02/25"
"ups.model": "Back-UPS BX1600MI"
"ups.status": "OL"
"ups.timer.shutdown": -1
additionalProperties:
oneOf:
- type: "number"
- type: "string"
commands:
type: "array"
description: "List of supported INSTCMD operations for the UPS device."
example: ["beeper.on", "beeper.off"]
items:
type: "string"
attached:
type: "array"
description: "List of IP addresses of devices attached to the UPS for power."
items:
type: "object"
required:
- "addr"
properties:
addr:
type: string
description: "Ipv4 or Ipv6 address of the attached client."
example: "192.168.1.10"
name:
type: string
description: "Optional client hostname."
example: "example.smdd.dev"
ArrayOfDevices:
type: array
items:
"$ref": "#/components/schemas/UpsDevice"
ProblemDetails:
type: object
required:
- title
- status
properties:
title:
type: string
description: "Human-readable title of the encountered error."
example: "Error title"
details:
type: string
description: "Optional additional information providing context about the error."
example: "It's just a flesh wound."
status:
type: number
description: "HTTP error code corresponding to the problem."
minimum: 100
maximum: 599
example: 400
CommandRequest:
type: object
required:
- instcmd
properties:
instcmd:
type: string
description: "INSTCMD to be executed on the UPS device."
example: "beeper.disable"
SetVarRequest:
type: object
required:
- variable
- value
properties:
variable:
type: string
description: "Name of the UPS variable to modify."
example: "battery.charge.low"
value:
example: 25
description: "Value to set for the specified variable. Value type depends on the variable's data type."
oneOf:
- type: "number"
- type: "string"
tags:
- name: namespace
description: "Endpoints for namespaces and their configurations."
- name: ups
description: "Endpoints for UPS devices monitoring and control."
- name: probes
description: "Server health check and readiness endpoints."