emqx_web_hook.schema 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. {default, ""},
  15. {datatype, string}
  16. ]}.
  17. {mapping, "web.hook.ssl.certfile", "emqx_web_hook.certfile", [
  18. {default, ""},
  19. {datatype, string}
  20. ]}.
  21. {mapping, "web.hook.ssl.keyfile", "emqx_web_hook.keyfile", [
  22. {default, ""},
  23. {datatype, string}
  24. ]}.
  25. {mapping, "web.hook.ssl.verify", "emqx_web_hook.verify", [
  26. {default, false},
  27. {datatype, {enum, [true, false]}}
  28. ]}.
  29. {mapping, "web.hook.pool_size", "emqx_web_hook.pool_size", [
  30. {default, 32},
  31. {datatype, integer}
  32. ]}.
  33. {mapping, "web.hook.rule.client.connect.$name", "emqx_web_hook.rules", [
  34. {datatype, string}
  35. ]}.
  36. {mapping, "web.hook.rule.client.connack.$name", "emqx_web_hook.rules", [
  37. {datatype, string}
  38. ]}.
  39. {mapping, "web.hook.rule.client.connected.$name", "emqx_web_hook.rules", [
  40. {datatype, string}
  41. ]}.
  42. {mapping, "web.hook.rule.client.disconnected.$name", "emqx_web_hook.rules", [
  43. {datatype, string}
  44. ]}.
  45. {mapping, "web.hook.rule.client.subscribe.$name", "emqx_web_hook.rules", [
  46. {datatype, string}
  47. ]}.
  48. {mapping, "web.hook.rule.client.unsubscribe.$name", "emqx_web_hook.rules", [
  49. {datatype, string}
  50. ]}.
  51. {mapping, "web.hook.rule.session.subscribed.$name", "emqx_web_hook.rules", [
  52. {datatype, string}
  53. ]}.
  54. {mapping, "web.hook.rule.session.unsubscribed.$name", "emqx_web_hook.rules", [
  55. {datatype, string}
  56. ]}.
  57. {mapping, "web.hook.rule.session.terminated.$name", "emqx_web_hook.rules", [
  58. {datatype, string}
  59. ]}.
  60. {mapping, "web.hook.rule.message.publish.$name", "emqx_web_hook.rules", [
  61. {datatype, string}
  62. ]}.
  63. {mapping, "web.hook.rule.message.acked.$name", "emqx_web_hook.rules", [
  64. {datatype, string}
  65. ]}.
  66. {mapping, "web.hook.rule.message.delivered.$name", "emqx_web_hook.rules", [
  67. {datatype, string}
  68. ]}.
  69. {translation, "emqx_web_hook.headers", fun(Conf) ->
  70. Headers = cuttlefish_variable:filter_by_prefix("web.hook.headers", Conf),
  71. [{K, V} || {[_, _, _, K], V} <- Headers]
  72. end}.
  73. {translation, "emqx_web_hook.rules", fun(Conf) ->
  74. Hooks = cuttlefish_variable:filter_by_prefix("web.hook.rule", Conf),
  75. lists:map(
  76. fun({[_, _, _,Name1,Name2, _], Val}) ->
  77. {lists:concat([Name1,".",Name2]), Val}
  78. end, Hooks)
  79. end}.