1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
|
static const char _afb_description_v2_monitor[] =
"{\"openapi\":\"3.0.0\",\"info\":{\"description\":\"monitoring of binding"
"s and internals\",\"title\":\"monitor\",\"version\":\"1.0\",\"x-binding-"
"c-generator\":{\"api\":\"monitor\",\"version\":2,\"prefix\":\"f_\",\"pos"
"tfix\":\"\",\"preinit\":null,\"init\":null,\"onevent\":null,\"scope\":\""
"static\",\"private\":true}},\"servers\":[{\"url\":\"ws://{host}:{port}/a"
"pi/monitor\",\"description\":\"The API server.\",\"variables\":{\"host\""
":{\"default\":\"localhost\"},\"port\":{\"default\":\"1234\"}},\"x-afb-ev"
"ents\":[{\"$ref\":\"#/components/schemas/afb-event\"}]}],\"components\":"
"{\"schemas\":{\"afb-reply\":{\"$ref\":\"#/components/schemas/afb-reply-v"
"1\"},\"afb-event\":{\"$ref\":\"#/components/schemas/afb-event-v1\"},\"af"
"b-reply-v1\":{\"title\":\"Generic response.\",\"type\":\"object\",\"requ"
"ired\":[\"jtype\",\"request\"],\"properties\":{\"jtype\":{\"type\":\"str"
"ing\",\"const\":\"afb-reply\"},\"request\":{\"type\":\"object\",\"requir"
"ed\":[\"status\"],\"properties\":{\"status\":{\"type\":\"string\"},\"inf"
"o\":{\"type\":\"string\"},\"token\":{\"type\":\"string\"},\"uuid\":{\"ty"
"pe\":\"string\"},\"reqid\":{\"type\":\"string\"}}},\"response\":{\"type\""
":\"object\"}}},\"afb-event-v1\":{\"type\":\"object\",\"required\":[\"jty"
"pe\",\"event\"],\"properties\":{\"jtype\":{\"type\":\"string\",\"const\""
":\"afb-event\"},\"event\":{\"type\":\"string\"},\"data\":{\"type\":\"obj"
"ect\"}}},\"set-verbosity\":{\"anyOf\":[{\"$ref\":\"#/components/schemas/"
"verbosity-map\"},{\"$ref\":\"#/components/schemas/verbosity-level\"}]},\""
"get-request\":{\"type\":\"object\",\"properties\":{\"verbosity\":{\"$ref"
"\":\"#/components/schemas/get-verbosity\"},\"apis\":{\"$ref\":\"#/compon"
"ents/schemas/get-apis\"}}},\"get-response\":{\"type\":\"object\",\"prope"
"rties\":{\"verbosity\":{\"$ref\":\"#/components/schemas/verbosity-map\"}"
",\"apis\":{\"type\":\"object\"}}},\"get-verbosity\":{\"anyOf\":[{\"type\""
":\"boolean\"},{\"type\":\"array\",\"items\":{\"type\":\"string\"}},{\"ty"
"pe\":\"object\"}]},\"get-apis\":{\"anyOf\":[{\"type\":\"boolean\"},{\"ty"
"pe\":\"array\",\"items\":{\"type\":\"string\"}},{\"type\":\"object\"}]},"
"\"verbosity-map\":{\"type\":\"object\",\"patternProperties\":{\"^.*$\":{"
"\"$ref\":\"#/components/schemas/verbosity-level\"}}},\"verbosity-level\""
":{\"enum\":[\"debug\",3,\"info\",2,\"notice\",\"warning\",1,\"error\",0]"
"},\"trace-add\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"$ref\":\"#/"
"components/schemas/trace-add-object\"}},{\"$ref\":\"#/components/schemas"
"/trace-add-any\"}]},\"trace-add-any\":{\"anyOf\":[{\"$ref\":\"#/componen"
"ts/schemas/trace-add-request\"},{\"$ref\":\"#/components/schemas/trace-a"
"dd-object\"}]},\"trace-add-object\":{\"type\":\"object\",\"properties\":"
"{\"name\":{\"type\":\"string\",\"description\":\"name of the generated e"
"vent\",\"default\":\"trace\"},\"tag\":{\"type\":\"string\",\"description"
"\":\"tag for grouping traces\",\"default\":\"trace\"},\"api\":{\"type\":"
"\"string\",\"description\":\"api for requests, daemons and services\"},\""
"verb\":{\"type\":\"string\",\"description\":\"verb for requests\"},\"uui"
"d\":{\"type\":\"string\",\"description\":\"uuid of session for requests\""
"},\"pattern\":{\"type\":\"string\",\"description\":\"pattern for events\""
"},\"request\":{\"$ref\":\"#/components/schemas/trace-add-request\"},\"da"
"emon\":{\"$ref\":\"#/components/schemas/trace-add-daemon\"},\"service\":"
"{\"$ref\":\"#/components/schemas/trace-add-service\"},\"event\":{\"$ref\""
":\"#/components/schemas/trace-add-event\"},\"session\":{\"$ref\":\"#/com"
"ponents/schemas/trace-add-session\"},\"for\":{\"$ref\":\"#/components/sc"
"hemas/trace-add\"}},\"examples\":[{\"tag\":\"1\",\"for\":[\"common\",{\""
"api\":\"xxx\",\"request\":\"*\",\"daemon\":\"*\",\"service\":\"*\"}]}]},"
"\"trace-add-request\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"$ref\""
":\"#/components/schemas/trace-request-names\"}},{\"$ref\":\"#/components"
"/schemas/trace-request-names\"}]},\"trace-request-names\":{\"title\":\"n"
"ame of traceable items of requests\",\"enum\":[\"*\",\"addref\",\"all\","
"\"args\",\"begin\",\"common\",\"context\",\"context_get\",\"context_set\""
",\"end\",\"event\",\"extra\",\"fail\",\"get\",\"json\",\"life\",\"ref\","
"\"result\",\"session\",\"session_close\",\"session_set_LOA\",\"simple\","
"\"store\",\"stores\",\"subcall\",\"subcall_result\",\"subcalls\",\"subca"
"llsync\",\"subcallsync_result\",\"subscribe\",\"success\",\"unref\",\"un"
"store\",\"unsubscribe\",\"vverbose\"]},\"trace-add-daemon\":{\"anyOf\":["
"{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/schemas/trace-dae"
"mon-names\"}},{\"$ref\":\"#/components/schemas/trace-daemon-names\"}]},\""
"trace-daemon-names\":{\"title\":\"name of traceable items of daemons\",\""
"enum\":[\"*\",\"all\",\"common\",\"event_broadcast_after\",\"event_broad"
"cast_before\",\"event_make\",\"extra\",\"get_event_loop\",\"get_system_b"
"us\",\"get_user_bus\",\"queue_job\",\"require_api\",\"require_api_result"
"\",\"rootdir_get_fd\",\"rootdir_open_locale\",\"unstore_req\",\"vverbose"
"\"]},\"trace-add-service\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\""
"$ref\":\"#/components/schemas/trace-service-names\"}},{\"$ref\":\"#/comp"
"onents/schemas/trace-service-names\"}]},\"trace-service-names\":{\"title"
"\":\"name of traceable items of services\",\"enum\":[\"*\",\"all\",\"cal"
"l\",\"call_result\",\"callsync\",\"callsync_result\",\"on_event_after\","
"\"on_event_before\",\"start_after\",\"start_before\"]},\"trace-add-event"
"\":{\"anyOf\":[{\"type\":\"array\",\"items\":{\"$ref\":\"#/components/sc"
"hemas/trace-event-names\"}},{\"$ref\":\"#/components/schemas/trace-event"
"-names\"}]},\"trace-event-names\":{\"title\":\"name of traceable items o"
"f events\",\"enum\":[\"*\",\"all\",\"broadcast_after\",\"broadcast_befor"
"e\",\"common\",\"create\",\"drop\",\"extra\",\"name\",\"push_after\",\"p"
"ush_before\"]},\"trace-add-session\":{\"anyOf\":[{\"type\":\"array\",\"i"
"tems\":{\"$ref\":\"#/components/schemas/trace-session-names\"}},{\"$ref\""
":\"#/components/schemas/trace-session-names\"}]},\"trace-session-names\""
":{\"title\":\"name of traceable items for sessions\",\"enum\":[\"*\",\"a"
"ddref\",\"all\",\"close\",\"common\",\"create\",\"destroy\",\"renew\",\""
"unref\"]},\"trace-drop\":{\"anyOf\":[{\"type\":\"boolean\"},{\"type\":\""
"object\",\"properties\":{\"event\":{\"anyOf\":[{\"type\":\"string\"},{\""
"type\":\"array\",\"items\":\"string\"}]},\"tag\":{\"anyOf\":[{\"type\":\""
"string\"},{\"type\":\"array\",\"items\":\"string\"}]},\"uuid\":{\"anyOf\""
":[{\"type\":\"string\"},{\"type\":\"array\",\"items\":\"string\"}]}}}]}}"
"},\"paths\":{\"/get\":{\"description\":\"Get monitoring data.\",\"get\":"
"{\"x-permissions\":{\"session\":\"check\"},\"parameters\":[{\"in\":\"que"
"ry\",\"name\":\"verbosity\",\"required\":false,\"schema\":{\"$ref\":\"#/"
"components/schemas/get-verbosity\"}},{\"in\":\"query\",\"name\":\"apis\""
",\"required\":false,\"schema\":{\"$ref\":\"#/components/schemas/get-apis"
"\"}}],\"responses\":{\"200\":{\"description\":\"A complex object array r"
"esponse\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":\"#/co"
"mponents/schemas/afb-reply\"}}}}}}},\"/set\":{\"description\":\"Set moni"
"toring actions.\",\"get\":{\"x-permissions\":{\"session\":\"check\"},\"p"
"arameters\":[{\"in\":\"query\",\"name\":\"verbosity\",\"required\":false"
",\"schema\":{\"$ref\":\"#/components/schemas/set-verbosity\"}}],\"respon"
"ses\":{\"200\":{\"description\":\"A complex object array response\",\"co"
"ntent\":{\"application/json\":{\"schema\":{\"$ref\":\"#/components/schem"
"as/afb-reply\"}}}}}}},\"/trace\":{\"description\":\"Set monitoring actio"
"ns.\",\"get\":{\"x-permissions\":{\"session\":\"check\"},\"parameters\":"
"[{\"in\":\"query\",\"name\":\"add\",\"required\":false,\"schema\":{\"$re"
"f\":\"#/components/schemas/trace-add\"}},{\"in\":\"query\",\"name\":\"dr"
"op\",\"required\":false,\"schema\":{\"$ref\":\"#/components/schemas/trac"
"e-drop\"}}],\"responses\":{\"200\":{\"description\":\"A complex object a"
"rray response\",\"content\":{\"application/json\":{\"schema\":{\"$ref\":"
"\"#/components/schemas/afb-reply\"}}}}}}},\"/session\":{\"description\":"
"\"describes the session.\",\"get\":{\"x-permissions\":{\"session\":\"che"
"ck\"},\"parameters\":[{\"in\":\"query\",\"name\":\"refresh-token\",\"req"
"uired\":false,\"schema\":{\"type\":\"boolean\"}}],\"responses\":{\"200\""
":{\"description\":\"A complex object array response\",\"content\":{\"app"
"lication/json\":{\"schema\":{\"$ref\":\"#/components/schemas/afb-reply\""
"}}}}}}}}}"
;
static void f_get(struct afb_req req);
static void f_set(struct afb_req req);
static void f_trace(struct afb_req req);
static void f_session(struct afb_req req);
static const struct afb_verb_v2 _afb_verbs_v2_monitor[] = {
{
.verb = "get",
.callback = f_get,
.auth = NULL,
.info = "Get monitoring data.",
.session = AFB_SESSION_CHECK_V2
},
{
.verb = "set",
.callback = f_set,
.auth = NULL,
.info = "Set monitoring actions.",
.session = AFB_SESSION_CHECK_V2
},
{
.verb = "trace",
.callback = f_trace,
.auth = NULL,
.info = "Set monitoring actions.",
.session = AFB_SESSION_CHECK_V2
},
{
.verb = "session",
.callback = f_session,
.auth = NULL,
.info = "describes the session.",
.session = AFB_SESSION_CHECK_V2
},
{
.verb = NULL,
.callback = NULL,
.auth = NULL,
.info = NULL,
.session = 0
}
};
static const struct afb_binding_v2 _afb_binding_v2_monitor = {
.api = "monitor",
.specification = _afb_description_v2_monitor,
.info = "monitoring of bindings and internals",
.verbs = _afb_verbs_v2_monitor,
.preinit = NULL,
.init = NULL,
.onevent = NULL,
.noconcurrency = 0
};
|