Merge pull request #8175 from terry-xiaoyu/create_bridge_connector_in_single_post
feat: support configure connector configs directly in bridges
This commit is contained in:
commit
0c95c7342f
|
@ -24,12 +24,12 @@ emqx_bridge_api {
|
||||||
|
|
||||||
desc_param_path_node {
|
desc_param_path_node {
|
||||||
desc {
|
desc {
|
||||||
en: """The bridge Id. Must be of format {type}:{name}"""
|
en: """The node name, e.g. emqx@127.0.0.1"""
|
||||||
zh: """Bridge ID , 格式为 {type}:{name}"""
|
zh: """节点名,比如 emqx@127.0.0.1"""
|
||||||
}
|
}
|
||||||
label: {
|
label: {
|
||||||
en: "Bridge ID"
|
en: "The node name"
|
||||||
zh: "Bridge ID"
|
zh: "节点名"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,12 +14,13 @@ emqx_bridge_schema {
|
||||||
desc_connector {
|
desc_connector {
|
||||||
desc {
|
desc {
|
||||||
en: """
|
en: """
|
||||||
The connector ID to be used for this bridge. Connector IDs must be of format:
|
The ID or the configs of the connector to be used for this bridge. Connector IDs must be of format:
|
||||||
<code>{type}:{name}</code>.</br>
|
<code>{type}:{name}</code>.</br>
|
||||||
In config files, you can find the corresponding config entry for a connector by such path:
|
In config files, you can find the corresponding config entry for a connector by such path:
|
||||||
'connectors.{type}.{name}'.</br>
|
'connectors.{type}.{name}'.</br>
|
||||||
"""
|
"""
|
||||||
zh: """Bridge 使用的 Connector 的 ID。Connector ID 的格式必须为:<code>{type}:{name}</code>.</br>
|
zh: """
|
||||||
|
Bridge 使用的 Connector 的 ID 或者配置。Connector ID 的格式必须为:<code>{type}:{name}</code>.</br>
|
||||||
在配置文件中,您可以通过以下路径找到 Connector 的相应配置条目:'connector.{type}.{name}'。</br>"""
|
在配置文件中,您可以通过以下路径找到 Connector 的相应配置条目:'connector.{type}.{name}'。</br>"""
|
||||||
}
|
}
|
||||||
label: {
|
label: {
|
||||||
|
|
|
@ -13,11 +13,11 @@ roots() -> [].
|
||||||
|
|
||||||
fields("ingress") ->
|
fields("ingress") ->
|
||||||
[emqx_bridge_schema:direction_field(ingress, emqx_connector_mqtt_schema:ingress_desc())] ++
|
[emqx_bridge_schema:direction_field(ingress, emqx_connector_mqtt_schema:ingress_desc())] ++
|
||||||
emqx_bridge_schema:common_bridge_fields() ++
|
emqx_bridge_schema:common_bridge_fields(mqtt_connector_ref()) ++
|
||||||
proplists:delete(hookpoint, emqx_connector_mqtt_schema:fields("ingress"));
|
proplists:delete(hookpoint, emqx_connector_mqtt_schema:fields("ingress"));
|
||||||
fields("egress") ->
|
fields("egress") ->
|
||||||
[emqx_bridge_schema:direction_field(egress, emqx_connector_mqtt_schema:egress_desc())] ++
|
[emqx_bridge_schema:direction_field(egress, emqx_connector_mqtt_schema:egress_desc())] ++
|
||||||
emqx_bridge_schema:common_bridge_fields() ++
|
emqx_bridge_schema:common_bridge_fields(mqtt_connector_ref()) ++
|
||||||
emqx_connector_mqtt_schema:fields("egress");
|
emqx_connector_mqtt_schema:fields("egress");
|
||||||
fields("post_ingress") ->
|
fields("post_ingress") ->
|
||||||
[
|
[
|
||||||
|
@ -63,3 +63,6 @@ name_field() ->
|
||||||
desc => ?DESC("desc_name")
|
desc => ?DESC("desc_name")
|
||||||
}
|
}
|
||||||
)}.
|
)}.
|
||||||
|
|
||||||
|
mqtt_connector_ref() ->
|
||||||
|
?R_REF(emqx_connector_mqtt_schema, "connector").
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
common_bridge_fields/0,
|
common_bridge_fields/1,
|
||||||
metrics_status_fields/0,
|
metrics_status_fields/0,
|
||||||
direction_field/2
|
direction_field/2
|
||||||
]).
|
]).
|
||||||
|
@ -50,7 +50,7 @@ http_schema(Method) ->
|
||||||
| Schemas
|
| Schemas
|
||||||
]).
|
]).
|
||||||
|
|
||||||
common_bridge_fields() ->
|
common_bridge_fields(ConnectorRef) ->
|
||||||
[
|
[
|
||||||
{enable,
|
{enable,
|
||||||
mk(
|
mk(
|
||||||
|
@ -62,7 +62,7 @@ common_bridge_fields() ->
|
||||||
)},
|
)},
|
||||||
{connector,
|
{connector,
|
||||||
mk(
|
mk(
|
||||||
binary(),
|
hoconsc:union([binary(), ConnectorRef]),
|
||||||
#{
|
#{
|
||||||
required => true,
|
required => true,
|
||||||
example => <<"mqtt:my_mqtt_connector">>,
|
example => <<"mqtt:my_mqtt_connector">>,
|
||||||
|
|
Loading…
Reference in New Issue