chore: hide cluster purge from cli and api for now

This commit is contained in:
Thales Macedo Garitezi 2023-08-22 16:30:15 -03:00
parent f988de4ff4
commit 5908b69353
3 changed files with 51 additions and 46 deletions

View File

@ -68,9 +68,10 @@ paths() ->
"/load_rebalance/:node/start", "/load_rebalance/:node/start",
"/load_rebalance/:node/stop", "/load_rebalance/:node/stop",
"/load_rebalance/:node/evacuation/start", "/load_rebalance/:node/evacuation/start",
"/load_rebalance/:node/evacuation/stop", "/load_rebalance/:node/evacuation/stop"
"/load_rebalance/:node/purge/start", %% TODO: uncomment after we officially release the feature.
"/load_rebalance/:node/purge/stop" %% "/load_rebalance/:node/purge/start",
%% "/load_rebalance/:node/purge/stop"
]. ].
schema("/load_rebalance/status") -> schema("/load_rebalance/status") ->
@ -179,42 +180,43 @@ schema("/load_rebalance/:node/evacuation/stop") ->
404 => error_codes([?NOT_FOUND], <<"Not Found">>) 404 => error_codes([?NOT_FOUND], <<"Not Found">>)
} }
} }
};
schema("/load_rebalance/:node/purge/start") ->
#{
'operationId' => '/load_rebalance/:node/purge/start',
post => #{
tags => [<<"load_rebalance">>],
summary => <<"Start purge on the whole cluster">>,
description => ?DESC("cluster_purge_start"),
parameters => [param_node()],
'requestBody' =>
emqx_dashboard_swagger:schema_with_examples(
ref(purge_start),
purge_example()
),
responses => #{
200 => response_schema(),
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
404 => error_codes([?NOT_FOUND], <<"Not Found">>)
}
}
};
schema("/load_rebalance/:node/purge/stop") ->
#{
'operationId' => '/load_rebalance/:node/purge/stop',
post => #{
tags => [<<"load_rebalance">>],
summary => <<"Stop purge on the whole cluster">>,
description => ?DESC("cluster_purge_stop"),
parameters => [param_node()],
responses => #{
200 => response_schema(),
400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
404 => error_codes([?NOT_FOUND], <<"Not Found">>)
}
}
}. }.
%% TODO: uncomment after we officially release the feature.
%% schema("/load_rebalance/:node/purge/start") ->
%% #{
%% 'operationId' => '/load_rebalance/:node/purge/start',
%% post => #{
%% tags => [<<"load_rebalance">>],
%% summary => <<"Start purge on the whole cluster">>,
%% description => ?DESC("cluster_purge_start"),
%% parameters => [param_node()],
%% 'requestBody' =>
%% emqx_dashboard_swagger:schema_with_examples(
%% ref(purge_start),
%% purge_example()
%% ),
%% responses => #{
%% 200 => response_schema(),
%% 400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
%% 404 => error_codes([?NOT_FOUND], <<"Not Found">>)
%% }
%% }
%% };
%% schema("/load_rebalance/:node/purge/stop") ->
%% #{
%% 'operationId' => '/load_rebalance/:node/purge/stop',
%% post => #{
%% tags => [<<"load_rebalance">>],
%% summary => <<"Stop purge on the whole cluster">>,
%% description => ?DESC("cluster_purge_stop"),
%% parameters => [param_node()],
%% responses => #{
%% 200 => response_schema(),
%% 400 => error_codes([?BAD_REQUEST], <<"Bad Request">>),
%% 404 => error_codes([?NOT_FOUND], <<"Not Found">>)
%% }
%% }
%% }.
%%-------------------------------------------------------------------- %%--------------------------------------------------------------------
%% Handlers %% Handlers
@ -849,8 +851,9 @@ rebalance_evacuation_example() ->
} }
}. }.
purge_example() -> %% TODO: uncomment after we officially release the feature.
#{purge => #{purge_rate => 100}}. %% purge_example() ->
%% #{purge => #{purge_rate => 100}}.
local_status_response_schema() -> local_status_response_schema() ->
hoconsc:union([ref(local_status_disabled), ref(local_status_enabled)]). hoconsc:union([ref(local_status_disabled), ref(local_status_enabled)]).

View File

@ -138,11 +138,12 @@ cli(_) ->
"Start current node evacuation with optional server redirect to the specified servers" "Start current node evacuation with optional server redirect to the specified servers"
}, },
{ %% TODO: uncomment after we officially release the feature.
"rebalance start --purge \\\n" %% {
" [--purge-rate CountPerSec]", %% "rebalance start --purge \\\n"
"Start purge on all running nodes in the cluster" %% " [--purge-rate CountPerSec]",
}, %% "Start purge on all running nodes in the cluster"
%% },
{ {
"rebalance start \\\n" "rebalance start \\\n"

View File

@ -120,7 +120,8 @@ t_start_evacuation_validation(Config) ->
api_get(["load_rebalance", "global_status"]) api_get(["load_rebalance", "global_status"])
). ).
t_start_purge_validation(Config) -> %% TODO: uncomment after we officially release the feature.
skipped_t_start_purge_validation(Config) ->
[Node1 | _] = ?config(cluster_nodes, Config), [Node1 | _] = ?config(cluster_nodes, Config),
Port1 = get_mqtt_port(Node1, tcp), Port1 = get_mqtt_port(Node1, tcp),
BadOpts = [ BadOpts = [