update apis to openapi3 where possible

This commit is contained in:
Torma Kristóf 2020-07-26 18:22:48 +02:00
parent 5a8846e525
commit e334ec94a6
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047
5 changed files with 496 additions and 661 deletions

View File

@ -1,58 +0,0 @@
swagger: "2.0"
info:
description: "This is the classification interface of the Birbnetes system."
version: "1.0.0"
title: "Classification Service"
contact:
email: "punkosdmarcell@rocketmail.com"
license:
name: "Apache 2.0"
url: "http://www.apache.org/licenses/LICENSE-2.0.html"
host: "dev.k8s.tcloud.enginner"
basePath: "/api/classification/v1"
tags:
- name: "classification"
description: "Classification Service interaction"
schemes:
- "https"
- "http"
paths:
/classify:
post:
tags:
- "classification"
summary: "Start classifying sample"
description: "This endpoint recieves the features extracted by the feature extractor"
operationId: "classify"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- name: "modelId"
in: "body"
schema:
type: "object"
properties:
tag:
type: "string"
features:
type: "array"
items:
type: "number"
model:
type: "string"
responses:
200:
description: "Classification started"
schema:
$ref: "#/definitions/ApiResponse"
definitions:
ApiResponse:
type: "object"
properties:
status:
type: "string"
message:
type: "string"

View File

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

View File

@ -1,191 +1,194 @@
swagger: "2.0" openapi: 3.0.3
info: info:
description: "This is the model-service interface of the Birbnetes system." title: Model Service
version: "1.0.1" description: This is the model-service interface of the Birbnetes system.
title: "Model Service"
contact: contact:
email: "punkosdmarcell@rocketmail.com" email: punkosdmarcell@rocketmail.com
license: license:
name: "Apache 2.0" name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html" url: http://www.apache.org/licenses/LICENSE-2.0.html
host: "dev.k8s.tcloud.enginner" version: 1.0.3
basePath: "/api/model/v1" servers:
- url: https://dev.k8s.tcloud.enginner/api/model/v1
- url: http://dev.k8s.tcloud.enginner/api/model/v1
tags: tags:
- name: "model" - name: model
description: "Model Service definition" description: Model Service definition
schemes:
- "https"
- "http"
paths: paths:
/model: /model:
get: get:
tags: tags:
- "model" - model
summary: "Return a brief list of available models" summary: Return a brief list of available models
description: "Returns a brief list of available models" description: Returns a brief list of available models
operationId: "getModelList" operationId: getModelList
produces:
- "application/json"
responses: responses:
200: 200:
description: "A brief list of available models" description: A brief list of available models
content:
application/json:
schema: schema:
$ref: "#/definitions/BriefModelDetails" $ref: '#/components/schemas/BriefModelDetails'
post: post:
tags: tags:
- "model" - model
summary: "Uploads a new model into the service" summary: Uploads a new model into the service
description: "" operationId: uploadFile
operationId: "uploadFile" requestBody:
consumes: content:
- "multipart/form-data" multipart/form-data:
produces: schema:
- "application/json" required:
parameters: - file
- name: "info" - info
in: "formData" properties:
description: "This is actually a UploadInfo but swagger 2.0 does not support that" info:
type: string
description: This is actually a UploadInfo but swagger 2.0 does
not support that
file:
type: string
description: model
format: binary
required: true required: true
type: "string"
- name: "file"
in: "formData"
description: "model"
required: true
type: "file"
responses: responses:
201: 201:
description: "Model successfully stored. This means that a get request for this object should be successful." description: Model successfully stored. This means that a get request for
this object should be successful.
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
409: 409:
description: "A model with this Id already exists" description: A model with this Id already exists
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
/model/{modelId}: /model/{modelId}:
get: get:
tags: tags:
- "model" - model
summary: "Download a model identified by Id" summary: Download a model identified by Id
description: "Returns a single model" description: Returns a single model
operationId: "getModelById" operationId: getModelById
produces:
- "application/json"
- "application/octet-stream"
parameters: parameters:
- name: "modelId" - name: modelId
in: "path" in: path
description: "Id of the model to return or `$default` for the default" description: Id of the model to return or `$default` for the default
required: true required: true
type: "string" schema:
type: string
responses: responses:
200: 200:
description: "The requested model" description: The requested model
content: {}
404: 404:
description: "A model with this Id does not exist." description: A model with this Id does not exist.
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
application/octet-stream:
schema:
$ref: '#/components/schemas/ApiResponse'
delete: delete:
tags: tags:
- "model" - model
summary: "Deletes a model identified by Id" summary: Deletes a model identified by Id
description: "" operationId: deleteModel
operationId: "deleteModel"
produces:
- "application/json"
parameters: parameters:
- name: "modelId" - name: modelId
in: "path" in: path
description: "Id of the model to delete" description: Id of the model to delete
required: true required: true
type: "string" schema:
type: string
responses: responses:
204: 204:
description: "Successful deletion" description: Successful deletion
content: {}
404: 404:
description: "An model with this Id does not exist." description: An model with this Id does not exist.
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
/model/$default: /model/$default:
put: put:
tags: tags:
- "model" - model
summary: "Updates the id of the default model" summary: Updates the id of the default model
description: "It really does" description: It really does
operationId: "updateDefault" operationId: updateDefault
produces: requestBody:
- "application/json" content:
parameters: '*/*':
- name: "modelId"
in: "body"
schema: schema:
type: "object" type: object
properties: properties:
id: id:
type: "string" type: string
required: false
responses: responses:
204: 204:
description: "Successful update" description: Successful update
content: {}
404: 404:
description: "The id does not identifies any model" description: The id does not identifies any model
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
x-codegen-request-body-name: modelId
/model/{modelId}/details: /model/{modelId}/details:
get: get:
tags: tags:
- "model" - model
summary: "Get the details of the model required for extraction" summary: Get the details of the model required for extraction
description: "Returns a single object representing model details" description: Returns a single object representing model details
operationId: "getModelDetailsById" operationId: getModelDetailsById
produces:
- "application/json"
parameters: parameters:
- name: "modelId" - name: modelId
in: "path" in: path
description: "Id of the model to return the details of or `$default` for the default model" description: Id of the model to return the details of or `$default` for the
default model
required: true required: true
type: "string" schema:
type: string
responses: responses:
200: 200:
description: "The details of the requested model." description: The details of the requested model.
content:
application/json:
schema: schema:
$ref: "#/definitions/ModelDetails" $ref: '#/components/schemas/ModelDetails'
404: 404:
description: "A model with this id does not exist." description: A model with this id does not exist.
content:
application/json:
schema: schema:
$ref: "#/definitions/ApiResponse" $ref: '#/components/schemas/ApiResponse'
components:
definitions: schemas:
ApiResponse: ApiResponse:
type: "object" type: object
properties: properties:
status: status:
type: "string" type: string
msg: msg:
type: "string" type: string
UploadInfo:
type: "object"
properties:
type:
type: "string"
id:
type: "string"
BriefModelDetails: BriefModelDetails:
type: array type: array
items: items:
type: "object" type: object
properties: properties:
id: id:
type: string type: string
default: default:
type: boolean type: boolean
ModelDetails: ModelDetails:
type: "object" type: object
properties: properties:
id: id:
type: string type: string

