added new protocols of datasource into API

pull/67/head
13621160019@163.com 2021-09-14 15:30:47 +08:00 committed by Caozhenhui
parent be1ab059a1
commit 0e483b674e
1 changed files with 19 additions and 4 deletions

View File

@ -104,7 +104,7 @@ class DataSourceCollection:
'mongodb', 'mongodb',
'influxdb'): 'influxdb'):
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_DATA_SOURCE_PROTOCOL.') description='API.INVALID_DATA_SOURCE_PROTOCOL')
protocol = new_values['data']['protocol'] protocol = new_values['data']['protocol']
if 'connection' not in new_values['data'].keys() or \ if 'connection' not in new_values['data'].keys() or \
@ -278,10 +278,25 @@ class DataSourceItem:
if 'protocol' not in new_values['data'].keys() \ if 'protocol' not in new_values['data'].keys() \
or new_values['data']['protocol'] not in \ or new_values['data']['protocol'] not in \
('modbus-tcp', 'modbus-rtu', 'bacnet-ip', 's7', 'profibus', 'profinet', 'opc-ua', 'lora', 'simulation', ('modbus-tcp',
'controllogix', 'weather'): 'modbus-rtu',
'bacnet-ip',
's7',
'profibus',
'profinet',
'opc-ua',
'lora',
'simulation',
'controllogix',
'weather',
'mysql',
'sqlserver',
'postgresql',
'oracle',
'mongodb',
'influxdb'):
raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST', raise falcon.HTTPError(falcon.HTTP_400, title='API.BAD_REQUEST',
description='API.INVALID_DATA_SOURCE_PROTOCOL.') description='API.INVALID_DATA_SOURCE_PROTOCOL')
protocol = new_values['data']['protocol'] protocol = new_values['data']['protocol']
if 'connection' not in new_values['data'].keys() or \ if 'connection' not in new_values['data'].keys() or \