create command and control api definition

This commit is contained in:
Torma Kristóf 2020-07-16 11:52:36 +02:00
parent d0923a6424
commit 5a8846e525

235
command-and-control.yml Normal file
View File

@ -0,0 +1,235 @@
swagger: "2.0"
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"
contact:
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"
tags:
- name: "cnc"
description: "Command and Control Service interaction"
schemes:
- "https"
- "http"
paths:
/device:
get:
summary: Get all device info
operationId: getall
tags:
- cnc
responses:
"200":
description: Array of devices
schema:
$ref: '#/definitions/ListOfDevices'
delete:
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)
post:
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}:
get:
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
responses:
"200":
description: Information about a particular device
schema:
$ref: '#/definitions/Device'
"404":
description: Device not found
delete:
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
responses:
"200":
description: Operation successful
"500":
description: Operation unsuccessful, rolled back successfully
"503":
description: Operation unsuccessful, rollback unsuccessful (device in errored state)
post:
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
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}:
get:
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
responses:
"200":
description: Information about a sensor
schema:
$ref: '#/definitions/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)
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
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:
- id
- 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:
- id
- status