MuranoCLI 3.2.0.beta.1 → 3.2.0.beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/.trustme.plugin +137 -0
- data/.trustme.sh +217 -117
- data/.trustme.vim +9 -3
- data/Gemfile +9 -3
- data/MuranoCLI.gemspec +8 -5
- data/Rakefile +1 -0
- data/dockers/Dockerfile.2.2.9 +6 -3
- data/dockers/Dockerfile.2.3.6 +6 -3
- data/dockers/Dockerfile.2.4.3 +6 -3
- data/dockers/Dockerfile.2.5.0 +6 -3
- data/dockers/Dockerfile.GemRelease +10 -8
- data/dockers/Dockerfile.m4 +23 -5
- data/dockers/docker-test.sh +65 -28
- data/docs/completions/murano_completion-bash +751 -57
- data/docs/develop.rst +10 -9
- data/lib/MrMurano/AccountBase.rb +95 -6
- data/lib/MrMurano/Commander-Entry.rb +9 -4
- data/lib/MrMurano/Config-Migrate.rb +2 -0
- data/lib/MrMurano/Config.rb +94 -26
- data/lib/MrMurano/Content.rb +1 -1
- data/lib/MrMurano/Exchange.rb +77 -42
- data/lib/MrMurano/Gateway.rb +1 -1
- data/lib/MrMurano/HttpAuthed.rb +20 -7
- data/lib/MrMurano/Logs.rb +10 -1
- data/lib/MrMurano/ProjectFile.rb +1 -1
- data/lib/MrMurano/ReCommander.rb +129 -73
- data/lib/MrMurano/Solution-ServiceConfig.rb +18 -11
- data/lib/MrMurano/Solution-Services.rb +78 -50
- data/lib/MrMurano/Solution-Users.rb +1 -1
- data/lib/MrMurano/Solution.rb +13 -63
- data/lib/MrMurano/SyncUpDown-Core.rb +185 -77
- data/lib/MrMurano/SyncUpDown-Item.rb +29 -4
- data/lib/MrMurano/SyncUpDown.rb +11 -11
- data/lib/MrMurano/Webservice-Cors.rb +1 -1
- data/lib/MrMurano/Webservice-Endpoint.rb +28 -17
- data/lib/MrMurano/Webservice-File.rb +103 -43
- data/lib/MrMurano/commands/domain.rb +1 -0
- data/lib/MrMurano/commands/element.rb +585 -0
- data/lib/MrMurano/commands/exchange.rb +211 -204
- data/lib/MrMurano/commands/gb.rb +1 -0
- data/lib/MrMurano/commands/globals.rb +17 -7
- data/lib/MrMurano/commands/init.rb +115 -101
- data/lib/MrMurano/commands/keystore.rb +1 -1
- data/lib/MrMurano/commands/logs.rb +2 -1
- data/lib/MrMurano/commands/postgresql.rb +17 -7
- data/lib/MrMurano/commands/service.rb +572 -0
- data/lib/MrMurano/commands/show.rb +7 -3
- data/lib/MrMurano/commands/solution.rb +2 -1
- data/lib/MrMurano/commands/solution_picker.rb +31 -15
- data/lib/MrMurano/commands/status.rb +205 -169
- data/lib/MrMurano/commands/sync.rb +70 -38
- data/lib/MrMurano/commands/token.rb +59 -14
- data/lib/MrMurano/commands/usage.rb +1 -0
- data/lib/MrMurano/commands.rb +2 -0
- data/lib/MrMurano/hash.rb +91 -0
- data/lib/MrMurano/http.rb +55 -6
- data/lib/MrMurano/makePretty.rb +47 -0
- data/lib/MrMurano/optparse.rb +60 -45
- data/lib/MrMurano/variegated/TruthyFalsey.rb +48 -0
- data/lib/MrMurano/variegated/ruby_dig.rb +64 -0
- data/lib/MrMurano/verbosing.rb +113 -3
- data/lib/MrMurano/version.rb +1 -1
- data/spec/Account_spec.rb +34 -20
- data/spec/Business_spec.rb +12 -9
- data/spec/Config_spec.rb +7 -1
- data/spec/Content_spec.rb +17 -1
- data/spec/GatewayBase_spec.rb +5 -2
- data/spec/GatewayDevice_spec.rb +4 -2
- data/spec/GatewayResource_spec.rb +4 -1
- data/spec/GatewaySettings_spec.rb +4 -1
- data/spec/HttpAuthed_spec.rb +73 -0
- data/spec/Http_spec.rb +32 -35
- data/spec/ProjectFile_spec.rb +1 -1
- data/spec/Solution-ServiceConfig_spec.rb +4 -1
- data/spec/Solution-ServiceEventHandler_spec.rb +6 -3
- data/spec/Solution-ServiceModules_spec.rb +4 -1
- data/spec/Solution-UsersRoles_spec.rb +4 -1
- data/spec/Solution_spec.rb +4 -1
- data/spec/SyncUpDown_spec.rb +1 -1
- data/spec/Webservice-Cors_spec.rb +4 -1
- data/spec/Webservice-Endpoint_spec.rb +9 -6
- data/spec/Webservice-File_spec.rb +17 -4
- data/spec/Webservice-Setting_spec.rb +6 -2
- data/spec/_workspace.rb +2 -0
- data/spec/cmd_common.rb +42 -13
- data/spec/cmd_content_spec.rb +17 -7
- data/spec/cmd_device_spec.rb +1 -1
- data/spec/cmd_domain_spec.rb +2 -2
- data/spec/cmd_element_spec.rb +400 -0
- data/spec/cmd_exchange_spec.rb +2 -2
- data/spec/cmd_init_spec.rb +59 -25
- data/spec/cmd_keystore_spec.rb +6 -3
- data/spec/cmd_link_spec.rb +10 -5
- data/spec/cmd_logs_spec.rb +1 -1
- data/spec/cmd_setting_application_spec.rb +18 -15
- data/spec/cmd_setting_product_spec.rb +7 -7
- data/spec/cmd_status_spec.rb +27 -17
- data/spec/cmd_syncdown_application_spec.rb +30 -3
- data/spec/cmd_syncdown_both_spec.rb +72 -18
- data/spec/cmd_syncup_spec.rb +71 -5
- data/spec/cmd_token_spec.rb +2 -2
- data/spec/cmd_usage_spec.rb +2 -2
- data/spec/dry_run_formatter.rb +27 -0
- data/spec/fixtures/dumped_config +8 -0
- data/spec/fixtures/exchange_element/element-show.json +1 -0
- data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +282 -0
- data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +588 -0
- data/spec/variegated_TruthyFalsey_spec.rb +29 -0
- metadata +51 -25
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
swagger: "2.0"
|
|
2
|
+
|
|
3
|
+
################################################################################
|
|
4
|
+
# Service Metadata #
|
|
5
|
+
################################################################################
|
|
6
|
+
info:
|
|
7
|
+
version: "1.0"
|
|
8
|
+
title: Transformer
|
|
9
|
+
description: |
|
|
10
|
+
This service is for Transforming SignalData.
|
|
11
|
+
contact:
|
|
12
|
+
name: Exosite Exosite Exosite Exosite
|
|
13
|
+
email: exosite@exosite.com
|
|
14
|
+
|
|
15
|
+
################################################################################
|
|
16
|
+
# API Information #
|
|
17
|
+
################################################################################
|
|
18
|
+
|
|
19
|
+
# A hostname with a valid, signed, and active TSL certificate is required.
|
|
20
|
+
host: transformer-dev.hosted.exosite.io
|
|
21
|
+
basePath: /api/v1
|
|
22
|
+
schemes:
|
|
23
|
+
- https
|
|
24
|
+
consumes:
|
|
25
|
+
- application/json
|
|
26
|
+
produces:
|
|
27
|
+
- application/json
|
|
28
|
+
|
|
29
|
+
################################################################################
|
|
30
|
+
# Solution lifecycle Events #
|
|
31
|
+
################################################################################
|
|
32
|
+
# Following Operation should generally be restricted with "x-exosite-restricted: true"
|
|
33
|
+
x-exosite-init: createSolution # Triggered by Murano when this service is enabled in a solution
|
|
34
|
+
x-exosite-info: getSolution # Triggered by Murano to retrieve custom information about the service solution namespace
|
|
35
|
+
x-exosite-update: updateSolution # Triggered by Murano when the solution service configuration is updated
|
|
36
|
+
x-exosite-gc: delSolution # Triggered by Murano when the service is removed from a solution or if the solution is deleted
|
|
37
|
+
|
|
38
|
+
################################################################################
|
|
39
|
+
# Service Configuration Parameters #
|
|
40
|
+
################################################################################
|
|
41
|
+
x-exosite-config-parameters:
|
|
42
|
+
- name: maximumTTL
|
|
43
|
+
type: number
|
|
44
|
+
description: Maximum number of times a message can propagate through
|
|
45
|
+
required: true # Indicates this parameter is required during configuration
|
|
46
|
+
- name: authToken
|
|
47
|
+
type: string
|
|
48
|
+
description: This is a placeholder for a potential future feature.
|
|
49
|
+
required: true # the only option that works is true…
|
|
50
|
+
- name: eventURI
|
|
51
|
+
type: string
|
|
52
|
+
description: This is a placeholder for a potential future feature.
|
|
53
|
+
required: true # the only option that works is true…
|
|
54
|
+
|
|
55
|
+
################################################################################
|
|
56
|
+
# Operations #
|
|
57
|
+
################################################################################
|
|
58
|
+
paths:
|
|
59
|
+
/:
|
|
60
|
+
get:
|
|
61
|
+
description: Alive check
|
|
62
|
+
operationId: alive
|
|
63
|
+
x-exosite-restricted: true # Indicate that this operation cannot be called from user scripts
|
|
64
|
+
responses:
|
|
65
|
+
"200":
|
|
66
|
+
description: Solution successfully created
|
|
67
|
+
default:
|
|
68
|
+
description: Error
|
|
69
|
+
schema:
|
|
70
|
+
$ref: '#/definitions/ErrorResponse'
|
|
71
|
+
|
|
72
|
+
# Administration endpoint used by Murano solution lifecycle events
|
|
73
|
+
# Those operation uses the "x-exosite-restricted" to prevent the user to access them directly
|
|
74
|
+
/{solution_id}:
|
|
75
|
+
parameters:
|
|
76
|
+
- name: solution_id
|
|
77
|
+
x-exosite-from: solution_id # Indicate this value is injected from the user solution_id
|
|
78
|
+
x-exosite-restricted: true # Indicate the user cannot provide this parameter
|
|
79
|
+
type: string
|
|
80
|
+
in: path
|
|
81
|
+
description: The solution identifier. Set automatically.
|
|
82
|
+
required: true
|
|
83
|
+
post:
|
|
84
|
+
description: Used by Murano to create a solution namespace.
|
|
85
|
+
operationId: createSolution
|
|
86
|
+
x-exosite-restricted: true # Indicate that this operation cannot be called from user scripts
|
|
87
|
+
parameters:
|
|
88
|
+
- name: settings
|
|
89
|
+
in: body
|
|
90
|
+
description: The service settings for a solution.
|
|
91
|
+
required: true
|
|
92
|
+
schema:
|
|
93
|
+
$ref: "#/definitions/SolutionSettings"
|
|
94
|
+
responses:
|
|
95
|
+
"200":
|
|
96
|
+
description: Solution successfully created
|
|
97
|
+
default:
|
|
98
|
+
description: Error
|
|
99
|
+
schema:
|
|
100
|
+
$ref: '#/definitions/ErrorResponse'
|
|
101
|
+
get:
|
|
102
|
+
description: Used by Murano to get the solution settings.
|
|
103
|
+
operationId: getSolution
|
|
104
|
+
responses:
|
|
105
|
+
"200":
|
|
106
|
+
description: Solution settings
|
|
107
|
+
schema:
|
|
108
|
+
$ref: "#/definitions/SolutionInfo"
|
|
109
|
+
default:
|
|
110
|
+
description: Error
|
|
111
|
+
schema:
|
|
112
|
+
$ref: '#/definitions/ErrorResponse'
|
|
113
|
+
put:
|
|
114
|
+
description: Used by Murano to update the solution settings.
|
|
115
|
+
operationId: updateSolution
|
|
116
|
+
x-exosite-restricted: true
|
|
117
|
+
parameters:
|
|
118
|
+
- name: settings
|
|
119
|
+
in: body
|
|
120
|
+
description: The service settings for a solution.
|
|
121
|
+
required: true
|
|
122
|
+
schema:
|
|
123
|
+
$ref: "#/definitions/SolutionSettings"
|
|
124
|
+
responses:
|
|
125
|
+
"205":
|
|
126
|
+
description: Settings updated
|
|
127
|
+
default:
|
|
128
|
+
description: Error
|
|
129
|
+
schema:
|
|
130
|
+
$ref: '#/definitions/ErrorResponse'
|
|
131
|
+
delete:
|
|
132
|
+
description: Used by Murano to remove a solution and clean its namespace.
|
|
133
|
+
operationId: delSolution
|
|
134
|
+
x-exosite-restricted: true
|
|
135
|
+
responses:
|
|
136
|
+
"205":
|
|
137
|
+
description: Solution successfully removed.
|
|
138
|
+
default:
|
|
139
|
+
description: Error
|
|
140
|
+
schema:
|
|
141
|
+
$ref: '#/definitions/ErrorResponse'
|
|
142
|
+
|
|
143
|
+
# Service operations available from scripting
|
|
144
|
+
/{solution_id}/transform:
|
|
145
|
+
parameters:
|
|
146
|
+
- name: solution_id
|
|
147
|
+
type: string
|
|
148
|
+
in: path
|
|
149
|
+
description: The solution identifier. Set automatically by Murano at service call.
|
|
150
|
+
x-exosite-from: solution_id # Indicate this value is injected from the user solution_id
|
|
151
|
+
x-exosite-restricted: true # Indicate the user cannot provide this parameter
|
|
152
|
+
required: true
|
|
153
|
+
post:
|
|
154
|
+
description: Create Transform
|
|
155
|
+
operationId: create
|
|
156
|
+
x-exosite-example: |
|
|
157
|
+
local res = Transformer.create{
|
|
158
|
+
subscribe = {"topic.name"},
|
|
159
|
+
tags = {"asset-42"},
|
|
160
|
+
select = "value * 24"
|
|
161
|
+
}
|
|
162
|
+
-- res.id is the UUID assigned to the new transform.
|
|
163
|
+
|
|
164
|
+
parameters:
|
|
165
|
+
- name: body
|
|
166
|
+
in: body
|
|
167
|
+
description: The Transform to create.
|
|
168
|
+
required: true
|
|
169
|
+
schema:
|
|
170
|
+
$ref: "#/definitions/Transformation"
|
|
171
|
+
responses:
|
|
172
|
+
"200":
|
|
173
|
+
description: Transform successfully saved
|
|
174
|
+
schema:
|
|
175
|
+
type: object
|
|
176
|
+
description: Transformation Id Object
|
|
177
|
+
properties:
|
|
178
|
+
id:
|
|
179
|
+
description: Transform ID
|
|
180
|
+
type: string
|
|
181
|
+
default:
|
|
182
|
+
description: Error
|
|
183
|
+
schema:
|
|
184
|
+
$ref: '#/definitions/ErrorResponse'
|
|
185
|
+
get:
|
|
186
|
+
description: Retrieve Transform from the solution namespace.
|
|
187
|
+
operationId: list
|
|
188
|
+
x-exosite-example: |
|
|
189
|
+
|
|
190
|
+
-- list Transforms with all of a specified tag
|
|
191
|
+
tag1 = "lkj32lk3lkj3"
|
|
192
|
+
tag2 = "lkj32lk3xyds"
|
|
193
|
+
rule = Transformer.list({all={tag1, tag2}})
|
|
194
|
+
|
|
195
|
+
--------------------------------------------------
|
|
196
|
+
|
|
197
|
+
-- list Transforms with any of a specified tag
|
|
198
|
+
tag1 = "lkj32lk3lkj3"
|
|
199
|
+
tag2 = "lkj32lk3xyds"
|
|
200
|
+
rule = Transformer.list({any={tag1, tag2}})
|
|
201
|
+
|
|
202
|
+
--------------------------------------------------
|
|
203
|
+
|
|
204
|
+
-- list Transforms with any of a specified tag and all of another tag
|
|
205
|
+
tag1 = "lkj32lk3lkj3"
|
|
206
|
+
tag2 = "lkj32lk3xyds"
|
|
207
|
+
rule = Transformer.list({any={tag2, tag3}, all={tag1, tag4}})
|
|
208
|
+
-- That is, (tag1 && tag4 && (tag2 || tag3))
|
|
209
|
+
|
|
210
|
+
parameters:
|
|
211
|
+
- name: tags_all
|
|
212
|
+
in: query
|
|
213
|
+
description: If present, only return Transforms with all of the listed tags
|
|
214
|
+
type: array
|
|
215
|
+
items:
|
|
216
|
+
type: string
|
|
217
|
+
- name: tags_any
|
|
218
|
+
in: query
|
|
219
|
+
description: If present, only return Transforms with any of the listed tags
|
|
220
|
+
type: array
|
|
221
|
+
items:
|
|
222
|
+
type: string
|
|
223
|
+
- name: limit
|
|
224
|
+
in: query
|
|
225
|
+
description: Maximum results to return
|
|
226
|
+
type: integer
|
|
227
|
+
- name: offset
|
|
228
|
+
in: query
|
|
229
|
+
description: Offset into results
|
|
230
|
+
type: integer
|
|
231
|
+
responses:
|
|
232
|
+
"200":
|
|
233
|
+
description: Successfully returned the Transforms for this solution
|
|
234
|
+
schema:
|
|
235
|
+
$ref: "#/definitions/TransformationArray"
|
|
236
|
+
default:
|
|
237
|
+
description: Error
|
|
238
|
+
schema:
|
|
239
|
+
$ref: '#/definitions/ErrorResponse'
|
|
240
|
+
|
|
241
|
+
delete:
|
|
242
|
+
description: Delete multiple Transforms by matching tags
|
|
243
|
+
operationId: deleteByTags
|
|
244
|
+
x-exosite-example: |
|
|
245
|
+
|
|
246
|
+
-- delete Transform with all of a specified tag
|
|
247
|
+
tag1 = "lkj32lk3lkj3"
|
|
248
|
+
tag2 = "lkj32lk3xyds"
|
|
249
|
+
rule = Transformer.deleteByTags({all={tag1, tag2}})
|
|
250
|
+
|
|
251
|
+
--------------------------------------------------
|
|
252
|
+
|
|
253
|
+
-- delete Transform with any of a specified tag
|
|
254
|
+
tag1 = "lkj32lk3lkj3"
|
|
255
|
+
tag2 = "lkj32lk3xyds"
|
|
256
|
+
rule = Transformer.deleteByTags({any={tag1, tag2}})
|
|
257
|
+
|
|
258
|
+
--------------------------------------------------
|
|
259
|
+
|
|
260
|
+
-- delete Transform with any of a specified tag and all of another tag
|
|
261
|
+
tag1 = "lkj32lk3lkj3"
|
|
262
|
+
tag2 = "lkj32lk3xyds"
|
|
263
|
+
rule = Transformer.deleteByTags({any={tag2, tag3}, all={tag1, tag4}})
|
|
264
|
+
-- That is, (tag1 && tag4 && (tag2 || tag3))
|
|
265
|
+
parameters:
|
|
266
|
+
- name: all
|
|
267
|
+
in: query
|
|
268
|
+
description: If present, only delete Transforms with all listed tags
|
|
269
|
+
required: false
|
|
270
|
+
type: array
|
|
271
|
+
items:
|
|
272
|
+
type: string
|
|
273
|
+
- name: any
|
|
274
|
+
in: query
|
|
275
|
+
description: Delete Transforms with any listed tags
|
|
276
|
+
required: true
|
|
277
|
+
type: array
|
|
278
|
+
items:
|
|
279
|
+
type: string
|
|
280
|
+
responses:
|
|
281
|
+
"205":
|
|
282
|
+
description: Deleted
|
|
283
|
+
default:
|
|
284
|
+
description: error
|
|
285
|
+
schema:
|
|
286
|
+
$ref: '#/definitions/ErrorResponse'
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
/{solution_id}/transform/{transform_id}:
|
|
290
|
+
parameters:
|
|
291
|
+
- name: solution_id
|
|
292
|
+
type: string
|
|
293
|
+
in: path
|
|
294
|
+
description: The solution identifier. Set automatically by Murano at service call.
|
|
295
|
+
x-exosite-from: solution_id # Indicate this value is injected from the user solution_id
|
|
296
|
+
x-exosite-restricted: true # Indicate the user cannot provide this parameter
|
|
297
|
+
required: true
|
|
298
|
+
- name: transform_id
|
|
299
|
+
type: string
|
|
300
|
+
in: path
|
|
301
|
+
description: The Transform id
|
|
302
|
+
required: true
|
|
303
|
+
get:
|
|
304
|
+
description: Retrieve a Transform
|
|
305
|
+
operationId: get
|
|
306
|
+
x-exosite-example: >
|
|
307
|
+
-- l
|
|
308
|
+
responses:
|
|
309
|
+
"200":
|
|
310
|
+
description: Successfully returned the Transform
|
|
311
|
+
schema:
|
|
312
|
+
$ref: "#/definitions/Transformation"
|
|
313
|
+
default:
|
|
314
|
+
description: Error
|
|
315
|
+
schema:
|
|
316
|
+
$ref: '#/definitions/ErrorResponse'
|
|
317
|
+
put:
|
|
318
|
+
description: Update a Transform
|
|
319
|
+
operationId: update
|
|
320
|
+
parameters:
|
|
321
|
+
- name: body
|
|
322
|
+
in: body
|
|
323
|
+
description: The updated Transform parameters.
|
|
324
|
+
required: true
|
|
325
|
+
schema:
|
|
326
|
+
$ref: "#/definitions/Transformation"
|
|
327
|
+
responses:
|
|
328
|
+
"205":
|
|
329
|
+
description: Transform updated
|
|
330
|
+
default:
|
|
331
|
+
description: Error
|
|
332
|
+
schema:
|
|
333
|
+
$ref: '#/definitions/ErrorResponse'
|
|
334
|
+
delete:
|
|
335
|
+
description: Delete a Transform
|
|
336
|
+
operationId: delete
|
|
337
|
+
responses:
|
|
338
|
+
"205":
|
|
339
|
+
description: Transform successfully removed.
|
|
340
|
+
default:
|
|
341
|
+
description: Error
|
|
342
|
+
schema:
|
|
343
|
+
$ref: '#/definitions/ErrorResponse'
|
|
344
|
+
|
|
345
|
+
/{solution_id}/process:
|
|
346
|
+
parameters:
|
|
347
|
+
- name: solution_id
|
|
348
|
+
type: string
|
|
349
|
+
in: path
|
|
350
|
+
description: The solution identifier. Set automatically by Murano at service call.
|
|
351
|
+
x-exosite-from: solution_id # Indicate this value is injected from the user solution_id
|
|
352
|
+
x-exosite-restricted: true # Indicate the user cannot provide this parameter
|
|
353
|
+
required: true
|
|
354
|
+
post:
|
|
355
|
+
description: |
|
|
356
|
+
Process an array of SignalData, likely into more of them
|
|
357
|
+
|
|
358
|
+
The `generated` property in the SignalData is used to find subscribers.
|
|
359
|
+
If there are no subscribed Transforms, then no new SignalData will be
|
|
360
|
+
produced.
|
|
361
|
+
|
|
362
|
+
Every found subscribed Transform has its JSONata executed on the
|
|
363
|
+
SignalData. If the result is defined, a new SignalData is generated by
|
|
364
|
+
the Transform’s `publishes` property. If the result is undefined, a new
|
|
365
|
+
SignalData is published from the `__Dropped`.
|
|
366
|
+
|
|
367
|
+
Generally, only debugging interfaces should subscribe to the `__Dropped`.
|
|
368
|
+
operationId: process
|
|
369
|
+
x-exosite-example: >
|
|
370
|
+
--#EVENT Scripts eventloop
|
|
371
|
+
-- Because private-exchange cannot generate events, we have to fake it.
|
|
372
|
+
-- For any internal object, if ttl > max-ttl then it is just dropped.
|
|
373
|
+
-- max-ttl is settable as service config
|
|
374
|
+
|
|
375
|
+
local res = Transformer.process{array=data.metricsArray}
|
|
376
|
+
if #res > 0 then
|
|
377
|
+
Scripts.trigger{event='Scripts.eventloop', mode='async', data={metricsArray=res}}
|
|
378
|
+
Scripts.trigger{event='Scripts.tsdbSubs', mode='async', data={metricsArray=res}}
|
|
379
|
+
-- Add triggers to subscribe other services. (RuleEngine, UserNotifier, ect)
|
|
380
|
+
|
|
381
|
+
end
|
|
382
|
+
parameters:
|
|
383
|
+
- name: body
|
|
384
|
+
in: body
|
|
385
|
+
description: Data to process
|
|
386
|
+
required: true
|
|
387
|
+
schema:
|
|
388
|
+
$ref: "#/definitions/SignalDataObjectArray"
|
|
389
|
+
responses:
|
|
390
|
+
"200":
|
|
391
|
+
description: Data successfully
|
|
392
|
+
schema:
|
|
393
|
+
$ref: "#/definitions/SignalDataArray"
|
|
394
|
+
default:
|
|
395
|
+
description: Error
|
|
396
|
+
schema:
|
|
397
|
+
$ref: '#/definitions/ErrorResponse'
|
|
398
|
+
|
|
399
|
+
################################################################################
|
|
400
|
+
# Definitions #
|
|
401
|
+
################################################################################
|
|
402
|
+
definitions:
|
|
403
|
+
SignalData:
|
|
404
|
+
type: object
|
|
405
|
+
description: A single instance of a piece of data inside a signal.
|
|
406
|
+
properties:
|
|
407
|
+
tags:
|
|
408
|
+
type: object
|
|
409
|
+
description: |
|
|
410
|
+
Tag-Value pairs to help ID the data. Used to tie the data back to an
|
|
411
|
+
Asset or Device or other things.
|
|
412
|
+
additionalProperties:
|
|
413
|
+
type: string
|
|
414
|
+
description: Value for a tag
|
|
415
|
+
minLength: 1
|
|
416
|
+
ts:
|
|
417
|
+
type: integer
|
|
418
|
+
description: Unix timestamp in microseconds of when the data originated
|
|
419
|
+
gts:
|
|
420
|
+
type: integer
|
|
421
|
+
description: Unix timestamp in microseconds of when this SignalData was generated
|
|
422
|
+
value:
|
|
423
|
+
type: [string, integer, object]
|
|
424
|
+
description: The value for this instance of data
|
|
425
|
+
origin:
|
|
426
|
+
type: string
|
|
427
|
+
description: The original Publishing ID
|
|
428
|
+
minLength: 1
|
|
429
|
+
generated:
|
|
430
|
+
type: string
|
|
431
|
+
description: The Publishing ID that created this SignalData.
|
|
432
|
+
minLength: 1
|
|
433
|
+
ttl:
|
|
434
|
+
type: integer
|
|
435
|
+
description: Value used to help prevent data from infinitely cycling
|
|
436
|
+
required:
|
|
437
|
+
- ts
|
|
438
|
+
- value
|
|
439
|
+
- origin
|
|
440
|
+
- generated
|
|
441
|
+
|
|
442
|
+
SignalDataArray:
|
|
443
|
+
type: array
|
|
444
|
+
description: Array of Signal Data
|
|
445
|
+
items:
|
|
446
|
+
$ref: '#/definitions/SignalData'
|
|
447
|
+
|
|
448
|
+
SignalDataObjectArray:
|
|
449
|
+
type: object
|
|
450
|
+
description: Workaround for Murano brokenness.
|
|
451
|
+
properties:
|
|
452
|
+
array:
|
|
453
|
+
$ref: '#/definitions/SignalDataArray'
|
|
454
|
+
|
|
455
|
+
Transformation:
|
|
456
|
+
type: object
|
|
457
|
+
description: Transformation definition
|
|
458
|
+
properties:
|
|
459
|
+
id:
|
|
460
|
+
type: string
|
|
461
|
+
readOnly: true
|
|
462
|
+
description: database assigned UUID for this Transformation
|
|
463
|
+
name:
|
|
464
|
+
type: string
|
|
465
|
+
description: User applied name to help identify
|
|
466
|
+
tags:
|
|
467
|
+
type: array
|
|
468
|
+
description: Array of tags to help identify this transformation
|
|
469
|
+
items:
|
|
470
|
+
type: string
|
|
471
|
+
description: Tag name
|
|
472
|
+
minLength: 1
|
|
473
|
+
subscribe:
|
|
474
|
+
type: array
|
|
475
|
+
description: Array of Publishing IDs to subscribe to
|
|
476
|
+
minItems: 1
|
|
477
|
+
items:
|
|
478
|
+
type: string
|
|
479
|
+
description: A Publishing ID to subscribe to.
|
|
480
|
+
minLength: 1
|
|
481
|
+
publishes:
|
|
482
|
+
type: string
|
|
483
|
+
description: |
|
|
484
|
+
Publishing ID to publish result to. If not defined, the transformations
|
|
485
|
+
uuid prefixed with 'Transform-' will be used.
|
|
486
|
+
minLength: 1
|
|
487
|
+
select:
|
|
488
|
+
type: string
|
|
489
|
+
minLength: 1
|
|
490
|
+
description: |
|
|
491
|
+
JSONata expression to transform the input SignalData into the result
|
|
492
|
+
value on the output SignalData.
|
|
493
|
+
|
|
494
|
+
http://docs.jsonata.org
|
|
495
|
+
|
|
496
|
+
In addition to the built-in functions, Transformer adds.
|
|
497
|
+
- $sub(array)
|
|
498
|
+
Subtract all elements in an array from each other.
|
|
499
|
+
- $deltas(array)
|
|
500
|
+
Create a new array that is the difference between each element of the source array.
|
|
501
|
+
- $enumerate(value, enums)
|
|
502
|
+
Convert a number into a string via lookups.
|
|
503
|
+
The enumeration is an array of arrays. The inner arrays having only two
|
|
504
|
+
elements. The first is a number, the second is a string. The outer
|
|
505
|
+
array is sorted by the numbers.
|
|
506
|
+
|
|
507
|
+
FE: [[10, 'critical low'], [35, 'low'], [55, 'high'], [70, 'critical high']]
|
|
508
|
+
|
|
509
|
+
The input value is matched less than each pair. When that’s true, then
|
|
510
|
+
the string for that pair is returned. If none of the values are
|
|
511
|
+
matched, the string of the last pair is returned.
|
|
512
|
+
|
|
513
|
+
additional_tags:
|
|
514
|
+
type: object
|
|
515
|
+
description: Any additional tags to add to the resulting SignalData
|
|
516
|
+
additionalProperties:
|
|
517
|
+
type: string
|
|
518
|
+
description: Value for a tag
|
|
519
|
+
minLength: 1
|
|
520
|
+
parameters:
|
|
521
|
+
type: object
|
|
522
|
+
description: |
|
|
523
|
+
Extra parameters for the JSONata expression that you want to keep seperated.
|
|
524
|
+
These will be in `$params`.
|
|
525
|
+
saving:
|
|
526
|
+
type: boolean
|
|
527
|
+
description: When true, the previous result is available in `$saved`
|
|
528
|
+
joining:
|
|
529
|
+
type: boolean
|
|
530
|
+
description: |
|
|
531
|
+
When true the previous SignalData for each subscribed topic will be
|
|
532
|
+
available in `$sources`
|
|
533
|
+
required:
|
|
534
|
+
- subscribe
|
|
535
|
+
- select
|
|
536
|
+
additionalProperties: false
|
|
537
|
+
|
|
538
|
+
TransformationArray:
|
|
539
|
+
type: array
|
|
540
|
+
description: Array of Transform definitions
|
|
541
|
+
items:
|
|
542
|
+
$ref: '#/definitions/Transformation'
|
|
543
|
+
|
|
544
|
+
SolutionSettings:
|
|
545
|
+
description: The service settings for a solution.
|
|
546
|
+
type: object
|
|
547
|
+
properties:
|
|
548
|
+
maximumTTL:
|
|
549
|
+
type: number
|
|
550
|
+
description: Maximum number of times a message can propagate through
|
|
551
|
+
minimum: 5
|
|
552
|
+
authToken:
|
|
553
|
+
type: string
|
|
554
|
+
description: This is a placeholder for a potential future feature.
|
|
555
|
+
eventURI:
|
|
556
|
+
type: string
|
|
557
|
+
description: This is a placeholder for a potential future feature.
|
|
558
|
+
required: [maximumTTL]
|
|
559
|
+
|
|
560
|
+
SolutionInfo:
|
|
561
|
+
description: The service settings & information for a solution.
|
|
562
|
+
type: object
|
|
563
|
+
properties:
|
|
564
|
+
maximumTTL:
|
|
565
|
+
type: number
|
|
566
|
+
description: Maximum number of times a message can propagate through
|
|
567
|
+
minimum: 5
|
|
568
|
+
authToken:
|
|
569
|
+
type: string
|
|
570
|
+
description: This is a placeholder for a potential future feature.
|
|
571
|
+
eventURI:
|
|
572
|
+
type: string
|
|
573
|
+
description: This is a placeholder for a potential future feature.
|
|
574
|
+
additionalInfo:
|
|
575
|
+
type: object
|
|
576
|
+
description: Some additional information from the service used for display purpose
|
|
577
|
+
|
|
578
|
+
ErrorResponse:
|
|
579
|
+
type: object
|
|
580
|
+
description: Error response
|
|
581
|
+
properties:
|
|
582
|
+
message:
|
|
583
|
+
type: string
|
|
584
|
+
description: Error message
|
|
585
|
+
name:
|
|
586
|
+
description: Error type
|
|
587
|
+
type: string
|
|
588
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
|
2
|
+
# License: PROPRIETARY. See LICENSE.txt.
|
|
3
|
+
# frozen_string_literal: true
|
|
4
|
+
|
|
5
|
+
# vim:tw=0:ts=2:sw=2:et:ai
|
|
6
|
+
# Unauthorized copying of this file is strictly prohibited.
|
|
7
|
+
|
|
8
|
+
require 'MrMurano/variegated/TruthyFalsey'
|
|
9
|
+
|
|
10
|
+
RSpec.describe 'variegated/TruthyFalsey' do
|
|
11
|
+
it %(knows what's true) do
|
|
12
|
+
tfy = TruthyFalsey.new('TruE')
|
|
13
|
+
expect(tfy.truthy?).to be(true)
|
|
14
|
+
expect(tfy.falsey?).to be(false)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
it %(knows what's false) do
|
|
18
|
+
tfy = TruthyFalsey.new('No')
|
|
19
|
+
expect(tfy.truthy?).to be(false)
|
|
20
|
+
expect(tfy.falsey?).to be(true)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
it %(doesn't know what it doesn't know) do
|
|
24
|
+
tfy = TruthyFalsey.new('FALS')
|
|
25
|
+
expect(tfy.truthy?).to be(false)
|
|
26
|
+
expect(tfy.falsey?).to be(false)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|