|
@@ -38,7 +38,9 @@
|
|
|
-type ip_port() :: tuple().
|
|
-type ip_port() :: tuple().
|
|
|
-type cipher() :: map().
|
|
-type cipher() :: map().
|
|
|
-type rfc3339_system_time() :: integer().
|
|
-type rfc3339_system_time() :: integer().
|
|
|
|
|
+-type qos():: integer().
|
|
|
|
|
|
|
|
|
|
+-typerefl_from_string({qos/0, emqx_schema, to_qos}).
|
|
|
-typerefl_from_string({duration/0, emqx_schema, to_duration}).
|
|
-typerefl_from_string({duration/0, emqx_schema, to_duration}).
|
|
|
-typerefl_from_string({duration_s/0, emqx_schema, to_duration_s}).
|
|
-typerefl_from_string({duration_s/0, emqx_schema, to_duration_s}).
|
|
|
-typerefl_from_string({duration_ms/0, emqx_schema, to_duration_ms}).
|
|
-typerefl_from_string({duration_ms/0, emqx_schema, to_duration_ms}).
|
|
@@ -62,7 +64,7 @@
|
|
|
mk_duration/2, to_bytesize/1, to_wordsize/1,
|
|
mk_duration/2, to_bytesize/1, to_wordsize/1,
|
|
|
to_percent/1, to_comma_separated_list/1,
|
|
to_percent/1, to_comma_separated_list/1,
|
|
|
to_bar_separated_list/1, to_ip_port/1,
|
|
to_bar_separated_list/1, to_ip_port/1,
|
|
|
- to_erl_cipher_suite/1,
|
|
|
|
|
|
|
+ to_erl_cipher_suite/1, to_qos/1,
|
|
|
to_comma_separated_atoms/1,
|
|
to_comma_separated_atoms/1,
|
|
|
rfc3339_to_system_time/1]).
|
|
rfc3339_to_system_time/1]).
|
|
|
|
|
|
|
@@ -71,7 +73,7 @@
|
|
|
-reflect_type([ duration/0, duration_s/0, duration_ms/0,
|
|
-reflect_type([ duration/0, duration_s/0, duration_ms/0,
|
|
|
bytesize/0, wordsize/0, percent/0, file/0,
|
|
bytesize/0, wordsize/0, percent/0, file/0,
|
|
|
comma_separated_list/0, bar_separated_list/0, ip_port/0,
|
|
comma_separated_list/0, bar_separated_list/0, ip_port/0,
|
|
|
- cipher/0,
|
|
|
|
|
|
|
+ cipher/0, qos/0,
|
|
|
comma_separated_atoms/0,
|
|
comma_separated_atoms/0,
|
|
|
rfc3339_system_time/0]).
|
|
rfc3339_system_time/0]).
|
|
|
|
|
|
|
@@ -312,7 +314,7 @@ message within this interval."""
|
|
|
desc => "Maximum topic levels allowed."
|
|
desc => "Maximum topic levels allowed."
|
|
|
})}
|
|
})}
|
|
|
, {"max_qos_allowed",
|
|
, {"max_qos_allowed",
|
|
|
- sc(range(0, 2),
|
|
|
|
|
|
|
+ sc(qos(),
|
|
|
#{ default => 2,
|
|
#{ default => 2,
|
|
|
desc => "Maximum QoS allowed."
|
|
desc => "Maximum QoS allowed."
|
|
|
})}
|
|
})}
|
|
@@ -1529,6 +1531,12 @@ rfc3339_to_system_time(DateTime) ->
|
|
|
to_bar_separated_list(Str) ->
|
|
to_bar_separated_list(Str) ->
|
|
|
{ok, string:tokens(Str, "| ")}.
|
|
{ok, string:tokens(Str, "| ")}.
|
|
|
|
|
|
|
|
|
|
+to_qos(Str) ->
|
|
|
|
|
+ case string:to_integer(Str) of
|
|
|
|
|
+ {Num, []} when Num >= 0 andalso Num =< 2 -> {ok, Num};
|
|
|
|
|
+ _ -> {error, Str}
|
|
|
|
|
+ end.
|
|
|
|
|
+
|
|
|
to_ip_port(Str) ->
|
|
to_ip_port(Str) ->
|
|
|
case string:tokens(Str, ": ") of
|
|
case string:tokens(Str, ": ") of
|
|
|
[Ip, Port] ->
|
|
[Ip, Port] ->
|