Merge pull request #8378 from lafirest/fix/hide_limiter_api

fix(api): temporarily hide the limiter's API
This commit is contained in:
lafirest 2022-07-01 17:14:33 +08:00 committed by GitHub
commit 62d822ee96
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 39 deletions

View File

@ -61,7 +61,8 @@
<<"event_message">>, <<"event_message">>,
<<"prometheus">>, <<"prometheus">>,
<<"telemetry">>, <<"telemetry">>,
<<"sys_topics">> <<"sys_topics">>,
<<"limiter">>
] ++ global_zone_roots() ] ++ global_zone_roots()
). ).
@ -74,8 +75,8 @@ paths() ->
[ [
"/configs", "/configs",
"/configs_reset/:rootname", "/configs_reset/:rootname",
"/configs/global_zone", "/configs/global_zone"
"/configs/limiter/:limiter_type" %% "/configs/limiter/:limiter_type"
] ++ ] ++
lists:map(fun({Name, _Type}) -> ?PREFIX ++ binary_to_list(Name) end, config_list()). lists:map(fun({Name, _Type}) -> ?PREFIX ++ binary_to_list(Name) end, config_list()).
@ -161,42 +162,42 @@ schema("/configs/global_zone") ->
} }
} }
}; };
schema("/configs/limiter/:limiter_type") -> %% schema("/configs/limiter/:limiter_type") ->
Schema = hoconsc:ref(emqx_limiter_schema, limiter_opts), %% Schema = hoconsc:ref(emqx_limiter_schema, limiter_opts),
Parameters = [ %% Parameters = [
{limiter_type, %% {limiter_type,
hoconsc:mk( %% hoconsc:mk(
hoconsc:enum(emqx_limiter_schema:types()), %% hoconsc:enum(emqx_limiter_schema:types()),
#{ %% #{
in => path, %% in => path,
required => true, %% required => true,
example => <<"bytes_in">>, %% example => <<"bytes_in">>,
desc => <<"The limiter type">> %% desc => <<"The limiter type">>
} %% }
)} %% )}
], %% ],
#{ %% #{
'operationId' => config, %% 'operationId' => config,
get => #{ %% get => #{
tags => [conf], %% tags => [conf],
description => <<"Get config of this limiter">>, %% description => <<"Get config of this limiter">>,
parameters => Parameters, %% parameters => Parameters,
responses => #{ %% responses => #{
200 => Schema, %% 200 => Schema,
404 => emqx_dashboard_swagger:error_codes(['NOT_FOUND'], <<"config not found">>) %% 404 => emqx_dashboard_swagger:error_codes(['NOT_FOUND'], <<"config not found">>)
} %% }
}, %% },
put => #{ %% put => #{
tags => [conf], %% tags => [conf],
description => <<"Update config of this limiter">>, %% description => <<"Update config of this limiter">>,
parameters => Parameters, %% parameters => Parameters,
'requestBody' => Schema, %% 'requestBody' => Schema,
responses => #{ %% responses => #{
200 => Schema, %% 200 => Schema,
400 => emqx_dashboard_swagger:error_codes(['UPDATE_FAILED']) %% 400 => emqx_dashboard_swagger:error_codes(['UPDATE_FAILED'])
} %% }
} %% }
}; %% };
schema(Path) -> schema(Path) ->
{RootKey, {_Root, Schema}} = find_schema(Path), {RootKey, {_Root, Schema}} = find_schema(Path),
#{ #{