-
Notifications
You must be signed in to change notification settings - Fork 1
/
createConnection.txt
41 lines (41 loc) · 2.36 KB
/
createConnection.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
curl -u devops:foobar -X POST -d '{
"targetActorSelection": "/system/sharding/connection",
"headers": {
"aggregate": false
},
"piggybackCommand": {
"type": "connectivity.commands:createConnection",
"connection": {
"id": "mqtt-udmiduino-0",
"connectionType": "mqtt",
"connectionStatus": "open",
"failoverEnabled": true,
"uri": "tcp://10.8.0.62:1883",
"sources": [
{
"addresses": [
"arup-8-fitzroy-street/UDMIduino-000/events"
],
"authorizationContext": ["nginx:ditto"],
"qos": 0,
"filters": []
}
],
"targets": [{
"address": "arup-8-fitzroy-street/UDMIduino-000/lum-value",
"authorizationContext": ["nginx:ditto"],
"topics": [
"_/_/things/twin/events",
"_/_/things/live/messages"
],
"qos": 0
}],
"mappingContext": {
"mappingEngine": "JavaScript",
"options": {
"incomingScript": "function mapToDittoProtocolMsg(headers, textPayload, bytePayload, contentType) { const thingId = 'UDMIduino-000'; const jsonString = String.fromCharCode.apply(null, new Uint8Array(bytePayload)); const jsonData = JSON.parse(jsonString); const value = { udmi: { properties: { version: 1, timestamp: 0, points: { lux_level: { present_value: jsonData.points.lux_level.present_value }, lum_value: { present_value: jsonData.points.lum_value.present_value }, dimmer_value: { present_value: jsonData.points.dimmer_value.present_value } } } } }; return Ditto.buildDittoProtocolMsg( 'arup.eight.fitzroy', thingId, 'things', 'twin', 'commands', 'modify', '/features', headers, value ); }"
}
}
}
}
}' 'http://localhost:8080/devops/piggyback/connectivity'