update apis to openapi3 where possible

This commit is contained in:
2020-07-26 18:22:48 +02:00
parent 5a8846e525
commit e334ec94a6
5 changed files with 496 additions and 661 deletions

View File

@@ -1,235 +1,260 @@
swagger: "2.0"
openapi: 3.0.3
info:
description: "This service s responsible for controlling and handling information about IoT devices in the Birbnetes system."
version: "1.0.0"
title: "Command and Control Service"
title: Command and Control Service
description: This service s responsible for controlling and handling information
about IoT devices in the Birbnetes system.
contact:
email: "tormakristof@tormakristof.eu"
email: tormakristof@tormakristof.eu
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "dev.k8s.tcloud.enginner"
basePath: "/api/cnc/v1"
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 1.0.0
servers:
- url: https://dev.k8s.tcloud.enginner/api/cnc/v1
- url: http://dev.k8s.tcloud.enginner/api/cnc/v1
tags:
- name: "cnc"
description: "Command and Control Service interaction"
schemes:
- "https"
- "http"
- name: cnc
description: Command and Control Service interaction
paths:
/device:
/devices:
get:
tags:
- cnc
summary: Get all device info
operationId: getall
tags:
- cnc
responses:
"200":
200:
description: Array of devices
schema:
$ref: '#/definitions/ListOfDevices'
delete:
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
tags:
- cnc
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (system in inconsistent state)
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/online:
post:
tags:
- cnc
summary: Bring all devices online
operationId: onlineall
tags:
- cnc
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (system in inconsistent state)
/device/{deviceID}:
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}:
get:
tags:
- cnc
summary: Get all device info
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to query
operationId: getdevice
tags:
- cnc
parameters:
- name: deviceID
in: path
description: ID of device to query
required: true
schema:
type: string
format: uuid
responses:
"200":
200:
description: Information about a particular device
schema:
$ref: '#/definitions/Device'
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/Device'
404:
description: Device not found
delete:
content: {}
/devices/{deviceID}/offline:
post:
tags:
- cnc
summary: Shut down device
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to shut down
operationId: offlinedevice
tags:
- cnc
parameters:
- name: deviceID
in: path
description: ID of device to shut down
required: true
schema:
type: string
format: uuid
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (device in errored state)
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/online:
post:
tags:
- cnc
summary: Bring device online
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to bring online
operationId: onlinedevice
tags:
- cnc
parameters:
- name: deviceID
in: path
description: ID of device to bring online
required: true
schema:
type: string
format: uuid
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (device in errored state)
/device/{deviceID}/{sensorID}:
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/{sensorID}:
get:
tags:
- cnc
summary: Get info about a particular device's sensor
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to query
- in: path
name: sensorID
type: "string"
format: "uuid"
required: true
description: ID of sensor to query
operationId: getsensor
tags:
- cnc
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:
"200":
200:
description: Information about a sensor
schema:
$ref: '#/definitions/Sensor'
"404":
content:
application/json:
schema:
$ref: '#/components/schemas/Sensor'
404:
description: Device or sensor not found
delete:
summary: Shut down sensor
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to query
- in: path
name: sensorID
type: "string"
format: "uuid"
required: true
description: ID of sensor to query
operationId: offlinesensor
tags:
- cnc
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (sensor in unknown state)
content: {}
/devices/{deviceID}/{sensorID}/offline:
post:
summary: Bring sensor online
parameters:
- in: path
name: deviceID
type: "string"
format: "uuid"
required: true
description: ID of device to query
- in: path
name: sensorID
type: "string"
format: "uuid"
required: true
description: ID of sensor to query
operationId: onlinesensor
tags:
- cnc
- cnc
summary: Shut down sensor
operationId: offlinesensor
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:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (sensor in unknown state)
definitions:
ListOfDevices:
type: "array"
items:
$ref: "#/definitions/Device"
Device:
type: "object"
properties:
id:
type: "string"
format: "uuid"
status:
type: "string"
enum: ["online", "error", "offline"]
url:
type: "string"
format: "url"
sensors:
$ref: '#/definitions/ArrayofSensors'
required:
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
/devices/{deviceID}/{sensorID}/online:
post:
tags:
- cnc
summary: Bring sensor online
operationId: onlinesensor
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:
200:
description: Message sent
content: {}
500:
description: Message sending unsuccessful
content: {}
components:
schemas:
ListOfDevices:
type: array
items:
$ref: '#/components/schemas/Device'
Device:
required:
- id
- sensors
- status
- url
- sensors
ArrayofSensors:
type: "array"
items:
$ref: "#/definitions/Sensor"
Sensor:
type: "object"
properties:
id:
type: "string"
format: "uuid"
status:
type: "string"
enum: ["online", "unknown", "offline"]
required:
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
- status
- status
type: object
properties:
id:
type: string
format: uuid
status:
type: string
enum:
- online
- unknown
- offline