chore(emqx_schema): change atom array to enum array for alarm.actions
This commit is contained in:
parent
daf2e5a444
commit
4fb484d4cf
|
@ -93,7 +93,6 @@
|
||||||
validate_heap_size/1,
|
validate_heap_size/1,
|
||||||
validate_packet_size/1,
|
validate_packet_size/1,
|
||||||
user_lookup_fun_tr/2,
|
user_lookup_fun_tr/2,
|
||||||
validate_alarm_actions/1,
|
|
||||||
validate_keepalive_multiplier/1,
|
validate_keepalive_multiplier/1,
|
||||||
non_empty_string/1,
|
non_empty_string/1,
|
||||||
validations/0,
|
validations/0,
|
||||||
|
@ -1617,10 +1616,9 @@ fields("alarm") ->
|
||||||
[
|
[
|
||||||
{"actions",
|
{"actions",
|
||||||
sc(
|
sc(
|
||||||
hoconsc:array(atom()),
|
hoconsc:array(hoconsc:enum([log, publish])),
|
||||||
#{
|
#{
|
||||||
default => [log, publish],
|
default => [log, publish],
|
||||||
validator => fun ?MODULE:validate_alarm_actions/1,
|
|
||||||
example => [log, publish],
|
example => [log, publish],
|
||||||
desc => ?DESC(alarm_actions)
|
desc => ?DESC(alarm_actions)
|
||||||
}
|
}
|
||||||
|
@ -2731,15 +2729,6 @@ validate_keepalive_multiplier(Multiplier) when
|
||||||
validate_keepalive_multiplier(_Multiplier) ->
|
validate_keepalive_multiplier(_Multiplier) ->
|
||||||
{error, #{reason => keepalive_multiplier_out_of_range, min => 1, max => 65535}}.
|
{error, #{reason => keepalive_multiplier_out_of_range, min => 1, max => 65535}}.
|
||||||
|
|
||||||
validate_alarm_actions(Actions) ->
|
|
||||||
UnSupported = lists:filter(
|
|
||||||
fun(Action) -> Action =/= log andalso Action =/= publish end, Actions
|
|
||||||
),
|
|
||||||
case UnSupported of
|
|
||||||
[] -> ok;
|
|
||||||
Error -> {error, Error}
|
|
||||||
end.
|
|
||||||
|
|
||||||
validate_tcp_keepalive(Value) ->
|
validate_tcp_keepalive(Value) ->
|
||||||
case iolist_to_binary(Value) of
|
case iolist_to_binary(Value) of
|
||||||
<<"none">> ->
|
<<"none">> ->
|
||||||
|
|
Loading…
Reference in New Issue