View File

@ -1,155 +1,175 @@
swagger: "2.0" openapi: 3.0.3
info: info:
description: "This is the feature extraction interface of the Birbnetes system." title: Output Service - RDB
version: "1.0.0" description: This is the feature extraction interface of the Birbnetes system.
title: "Output Service - RDB"
contact: contact:
email: "tormakristof@tormakristof.eu" email: tormakristof@tormakristof.eu
license: license:
name: "Apache 2.0" name: Apache 2.0
url: "http://www.apache.org/licenses/LICENSE-2.0.html" url: http://www.apache.org/licenses/LICENSE-2.0.html
host: "dev.k8s.tcloud.enginner" version: 1.0.0
basePath: "/api/result/rdb/v1" servers:
- url: https://dev.k8s.tcloud.enginner/api/result/rdb/v1
- url: http://dev.k8s.tcloud.enginner/api/result/rdb/v1
tags: tags:
- name: "result" - name: result
description: "Output Service - RDB interaction" description: Output Service - RDB interaction
schemes:
- "https"
- "http"
paths: paths:
/result: /result:
get: get:
tags:
- result
summary: Get all decision objects summary: Get all decision objects
operationId: getall operationId: getall
tags:
- result
responses: responses:
"200": 200:
description: Array of decision objects description: Array of decision objects
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObjects' $ref: '#/components/schemas/ResultObjects'
"404": 404:
description: No object matching filter description: No object matching filter
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/result/filter/negative: /result/filter/negative:
get: get:
tags:
- result
summary: Get all negative decision objects summary: Get all negative decision objects
operationId: getallnegative operationId: getallnegative
tags:
- result
responses: responses:
"200": 200:
description: Array of decision objects description: Array of decision objects
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObjects' $ref: '#/components/schemas/ResultObjects'
"404": 404:
description: No object matching filter description: No object matching filter
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/result/filter/positive: /result/filter/positive:
get: get:
tags:
- result
summary: Get positive decision objects summary: Get positive decision objects
operationId: getallpositive operationId: getallpositive
tags:
- result
responses: responses:
"200": 200:
description: Array of decision objects description: Array of decision objects
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObjects' $ref: '#/components/schemas/ResultObjects'
"404": 404:
description: No object matching filter description: No object matching filter
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/result/after/{dateAfter}: /result/after/{dateAfter}:
get: get:
summary: Get decision before a date
operationId: getallafter
tags: tags:
- result - result
summary: Get decision before a date
operationId: getallafter
parameters: parameters:
- name: dateAfter - name: dateAfter
in: path in: path
description: Date of filter description: Date of filter
required: true required: true
schema:
type: string type: string
format: date format: date
responses: responses:
"200": 200:
description: Array of decision objects description: Array of decision objects
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObjects' $ref: '#/components/schemas/ResultObjects'
"404": 404:
description: No object matching filter description: No object matching filter
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/result/before/{dateBefore}: /result/before/{dateBefore}:
get: get:
summary: Get decision before a date
operationId: getallbefore
tags: tags:
- result - result
summary: Get decision before a date
operationId: getallbefore
parameters: parameters:
- name: dateBefore - name: dateBefore
in: path in: path
description: Date of filter description: Date of filter
required: true required: true
schema:
type: string type: string
format: date format: date
responses: responses:
"200": 200:
description: Array of decision objects description: Array of decision objects
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObjects' $ref: '#/components/schemas/ResultObjects'
"404": 404:
description: NO objects matching filter description: NO objects matching filter
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
/result/{tagID}: /result/{tagID}:
get: get:
summary: Get decision by ID
operationId: getDecision
tags: tags:
- result - result
summary: Get decision by ID
operationId: getDecision
parameters: parameters:
- name: tagID - name: tagID
in: path in: path
description: ID of wave file description: ID of wave file
required: true required: true
schema:
type: integer type: integer
format: int32 format: int32
responses: responses:
"200": 200:
description: Decision object description: Decision object
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ResultObject' $ref: '#/components/schemas/ResultObject'
"404": 404:
description: Tag not found description: Tag not found
content:
'application/JSON':
schema: schema:
$ref: '#/definitions/ApiResponse' $ref: '#/components/schemas/ApiResponse'
components:
definitions: schemas:
ResultObjects: ResultObjects:
type: array type: array
items: items:
$ref: '#/definitions/ResultObject' $ref: '#/components/schemas/ResultObject'
ResultObject: ResultObject:
type: "object" type: object
properties: properties:
tag: tag:
type: "string" type: string
probability: probability:
type: "number" type: number
ApiResponse: ApiResponse:
type: "object" type: object
properties: properties:
status: status:
type: "string" type: string
message: message:
type: "string" type: string

