-
Notifications
You must be signed in to change notification settings - Fork 1
/
flogo.json
233 lines (233 loc) · 6.59 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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
{
"name": "flogo-demo-iot",
"type": "flogo:app",
"version": "0.0.1",
"appModel": "1.0.0",
"triggers": [
{
"id": "smiley",
"ref": "github.com/TIBCOSoftware/flogo-contrib/trigger/rest",
"name": "smiley",
"description": "Triggers the display of the selected smiley on the Raspberry Pi screen.",
"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"
},
{
"mapTo": "smileyFile",
"type": "expression",
"value": "string.concat($env.DEMO_IOT_EMOJIS_DIR, string.concat(\"/\", string.concat($.pathParams.smileyId, \".png\")))"
}
],
"output": [
{
"mapTo": "code",
"type": "assign",
"value": "$.returnCode"
}
]
}
},
"settings": {
"method": "GET",
"path": "/v1/smiley/:smileyId"
}
}
]
}
],
"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 Filename",
"description": "Log the resolved filename of the smiley to display",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/log",
"input": {
"flowInfo": "false",
"addToFlow": "false"
},
"mappings": {
"input": [
{
"type": "expression",
"value": "string.concat(\"File to display: \", $flow.smileyFile)",
"mapTo": "message"
}
]
}
}
},
{
"id": "copyfile_4",
"name": "Copy Image File",
"description": "Copy selected smiley image file to a temporary location",
"activity": {
"ref": "github.com/square-it/flogo-contrib-activities/copyfile",
"input": {
"destination": "/tmp/current.png"
},
"mappings": {
"input": [
{
"type": "assign",
"value": "$flow.smileyFile",
"mapTo": "source"
}
]
}
}
},
{
"id": "command_5",
"name": "Call fbi Command",
"description": "Execute the fbi command to display the smiley image on the Raspberry Pi screen",
"activity": {
"ref": "github.com/square-it/flogo-contrib-activities/command",
"input": {
"command": "fbi",
"useCurrentEnvironment": true,
"timeout": 0,
"wait": true
},
"mappings": {
"input": [
{
"type": "object",
"value": [
"-T",
"2",
"-a",
"-noverbose",
"-nocomments",
"/tmp/current.png"
],
"mapTo": "arguments"
}
]
}
}
},
{
"id": "log_6",
"name": "Log fbi Output",
"description": "Log the output of the fbi command",
"activity": {
"ref": "github.com/TIBCOSoftware/flogo-contrib/activity/log",
"input": {
"flowInfo": "false",
"addToFlow": "false"
},
"mappings": {
"input": [
{
"type": "assign",
"value": "$activity[command_5].output",
"mapTo": "message"
}
]
}
}
},
{
"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": "copyfile_4"
},
{
"from": "copyfile_4",
"to": "command_5"
},
{
"from": "command_5",
"to": "log_6"
},
{
"from": "log_6",
"to": "actreply_7"
}
]
}
}
]
}