fix(bridge-s3): expose connector-level `resource_opts` properly
This commit is contained in:
parent
ee02079661
commit
d8b6ecd185
|
@ -313,10 +313,9 @@ create_action_api(Config, Overrides) ->
|
||||||
ActionConfig0 = ?config(action_config, Config),
|
ActionConfig0 = ?config(action_config, Config),
|
||||||
ActionConfig = emqx_utils_maps:deep_merge(ActionConfig0, Overrides),
|
ActionConfig = emqx_utils_maps:deep_merge(ActionConfig0, Overrides),
|
||||||
Params = ActionConfig#{<<"type">> => ActionType, <<"name">> => ActionName},
|
Params = ActionConfig#{<<"type">> => ActionType, <<"name">> => ActionName},
|
||||||
Method = post,
|
|
||||||
Path = emqx_mgmt_api_test_util:api_path(["actions"]),
|
Path = emqx_mgmt_api_test_util:api_path(["actions"]),
|
||||||
ct:pal("creating action (http):\n ~p", [Params]),
|
ct:pal("creating action (http):\n ~p", [Params]),
|
||||||
Res = request(Method, Path, Params),
|
Res = request(post, Path, Params),
|
||||||
ct:pal("action create (http) result:\n ~p", [Res]),
|
ct:pal("action create (http) result:\n ~p", [Res]),
|
||||||
Res.
|
Res.
|
||||||
|
|
||||||
|
@ -324,11 +323,9 @@ get_action_api(Config) ->
|
||||||
ActionName = ?config(action_name, Config),
|
ActionName = ?config(action_name, Config),
|
||||||
ActionType = ?config(action_type, Config),
|
ActionType = ?config(action_type, Config),
|
||||||
ActionId = emqx_bridge_resource:bridge_id(ActionType, ActionName),
|
ActionId = emqx_bridge_resource:bridge_id(ActionType, ActionName),
|
||||||
Params = [],
|
|
||||||
Method = get,
|
|
||||||
Path = emqx_mgmt_api_test_util:api_path(["actions", ActionId]),
|
Path = emqx_mgmt_api_test_util:api_path(["actions", ActionId]),
|
||||||
ct:pal("getting action (http)"),
|
ct:pal("getting action (http)"),
|
||||||
Res = request(Method, Path, Params),
|
Res = request(get, Path, []),
|
||||||
ct:pal("get action (http) result:\n ~p", [Res]),
|
ct:pal("get action (http) result:\n ~p", [Res]),
|
||||||
Res.
|
Res.
|
||||||
|
|
||||||
|
@ -346,8 +343,7 @@ update_bridge_api(Config, Overrides) ->
|
||||||
PathRoot = api_path_root(Kind),
|
PathRoot = api_path_root(Kind),
|
||||||
Path = emqx_mgmt_api_test_util:api_path([PathRoot, BridgeId]),
|
Path = emqx_mgmt_api_test_util:api_path([PathRoot, BridgeId]),
|
||||||
ct:pal("updating bridge (~s, http):\n ~p", [Kind, Params]),
|
ct:pal("updating bridge (~s, http):\n ~p", [Kind, Params]),
|
||||||
Method = put,
|
Res = request(put, Path, Params),
|
||||||
Res = request(Method, Path, Params),
|
|
||||||
ct:pal("update bridge (~s, http) result:\n ~p", [Kind, Res]),
|
ct:pal("update bridge (~s, http) result:\n ~p", [Kind, Res]),
|
||||||
Res.
|
Res.
|
||||||
|
|
||||||
|
|
|
@ -53,11 +53,7 @@ fields(action) ->
|
||||||
}
|
}
|
||||||
)};
|
)};
|
||||||
fields("config_connector") ->
|
fields("config_connector") ->
|
||||||
lists:append([
|
emqx_connector_schema:common_fields() ++ fields(s3_connector_config);
|
||||||
emqx_connector_schema:common_fields(),
|
|
||||||
fields(s3_connector_config),
|
|
||||||
emqx_connector_schema:resource_opts_ref(?MODULE, s3_connector_resource_opts)
|
|
||||||
]);
|
|
||||||
fields(?ACTION) ->
|
fields(?ACTION) ->
|
||||||
emqx_bridge_v2_schema:make_producer_action_schema(
|
emqx_bridge_v2_schema:make_producer_action_schema(
|
||||||
hoconsc:mk(
|
hoconsc:mk(
|
||||||
|
@ -72,7 +68,8 @@ fields(?ACTION) ->
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
fields(s3_connector_config) ->
|
fields(s3_connector_config) ->
|
||||||
emqx_s3_schema:fields(s3_client);
|
emqx_s3_schema:fields(s3_client) ++
|
||||||
|
emqx_connector_schema:resource_opts_ref(?MODULE, s3_connector_resource_opts);
|
||||||
fields(s3_upload_parameters) ->
|
fields(s3_upload_parameters) ->
|
||||||
emqx_s3_schema:fields(s3_upload) ++
|
emqx_s3_schema:fields(s3_upload) ++
|
||||||
[
|
[
|
||||||
|
|
|
@ -95,6 +95,10 @@ connector_config(Name, _Config) ->
|
||||||
<<"pool_size">> => 4,
|
<<"pool_size">> => 4,
|
||||||
<<"max_retries">> => 0,
|
<<"max_retries">> => 0,
|
||||||
<<"enable_pipelining">> => 1
|
<<"enable_pipelining">> => 1
|
||||||
|
},
|
||||||
|
<<"resource_opts">> => #{
|
||||||
|
<<"health_check_interval">> => <<"5s">>,
|
||||||
|
<<"start_timeout">> => <<"5s">>
|
||||||
}
|
}
|
||||||
}).
|
}).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue