fix(emqx_data_bridge): resource type to bridge type

This commit is contained in:
Shawn 2021-06-07 20:01:28 +08:00
parent e9fe345ac8
commit dddab31326
2 changed files with 5 additions and 1 deletions

View File

@ -2,6 +2,7 @@
-export([ load_bridges/0 -export([ load_bridges/0
, resource_type/1 , resource_type/1
, bridge_type/1
, name_to_resource_id/1 , name_to_resource_id/1
, resource_id_to_name/1 , resource_id_to_name/1
, list_bridges/0 , list_bridges/0
@ -15,6 +16,8 @@ load_bridges() ->
resource_type(<<"mysql">>) -> emqx_connector_mysql. resource_type(<<"mysql">>) -> emqx_connector_mysql.
bridge_type(emqx_connector_mysql) -> <<"mysql">>.
name_to_resource_id(BridgeName) -> name_to_resource_id(BridgeName) ->
<<"bridge:", BridgeName/binary>>. <<"bridge:", BridgeName/binary>>.

View File

@ -94,5 +94,6 @@ delete_bridge(#{name := Name}, _Params) ->
end. end.
format_api_reply(#{resource_type := Type, id := Id, config := Conf, status := Status}) -> format_api_reply(#{resource_type := Type, id := Id, config := Conf, status := Status}) ->
#{type => Type, name => emqx_data_bridge:resource_id_to_name(Id), #{type => emqx_data_bridge:bridge_type(Type),
name => emqx_data_bridge:resource_id_to_name(Id),
config => Conf, status => Status}. config => Conf, status => Status}.