Warning |
---|
|
This library is not a part of version 1.0 of the pico-engine |
...
Code Block |
---|
children = engine:listChildren(pico_id)
/*
[
"child 0 pico_id",
"child 1 pico_id",
...
]
*/ |
listPolicies
List all the engine policies.
Code Block |
---|
policies = engine:listPolicies()
/*
[
{id: "1234", name: "policy 1", event: {allow: [...]} query: ...},
{id: "4321", name: "policy 2", event: {allow: [...]} query: ...},
{id: "5555", name: "policy 3", event: {allow: [...]} query: ...},
]
*/ |
listChannels
List the pico's channels.
...
Code Block |
---|
engine:removePico(id) |
newPolicy
Creates a new policy.
Parameter | Datatype | Required |
---|
<policy> | <map> | YES |
Code Block |
---|
engine:newPolicy({
name: "only allow foo/bar events",
event: {
allow: [
{domain: "foo", type: "bar"}
]
}
}) setting(resp)
/*
{
id: "1234",
name: "only allow foo/bar events",
event: {
allow: [{domain: "foo", type: "bar"}],
deny: [],
},
query: {allow: [], deny: []}
}
*/ |
For more description on how these policies work see: https://github.com/Picolab/pico-engine/pull/350#issue-160657235
removePolicy
Removes a policy. It will error if any channels are still using it.
Parameter | Datatype | Required |
---|
<policy_id> | <string> | YES |
Code Block |
---|
engine:removePolicy("1234") |
newChannel
Creates a new channel for a pico.
Parameter | Datatype | Required | Default |
---|
<pico_id> | <string> | NO | the running pico_id |
<name> | <string> | YES |
|
<type> | <string> | YES |
|
<policy_id> | <string> | YES |
|
Code Block |
---|
engine:newChannel(name = "channel_name", type = "channel_type", policy_id = "1234") setting(resp)
/*
{
"id" : <new_eci>,
"pico_id": <pico_id>,
"name": "channel_name",
"type": "channel_type",
"policy_id": "1234"
}
*/ |
Note: "id" in the resp body is the given pico's new channel eci, not the original id passed into the function.
...