|
2 | 2 | "openapi": "3.1.0", |
3 | 3 | "info": { |
4 | 4 | "title": "Time Series Analytics Microservice API", |
5 | | - "version": "1.0.0" |
| 5 | + "version": "1.1.0" |
6 | 6 | }, |
| 7 | + "servers": [ |
| 8 | + { |
| 9 | + "url": "/ts-api" |
| 10 | + } |
| 11 | + ], |
7 | 12 | "paths": { |
8 | 13 | "/health": { |
9 | 14 | "get": { |
|
27 | 32 | "/opcua_alerts": { |
28 | 33 | "post": { |
29 | 34 | "summary": "Receive Alert", |
30 | | - "description": "Receive and process OPC UA alerts.\n\nThis endpoint accepts alert messages in JSON format and forwards them to the configured OPC UA client.\nIf the OPC UA client is not initialized, it will attempt to initialize it using the current configuration.\n\nRequest Body Example:\n {\n \"alert\": \"message\"\n }\n\nResponses:\n 200:\n description: Alert received and processed successfully.\n content:\n application/json:\n example:\n {\n \"status_code\": 200,\n \"status\": \"success\",\n \"message\": \"Alert received\"\n }\n 500:\n description: Failed to process the alert due to server error or misconfiguration.\n content:\n application/json:\n example:\n {\n \"detail\": \"Failed to initialize OPC UA client: \u003Cerror_message\u003E\"\n }\n\nRaises:\n HTTPException: If OPC UA alerts are not configured or if there is an error during processing.", |
| 35 | + "description": "Receive and process OPC UA alerts.\n\nThis endpoint accepts alert messages in JSON format and forwards them to the \nconfigured OPC UA client.\nIf the OPC UA client is not initialized, it will attempt to initialize it \nusing the current configuration.\n\nRequest Body Example:\n {\n \"alert\": \"message\"\n }\n\nResponses:\n 200:\n description: Alert received and processed successfully.\n content:\n application/json:\n example:\n {\n \"status_code\": 200,\n \"status\": \"success\",\n \"message\": \"Alert received\"\n }\n 500:\n description: Failed to process the alert due to server error or misconfiguration.\n content:\n application/json:\n example:\n {\n \"detail\": \"Failed to initialize OPC UA client: \u003Cerror_message\u003E\"\n }\n\nRaises:\n HTTPException: If OPC UA alerts are not configured or if there is an error during \n processing.", |
31 | 36 | "operationId": "receive_alert_opcua_alerts_post", |
32 | 37 | "requestBody": { |
33 | 38 | "content": { |
34 | 39 | "application/json": { |
35 | 40 | "schema": { |
36 | | - "$ref": "#/components/schemas/Opcua_Alerts_Message" |
| 41 | + "$ref": "#/components/schemas/OpcuaAlertsMessage" |
37 | 42 | } |
38 | 43 | } |
39 | 44 | }, |
|
66 | 71 | "/input": { |
67 | 72 | "post": { |
68 | 73 | "summary": "Receive Data", |
69 | | - "description": "Receives a data point in JSON format, converts it to InfluxDB line protocol, and sends it to the Kapacitor service.\n\nThe input JSON must include:\n - topic (str): The topic name.\n - tags (dict): Key-value pairs for tags (e.g., {\"location\": \"factory1\"}).\n - fields (dict): Key-value pairs for fields (e.g., {\"temperature\": 23.5}).\n - timestamp (int, optional): Epoch time in nanoseconds. If omitted, current time is used.\n\nExample request body:\n{\n \"topic\": \"sensor_data\",\n \"tags\": {\"location\": \"factory1\", \"device\": \"sensorA\"},\n \"fields\": {\"temperature\": 23.5, \"humidity\": 60},\n \"timestamp\": 1718000000000000000\n}\n\nArgs:\n data_point (DataPoint): The data point to be processed, provided in the request body.\nReturns:\n dict: A status message indicating success or failure.\nRaises:\n HTTPException: If the Kapacitor service returns an error or if any exception occurs during processing.\n\nresponses:\n '200':\n description: Data successfully sent to the Time series Analytics microservice\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: success\n message:\n type: string\n example: Data sent to Time series Analytics microservice\n '4XX':\n description: Client error (e.g., invalid input or Kapacitor error)\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/HTTPValidationError'\n '500':\n description: Internal server error\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string", |
| 74 | + "description": "Receives a data point in JSON format, converts it to InfluxDB line protocol, \nand sends it to the Kapacitor service.\n\nThe input JSON must include:\n - topic (str): The topic name.\n - tags (dict): Key-value pairs for tags (e.g., {\"location\": \"factory1\"}).\n - fields (dict): Key-value pairs for fields (e.g., {\"temperature\": 23.5}).\n - timestamp (int, optional): Epoch time in nanoseconds. If omitted, current time is used.\n\nExample request body:\n{\n \"topic\": \"sensor_data\",\n \"tags\": {\"location\": \"factory1\", \"device\": \"sensorA\"},\n \"fields\": {\"temperature\": 23.5, \"humidity\": 60},\n \"timestamp\": 1718000000000000000\n}\n\nArgs:\n data_point (DataPoint): The data point to be processed, provided in the request body.\nReturns:\n dict: A status message indicating success or failure.\nRaises:\n HTTPException: If the Kapacitor service returns an error or if any exception \n occurs during processing.\n\nresponses:\n '200':\n description: Data successfully sent to the Time series Analytics microservice\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: success\n message:\n type: string\n example: Data sent to Time series Analytics microservice\n '4XX':\n description: Client error (e.g., invalid input or Kapacitor error)\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/HTTPValidationError'\n '500':\n description: Internal server error\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string", |
70 | 75 | "operationId": "receive_data_input_post", |
71 | 76 | "requestBody": { |
72 | 77 | "content": { |
|
105 | 110 | "/config": { |
106 | 111 | "get": { |
107 | 112 | "summary": "Get Config", |
108 | | - "description": "Endpoint to retrieve the current configuration of the input service.\nAccepts an optional 'restart' query parameter and returns the current configuration in JSON format.\nIf 'restart=true' is provided, the Time Series Analytics Microservice UDF deployment service will be restarted before returning the configuration.\n\n---\nparameters:\n - in: query\n name: restart\n schema:\n type: boolean\n default: false\n description: Restart the Time Series Analytics Microservice UDF deployment if true\nresponses:\n 200:\n description: Current configuration retrieved successfully\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"model_registry\": { \"enable\": true, \"version\": \"2.0\" },\n \"udfs\": { \"name\": \"udf_name\", \"model\": \"model_name\" },\n \"alerts\": {}\n }\n 500:\n description: Failed to retrieve configuration\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to retrieve configuration\"", |
| 113 | + "description": "Endpoint to retrieve the current configuration of the input service.\nAccepts an optional 'restart' query parameter and returns the current configuration \nin JSON format.\nIf 'restart=true' is provided, the Time Series Analytics Microservice UDF deployment \nservice will be restarted before returning the configuration.\n\n---\nparameters:\n - in: query\n name: restart\n schema:\n type: boolean\n default: false\n description: Restart the Time Series Analytics Microservice UDF deployment if true\nresponses:\n 200:\n description: Current configuration retrieved successfully\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"udfs\": { \"name\": \"udf_name\", \"model\": \"model_name\" },\n \"alerts\": {}\n }\n 500:\n description: Failed to retrieve configuration\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to retrieve configuration\"", |
109 | 114 | "operationId": "get_config_config_get", |
110 | 115 | "parameters": [ |
111 | 116 | { |
|
153 | 158 | }, |
154 | 159 | "post": { |
155 | 160 | "summary": "Config File Change", |
156 | | - "description": "Endpoint to handle configuration changes.\nThis endpoint can be used to update the configuration of the input service.\nUpdates the configuration of the input service with the provided key-value pairs.\n\n---\nrequestBody:\n required: true\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\"model_registry\": {\n \"enable\": true\n \"version\": \"2.0\"\n },\n \"udfs\": {\n \"name\": \"udf_name\",\n \"model\": \"model_name\"}\n \"alerts\": {\n }\nresponses:\n 200:\n description: Configuration updated successfully\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: \"success\"\n message:\n type: string\n example: \"Configuration updated successfully\"\n 400:\n description: Invalid input or error processing request\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Error message\"\n 500:\n description: Failed to write configuration to file\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to write configuration to file\"", |
| 161 | + "description": "Endpoint to handle configuration changes.\nThis endpoint can be used to update the configuration of the input service.\nUpdates the configuration of the input service with the provided key-value pairs.\n\n---\nrequestBody:\n required: true\n content:\n application/json:\n schema:\n type: object\n additionalProperties: true\n example:\n {\n \"udfs\": {\n \"name\": \"udf_name\",\n \"model\": \"model_name\",\n \"device\": \"cpu or gpu\"}\n \"alerts\": {\n }\nresponses:\n 200:\n description: Configuration updated successfully\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: \"success\"\n message:\n type: string\n example: \"Configuration updated successfully\"\n 400:\n description: Invalid input or error processing request\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Error message\"\n 500:\n description: Failed to write configuration to file\n content:\n application/json:\n schema:\n type: object\n properties:\n detail:\n type: string\n example: \"Failed to write configuration to file\"", |
157 | 162 | "operationId": "config_file_change_config_post", |
158 | 163 | "requestBody": { |
159 | 164 | "required": true, |
|
194 | 199 | "schemas": { |
195 | 200 | "Config": { |
196 | 201 | "properties": { |
197 | | - "model_registry": { |
198 | | - "additionalProperties": true, |
199 | | - "type": "object", |
200 | | - "title": "Model Registry", |
201 | | - "default": { |
202 | | - "enable": false, |
203 | | - "version": "1.0" |
204 | | - } |
205 | | - }, |
206 | 202 | "udfs": { |
207 | 203 | "additionalProperties": true, |
208 | 204 | "type": "object", |
209 | 205 | "title": "Udfs", |
210 | 206 | "default": { |
211 | | - "name": "udf_name" |
| 207 | + "name": "udf_name", |
| 208 | + "device": "cpu/gpu" |
212 | 209 | } |
213 | 210 | }, |
214 | 211 | "alerts": { |
|
228 | 225 | } |
229 | 226 | }, |
230 | 227 | "type": "object", |
231 | | - "title": "Config" |
| 228 | + "title": "Config", |
| 229 | + "description": "Configuration model for the service." |
232 | 230 | }, |
233 | 231 | "DataPoint": { |
234 | 232 | "properties": { |
|
270 | 268 | "topic", |
271 | 269 | "fields" |
272 | 270 | ], |
273 | | - "title": "DataPoint" |
| 271 | + "title": "DataPoint", |
| 272 | + "description": "Data point model for input data." |
274 | 273 | }, |
275 | 274 | "HTTPValidationError": { |
276 | 275 | "properties": { |
|
285 | 284 | "type": "object", |
286 | 285 | "title": "HTTPValidationError" |
287 | 286 | }, |
288 | | - "Opcua_Alerts_Message": { |
| 287 | + "OpcuaAlertsMessage": { |
289 | 288 | "properties": { |
290 | 289 |
|
291 | 290 | }, |
292 | 291 | "additionalProperties": true, |
293 | 292 | "type": "object", |
294 | | - "title": "Opcua_Alerts_Message" |
| 293 | + "title": "OpcuaAlertsMessage", |
| 294 | + "description": "Model for OPC UA alert messages." |
295 | 295 | }, |
296 | 296 | "ValidationError": { |
297 | 297 | "properties": { |
|
0 commit comments