View File

@ -1,155 +0,0 @@
swagger: "2.0"
info:
description: "This is the feature extraction interface of the Birbnetes system."
version: "1.0.0"
title: "Output Service - RDB"
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/result/rdb/v1"
tags:
- name: "result"
description: "Output Service - RDB interaction"
schemes:
- "https"
- "http"
paths:
/result:
get:
summary: Get all decision objects
operationId: getall
tags:
- result
responses:
"200":
description: Array of decision objects
schema:
$ref: '#/definitions/ResultObjects'
"404":
description: No object matching filter
schema:
$ref: '#/definitions/ApiResponse'
/result/filter/negative:
get:
summary: Get all negative decision objects
operationId: getallnegative
tags:
- result
responses:
"200":
description: Array of decision objects
schema:
$ref: '#/definitions/ResultObjects'
"404":
description: No object matching filter
schema:
$ref: '#/definitions/ApiResponse'
/result/filter/positive:
get:
summary: Get positive decision objects
operationId: getallpositive
tags:
- result
responses:
"200":
description: Array of decision objects
schema:
$ref: '#/definitions/ResultObjects'
"404":
description: No object matching filter
schema:
$ref: '#/definitions/ApiResponse'
/result/after/{dateAfter}:
get:
summary: Get decision before a date
operationId: getallafter
tags:
- result
parameters:
- name: dateAfter
in: path
description: Date of filter
required: true
type: string
format: date
responses:
"200":
description: Array of decision objects
schema:
$ref: '#/definitions/ResultObjects'
"404":
description: No object matching filter
schema:
$ref: '#/definitions/ApiResponse'
/result/before/{dateBefore}:
get:
summary: Get decision before a date
operationId: getallbefore
tags:
- result
parameters:
- name: dateBefore
in: path
description: Date of filter
required: true
type: string
format: date
responses:
"200":
description: Array of decision objects
schema:
$ref: '#/definitions/ResultObjects'
"404":
description: NO objects matching filter
schema:
$ref: '#/definitions/ApiResponse'
/result/{tagID}:
get:
summary: Get decision by ID
operationId: getDecision
tags:
- result
parameters:
- name: tagID
in: path
description: ID of wave file
required: true
type: integer
format: int32
responses:
"200":
description: Decision object
schema:
$ref: '#/definitions/ResultObject'
"404":
description: Tag not found
schema:
$ref: '#/definitions/ApiResponse'
definitions:
ResultObjects:
type: array
items:
$ref: '#/definitions/ResultObject'
ResultObject:
type: "object"
properties:
tag:
type: "string"
probability:
type: "number"
ApiResponse:
type: "object"
properties:
status:
type: "string"
message:
type: "string"