chore: add emqx_management_proto_v4
This commit is contained in:
parent
fc806c4acd
commit
48c53d8b32
|
@ -2,7 +2,7 @@
|
|||
{application, emqx_management, [
|
||||
{description, "EMQX Management API and CLI"},
|
||||
% strict semver, bump manually!
|
||||
{vsn, "5.0.23"},
|
||||
{vsn, "5.0.24"},
|
||||
{modules, []},
|
||||
{registered, [emqx_management_sup]},
|
||||
{applications, [kernel, stdlib, emqx_plugins, minirest, emqx, emqx_ctl]},
|
||||
|
|
|
@ -326,7 +326,7 @@ kickout_client(Node, ClientId) ->
|
|||
|
||||
kickout_clients(ClientIds) when is_list(ClientIds) ->
|
||||
F = fun(Node) ->
|
||||
emqx_management_proto_v3:kickout_clients(Node, ClientIds)
|
||||
emqx_management_proto_v4:kickout_clients(Node, ClientIds)
|
||||
end,
|
||||
Results = lists:map(F, emqx:running_nodes()),
|
||||
case lists:filter(fun(Res) -> Res =/= ok end, Results) of
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
call_client/3,
|
||||
|
||||
get_full_config/1,
|
||||
|
||||
kickout_clients/2
|
||||
get_full_config/1
|
||||
]).
|
||||
|
||||
-include_lib("emqx/include/bpapi.hrl").
|
||||
|
@ -80,7 +78,3 @@ call_client(Node, ClientId, Req) ->
|
|||
-spec get_full_config(node()) -> map() | list() | {badrpc, _}.
|
||||
get_full_config(Node) ->
|
||||
rpc:call(Node, emqx_mgmt_api_configs, get_full_config, []).
|
||||
|
||||
-spec kickout_clients(node(), [emqx_types:clientid()]) -> ok | {badrpc, _}.
|
||||
kickout_clients(Node, ClientIds) ->
|
||||
rpc:call(Node, emqx_mgmt, do_kickout_clients, [ClientIds]).
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
%%--------------------------------------------------------------------
|
||||
%% Copyright (c) 2022-2023 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||
%%
|
||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||
%% you may not use this file except in compliance with the License.
|
||||
%% You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing, software
|
||||
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
-module(emqx_management_proto_v4).
|
||||
|
||||
-behaviour(emqx_bpapi).
|
||||
|
||||
-export([
|
||||
introduced_in/0,
|
||||
|
||||
node_info/1,
|
||||
broker_info/1,
|
||||
list_subscriptions/1,
|
||||
|
||||
list_listeners/1,
|
||||
subscribe/3,
|
||||
unsubscribe/3,
|
||||
unsubscribe_batch/3,
|
||||
|
||||
call_client/3,
|
||||
|
||||
get_full_config/1,
|
||||
|
||||
kickout_clients/2
|
||||
]).
|
||||
|
||||
-include_lib("emqx/include/bpapi.hrl").
|
||||
|
||||
introduced_in() ->
|
||||
"5.1.0".
|
||||
|
||||
-spec unsubscribe_batch(node(), emqx_types:clientid(), [emqx_types:topic()]) ->
|
||||
{unsubscribe, _} | {error, _} | {badrpc, _}.
|
||||
unsubscribe_batch(Node, ClientId, Topics) ->
|
||||
rpc:call(Node, emqx_mgmt, do_unsubscribe_batch, [ClientId, Topics]).
|
||||
|
||||
-spec node_info([node()]) -> emqx_rpc:erpc_multicall(map()).
|
||||
node_info(Nodes) ->
|
||||
erpc:multicall(Nodes, emqx_mgmt, node_info, [], 30000).
|
||||
|
||||
-spec broker_info([node()]) -> emqx_rpc:erpc_multicall(map()).
|
||||
broker_info(Nodes) ->
|
||||
erpc:multicall(Nodes, emqx_mgmt, broker_info, [], 30000).
|
||||
|
||||
-spec list_subscriptions(node()) -> [map()] | {badrpc, _}.
|
||||
list_subscriptions(Node) ->
|
||||
rpc:call(Node, emqx_mgmt, do_list_subscriptions, []).
|
||||
|
||||
-spec list_listeners(node()) -> map() | {badrpc, _}.
|
||||
list_listeners(Node) ->
|
||||
rpc:call(Node, emqx_mgmt_api_listeners, do_list_listeners, []).
|
||||
|
||||
-spec subscribe(node(), emqx_types:clientid(), emqx_types:topic_filters()) ->
|
||||
{subscribe, _} | {error, atom()} | {badrpc, _}.
|
||||
subscribe(Node, ClientId, TopicTables) ->
|
||||
rpc:call(Node, emqx_mgmt, do_subscribe, [ClientId, TopicTables]).
|
||||
|
||||
-spec unsubscribe(node(), emqx_types:clientid(), emqx_types:topic()) ->
|
||||
{unsubscribe, _} | {error, _} | {badrpc, _}.
|
||||
unsubscribe(Node, ClientId, Topic) ->
|
||||
rpc:call(Node, emqx_mgmt, do_unsubscribe, [ClientId, Topic]).
|
||||
|
||||
-spec call_client(node(), emqx_types:clientid(), term()) -> term().
|
||||
call_client(Node, ClientId, Req) ->
|
||||
rpc:call(Node, emqx_mgmt, do_call_client, [ClientId, Req]).
|
||||
|
||||
-spec get_full_config(node()) -> map() | list() | {badrpc, _}.
|
||||
get_full_config(Node) ->
|
||||
rpc:call(Node, emqx_mgmt_api_configs, get_full_config, []).
|
||||
|
||||
-spec kickout_clients(node(), [emqx_types:clientid()]) -> ok | {badrpc, _}.
|
||||
kickout_clients(Node, ClientIds) ->
|
||||
rpc:call(Node, emqx_mgmt, do_kickout_clients, [ClientIds]).
|
Loading…
Reference in New Issue