-
Notifications
You must be signed in to change notification settings - Fork 0
/
flogo.json
208 lines (208 loc) · 5.8 KB
/
flogo.json
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
{
"name": "flogo-demo-services",
"type": "flogo:app",
"version": "0.0.1",
"appModel": "1.0.0",
"triggers": [
{
"id": "smiley_from_rest",
"ref": "github.com/TIBCOSoftware/flogo-contrib/trigger/rest",
"name": "Smiley from REST",
"description": "Triggers the display of the selected smiley on the Raspberry Pi screen by a REST request.",
"settings": {
"port": 4445
},
"handlers": [
{
"action": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/action/flow",
"data": {
"flowURI": "res://flow:flogo_smiley_demo"
},
"mappings": {
"input": [
{
"mapTo": "smileyId",
"type": "assign",
"value": "$.pathParams.smileyId"
}
],
"output": [
{
"mapTo": "code",
"type": "assign",
"value": "$.returnCode"
}
]
}
},
"settings": {
"method": "GET",
"path": "/v1/smiley/:smileyId"
}
}
]
},
{
"id": "smiley_from_mqtt",
"ref": "github.com/TIBCOSoftware/flogo-contrib/trigger/mqtt",
"name": "Smiley from MQTT",
"description": "Triggers the display of the selected smiley on the Raspberry Pi screen by a MQTT message.",
"settings": {
"broker": "$env[MQTT_BROKER]",
"id": "$env[MQTT_ID]"
},
"handlers": [
{
"action": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/action/flow",
"data": {
"flowURI": "res://flow:flogo_smiley_demo"
},
"mappings": {
"input": [
{
"mapTo": "smileyId",
"type": "assign",
"value": "$.message"
}
]
}
},
"settings": {
"topic": "demo"
}
}
]
}
],
"resources": [
{
"id": "flow:flogo_smiley_demo",
"data": {
"name": "Flogo Smiley Demo",
"description": "This is a simple API to display smiley pictures on a screen of a Raspberry PI running a Flogo IoT application",
"metadata": {
"input": [
{
"name": "smileyId",
"type": "string"
},
{
"name": "smileyFile",
"type": "string"
}
],
"output": [
{
"name": "returnCode",
"type": "integer"
}
]
},
"tasks": [
{
"id": "log_2",
"name": "Log Smiley ID",
"description": "Log the received smiley ID",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/log",
"input": {
"flowInfo": "false",
"addToFlow": "false"
},
"mappings": {
"input": [
{
"type": "expression",
"value": "string.concat(\"Receive request with smiley id: \", $flow.smileyId)",
"mapTo": "message"
}
]
}
}
},
{
"id": "log_3",
"name": "Log Smiley Request",
"description": "Log the request to send to the Raspberry Pi",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/log",
"input": {
"flowInfo": "false",
"addToFlow": "false"
},
"mappings": {
"input": [
{
"type": "expression",
"value": "string.concat(\"Forwarding request to: http://\", $env.RPI_HOST, \":\", $env.RPI_PORT, \"/v1/smiley/\", $flow.smileyId)",
"mapTo": "message"
}
]
}
}
},
{
"id": "rest_8",
"name": "Invoke REST Service",
"description": "Simple REST Activity",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/rest",
"input": {
"method": "GET"
},
"mappings": {
"input": [
{
"type": "expression",
"value": "string.concat(\"http://\", $env.RPI_HOST, \":\", $env.RPI_PORT, \"/v1/smiley/:smileyId\")",
"mapTo": "uri"
},
{
"type": "object",
"value": {
"smileyId": "{{$flow.smileyId}}"
},
"mapTo": "pathParams"
}
]
}
}
},
{
"id": "actreply_7",
"name": "Reply To Trigger",
"description": "Send HTTP 200 status code",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/actreply",
"input": {
"mappings": [
{
"mapTo": "returnCode",
"type": "literal",
"value": 200
}
]
}
}
}
],
"links": [
{
"from": "log_2",
"to": "log_3"
},
{
"from": "log_3",
"to": "rest_8"
},
{
"from": "rest_8",
"to": "actreply_7"
}
]
}
}
]
}