emqx_web_hook.schema 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. %%-*- mode: erlang -*-
  2. %% EMQ X R3.0 config mapping
  3. {mapping, "web.hook.url", "emqx_web_hook.url", [
  4. {datatype, string}
  5. ]}.
  6. {mapping, "web.hook.headers.$name", "emqx_web_hook.headers", [
  7. {datatype, string}
  8. ]}.
  9. {mapping, "web.hook.body.encoding_of_payload_field", "emqx_web_hook.encoding_of_payload_field", [
  10. {default, plain},
  11. {datatype, {enum, [plain, base62, base64]}}
  12. ]}.
  13. {mapping, "web.hook.ssl.cacertfile", "emqx_web_hook.cacertfile", [
  14. {datatype, string}
  15. ]}.
  16. {mapping, "web.hook.ssl.certfile", "emqx_web_hook.certfile", [
  17. {datatype, string}
  18. ]}.
  19. {mapping, "web.hook.ssl.keyfile", "emqx_web_hook.keyfile", [
  20. {datatype, string}
  21. ]}.
  22. {mapping, "web.hook.ssl.verify", "emqx_web_hook.verify", [
  23. {default, false},
  24. {datatype, {enum, [true, false]}}
  25. ]}.
  26. {mapping, "web.hook.pool_size", "emqx_web_hook.pool_size", [
  27. {default, 32},
  28. {datatype, integer}
  29. ]}.
  30. {mapping, "web.hook.rule.client.connect.$name", "emqx_web_hook.rules", [
  31. {datatype, string}
  32. ]}.
  33. {mapping, "web.hook.rule.client.connack.$name", "emqx_web_hook.rules", [
  34. {datatype, string}
  35. ]}.
  36. {mapping, "web.hook.rule.client.connected.$name", "emqx_web_hook.rules", [
  37. {datatype, string}
  38. ]}.
  39. {mapping, "web.hook.rule.client.disconnected.$name", "emqx_web_hook.rules", [
  40. {datatype, string}
  41. ]}.
  42. {mapping, "web.hook.rule.client.subscribe.$name", "emqx_web_hook.rules", [
  43. {datatype, string}
  44. ]}.
  45. {mapping, "web.hook.rule.client.unsubscribe.$name", "emqx_web_hook.rules", [
  46. {datatype, string}
  47. ]}.
  48. {mapping, "web.hook.rule.session.subscribed.$name", "emqx_web_hook.rules", [
  49. {datatype, string}
  50. ]}.
  51. {mapping, "web.hook.rule.session.unsubscribed.$name", "emqx_web_hook.rules", [
  52. {datatype, string}
  53. ]}.
  54. {mapping, "web.hook.rule.session.terminated.$name", "emqx_web_hook.rules", [
  55. {datatype, string}
  56. ]}.
  57. {mapping, "web.hook.rule.message.publish.$name", "emqx_web_hook.rules", [
  58. {datatype, string}
  59. ]}.
  60. {mapping, "web.hook.rule.message.acked.$name", "emqx_web_hook.rules", [
  61. {datatype, string}
  62. ]}.
  63. {mapping, "web.hook.rule.message.delivered.$name", "emqx_web_hook.rules", [
  64. {datatype, string}
  65. ]}.
  66. {translation, "emqx_web_hook.headers", fun(Conf) ->
  67. Headers = cuttlefish_variable:filter_by_prefix("web.hook.headers", Conf),
  68. [{K, V} || {[_, _, _, K], V} <- Headers]
  69. end}.
  70. {translation, "emqx_web_hook.rules", fun(Conf) ->
  71. Hooks = cuttlefish_variable:filter_by_prefix("web.hook.rule", Conf),
  72. lists:map(
  73. fun({[_, _, _,Name1,Name2, _], Val}) ->
  74. {lists:concat([Name1,".",Name2]), Val}
  75. end, Hooks)
  76. end}.