From 5a8846e525a5e940eaae286ccfe3ec0d33c91f8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torma=20Krist=C3=B3f?= Date: Thu, 16 Jul 2020 11:52:36 +0200 Subject: [PATCH] create command and control api definition --- command-and-control.yml | 235 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 command-and-control.yml diff --git a/command-and-control.yml b/command-and-control.yml new file mode 100644 index 0000000..2c5b6ee --- /dev/null +++ b/command-and-control.yml @@ -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 \ No newline at end of file