diff --git a/examples/actors.dhall b/examples/actors.dhall new file mode 100644 index 0000000..495d552 --- /dev/null +++ b/examples/actors.dhall @@ -0,0 +1,11 @@ +{ Shelly_1234 = { module = "Shelly", params = {=} } +, Bash = + { module = "Process" + , params = { cmd = "./examples/actor.sh", args = "your ad could be here" } + } +, Bash2 = + { module = "Process" + , params = { cmd = "./examples/actor.sh", args = "this is a different one" } + } +, FailBash = { module = "Process", params.cmd = "./examples/fail-actor.sh" } +} diff --git a/examples/bffh.dhall b/examples/bffh.dhall index 308f19f..4a0f025 100644 --- a/examples/bffh.dhall +++ b/examples/bffh.dhall @@ -1,76 +1,20 @@ --- { actor_connections = [] : List { _1 : Text, _2 : Text } -{ actor_connections = - -- Link up machines to actors - [ { _1 = "Testmachine", _2 = "Shelly_1234" } - , { _1 = "Another", _2 = "Bash" } - -- One machine can have as many actors as it wants - , { _1 = "Yetmore", _2 = "Bash2" } - , { _1 = "Yetmore", _2 = "FailBash"} - ] -, actors = - { Shelly_1234 = { module = "Shelly", params = {=} } - , Bash = { module = "Process", params = - { cmd = "./examples/actor.sh" - , args = "your ad could be here" - }} - , Bash2 = { module = "Process", params = - { cmd = "./examples/actor.sh" - , args = "this is a different one" - }} - , FailBash = { module = "Process", params = - { cmd = "./examples/fail-actor.sh" - }} - } - , init_connections = [] : List { _1 : Text, _2 : Text } ---, init_connections = [{ _1 = "Initiator", _2 = "Testmachine" }] -, initiators = {=} - --{ Initiator = { module = "Dummy", params = {=} } } -, listens = +{ actor_connections = + -- Link up machines to actors + [ { _1 = "Testmachine", _2 = "Shelly_1234" } + , { _1 = "Another", _2 = "Bash" } + , { _1 = "Yetmore", _2 = "Bash2" } + , { _1 = "Yetmore", _2 = "FailBash" } + ] +, actors = ./actors.dhall +, init_connections = [] : List { _1 : Text, _2 : Text } +, initiators = ./initiators.dhall +, listens = [ { address = "127.0.0.1", port = Some 59661 } , { address = "::1", port = Some 59661 } , { address = "192.168.0.114", port = Some 59661 } ] -, machines = - { Testmachine = - { description = Some "A test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Testmachine" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Another = - { description = Some "Another test machine" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Another" - , read = "lab.test.read" - , write = "lab.test.write" - }, - Yetmore = - { description = Some "Yet more test machines" - , disclose = "lab.test.read" - , manage = "lab.test.admin" - , name = "Yetmore" - , read = "lab.test.read" - , write = "lab.test.write" - } - } -, mqtt_url = "tcp://localhost:1883" +, machines = ./machines.dhall , db_path = "/tmp/bffh" -, roles = - { testrole = - { permissions = [ "lab.test.*" ] } - , somerole = - { parents = ["testparent"] - , permissions = [ "lab.some.admin" ] - } - , testparent = - { permissions = - [ "lab.some.write" - , "lab.some.read" - , "lab.some.disclose" - ] - } - } +, roles = ./roles.dhall +, mqtt_url = "tcp://localhost:1883" } diff --git a/examples/initiators.dhall b/examples/initiators.dhall new file mode 100644 index 0000000..339130f --- /dev/null +++ b/examples/initiators.dhall @@ -0,0 +1 @@ +{=} diff --git a/examples/machines.dhall b/examples/machines.dhall new file mode 100644 index 0000000..6a145eb --- /dev/null +++ b/examples/machines.dhall @@ -0,0 +1,28 @@ +{ Testmachine = + { description = Some "A test machine" + , name = "Textmachine" + + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + , disclose = "lab.test.read" + } +, Another = + { description = Some "Another test machine" + , name = "Another" + + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + }, + Yetmore = + { description = Some "Yet more test machines" + , name = "Yetmore" + + , disclose = "lab.test.read" + , manage = "lab.test.admin" + , read = "lab.test.read" + , write = "lab.test.write" + } +} diff --git a/examples/roles.dhall b/examples/roles.dhall new file mode 100644 index 0000000..75a4d4b --- /dev/null +++ b/examples/roles.dhall @@ -0,0 +1,14 @@ +{ testrole = + { permissions = [ "lab.test.*" ] } +, somerole = + { parents = ["testparent"] + , permissions = [ "lab.some.admin" ] + } +, testparent = + { permissions = + [ "lab.some.write" + , "lab.some.read" + , "lab.some.disclose" + ] + } +} diff --git a/examples/types/Machine.dhall b/examples/types/Machine.dhall new file mode 100644 index 0000000..c48c85f --- /dev/null +++ b/examples/types/Machine.dhall @@ -0,0 +1,15 @@ +let Map = https://prelude.dhall-lang.org/v20.2.0/Map/Type + sha256:210c7a9eba71efbb0f7a66b3dcf8b9d3976ffc2bc0e907aadfb6aa29c333e8ed + +let Machine = + { Type = + { description : Optional Text + , manage : Text + , write : Text + , read : Text + , disclose : Text + } + , default = { description = None } + } + +in Machine