summaryrefslogtreecommitdiffstats
path: root/signal-composer-binding/signal-composer-apidef.h
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2017-12-18 16:40:50 +0100
committerRomain Forlot <romain.forlot@iot.bzh>2017-12-18 17:40:02 +0100
commit15efef0b066a1416778a304ed41cdf3ecb3209ef (patch)
tree507c2eb9ff510d20e0ea3fa7d6b5b2e176364232 /signal-composer-binding/signal-composer-apidef.h
parent1b3411359d6a0e53f12811436a5410104816da34 (diff)
More security to add new signals/source at runtime
Also renamed loadConf to addObjects to avoid confusion with loadConf at init time. Improve file research if fullpath not procided by searching in the CONTROL_CONFIG_PATH. Change-Id: I8e541ff7437f0378bcdc7215ff9f391dcce6db9f Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'signal-composer-binding/signal-composer-apidef.h')
-rw-r--r--signal-composer-binding/signal-composer-apidef.h55
1 files changed, 32 insertions, 23 deletions
diff --git a/signal-composer-binding/signal-composer-apidef.h b/signal-composer-binding/signal-composer-apidef.h
index abd0539..3f10fa5 100644
--- a/signal-composer-binding/signal-composer-apidef.h
+++ b/signal-composer-binding/signal-composer-apidef.h
@@ -21,31 +21,40 @@ static const char _afb_description_v2_signal_composer[] =
"ct\"}}},\"afb-event-v2\":{\"type\":\"object\",\"required\":[\"jtype\",\""
"event\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\":\"afb-"
"event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"object\"}}"
- "}},\"x-permissions\":{},\"responses\":{\"200\":{\"description\":\"A comp"
- "lex object array response\",\"content\":{\"application/json\":{\"schema\""
- ":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\":{\"/subscr"
- "ibe\":{\"description\":\"Subscribe to a signal object\",\"parameters\":["
- "{\"in\":\"query\",\"name\":\"event\",\"required\":false,\"schema\":{\"ty"
- "pe\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/components/respo"
- "nses/200\"}}},\"/unsubscribe\":{\"description\":\"Unsubscribe previously"
- " suscribed signal objects.\",\"parameters\":[{\"in\":\"query\",\"name\":"
- "\"event\",\"required\":false,\"schema\":{\"type\":\"string\"}}],\"respon"
- "ses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/get\":{\"d"
- "escription\":\"Get informations about a resource or element\",\"response"
- "s\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/list\":{\"de"
- "scription\":\"List all signals already configured\",\"responses\":{\"200"
- "\":{\"$ref\":\"#/components/responses/200\"}}},\"/loadConf\":{\"descript"
- "ion\":\"Load config file in directory passed as argument searching for p"
- "attern 'sig' in filename\",\"parameters\":[{\"in\":\"query\",\"name\":\""
- "path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"responses\""
- ":{\"200\":{\"$ref\":\"#/components/responses/200\"}}}}}"
+ "}},\"x-permissions\":{\"addObjects\":{\"permission\":\"urn:AGL:permissio"
+ "n::platform:composer:addObjects\"}},\"responses\":{\"200\":{\"descriptio"
+ "n\":\"A complex object array response\",\"content\":{\"application/json\""
+ ":{\"schema\":{\"$ref\":\"#/components/schemas/afb-reply\"}}}}}},\"paths\""
+ ":{\"/subscribe\":{\"description\":\"Subscribe to a signal object\",\"par"
+ "ameters\":[{\"in\":\"query\",\"name\":\"event\",\"required\":false,\"sch"
+ "ema\":{\"type\":\"string\"}}],\"responses\":{\"200\":{\"$ref\":\"#/compo"
+ "nents/responses/200\"}}},\"/unsubscribe\":{\"description\":\"Unsubscribe"
+ " previously suscribed signal objects.\",\"parameters\":[{\"in\":\"query\""
+ ",\"name\":\"event\",\"required\":false,\"schema\":{\"type\":\"string\"}}"
+ "],\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/"
+ "get\":{\"description\":\"Get informations about a resource or element\","
+ "\"responses\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/li"
+ "st\":{\"description\":\"List all signals already configured\",\"response"
+ "s\":{\"200\":{\"$ref\":\"#/components/responses/200\"}}},\"/addObjects\""
+ ":{\"description\":\"Load new objects from an additional config file desi"
+ "gnated by JSON argument with the key 'file'.\",\"get\":{\"x-permissions\""
+ ":{\"$ref\":\"#/components/x-permissions/addObjects\"},\"responses\":{\"2"
+ "00\":{\"$ref\":\"#/components/responses/200\"}}},\"parameters\":[{\"in\""
+ ":\"query\",\"name\":\"path\",\"required\":true,\"schema\":{\"type\":\"st"
+ "ring\"}}]}}}"
;
+#ifdef __cplusplus
+#include <afb/afb-binding>
+#endif
+static const struct afb_auth _afb_auths_v2_signal_composer[] = {
+ afb::auth_permission("urn:AGL:permission::platform:composer:addObjects")
+};
void subscribe(struct afb_req req);
void unsubscribe(struct afb_req req);
void get(struct afb_req req);
void list(struct afb_req req);
- void loadConf(struct afb_req req);
+ void addObjects(struct afb_req req);
static const struct afb_verb_v2 _afb_verbs_v2_signal_composer[] = {
{
@@ -77,10 +86,10 @@ static const struct afb_verb_v2 _afb_verbs_v2_signal_composer[] = {
.session = AFB_SESSION_NONE_V2
},
{
- .verb = "loadConf",
- .callback = loadConf,
- .auth = NULL,
- .info = "Load config file in directory passed as argument searching for pattern 'sig' in filename",
+ .verb = "addObjects",
+ .callback = addObjects,
+ .auth = &_afb_auths_v2_signal_composer[0],
+ .info = "Load new objects from an additional config file designated by JSON argument with the key 'file'.",
.session = AFB_SESSION_NONE_V2
},
{