emqx_web_hook.schema 2.8 KB

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