fix: enable param is atom
This commit is contained in:
parent
abcae6b509
commit
2b66018d3b
|
@ -391,11 +391,7 @@ schema("/bridges_v2_probe") ->
|
||||||
'/bridges_v2/:id/enable/:enable'(put, #{bindings := #{id := Id, enable := Enable}}) ->
|
'/bridges_v2/:id/enable/:enable'(put, #{bindings := #{id := Id, enable := Enable}}) ->
|
||||||
?TRY_PARSE_ID(
|
?TRY_PARSE_ID(
|
||||||
Id,
|
Id,
|
||||||
case enable_func(Enable) of
|
case emqx_bridge_v2:disable_enable(enable_func(Enable), BridgeType, BridgeName) of
|
||||||
invalid ->
|
|
||||||
?NOT_FOUND(<<"Invalid operation">>);
|
|
||||||
OperFunc ->
|
|
||||||
case emqx_bridge_v2:disable_enable(OperFunc, BridgeType, BridgeName) of
|
|
||||||
{ok, _} ->
|
{ok, _} ->
|
||||||
?NO_CONTENT;
|
?NO_CONTENT;
|
||||||
{error, {pre_config_update, _, not_found}} ->
|
{error, {pre_config_update, _, not_found}} ->
|
||||||
|
@ -407,7 +403,6 @@ schema("/bridges_v2_probe") ->
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
?INTERNAL_ERROR(Reason)
|
?INTERNAL_ERROR(Reason)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
).
|
).
|
||||||
|
|
||||||
'/bridges_v2/:id/:operation'(post, #{
|
'/bridges_v2/:id/:operation'(post, #{
|
||||||
|
@ -728,9 +723,8 @@ create_or_update_bridge(BridgeType, BridgeName, Conf, HttpStatusCode) ->
|
||||||
?BAD_REQUEST(map_to_json(redact(Reason)))
|
?BAD_REQUEST(map_to_json(redact(Reason)))
|
||||||
end.
|
end.
|
||||||
|
|
||||||
enable_func(<<"true">>) -> enable;
|
enable_func(true) -> enable;
|
||||||
enable_func(<<"false">>) -> disable;
|
enable_func(false) -> disable.
|
||||||
enable_func(_) -> invalid.
|
|
||||||
|
|
||||||
filter_out_request_body(Conf) ->
|
filter_out_request_body(Conf) ->
|
||||||
ExtraConfs = [
|
ExtraConfs = [
|
||||||
|
|
Loading…
Reference in New Issue