204 lines
5.1 KiB
YAML
204 lines
5.1 KiB
YAML
openapi: 3.0.3
|
|
info:
|
|
title: SEBRAUC
|
|
version: 0.1.0
|
|
description: REST API for the SEBRAUC firmware updater
|
|
servers:
|
|
- url: http://localhost:8080/api
|
|
paths:
|
|
/status:
|
|
get:
|
|
operationId: getStatus
|
|
responses:
|
|
200:
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/RaucStatus"
|
|
default:
|
|
description: Server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
|
|
/info:
|
|
get:
|
|
operationId: getInfo
|
|
responses:
|
|
200:
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/SystemInfo"
|
|
default:
|
|
description: Server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
|
|
/update:
|
|
post:
|
|
operationId: startUpdate
|
|
requestBody:
|
|
content:
|
|
multipart/form-data:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
updateFile:
|
|
type: string
|
|
format: binary
|
|
responses:
|
|
200:
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
default:
|
|
description: Server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
|
|
/reboot:
|
|
post:
|
|
operationId: startReboot
|
|
responses:
|
|
200:
|
|
description: OK
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
default:
|
|
description: Server error
|
|
content:
|
|
application/json:
|
|
schema:
|
|
$ref: "#/components/schemas/StatusMessage"
|
|
|
|
components:
|
|
schemas:
|
|
RaucStatus:
|
|
type: object
|
|
properties:
|
|
installing:
|
|
description: True if the installer is running
|
|
type: boolean
|
|
percent:
|
|
description: Installation progress
|
|
type: integer
|
|
minimum: 0
|
|
maximum: 100
|
|
message:
|
|
description: Current installation step
|
|
type: string
|
|
example: Copying image to rootfs.0
|
|
last_error:
|
|
description: Installation error message
|
|
type: string
|
|
example: "Failed to check bundle identifier: Invalid identifier. Did you pass a valid RAUC bundle?"
|
|
log:
|
|
description: Full command line output of the current installation
|
|
type: string
|
|
example: "0% Installing\n0% Determining slot states\n20% Determining slot states done.\n"
|
|
required:
|
|
- installing
|
|
- percent
|
|
- message
|
|
- last_error
|
|
- log
|
|
|
|
SystemInfo:
|
|
type: object
|
|
properties:
|
|
hostname:
|
|
description: Hostname of the system
|
|
type: string
|
|
example: "raspberrypi3"
|
|
os_name:
|
|
description: Name of the os distribution
|
|
type: string
|
|
example: "Poky"
|
|
os_version:
|
|
description: Operating system version
|
|
type: string
|
|
example: "1.0.2"
|
|
uptime:
|
|
description: System uptime in seconds
|
|
type: integer
|
|
example: 5832
|
|
rauc_compatible:
|
|
description: Compatible firmware name
|
|
type: string
|
|
example: "Poky"
|
|
rauc_variant:
|
|
description: Compatible firmware variant
|
|
type: string
|
|
example: "rpi-prod"
|
|
rauc_rootfs:
|
|
description: List of RAUC root filesystems
|
|
type: object
|
|
additionalProperties:
|
|
$ref: "#/components/schemas/Rootfs"
|
|
required:
|
|
- hostname
|
|
- os_name
|
|
- os_version
|
|
- uptime
|
|
- rauc_compatible
|
|
- rauc_variant
|
|
- rauc_rootfs
|
|
|
|
Rootfs:
|
|
type: object
|
|
properties:
|
|
device:
|
|
description: Block device
|
|
type: string
|
|
example: "/dev/mmcblk0p2"
|
|
type:
|
|
description: Filesystem
|
|
type: string
|
|
example: ext4
|
|
mountpoint:
|
|
description: Mount path (null when not mounted)
|
|
type: string
|
|
nullable: true
|
|
example: "/"
|
|
bootable:
|
|
description: "Is the filesystem bootable"
|
|
type: boolean
|
|
booted:
|
|
description: "Is the filesystem booted"
|
|
type: boolean
|
|
primary:
|
|
description: "Is the filesystem the next boot target"
|
|
type: boolean
|
|
required:
|
|
- device
|
|
- type
|
|
- mountpoint
|
|
- bootable
|
|
- booted
|
|
- primary
|
|
|
|
StatusMessage:
|
|
type: object
|
|
properties:
|
|
success:
|
|
description: Is operation successful
|
|
type: boolean
|
|
msg:
|
|
description: Success message
|
|
type: string
|
|
example: Update started
|
|
required:
|
|
- success
|
|
- msg
|