|
|
@@ -0,0 +1,54 @@
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+%% Copyright (c) 2024 EMQ Technologies Co., Ltd. All Rights Reserved.
|
|
|
+%%--------------------------------------------------------------------
|
|
|
+
|
|
|
+-module(emqx_bridge_s3_sup).
|
|
|
+
|
|
|
+%% API
|
|
|
+-export([
|
|
|
+ start_link/0,
|
|
|
+ start_child/1,
|
|
|
+ delete_child/1
|
|
|
+]).
|
|
|
+
|
|
|
+%% `supervisor' API
|
|
|
+-export([init/1]).
|
|
|
+
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+%% Type declarations
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+%% API
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+
|
|
|
+start_link() ->
|
|
|
+ supervisor:start_link({local, ?MODULE}, ?MODULE, []).
|
|
|
+
|
|
|
+start_child(ChildSpec) ->
|
|
|
+ supervisor:start_child(?MODULE, ChildSpec).
|
|
|
+
|
|
|
+delete_child(ChildId) ->
|
|
|
+ case supervisor:terminate_child(?MODULE, ChildId) of
|
|
|
+ ok ->
|
|
|
+ supervisor:delete_child(?MODULE, ChildId);
|
|
|
+ Error ->
|
|
|
+ Error
|
|
|
+ end.
|
|
|
+
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+%% `supervisor' API
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+
|
|
|
+init([]) ->
|
|
|
+ SupFlags = #{
|
|
|
+ strategy => one_for_one,
|
|
|
+ intensity => 1,
|
|
|
+ period => 1
|
|
|
+ },
|
|
|
+ ChildSpecs = [],
|
|
|
+ {ok, {SupFlags, ChildSpecs}}.
|
|
|
+
|
|
|
+%%------------------------------------------------------------------------------
|
|
|
+%% Internal fns
|
|
|
+%%------------------------------------------------------------------------------
|