fix: problems found by @thalesmg in code review
Co-authored-by: Thales Macedo Garitezi <thalesmg@gmail.com>
This commit is contained in:
parent
49fdfef8c3
commit
e93b71d8d5
|
@ -1,3 +1,5 @@
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
%%
|
%%
|
||||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
%% you may not use this file except in compliance with the License.
|
%% you may not use this file except in compliance with the License.
|
||||||
|
@ -146,7 +148,7 @@ action_info_modules() ->
|
||||||
lists:usort(lists:flatten(ActionInfoModules) ++ hard_coded_action_info_modules()).
|
lists:usort(lists:flatten(ActionInfoModules) ++ hard_coded_action_info_modules()).
|
||||||
|
|
||||||
action_info_modules(App) ->
|
action_info_modules(App) ->
|
||||||
case application:get_env(App, emqx, action_info_module) of
|
case application:get_env(App, emqx_action_info_module) of
|
||||||
{ok, Module} ->
|
{ok, Module} ->
|
||||||
[Module];
|
[Module];
|
||||||
_ ->
|
_ ->
|
||||||
|
|
|
@ -101,7 +101,7 @@
|
||||||
|
|
||||||
%% Compatibility Layer API
|
%% Compatibility Layer API
|
||||||
%% All public functions for the compatibility layer should be prefixed with
|
%% All public functions for the compatibility layer should be prefixed with
|
||||||
%% birdge_v1_
|
%% bridge_v1_
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
bridge_v1_lookup_and_transform/2,
|
bridge_v1_lookup_and_transform/2,
|
||||||
|
|
|
@ -90,13 +90,10 @@ api_schema(Method) ->
|
||||||
hoconsc:union(bridge_api_union(EE ++ APISchemas)).
|
hoconsc:union(bridge_api_union(EE ++ APISchemas)).
|
||||||
|
|
||||||
registered_api_schemas(Method) ->
|
registered_api_schemas(Method) ->
|
||||||
%% We *must* do this to ensure the module is really loaded, especially when we use
|
RegisteredSchemas = emqx_action_info:registered_schema_modules(),
|
||||||
%% `call_hocon' from `nodetool' to generate initial configurations.
|
|
||||||
_ = emqx_bridge_v2:module_info(),
|
|
||||||
RegistredSchmeas = emqx_action_info:registered_schema_modules(),
|
|
||||||
[
|
[
|
||||||
api_ref(SchemaModule, atom_to_binary(BridgeV2Type), Method ++ "_bridge_v2")
|
api_ref(SchemaModule, atom_to_binary(BridgeV2Type), Method ++ "_bridge_v2")
|
||||||
|| {BridgeV2Type, SchemaModule} <- RegistredSchmeas
|
|| {BridgeV2Type, SchemaModule} <- RegisteredSchemas
|
||||||
].
|
].
|
||||||
|
|
||||||
api_ref(Module, Type, Method) ->
|
api_ref(Module, Type, Method) ->
|
||||||
|
@ -148,9 +145,6 @@ roots() ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fields(actions) ->
|
fields(actions) ->
|
||||||
%% We *must* do this to ensure the module is really loaded, especially when we use
|
|
||||||
%% `call_hocon' from `nodetool' to generate initial configurations.
|
|
||||||
_ = emqx_bridge_v2:module_info(),
|
|
||||||
enterprise_fields_actions() ++
|
enterprise_fields_actions() ++
|
||||||
registered_schema_fields().
|
registered_schema_fields().
|
||||||
|
|
||||||
|
|
|
@ -527,17 +527,17 @@ fields(resource_opts) ->
|
||||||
SupportedFields = [health_check_interval],
|
SupportedFields = [health_check_interval],
|
||||||
CreationOpts = emqx_resource_schema:create_opts(_Overrides = []),
|
CreationOpts = emqx_resource_schema:create_opts(_Overrides = []),
|
||||||
lists:filter(fun({Field, _}) -> lists:member(Field, SupportedFields) end, CreationOpts);
|
lists:filter(fun({Field, _}) -> lists:member(Field, SupportedFields) end, CreationOpts);
|
||||||
fields(bridge_v2_field) ->
|
fields(action_field) ->
|
||||||
{kafka_producer,
|
{kafka_producer,
|
||||||
mk(
|
mk(
|
||||||
hoconsc:map(name, ref(emqx_bridge_kafka, kafka_producer_action)),
|
hoconsc:map(name, ref(emqx_bridge_kafka, kafka_producer_action)),
|
||||||
#{
|
#{
|
||||||
desc => <<"Kafka Producer Bridge V2 Config">>,
|
desc => <<"Kafka Producer Action Config">>,
|
||||||
required => false
|
required => false
|
||||||
}
|
}
|
||||||
)};
|
)};
|
||||||
fields(action) ->
|
fields(action) ->
|
||||||
fields(bridge_v2_field).
|
fields(action_field).
|
||||||
|
|
||||||
desc("config_connector") ->
|
desc("config_connector") ->
|
||||||
?DESC("desc_config");
|
?DESC("desc_config");
|
||||||
|
|
Loading…
Reference in New Issue