MuranoCLI 3.2.1.pre.beta.6 → 3.2.1.pre.beta.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +10 -0
- data/MuranoCLI.gemspec +37 -6
- data/Rakefile +38 -11
- data/lib/MrMurano/commands/business.rb +0 -4
- data/lib/MrMurano/version.rb +1 -1
- metadata +2 -251
- data/dockers/Dockerfile.2.2.9 +0 -40
- data/dockers/Dockerfile.2.3.6 +0 -40
- data/dockers/Dockerfile.2.4.3 +0 -40
- data/dockers/Dockerfile.2.5.0 +0 -40
- data/dockers/Dockerfile.GemRelease +0 -49
- data/dockers/Dockerfile.m4 +0 -122
- data/dockers/README.rst +0 -362
- data/dockers/RELEASE.rst +0 -135
- data/dockers/docker-test.sh +0 -163
- data/dockers/gem-release.sh +0 -4
- data/docs/basic_example.rst +0 -436
- data/docs/ci/.trustme.plugin +0 -140
- data/docs/ci/.trustme.sh +0 -516
- data/docs/ci/.trustme.vim +0 -55
- data/docs/completions/murano_completion-bash +0 -4484
- data/docs/demo.md +0 -109
- data/docs/develop.rst +0 -392
- data/docs/release.rst +0 -295
- data/spec/Account-Passwords_spec.rb +0 -245
- data/spec/Account_spec.rb +0 -256
- data/spec/Business_spec.rb +0 -307
- data/spec/ConfigFile_spec.rb +0 -55
- data/spec/ConfigMigrate_spec.rb +0 -108
- data/spec/Config_spec.rb +0 -440
- data/spec/Content_spec.rb +0 -422
- data/spec/GatewayBase_spec.rb +0 -65
- data/spec/GatewayDevice_spec.rb +0 -403
- data/spec/GatewayResource_spec.rb +0 -283
- data/spec/GatewaySettings_spec.rb +0 -130
- data/spec/HttpAuthed_spec.rb +0 -87
- data/spec/Http_spec.rb +0 -220
- data/spec/MakePretties_spec.rb +0 -127
- data/spec/Mock_spec.rb +0 -62
- data/spec/ProjectFile_spec.rb +0 -381
- data/spec/Setting_spec.rb +0 -120
- data/spec/Solution-ServiceConfig_spec.rb +0 -272
- data/spec/Solution-ServiceEventHandler_spec.rb +0 -442
- data/spec/Solution-ServiceModules_spec.rb +0 -562
- data/spec/Solution-UsersRoles_spec.rb +0 -269
- data/spec/Solution_spec.rb +0 -140
- data/spec/SyncRoot_spec.rb +0 -111
- data/spec/SyncUpDown_spec.rb +0 -868
- data/spec/Verbosing_spec.rb +0 -332
- data/spec/Webservice-Cors_spec.rb +0 -225
- data/spec/Webservice-Endpoint_spec.rb +0 -650
- data/spec/Webservice-File_spec.rb +0 -282
- data/spec/Webservice-Setting_spec.rb +0 -105
- data/spec/_workspace.rb +0 -43
- data/spec/cmd_business_spec.rb +0 -64
- data/spec/cmd_common.rb +0 -507
- data/spec/cmd_config_spec.rb +0 -73
- data/spec/cmd_content_spec.rb +0 -109
- data/spec/cmd_cors_spec.rb +0 -54
- data/spec/cmd_device_spec.rb +0 -130
- data/spec/cmd_domain_spec.rb +0 -62
- data/spec/cmd_element_spec.rb +0 -401
- data/spec/cmd_exchange_spec.rb +0 -114
- data/spec/cmd_help_spec.rb +0 -72
- data/spec/cmd_init_spec.rb +0 -475
- data/spec/cmd_keystore_spec.rb +0 -97
- data/spec/cmd_link_spec.rb +0 -105
- data/spec/cmd_logs_spec.rb +0 -162
- data/spec/cmd_password_spec.rb +0 -64
- data/spec/cmd_setting_application_spec.rb +0 -300
- data/spec/cmd_setting_product_spec.rb +0 -246
- data/spec/cmd_status_spec.rb +0 -300
- data/spec/cmd_syncdown_application_spec.rb +0 -128
- data/spec/cmd_syncdown_both_spec.rb +0 -178
- data/spec/cmd_syncdown_unit_spec.rb +0 -861
- data/spec/cmd_syncup_spec.rb +0 -148
- data/spec/cmd_token_spec.rb +0 -53
- data/spec/cmd_usage_spec.rb +0 -79
- data/spec/dry_run_formatter.rb +0 -28
- data/spec/fixtures/.mrmuranorc +0 -9
- data/spec/fixtures/ProjectFiles/invalid.yaml +0 -9
- data/spec/fixtures/ProjectFiles/only_meta.yaml +0 -24
- data/spec/fixtures/ProjectFiles/with_routes.yaml +0 -27
- data/spec/fixtures/SolutionFiles/0.2.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.2.0_invalid.json +0 -18
- data/spec/fixtures/SolutionFiles/0.2.json +0 -21
- data/spec/fixtures/SolutionFiles/0.3.0.json +0 -20
- data/spec/fixtures/SolutionFiles/0.3.0_invalid.json +0 -19
- data/spec/fixtures/SolutionFiles/0.3.json +0 -20
- data/spec/fixtures/SolutionFiles/basic.json +0 -20
- data/spec/fixtures/SolutionFiles/secret.json +0 -6
- data/spec/fixtures/configfile +0 -9
- data/spec/fixtures/dumped_config +0 -57
- data/spec/fixtures/exchange_element/element-show.json +0 -1
- data/spec/fixtures/exchange_element/swagger-mur-6407__10k.yaml +0 -282
- data/spec/fixtures/exchange_element/swagger-mur-6407__20k.yaml +0 -588
- data/spec/fixtures/gateway_resource_files/resources.notyaml +0 -12
- data/spec/fixtures/gateway_resource_files/resources.yaml +0 -13
- data/spec/fixtures/gateway_resource_files/resources_invalid.yaml +0 -13
- data/spec/fixtures/mrmuranorc_deleted_bob +0 -6
- data/spec/fixtures/mrmuranorc_tool_bob +0 -3
- data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +0 -116
- data/spec/fixtures/product_spec_files/example.murano.spec.yaml +0 -14
- data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +0 -21
- data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +0 -16
- data/spec/fixtures/product_spec_files/lightbulb-no-state.yaml +0 -11
- data/spec/fixtures/product_spec_files/lightbulb.yaml +0 -21
- data/spec/fixtures/roles-three.yaml +0 -11
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 0.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value 1.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value No.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value Yes.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value bob.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value false.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value off.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value on.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a bool value true.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob with STDIN.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) a json array blob.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting Writes (using Webservice.cors) appends an array.webmock +0 -98
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors to a file.webmock +0 -72
- data/spec/fixtures/snapshots/murano application setting reads Webservice.cors.webmock +0 -72
- data/spec/fixtures/snapshots/murano business list as json.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list as table.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list fewer fields.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list only ids.webmock +0 -27
- data/spec/fixtures/snapshots/murano business list output to file.webmock +0 -27
- data/spec/fixtures/snapshots/murano business without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Needs a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Reads a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Removes a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a key.webmock +0 -9
- data/spec/fixtures/snapshots/murano config Sets a user key.webmock +0 -9
- data/spec/fixtures/snapshots/murano content life cycle.webmock +0 -144
- data/spec/fixtures/snapshots/murano cors sets CORS.webmock +0 -78
- data/spec/fixtures/snapshots/murano cors show CORS.webmock +0 -64
- data/spec/fixtures/snapshots/murano device activates.webmock +0 -86
- data/spec/fixtures/snapshots/murano device enables a batch.webmock +0 -76
- data/spec/fixtures/snapshots/murano device enables and lists.webmock +0 -78
- data/spec/fixtures/snapshots/murano device writes and reads.webmock +0 -136
- data/spec/fixtures/snapshots/murano domain show domain.webmock +0 -101
- data/spec/fixtures/snapshots/murano element edit unknown as unknown element.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano element show as csv.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as default-table.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as json.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table truncate.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as table wrap.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show as yaml.webmock +0 -43
- data/spec/fixtures/snapshots/murano element show using ambiguous name.webmock +0 -43
- data/spec/fixtures/snapshots/murano element without project usage.webmock +0 -9
- data/spec/fixtures/snapshots/murano exchange with project list as json.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list as table.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list fewer fields.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list only ids.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list output to file.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange with project list purchase is already added ID.webmock +0 -83
- data/spec/fixtures/snapshots/murano exchange with project list purchase is ambiguous name.webmock +0 -59
- data/spec/fixtures/snapshots/murano exchange without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander as --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using commander no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell no args.webmock +0 -9
- data/spec/fixtures/snapshots/murano help using subshell with --help.webmock +0 -9
- data/spec/fixtures/snapshots/murano init Won't init in HOME (gracefully).webmock +0 -9
- data/spec/fixtures/snapshots/murano init in empty directory with existing project.webmock +0 -201
- data/spec/fixtures/snapshots/murano init in empty directory without existing project.webmock +0 -193
- data/spec/fixtures/snapshots/murano init in existing project directory with ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.2.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory with SolutionFile 0.3.0.webmock +0 -213
- data/spec/fixtures/snapshots/murano init in existing project directory without ProjectFile.webmock +0 -213
- data/spec/fixtures/snapshots/murano keystore can call other commands.webmock +0 -108
- data/spec/fixtures/snapshots/murano keystore clearAll.webmock +0 -124
- data/spec/fixtures/snapshots/murano keystore deletes.webmock +0 -112
- data/spec/fixtures/snapshots/murano keystore gets.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore infos.webmock +0 -96
- data/spec/fixtures/snapshots/murano keystore lists.webmock +0 -96
- data/spec/fixtures/snapshots/murano link with project links and lists.webmock +0 -149
- data/spec/fixtures/snapshots/murano link with project unlinks.webmock +0 -165
- data/spec/fixtures/snapshots/murano link without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using commander will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano link without project subshell vs inline using subshell will not list.webmock +0 -27
- data/spec/fixtures/snapshots/murano logs when project is setup tail log.webmock +0 -9
- data/spec/fixtures/snapshots/murano password Lists when no file.webmock +0 -9
- data/spec/fixtures/snapshots/murano password deletes a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano password sets a password.webmock +0 -9
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a forced string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value fiftyHalf.webmock +0 -64
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value float 12.67.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value integer 12.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a number value on STDIN.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) a string value.webmock +0 -90
- data/spec/fixtures/snapshots/murano product setting Writes (using Device2.identity_format) merges into a dictionary.webmock +0 -90
- data/spec/fixtures/snapshots/murano single sync without ProjectFile syncdown.webmock +0 -322
- data/spec/fixtures/snapshots/murano status with ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.2.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status with Solutionfile 0.3.0 status.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches file path.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile matches route.webmock +0 -153
- data/spec/fixtures/snapshots/murano status without ProjectFile status.webmock +0 -153
- data/spec/fixtures/snapshots/murano syncdown stubbed without ProjectFile syncdown.webmock +0 -151
- data/spec/fixtures/snapshots/murano syncdown without ProjectFile syncdown.webmock +0 -479
- data/spec/fixtures/snapshots/murano syncup without ProjectFile syncup.webmock +0 -357
- data/spec/fixtures/snapshots/murano token with project list as table.webmock +0 -9
- data/spec/fixtures/snapshots/murano token without project help.webmock +0 -9
- data/spec/fixtures/snapshots/murano usage show usage.webmock +0 -93
- data/spec/fixtures/syncable_conflict/services/devdata.lua +0 -18
- data/spec/fixtures/syncable_conflict/services/timers.lua +0 -4
- data/spec/fixtures/syncable_content/assets/icon.png +0 -0
- data/spec/fixtures/syncable_content/assets/index.html +0 -0
- data/spec/fixtures/syncable_content/assets/js/script.js +0 -0
- data/spec/fixtures/syncable_content/modules/table_util.lua +0 -58
- data/spec/fixtures/syncable_content/routes/manyRoutes.lua +0 -11
- data/spec/fixtures/syncable_content/routes/singleRoute.lua +0 -5
- data/spec/fixtures/websocket/README.rst +0 -110
- data/spec/fixtures/websocket/logs_blather.rb +0 -27
- data/spec/fixtures/websocket/logs_faker.rb +0 -153
- data/spec/fixtures/websocket/simple_connection.rb +0 -45
- data/spec/fixtures/websocket/simple_options.rb +0 -77
- data/spec/fixtures/websocket/simple_server.rb +0 -69
- data/spec/fixtures/websocket/wss-echo.rb +0 -48
- data/spec/fixtures/websocket/wss-fake-logs.rb +0 -20
- data/spec/spec_helper.rb +0 -131
- data/spec/variegated_TruthyFalsey_spec.rb +0 -29
- data/spec/webmock_snapshot.rb +0 -296
@@ -1,18 +0,0 @@
|
|
1
|
-
--#EVENT device2 data_in
|
2
|
-
-- luacheck: globals data (magic variable from Murano)
|
3
|
-
|
4
|
-
-- Get the timestamp for this data if a record action.
|
5
|
-
-- Otherwise use default (now)
|
6
|
-
local stamped = nil
|
7
|
-
if data.api == "record" then
|
8
|
-
stamped = tostring(data.value[1]) .. 's'
|
9
|
-
end
|
10
|
-
|
11
|
-
-- Save it to timeseries database.
|
12
|
-
Tsdb.write{
|
13
|
-
tags = {sn=data.device_sn},
|
14
|
-
metrics = {[data.alias] = tonumber(data.value[2])},
|
15
|
-
ts = stamped
|
16
|
-
}
|
17
|
-
|
18
|
-
-- vim: set et ai sw=2 ts=2 :
|
Binary file
|
File without changes
|
File without changes
|
@@ -1,58 +0,0 @@
|
|
1
|
-
-- luacheck: ignore 122/table (This is all about modifying the table)
|
2
|
-
|
3
|
-
---
|
4
|
-
-- Dump a table as a string; recursively
|
5
|
-
-- \returns string
|
6
|
-
function table.dump(o)
|
7
|
-
if type(o) == 'table' then
|
8
|
-
local s = '{ '
|
9
|
-
for k,v in pairs(o) do
|
10
|
-
if type(k) ~= 'number' then k = '"'..k..'"' end
|
11
|
-
s = s .. '['..k..'] = ' .. table.dump(v) .. ','
|
12
|
-
end
|
13
|
-
return s .. '} '
|
14
|
-
else
|
15
|
-
return tostring(o)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
---
|
20
|
-
-- Does table have item?
|
21
|
-
function table.contains(table, element)
|
22
|
-
for _, value in pairs(table) do
|
23
|
-
if value == element then
|
24
|
-
return true
|
25
|
-
end
|
26
|
-
end
|
27
|
-
return false
|
28
|
-
end
|
29
|
-
|
30
|
-
|
31
|
-
---
|
32
|
-
-- Find a table in a list of tables.
|
33
|
-
-- \returns idx, table found; nil if not found
|
34
|
-
function table.find(tbl, key, value)
|
35
|
-
if type(key) == 'nil' then return nil, nil end
|
36
|
-
for i,v in ipairs(tbl) do
|
37
|
-
if type(v) == 'table' then
|
38
|
-
if v[key] == value then
|
39
|
-
return i, v
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
return nil, nil
|
44
|
-
end
|
45
|
-
|
46
|
-
---
|
47
|
-
-- Replace a table
|
48
|
-
function table.replacingAdd(tbl, key, newitem)
|
49
|
-
local idx, _ = table.find(tbl, key, newitem[key])
|
50
|
-
if idx == nil then
|
51
|
-
table.insert(tbl, newitem)
|
52
|
-
else
|
53
|
-
table.remove(tbl, idx)
|
54
|
-
table.insert(tbl, idx, newitem)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
-- vim: set ai sw=2 ts=2 :
|
@@ -1,11 +0,0 @@
|
|
1
|
-
--#ENDPOINT post /api/fire
|
2
|
-
-- luacheck: globals request response (magic variables from Murano)
|
3
|
-
response.code = 403
|
4
|
-
|
5
|
-
--#ENDPOINT put /api/fire/{code}
|
6
|
-
response.code = 500
|
7
|
-
|
8
|
-
--#ENDPOINT delete /api/fire/{code}
|
9
|
-
return 'ok'
|
10
|
-
|
11
|
-
-- vim: set ai sw=2 ts=2 :
|
@@ -1,110 +0,0 @@
|
|
1
|
-
############################
|
2
|
-
Murano CLI WebSocket Servers
|
3
|
-
############################
|
4
|
-
|
5
|
-
========
|
6
|
-
Overview
|
7
|
-
========
|
8
|
-
|
9
|
-
There are 2 WebSocket servers under ``spec/fixtures/websocket/``:
|
10
|
-
|
11
|
-
- ``wss-fake-logs.rb``: Run this for developing. It'll spit out a fake log record every second to any client that connect.
|
12
|
-
|
13
|
-
- ``wss-echo.rb``: The spec tests use this to test the new logs command code. Whatever the server receives on stdin it just echos to any client that's connected.
|
14
|
-
|
15
|
-
=====
|
16
|
-
Usage
|
17
|
-
=====
|
18
|
-
|
19
|
-
From one terminal, start the fake logs server:
|
20
|
-
|
21
|
-
.. code-block:: bash
|
22
|
-
|
23
|
-
cd /path/to/exosite-murcli/spec/fixtures/websocket
|
24
|
-
|
25
|
-
./wss-fake-logs.rb
|
26
|
-
|
27
|
-
From another terminal, you can use any WebSocket client.
|
28
|
-
|
29
|
-
\1. Using Murano CLI.:
|
30
|
-
|
31
|
-
.. code-block:: bash
|
32
|
-
|
33
|
-
murano logs -f -c net.host=127.0.0.1:4180 -c net.protocol=http --tracking --trace
|
34
|
-
|
35
|
-
\2. Using ``esphen/wsta``:
|
36
|
-
|
37
|
-
.. code-block:: bash
|
38
|
-
|
39
|
-
# Locally
|
40
|
-
wsta --ping 10 "ws://127.0.0.1:4180/path/does/not/matter?limit=1000"
|
41
|
-
|
42
|
-
# Against BizAPI.
|
43
|
-
wsta --ping 10 "wss://bizapi-dev.hosted.exosite.io/api/v1/solution/m1ti0dv29pb340000/logs?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&limit=1000"
|
44
|
-
|
45
|
-
\3. Using ``hashrocket/ws``:
|
46
|
-
|
47
|
-
.. code-block:: bash
|
48
|
-
|
49
|
-
ws "wss://bizapi-dev.hosted.exosite.io/api/v1/solution/m1ti0dv29pb340000/logs?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&limit=1000"
|
50
|
-
|
51
|
-
-----------------
|
52
|
-
Token Shenanigans
|
53
|
-
-----------------
|
54
|
-
|
55
|
-
To run ``murano logs`` locally, against 127.0.0.1, you'll probably
|
56
|
-
need to disable the token mechanism.
|
57
|
-
|
58
|
-
Add this to ``lib/MrMurano/Account.rb``::
|
59
|
-
|
60
|
-
def token_fetch_biz
|
61
|
-
@token_biz = 'XXX'
|
62
|
-
return
|
63
|
-
|
64
|
-
=========================
|
65
|
-
Non-Murano CLI WS Clients
|
66
|
-
=========================
|
67
|
-
|
68
|
-
---------------
|
69
|
-
``esphen/wsta``
|
70
|
-
---------------
|
71
|
-
|
72
|
-
- ``esphen/wsta`` is a WebSocket CLI client written in Rust.
|
73
|
-
|
74
|
-
As of late 2017, it's 1 year old and appears to be the most sophisticated client.
|
75
|
-
|
76
|
-
https://github.com/esphen/wsta
|
77
|
-
|
78
|
-
To install:
|
79
|
-
|
80
|
-
.. code-block:: bash
|
81
|
-
|
82
|
-
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/home:/esphen/xUbuntu_16.04/ /' > /etc/apt/sources.list.d/wsta.list"
|
83
|
-
wget -nv https://download.opensuse.org/repositories/home:esphen/xUbuntu_16.04/Release.key -O Release.key
|
84
|
-
sudo apt-key add - < Release.key
|
85
|
-
rm Release.key
|
86
|
-
sudo apt-get update
|
87
|
-
sudo apt-get install wsta
|
88
|
-
|
89
|
-
-----------------
|
90
|
-
``hashrocket/ws``
|
91
|
-
-----------------
|
92
|
-
|
93
|
-
- ``hashrocket/ws`` is WebSocket CLI client written in Go.
|
94
|
-
|
95
|
-
As of late 2017, it's 1 year old.
|
96
|
-
|
97
|
-
https://github.com/hashrocket/ws
|
98
|
-
|
99
|
-
To install:
|
100
|
-
|
101
|
-
.. code-block:: bash
|
102
|
-
|
103
|
-
go get -u github.com/hashrocket/ws
|
104
|
-
|
105
|
-
---------------------------------------
|
106
|
-
Browser-based "Simple WebSocket Client"
|
107
|
-
---------------------------------------
|
108
|
-
|
109
|
-
https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en
|
110
|
-
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
5
|
-
# Unauthorized copying of this file is strictly prohibited.
|
6
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
7
|
-
|
8
|
-
require 'json'
|
9
|
-
|
10
|
-
require 'eventmachine'
|
11
|
-
|
12
|
-
require_relative 'simple_connection'
|
13
|
-
require_relative 'logs_faker'
|
14
|
-
|
15
|
-
class LogsBlatherConnection < SimpleWebSocket::SimpleConnection
|
16
|
-
include LogsFakerModule
|
17
|
-
def conn_on_open(event)
|
18
|
-
super(event)
|
19
|
-
_timer = EventMachine::PeriodicTimer.new(1) do
|
20
|
-
resp = JSON.generate(random_example)
|
21
|
-
@driver.text(resp)
|
22
|
-
# If we needed to stop the timer:
|
23
|
-
# _timer.cancel
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
@@ -1,153 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
5
|
-
# Unauthorized copying of this file is strictly prohibited.
|
6
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
7
|
-
|
8
|
-
module LogsFakerModule
|
9
|
-
def initialize
|
10
|
-
super
|
11
|
-
@examples = [
|
12
|
-
example_type_script,
|
13
|
-
example_type_call,
|
14
|
-
example_type_event,
|
15
|
-
example_type_config_device_v1,
|
16
|
-
example_type_config_null,
|
17
|
-
example_type_config_newservice,
|
18
|
-
example_severity_build(0),
|
19
|
-
example_severity_build(1),
|
20
|
-
example_severity_build(2),
|
21
|
-
example_severity_build(3),
|
22
|
-
example_severity_build(4),
|
23
|
-
example_severity_build(5),
|
24
|
-
example_severity_build(6),
|
25
|
-
example_severity_build(7),
|
26
|
-
example_severity_build(8),
|
27
|
-
]
|
28
|
-
end
|
29
|
-
|
30
|
-
def random_example
|
31
|
-
@examples[Random.rand(@examples.length)]
|
32
|
-
end
|
33
|
-
|
34
|
-
# The examples below are from the Service & Script Debug Log RFC:
|
35
|
-
# https://docs.google.com/document/d/1mlLSLXJj0lMDqpblzEwfAew_G8C3e5HCtAgjyyrGaKc/edit#heading=h.nrw8qx9k0clk
|
36
|
-
|
37
|
-
def example_type_script
|
38
|
-
{
|
39
|
-
type: 'script',
|
40
|
-
timestamp: 1_474_489_282_537,
|
41
|
-
severity: 6, # info
|
42
|
-
message: 'abc from lua',
|
43
|
-
tracking_id: '<UUID>',
|
44
|
-
service: 'webservice',
|
45
|
-
event: 'request',
|
46
|
-
data: { # Type specific
|
47
|
-
endpoint: 'GET:/index',
|
48
|
-
location: 'GET:/index:123',
|
49
|
-
elapsed: 10,
|
50
|
-
},
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
def example_type_call
|
55
|
-
{
|
56
|
-
type: 'call',
|
57
|
-
timestamp: 1_474_489_282_537,
|
58
|
-
severity: 3, # error
|
59
|
-
message: 'Service Call failed with error: timeout',
|
60
|
-
tracking_id: '<UUID>',
|
61
|
-
service: 'keystore',
|
62
|
-
event: 'get', # The operation id
|
63
|
-
data: { # Type specific
|
64
|
-
request: '{..}',
|
65
|
-
response: '{..}',
|
66
|
-
code: 504,
|
67
|
-
},
|
68
|
-
}
|
69
|
-
end
|
70
|
-
|
71
|
-
def example_type_event
|
72
|
-
{
|
73
|
-
type: 'event',
|
74
|
-
timestamp: 1_474_489_282_537,
|
75
|
-
severity: 3, # error
|
76
|
-
message: 'Event trigger failed with: event handler not found',
|
77
|
-
tracking_id: '<UUID>',
|
78
|
-
service: 'timer',
|
79
|
-
event: 'timer',
|
80
|
-
data: { # Type specific
|
81
|
-
request: '<incoming payload>',
|
82
|
-
response: '<lua response payload>',
|
83
|
-
code: 404,
|
84
|
-
},
|
85
|
-
}
|
86
|
-
end
|
87
|
-
|
88
|
-
def example_type_config_device_v1
|
89
|
-
{
|
90
|
-
type: 'config',
|
91
|
-
timestamp: 1_474_489_282_537,
|
92
|
-
severity: 4, # warning
|
93
|
-
message: "The service 'Device' used by the solution has been deprecated. Refer to the Service documentation for more information.",
|
94
|
-
tracking_id: '<UUID>',
|
95
|
-
service: 'deviceV1',
|
96
|
-
event: nil,
|
97
|
-
data: {},
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
def example_type_config_null
|
102
|
-
{
|
103
|
-
type: 'config',
|
104
|
-
timestamp: 1_474_489_282_537,
|
105
|
-
severity: 5, # notice
|
106
|
-
message: 'The module ‘util’ has been updated',
|
107
|
-
tracking_id: '<UUID>',
|
108
|
-
service: nil, # if eventhandler here fill the service alias
|
109
|
-
event: nil, # if eventhandler script here fill the event
|
110
|
-
data: {
|
111
|
-
module: 'util',
|
112
|
-
code: 200,
|
113
|
-
},
|
114
|
-
}
|
115
|
-
end
|
116
|
-
|
117
|
-
def example_type_config_newservice
|
118
|
-
{
|
119
|
-
type: 'config',
|
120
|
-
timestamp: 1_474_489_282_537,
|
121
|
-
severity: 5, # notice
|
122
|
-
message: 'The service ‘newservice’ has been added to the solution',
|
123
|
-
tracking_id: '<UUID>',
|
124
|
-
service: 'newservice',
|
125
|
-
event: nil,
|
126
|
-
data: {
|
127
|
-
parameters: {},
|
128
|
-
code: 200,
|
129
|
-
},
|
130
|
-
}
|
131
|
-
end
|
132
|
-
|
133
|
-
def example_severity_build(severity)
|
134
|
-
{
|
135
|
-
type: 'config',
|
136
|
-
timestamp: 1_474_489_282_537,
|
137
|
-
severity: severity,
|
138
|
-
message: 'The service ‘newservice’ has been added to the solution',
|
139
|
-
tracking_id: '<UUID>',
|
140
|
-
service: 'websocket',
|
141
|
-
event: '/api/v1/foo/long/event/name',
|
142
|
-
data: {
|
143
|
-
parameters: {},
|
144
|
-
code: 200,
|
145
|
-
},
|
146
|
-
}
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
class LogsFaker
|
151
|
-
include LogsFakerModule
|
152
|
-
end
|
153
|
-
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Copyright © 2016-2017 Exosite LLC. All Rights Reserved
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
# License: PROPRIETARY. See LICENSE.txt.
|
5
|
-
# Unauthorized copying of this file is strictly prohibited.
|
6
|
-
# vim:tw=0:ts=2:sw=2:et:ai
|
7
|
-
|
8
|
-
require 'eventmachine'
|
9
|
-
require 'websocket/driver'
|
10
|
-
|
11
|
-
module SimpleWebSocket
|
12
|
-
class SimpleConnection < EventMachine::Connection
|
13
|
-
def initialize
|
14
|
-
@driver = WebSocket::Driver.server(self)
|
15
|
-
|
16
|
-
@driver.on :connect, &method(:conn_on_open)
|
17
|
-
|
18
|
-
@driver.on :message, (lambda do |e|
|
19
|
-
@driver.text(e.data)
|
20
|
-
end)
|
21
|
-
|
22
|
-
@driver.on :close, (lambda do |_e|
|
23
|
-
close_connection_after_writing
|
24
|
-
end)
|
25
|
-
end
|
26
|
-
|
27
|
-
def receive_data(data)
|
28
|
-
@driver.parse(data)
|
29
|
-
end
|
30
|
-
|
31
|
-
def write(data)
|
32
|
-
send_data(data)
|
33
|
-
end
|
34
|
-
|
35
|
-
def conn_on_open(event)
|
36
|
-
if WebSocket::Driver.websocket?(@driver.env)
|
37
|
-
@driver.start
|
38
|
-
else
|
39
|
-
# Other HTTP requests.
|
40
|
-
warn "WARNING: unhandled request: #{event}"
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|