swagger-docs/command-and-control.yml

260 lines
5.9 KiB
YAML
Raw Normal View History

2020-07-26 18:22:48 +02:00
openapi: 3.0.3
info:
2020-07-26 18:22:48 +02:00
title: Command and Control Service
description: This service s responsible for controlling and handling information
about IoT devices in the Birbnetes system.
contact:
2020-07-26 18:22:48 +02:00
email: tormakristof@tormakristof.eu
license:
2020-07-26 18:22:48 +02:00
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
2020-09-30 01:27:43 +02:00
- url: https://birb.k8s.kmlabz.com
tags:
2020-07-26 18:22:48 +02:00
- name: cnc
description: Command and Control Service interaction
paths:
2020-07-26 18:22:48 +02:00
/devices:
get:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Get all device info
operationId: getall
responses:
2020-07-26 18:22:48 +02:00
200:
description: Array of devices
2020-07-26 18:22:48 +02:00
content:
application/json:
schema:
$ref: '#/components/schemas/ListOfDevices'
404:
description: No device found
content: {}
/devices/offline:
post:
tags:
- cnc
summary: Shut down all devices
operationId: offlineall
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/online:
post:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Bring all devices online
operationId: onlineall
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}:
get:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Get all device info
operationId: getdevice
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to query
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Information about a particular device
2020-07-26 18:22:48 +02:00
content:
application/json:
schema:
$ref: '#/components/schemas/Device'
404:
description: Device not found
2020-07-26 18:22:48 +02:00
content: {}
/devices/{deviceID}/offline:
post:
tags:
- cnc
summary: Shut down device
operationId: offlinedevice
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to shut down
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/online:
post:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Bring device online
operationId: onlinedevice
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to bring online
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/{sensorID}:
get:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Get info about a particular device's sensor
operationId: getsensor
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to query
required: true
schema:
type: string
format: uuid
- name: sensorID
in: path
description: ID of sensor to query
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Information about a sensor
2020-07-26 18:22:48 +02:00
content:
application/json:
schema:
$ref: '#/components/schemas/Sensor'
404:
description: Device or sensor not found
2020-07-26 18:22:48 +02:00
content: {}
/devices/{deviceID}/{sensorID}/offline:
post:
tags:
- cnc
summary: Shut down sensor
operationId: offlinesensor
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to query
required: true
schema:
type: string
format: uuid
- name: sensorID
in: path
description: ID of sensor to query
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/{sensorID}/online:
post:
2020-07-26 18:22:48 +02:00
tags:
- cnc
summary: Bring sensor online
operationId: onlinesensor
2020-07-26 18:22:48 +02:00
parameters:
- name: deviceID
in: path
description: ID of device to query
required: true
schema:
type: string
format: uuid
- name: sensorID
in: path
description: ID of sensor to query
required: true
schema:
type: string
format: uuid
responses:
2020-07-26 18:22:48 +02:00
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
components:
schemas:
ListOfDevices:
type: array
items:
$ref: '#/components/schemas/Device'
Device:
required:
- id
2020-07-26 18:22:48 +02:00
- sensors
- status
- url
2020-07-26 18:22:48 +02:00
type: object
properties:
id:
type: string
format: uuid
status:
type: string
enum:
- online
- error
- offline
url:
type: string
format: url
sensors:
$ref: '#/components/schemas/ArrayofSensors'
ArrayofSensors:
type: array
items:
$ref: '#/components/schemas/Sensor'
Sensor:
required:
- id
2020-07-26 18:22:48 +02:00
- status
type: object
properties:
id:
type: string
format: uuid
status:
type: string
enum:
- online
- unknown
- offline