chore: make sure swagger's tags always titlecase
This commit is contained in:
parent
adcd899562
commit
dd59c850e0
|
@ -33,14 +33,8 @@
|
||||||
|
|
||||||
% Swagger
|
% Swagger
|
||||||
|
|
||||||
-define(API_TAGS_GLOBAL, [
|
-define(API_TAGS_GLOBAL, [<<"authentication">>]).
|
||||||
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
-define(API_TAGS_SINGLE, [<<"listener authentication">>]).
|
||||||
<<"authentication config(global)">>
|
|
||||||
]).
|
|
||||||
-define(API_TAGS_SINGLE, [
|
|
||||||
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
|
||||||
<<"authentication config(single listener)">>
|
|
||||||
]).
|
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
api_spec/0,
|
api_spec/0,
|
||||||
|
|
|
@ -32,11 +32,11 @@
|
||||||
|
|
||||||
-define(API_TAGS_GLOBAL, [
|
-define(API_TAGS_GLOBAL, [
|
||||||
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
||||||
<<"authentication config(global)">>
|
<<"authentication">>
|
||||||
]).
|
]).
|
||||||
-define(API_TAGS_SINGLE, [
|
-define(API_TAGS_SINGLE, [
|
||||||
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
?EMQX_AUTHENTICATION_CONFIG_ROOT_NAME_BINARY,
|
||||||
<<"authentication config(single listener)">>
|
<<"listener authentication">>
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-export([
|
-export([
|
||||||
|
|
|
@ -50,6 +50,8 @@
|
||||||
aggregate_metrics/1
|
aggregate_metrics/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
|
-define(TAGS, [<<"Authorization">>]).
|
||||||
|
|
||||||
api_spec() ->
|
api_spec() ->
|
||||||
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true}).
|
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true}).
|
||||||
|
|
||||||
|
@ -70,6 +72,7 @@ schema("/authorization/sources") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_get),
|
description => ?DESC(authorization_sources_get),
|
||||||
|
tags => ?TAGS,
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
200 => mk(
|
200 => mk(
|
||||||
|
@ -81,6 +84,7 @@ schema("/authorization/sources") ->
|
||||||
post =>
|
post =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_post),
|
description => ?DESC(authorization_sources_post),
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => mk(
|
'requestBody' => mk(
|
||||||
hoconsc:union(authz_sources_type_refs()),
|
hoconsc:union(authz_sources_type_refs()),
|
||||||
#{desc => ?DESC(source_config)}
|
#{desc => ?DESC(source_config)}
|
||||||
|
@ -101,6 +105,7 @@ schema("/authorization/sources/:type") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_type_get),
|
description => ?DESC(authorization_sources_type_get),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => parameters_field(),
|
parameters => parameters_field(),
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -114,6 +119,7 @@ schema("/authorization/sources/:type") ->
|
||||||
put =>
|
put =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_type_put),
|
description => ?DESC(authorization_sources_type_put),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => parameters_field(),
|
parameters => parameters_field(),
|
||||||
'requestBody' => mk(hoconsc:union(authz_sources_type_refs())),
|
'requestBody' => mk(hoconsc:union(authz_sources_type_refs())),
|
||||||
responses =>
|
responses =>
|
||||||
|
@ -125,6 +131,7 @@ schema("/authorization/sources/:type") ->
|
||||||
delete =>
|
delete =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_type_delete),
|
description => ?DESC(authorization_sources_type_delete),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => parameters_field(),
|
parameters => parameters_field(),
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -139,6 +146,7 @@ schema("/authorization/sources/:type/status") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_type_status_get),
|
description => ?DESC(authorization_sources_type_status_get),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => parameters_field(),
|
parameters => parameters_field(),
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -159,6 +167,7 @@ schema("/authorization/sources/:type/move") ->
|
||||||
post =>
|
post =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(authorization_sources_type_move_post),
|
description => ?DESC(authorization_sources_type_move_post),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => parameters_field(),
|
parameters => parameters_field(),
|
||||||
'requestBody' =>
|
'requestBody' =>
|
||||||
emqx_dashboard_swagger:schema_with_examples(
|
emqx_dashboard_swagger:schema_with_examples(
|
||||||
|
|
|
@ -44,12 +44,14 @@ schema("/mqtt/auto_subscribe") ->
|
||||||
'operationId' => auto_subscribe,
|
'operationId' => auto_subscribe,
|
||||||
get => #{
|
get => #{
|
||||||
description => ?DESC(list_auto_subscribe_api),
|
description => ?DESC(list_auto_subscribe_api),
|
||||||
|
tags => [<<"Auto subscribe">>],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe")
|
200 => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
put => #{
|
put => #{
|
||||||
description => ?DESC(update_auto_subscribe_api),
|
description => ?DESC(update_auto_subscribe_api),
|
||||||
|
tags => [<<"Auto subscribe">>],
|
||||||
'requestBody' => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe"),
|
'requestBody' => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe"),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe"),
|
200 => hoconsc:ref(emqx_auto_subscribe_schema, "auto_subscribe"),
|
||||||
|
|
|
@ -51,6 +51,7 @@ schema("/error_codes") ->
|
||||||
get => #{
|
get => #{
|
||||||
security => [],
|
security => [],
|
||||||
description => <<"API Error Codes">>,
|
description => <<"API Error Codes">>,
|
||||||
|
tags => [<<"Error Codes">>],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:array(hoconsc:ref(?MODULE, error_code))
|
200 => hoconsc:array(hoconsc:ref(?MODULE, error_code))
|
||||||
}
|
}
|
||||||
|
@ -62,6 +63,7 @@ schema("/error_codes/:code") ->
|
||||||
get => #{
|
get => #{
|
||||||
security => [],
|
security => [],
|
||||||
description => <<"API Error Codes">>,
|
description => <<"API Error Codes">>,
|
||||||
|
tags => [<<"Error Codes">>],
|
||||||
parameters => [
|
parameters => [
|
||||||
{code,
|
{code,
|
||||||
hoconsc:mk(hoconsc:enum(emqx_dashboard_error_code:all()), #{
|
hoconsc:mk(hoconsc:enum(emqx_dashboard_error_code:all()), #{
|
||||||
|
|
|
@ -37,7 +37,7 @@ schema("/monitor") ->
|
||||||
#{
|
#{
|
||||||
'operationId' => monitor,
|
'operationId' => monitor,
|
||||||
get => #{
|
get => #{
|
||||||
tags => [dashboard],
|
tags => [<<"metrics">>],
|
||||||
desc => <<"List monitor data.">>,
|
desc => <<"List monitor data.">>,
|
||||||
parameters => [parameter_latest()],
|
parameters => [parameter_latest()],
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -50,7 +50,7 @@ schema("/monitor/nodes/:node") ->
|
||||||
#{
|
#{
|
||||||
'operationId' => monitor,
|
'operationId' => monitor,
|
||||||
get => #{
|
get => #{
|
||||||
tags => [dashboard],
|
tags => [<<"metrics">>],
|
||||||
desc => <<"List the monitor data on the node.">>,
|
desc => <<"List the monitor data on the node.">>,
|
||||||
parameters => [parameter_node(), parameter_latest()],
|
parameters => [parameter_node(), parameter_latest()],
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -63,7 +63,7 @@ schema("/monitor_current") ->
|
||||||
#{
|
#{
|
||||||
'operationId' => monitor_current,
|
'operationId' => monitor_current,
|
||||||
get => #{
|
get => #{
|
||||||
tags => [dashboard],
|
tags => [<<"metrics">>],
|
||||||
desc => <<"Current status. Gauge and rate.">>,
|
desc => <<"Current status. Gauge and rate.">>,
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:ref(sampler_current), #{})
|
200 => hoconsc:mk(hoconsc:ref(sampler_current), #{})
|
||||||
|
@ -74,7 +74,7 @@ schema("/monitor_current/nodes/:node") ->
|
||||||
#{
|
#{
|
||||||
'operationId' => monitor_current,
|
'operationId' => monitor_current,
|
||||||
get => #{
|
get => #{
|
||||||
tags => [dashboard],
|
tags => [<<"metrics">>],
|
||||||
desc => <<"Node current status. Gauge and rate.">>,
|
desc => <<"Node current status. Gauge and rate.">>,
|
||||||
parameters => [parameter_node()],
|
parameters => [parameter_node()],
|
||||||
responses => #{
|
responses => #{
|
||||||
|
|
|
@ -338,10 +338,17 @@ to_spec(Meta, Params, RequestBody, Responses) ->
|
||||||
maps:put('requestBody', RequestBody, Spec).
|
maps:put('requestBody', RequestBody, Spec).
|
||||||
|
|
||||||
generate_method_desc(Spec = #{desc := _Desc}) ->
|
generate_method_desc(Spec = #{desc := _Desc}) ->
|
||||||
trans_description(maps:remove(desc, Spec), Spec);
|
Spec1 = trans_description(maps:remove(desc, Spec), Spec),
|
||||||
|
trans_tags(Spec1);
|
||||||
generate_method_desc(Spec = #{description := _Desc}) ->
|
generate_method_desc(Spec = #{description := _Desc}) ->
|
||||||
trans_description(Spec, Spec);
|
Spec1 = trans_description(Spec, Spec),
|
||||||
|
trans_tags(Spec1);
|
||||||
generate_method_desc(Spec) ->
|
generate_method_desc(Spec) ->
|
||||||
|
trans_tags(Spec).
|
||||||
|
|
||||||
|
trans_tags(Spec = #{tags := Tags}) ->
|
||||||
|
Spec#{tags => [string:titlecase(to_bin(Tag)) || Tag <- Tags]};
|
||||||
|
trans_tags(Spec) ->
|
||||||
Spec.
|
Spec.
|
||||||
|
|
||||||
parameters(Params, Module) ->
|
parameters(Params, Module) ->
|
||||||
|
|
|
@ -48,7 +48,7 @@ schema(?PREFIX ++ "/request") ->
|
||||||
#{
|
#{
|
||||||
operationId => request,
|
operationId => request,
|
||||||
post => #{
|
post => #{
|
||||||
tags => [<<"gateway|coap">>],
|
tags => [<<"coap">>],
|
||||||
desc => ?DESC(send_coap_request),
|
desc => ?DESC(send_coap_request),
|
||||||
parameters => request_parameters(),
|
parameters => request_parameters(),
|
||||||
requestBody => request_body(),
|
requestBody => request_body(),
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
|
|
||||||
-export([alarms/2]).
|
-export([alarms/2]).
|
||||||
|
|
||||||
|
-define(TAGS, [<<"alarms">>]).
|
||||||
|
|
||||||
%% internal export (for query)
|
%% internal export (for query)
|
||||||
-export([query/4]).
|
-export([query/4]).
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ schema("/alarms") ->
|
||||||
'operationId' => alarms,
|
'operationId' => alarms,
|
||||||
get => #{
|
get => #{
|
||||||
description => ?DESC(list_alarms_api),
|
description => ?DESC(list_alarms_api),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
hoconsc:ref(emqx_dashboard_swagger, page),
|
hoconsc:ref(emqx_dashboard_swagger, page),
|
||||||
hoconsc:ref(emqx_dashboard_swagger, limit),
|
hoconsc:ref(emqx_dashboard_swagger, limit),
|
||||||
|
@ -59,6 +62,7 @@ schema("/alarms") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => ?DESC(delete_alarms_api),
|
description => ?DESC(delete_alarms_api),
|
||||||
|
tags => ?TAGS,
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => ?DESC(delete_alarms_api_response204)
|
204 => ?DESC(delete_alarms_api_response204)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
-export([api_spec/0, fields/1, paths/0, schema/1, namespace/0]).
|
-export([api_spec/0, fields/1, paths/0, schema/1, namespace/0]).
|
||||||
-export([api_key/2, api_key_by_name/2]).
|
-export([api_key/2, api_key_by_name/2]).
|
||||||
-export([validate_name/1]).
|
-export([validate_name/1]).
|
||||||
|
-define(TAGS, [<<"API keys">>]).
|
||||||
|
|
||||||
namespace() -> "api_key".
|
namespace() -> "api_key".
|
||||||
|
|
||||||
|
@ -36,12 +37,14 @@ schema("/api_key") ->
|
||||||
'operationId' => api_key,
|
'operationId' => api_key,
|
||||||
get => #{
|
get => #{
|
||||||
description => "Return api_key list",
|
description => "Return api_key list",
|
||||||
|
tags => ?TAGS,
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => delete([api_secret], fields(app))
|
200 => delete([api_secret], fields(app))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
post => #{
|
post => #{
|
||||||
description => "Create new api_key",
|
description => "Create new api_key",
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => delete([created_at, api_key, api_secret], fields(app)),
|
'requestBody' => delete([created_at, api_key, api_secret], fields(app)),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(app),
|
200 => hoconsc:ref(app),
|
||||||
|
@ -54,6 +57,7 @@ schema("/api_key/:name") ->
|
||||||
'operationId' => api_key_by_name,
|
'operationId' => api_key_by_name,
|
||||||
get => #{
|
get => #{
|
||||||
description => "Return the specific api_key",
|
description => "Return the specific api_key",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => delete([api_secret], fields(app)),
|
200 => delete([api_secret], fields(app)),
|
||||||
|
@ -62,6 +66,7 @@ schema("/api_key/:name") ->
|
||||||
},
|
},
|
||||||
put => #{
|
put => #{
|
||||||
description => "Update the specific api_key",
|
description => "Update the specific api_key",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
'requestBody' => delete([created_at, api_key, api_secret, name], fields(app)),
|
'requestBody' => delete([created_at, api_key, api_secret, name], fields(app)),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -71,6 +76,7 @@ schema("/api_key/:name") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => "Delete the specific api_key",
|
description => "Delete the specific api_key",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Delete successfully">>,
|
204 => <<"Delete successfully">>,
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-define(TAB, emqx_banned).
|
-define(TAB, emqx_banned).
|
||||||
|
-define(TAGS, [<<"Banned">>]).
|
||||||
|
|
||||||
-define(BANNED_TYPES, [clientid, username, peerhost]).
|
-define(BANNED_TYPES, [clientid, username, peerhost]).
|
||||||
|
|
||||||
|
@ -55,6 +56,7 @@ schema("/banned") ->
|
||||||
'operationId' => banned,
|
'operationId' => banned,
|
||||||
get => #{
|
get => #{
|
||||||
description => ?DESC(list_banned_api),
|
description => ?DESC(list_banned_api),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
hoconsc:ref(emqx_dashboard_swagger, page),
|
hoconsc:ref(emqx_dashboard_swagger, page),
|
||||||
hoconsc:ref(emqx_dashboard_swagger, limit)
|
hoconsc:ref(emqx_dashboard_swagger, limit)
|
||||||
|
@ -68,6 +70,7 @@ schema("/banned") ->
|
||||||
},
|
},
|
||||||
post => #{
|
post => #{
|
||||||
description => ?DESC(create_banned_api),
|
description => ?DESC(create_banned_api),
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => hoconsc:mk(hoconsc:ref(ban)),
|
'requestBody' => hoconsc:mk(hoconsc:ref(ban)),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => [{data, hoconsc:mk(hoconsc:array(hoconsc:ref(ban)), #{})}],
|
200 => [{data, hoconsc:mk(hoconsc:array(hoconsc:ref(ban)), #{})}],
|
||||||
|
@ -83,6 +86,7 @@ schema("/banned/:as/:who") ->
|
||||||
'operationId' => delete_banned,
|
'operationId' => delete_banned,
|
||||||
delete => #{
|
delete => #{
|
||||||
description => ?DESC(delete_banned_api),
|
description => ?DESC(delete_banned_api),
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
{as,
|
{as,
|
||||||
hoconsc:mk(hoconsc:enum(?BANNED_TYPES), #{
|
hoconsc:mk(hoconsc:enum(?BANNED_TYPES), #{
|
||||||
|
|
|
@ -54,6 +54,7 @@
|
||||||
-export([do_subscribe/3]).
|
-export([do_subscribe/3]).
|
||||||
|
|
||||||
-define(CLIENT_QTAB, emqx_channel_info).
|
-define(CLIENT_QTAB, emqx_channel_info).
|
||||||
|
-define(TAGS, [<<"Clients">>]).
|
||||||
|
|
||||||
-define(CLIENT_QSCHEMA, [
|
-define(CLIENT_QSCHEMA, [
|
||||||
{<<"node">>, atom},
|
{<<"node">>, atom},
|
||||||
|
@ -100,6 +101,7 @@ schema("/clients") ->
|
||||||
'operationId' => clients,
|
'operationId' => clients,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"List clients">>,
|
description => <<"List clients">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
hoconsc:ref(emqx_dashboard_swagger, page),
|
hoconsc:ref(emqx_dashboard_swagger, page),
|
||||||
hoconsc:ref(emqx_dashboard_swagger, limit),
|
hoconsc:ref(emqx_dashboard_swagger, limit),
|
||||||
|
@ -220,6 +222,7 @@ schema("/clients/:clientid") ->
|
||||||
'operationId' => client,
|
'operationId' => client,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"Get clients info by client ID">>,
|
description => <<"Get clients info by client ID">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:ref(?MODULE, client), #{}),
|
200 => hoconsc:mk(hoconsc:ref(?MODULE, client), #{}),
|
||||||
|
@ -230,6 +233,7 @@ schema("/clients/:clientid") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => <<"Kick out client by client ID">>,
|
description => <<"Kick out client by client ID">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
{clientid, hoconsc:mk(binary(), #{in => path})}
|
{clientid, hoconsc:mk(binary(), #{in => path})}
|
||||||
],
|
],
|
||||||
|
@ -246,6 +250,7 @@ schema("/clients/:clientid/authorization/cache") ->
|
||||||
'operationId' => authz_cache,
|
'operationId' => authz_cache,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"Get client authz cache in the cluster.">>,
|
description => <<"Get client authz cache in the cluster.">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:ref(?MODULE, authz_cache), #{}),
|
200 => hoconsc:mk(hoconsc:ref(?MODULE, authz_cache), #{}),
|
||||||
|
@ -256,6 +261,7 @@ schema("/clients/:clientid/authorization/cache") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => <<"Clean client authz cache in the cluster.">>,
|
description => <<"Clean client authz cache in the cluster.">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Kick out client successfully">>,
|
204 => <<"Kick out client successfully">>,
|
||||||
|
@ -270,6 +276,7 @@ schema("/clients/:clientid/subscriptions") ->
|
||||||
'operationId' => subscriptions,
|
'operationId' => subscriptions,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"Get client subscriptions">>,
|
description => <<"Get client subscriptions">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(
|
200 => hoconsc:mk(
|
||||||
|
@ -286,6 +293,7 @@ schema("/clients/:clientid/subscribe") ->
|
||||||
'operationId' => subscribe,
|
'operationId' => subscribe,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Subscribe">>,
|
description => <<"Subscribe">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, subscribe)),
|
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, subscribe)),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -301,6 +309,7 @@ schema("/clients/:clientid/subscribe/bulk") ->
|
||||||
'operationId' => subscribe_batch,
|
'operationId' => subscribe_batch,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Subscribe">>,
|
description => <<"Subscribe">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, subscribe))),
|
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, subscribe))),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -316,6 +325,7 @@ schema("/clients/:clientid/unsubscribe") ->
|
||||||
'operationId' => unsubscribe,
|
'operationId' => unsubscribe,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Unsubscribe">>,
|
description => <<"Unsubscribe">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, unsubscribe)),
|
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, unsubscribe)),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -331,6 +341,7 @@ schema("/clients/:clientid/unsubscribe/bulk") ->
|
||||||
'operationId' => unsubscribe_batch,
|
'operationId' => unsubscribe_batch,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Unsubscribe">>,
|
description => <<"Unsubscribe">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, unsubscribe))),
|
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, unsubscribe))),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
@ -346,6 +357,7 @@ schema("/clients/:clientid/keepalive") ->
|
||||||
'operationId' => set_keepalive,
|
'operationId' => set_keepalive,
|
||||||
put => #{
|
put => #{
|
||||||
description => <<"Set the online client keepalive by seconds">>,
|
description => <<"Set the online client keepalive by seconds">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
parameters => [{clientid, hoconsc:mk(binary(), #{in => path})}],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, keepalive)),
|
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, keepalive)),
|
||||||
responses => #{
|
responses => #{
|
||||||
|
|
|
@ -40,6 +40,7 @@ schema("/cluster") ->
|
||||||
'operationId' => cluster_info,
|
'operationId' => cluster_info,
|
||||||
get => #{
|
get => #{
|
||||||
description => "Get cluster info",
|
description => "Get cluster info",
|
||||||
|
tags => [<<"Cluster">>],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => [
|
200 => [
|
||||||
{name, ?HOCON(string(), #{desc => "Cluster name"})},
|
{name, ?HOCON(string(), #{desc => "Cluster name"})},
|
||||||
|
@ -54,6 +55,7 @@ schema("/cluster/:node/invite") ->
|
||||||
'operationId' => invite_node,
|
'operationId' => invite_node,
|
||||||
put => #{
|
put => #{
|
||||||
description => "Invite node to cluster",
|
description => "Invite node to cluster",
|
||||||
|
tags => [<<"Cluster">>],
|
||||||
parameters => [hoconsc:ref(node)],
|
parameters => [hoconsc:ref(node)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => <<"ok">>,
|
200 => <<"ok">>,
|
||||||
|
@ -66,6 +68,7 @@ schema("/cluster/:node/force_leave") ->
|
||||||
'operationId' => force_leave,
|
'operationId' => force_leave,
|
||||||
delete => #{
|
delete => #{
|
||||||
description => "Force leave node from cluster",
|
description => "Force leave node from cluster",
|
||||||
|
tags => [<<"Cluster">>],
|
||||||
parameters => [hoconsc:ref(node)],
|
parameters => [hoconsc:ref(node)],
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Delete successfully">>,
|
204 => <<"Delete successfully">>,
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
-import(hoconsc, [mk/2, ref/2]).
|
-import(hoconsc, [mk/2, ref/2]).
|
||||||
|
|
||||||
%% minirest/dashbaord_swagger behaviour callbacks
|
%% minirest/dashboard_swagger behaviour callbacks
|
||||||
-export([
|
-export([
|
||||||
api_spec/0,
|
api_spec/0,
|
||||||
paths/0,
|
paths/0,
|
||||||
|
@ -74,6 +74,7 @@ schema("/metrics") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"EMQX metrics">>,
|
description => <<"EMQX metrics">>,
|
||||||
|
tags => [<<"Metrics">>],
|
||||||
parameters =>
|
parameters =>
|
||||||
[
|
[
|
||||||
{aggregate,
|
{aggregate,
|
||||||
|
|
|
@ -64,6 +64,7 @@ schema("/nodes") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"List EMQX nodes">>,
|
description => <<"List EMQX nodes">>,
|
||||||
|
tags => [<<"Nodes">>],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
200 => mk(
|
200 => mk(
|
||||||
|
@ -79,6 +80,7 @@ schema("/nodes/:node") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Get node info">>,
|
description => <<"Get node info">>,
|
||||||
|
tags => [<<"Nodes">>],
|
||||||
parameters => [ref(node_name)],
|
parameters => [ref(node_name)],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -96,6 +98,7 @@ schema("/nodes/:node/metrics") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Get node metrics">>,
|
description => <<"Get node metrics">>,
|
||||||
|
tags => [<<"Nodes">>],
|
||||||
parameters => [ref(node_name)],
|
parameters => [ref(node_name)],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -113,6 +116,7 @@ schema("/nodes/:node/stats") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Get node stats">>,
|
description => <<"Get node stats">>,
|
||||||
|
tags => [<<"Nodes">>],
|
||||||
parameters => [ref(node_name)],
|
parameters => [ref(node_name)],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
|
|
@ -48,6 +48,7 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-define(NAME_RE, "^[A-Za-z]+[A-Za-z0-9-_.]*$").
|
-define(NAME_RE, "^[A-Za-z]+[A-Za-z0-9-_.]*$").
|
||||||
|
-define(TAGS, [<<"Plugins">>]).
|
||||||
|
|
||||||
namespace() -> "plugins".
|
namespace() -> "plugins".
|
||||||
|
|
||||||
|
@ -72,6 +73,7 @@ schema("/plugins") ->
|
||||||
"List all install plugins.</br>"
|
"List all install plugins.</br>"
|
||||||
"Plugins are launched in top-down order.</br>"
|
"Plugins are launched in top-down order.</br>"
|
||||||
"Using `POST /plugins/{name}/move` to change the boot order.",
|
"Using `POST /plugins/{name}/move` to change the boot order.",
|
||||||
|
tags => ?TAGS,
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:array(hoconsc:ref(plugin))
|
200 => hoconsc:array(hoconsc:ref(plugin))
|
||||||
}
|
}
|
||||||
|
@ -85,6 +87,7 @@ schema("/plugins/install") ->
|
||||||
"Install a plugin(plugin-vsn.tar.gz)."
|
"Install a plugin(plugin-vsn.tar.gz)."
|
||||||
"Follow [emqx-plugin-template](https://github.com/emqx/emqx-plugin-template) "
|
"Follow [emqx-plugin-template](https://github.com/emqx/emqx-plugin-template) "
|
||||||
"to develop plugin.",
|
"to develop plugin.",
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => #{
|
'requestBody' => #{
|
||||||
content => #{
|
content => #{
|
||||||
'multipart/form-data' => #{
|
'multipart/form-data' => #{
|
||||||
|
@ -111,6 +114,7 @@ schema("/plugins/:name") ->
|
||||||
'operationId' => plugin,
|
'operationId' => plugin,
|
||||||
get => #{
|
get => #{
|
||||||
description => "Describe a plugin according `release.json` and `README.md`.",
|
description => "Describe a plugin according `release.json` and `README.md`.",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(plugin),
|
200 => hoconsc:ref(plugin),
|
||||||
|
@ -119,6 +123,7 @@ schema("/plugins/:name") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => "Uninstall a plugin package.",
|
description => "Uninstall a plugin package.",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Uninstall successfully">>,
|
204 => <<"Uninstall successfully">>,
|
||||||
|
@ -134,6 +139,7 @@ schema("/plugins/:name/:action") ->
|
||||||
"start/stop a installed plugin.</br>"
|
"start/stop a installed plugin.</br>"
|
||||||
"- **start**: start the plugin.</br>"
|
"- **start**: start the plugin.</br>"
|
||||||
"- **stop**: stop the plugin.</br>",
|
"- **stop**: stop the plugin.</br>",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
hoconsc:ref(name),
|
hoconsc:ref(name),
|
||||||
{action, hoconsc:mk(hoconsc:enum([start, stop]), #{desc => "Action", in => path})}
|
{action, hoconsc:mk(hoconsc:enum([start, stop]), #{desc => "Action", in => path})}
|
||||||
|
@ -149,6 +155,7 @@ schema("/plugins/:name/move") ->
|
||||||
'operationId' => update_boot_order,
|
'operationId' => update_boot_order,
|
||||||
post => #{
|
post => #{
|
||||||
description => "Setting the boot order of plugins.",
|
description => "Setting the boot order of plugins.",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
'requestBody' => move_request_body(),
|
'requestBody' => move_request_body(),
|
||||||
responses => #{200 => <<"OK">>}
|
responses => #{200 => <<"OK">>}
|
||||||
|
|
|
@ -43,6 +43,7 @@ schema("/publish") ->
|
||||||
'operationId' => publish,
|
'operationId' => publish,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Publish Message">>,
|
description => <<"Publish Message">>,
|
||||||
|
tags => [<<"Mqtt">>],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, publish_message)),
|
'requestBody' => hoconsc:mk(hoconsc:ref(?MODULE, publish_message)),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:ref(?MODULE, publish_message_info))
|
200 => hoconsc:mk(hoconsc:ref(?MODULE, publish_message_info))
|
||||||
|
@ -54,6 +55,7 @@ schema("/publish/bulk") ->
|
||||||
'operationId' => publish_batch,
|
'operationId' => publish_batch,
|
||||||
post => #{
|
post => #{
|
||||||
description => <<"Publish Messages">>,
|
description => <<"Publish Messages">>,
|
||||||
|
tags => [<<"Mqtt">>],
|
||||||
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, publish_message)), #{}),
|
'requestBody' => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, publish_message)), #{}),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, publish_message_info)), #{})
|
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, publish_message_info)), #{})
|
||||||
|
|
|
@ -50,7 +50,7 @@ schema("/stats") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"EMQX stats">>,
|
description => <<"EMQX stats">>,
|
||||||
tags => [<<"stats">>],
|
tags => [<<"metrics">>],
|
||||||
parameters => [ref(aggregate)],
|
parameters => [ref(aggregate)],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
|
|
@ -37,6 +37,7 @@ schema("/status") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Node running status">>,
|
description => <<"Node running status">>,
|
||||||
|
tags => [<<"Status">>],
|
||||||
security => [],
|
security => [],
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
|
|
@ -60,6 +60,7 @@ schema("/subscriptions") ->
|
||||||
'operationId' => subscriptions,
|
'operationId' => subscriptions,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"List subscriptions">>,
|
description => <<"List subscriptions">>,
|
||||||
|
tags => [<<"Subscriptions">>],
|
||||||
parameters => parameters(),
|
parameters => parameters(),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, subscription)), #{})
|
200 => hoconsc:mk(hoconsc:array(hoconsc:ref(?MODULE, subscription)), #{})
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
-export([sys/2]).
|
-export([sys/2]).
|
||||||
|
|
||||||
-define(TAGS, [<<"sys">>]).
|
-define(TAGS, [<<"system topics">>]).
|
||||||
|
|
||||||
namespace() -> "sys".
|
namespace() -> "sys".
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
-define(TOPIC_NOT_FOUND, 'TOPIC_NOT_FOUND').
|
-define(TOPIC_NOT_FOUND, 'TOPIC_NOT_FOUND').
|
||||||
|
|
||||||
-define(TOPICS_QUERY_SCHEMA, [{<<"topic">>, binary}, {<<"node">>, atom}]).
|
-define(TOPICS_QUERY_SCHEMA, [{<<"topic">>, binary}, {<<"node">>, atom}]).
|
||||||
|
-define(TAGS, [<<"Topics">>]).
|
||||||
|
|
||||||
api_spec() ->
|
api_spec() ->
|
||||||
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true, translate_body => true}).
|
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true, translate_body => true}).
|
||||||
|
@ -51,6 +52,7 @@ schema("/topics") ->
|
||||||
'operationId' => topics,
|
'operationId' => topics,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"Topics list">>,
|
description => <<"Topics list">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
topic_param(query),
|
topic_param(query),
|
||||||
node_param(),
|
node_param(),
|
||||||
|
@ -70,6 +72,7 @@ schema("/topics/:topic") ->
|
||||||
'operationId' => topic,
|
'operationId' => topic,
|
||||||
get => #{
|
get => #{
|
||||||
description => <<"Lookup topic info by name">>,
|
description => <<"Lookup topic info by name">>,
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [topic_param(path)],
|
parameters => [topic_param(path)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:mk(hoconsc:ref(topic), #{}),
|
200 => hoconsc:mk(hoconsc:ref(topic), #{}),
|
||||||
|
|
|
@ -47,6 +47,7 @@
|
||||||
|
|
||||||
-define(TO_BIN(_B_), iolist_to_binary(_B_)).
|
-define(TO_BIN(_B_), iolist_to_binary(_B_)).
|
||||||
-define(NOT_FOUND(N), {404, #{code => 'NOT_FOUND', message => ?TO_BIN([N, " NOT FOUND"])}}).
|
-define(NOT_FOUND(N), {404, #{code => 'NOT_FOUND', message => ?TO_BIN([N, " NOT FOUND"])}}).
|
||||||
|
-define(TAGS, [<<"Trace">>]).
|
||||||
|
|
||||||
namespace() -> "trace".
|
namespace() -> "trace".
|
||||||
|
|
||||||
|
@ -61,12 +62,14 @@ schema("/trace") ->
|
||||||
'operationId' => trace,
|
'operationId' => trace,
|
||||||
get => #{
|
get => #{
|
||||||
description => "List all trace",
|
description => "List all trace",
|
||||||
|
tags => ?TAGS,
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(trace)
|
200 => hoconsc:ref(trace)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
post => #{
|
post => #{
|
||||||
description => "Create new trace",
|
description => "Create new trace",
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => delete([status, log_size], fields(trace)),
|
'requestBody' => delete([status, log_size], fields(trace)),
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(trace),
|
200 => hoconsc:ref(trace),
|
||||||
|
@ -82,6 +85,7 @@ schema("/trace") ->
|
||||||
},
|
},
|
||||||
delete => #{
|
delete => #{
|
||||||
description => "Clear all traces",
|
description => "Clear all traces",
|
||||||
|
tags => ?TAGS,
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"No Content">>
|
204 => <<"No Content">>
|
||||||
}
|
}
|
||||||
|
@ -92,6 +96,7 @@ schema("/trace/:name") ->
|
||||||
'operationId' => delete_trace,
|
'operationId' => delete_trace,
|
||||||
delete => #{
|
delete => #{
|
||||||
description => "Delete trace by name",
|
description => "Delete trace by name",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Delete successfully">>,
|
204 => <<"Delete successfully">>,
|
||||||
|
@ -104,6 +109,7 @@ schema("/trace/:name/stop") ->
|
||||||
'operationId' => update_trace,
|
'operationId' => update_trace,
|
||||||
put => #{
|
put => #{
|
||||||
description => "Stop trace by name",
|
description => "Stop trace by name",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name)],
|
parameters => [hoconsc:ref(name)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 => hoconsc:ref(trace),
|
200 => hoconsc:ref(trace),
|
||||||
|
@ -116,6 +122,7 @@ schema("/trace/:name/download") ->
|
||||||
'operationId' => download_trace_log,
|
'operationId' => download_trace_log,
|
||||||
get => #{
|
get => #{
|
||||||
description => "Download trace log by name",
|
description => "Download trace log by name",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [hoconsc:ref(name), hoconsc:ref(node)],
|
parameters => [hoconsc:ref(name), hoconsc:ref(node)],
|
||||||
responses => #{
|
responses => #{
|
||||||
200 =>
|
200 =>
|
||||||
|
@ -134,6 +141,7 @@ schema("/trace/:name/log") ->
|
||||||
'operationId' => stream_log_file,
|
'operationId' => stream_log_file,
|
||||||
get => #{
|
get => #{
|
||||||
description => "view trace log",
|
description => "view trace log",
|
||||||
|
tags => ?TAGS,
|
||||||
parameters => [
|
parameters => [
|
||||||
hoconsc:ref(name),
|
hoconsc:ref(name),
|
||||||
hoconsc:ref(bytes),
|
hoconsc:ref(bytes),
|
||||||
|
|
|
@ -52,12 +52,14 @@ schema("/telemetry/status") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(get_telemetry_status_api),
|
description => ?DESC(get_telemetry_status_api),
|
||||||
|
tags => [<<"Telemetry">>],
|
||||||
responses =>
|
responses =>
|
||||||
#{200 => status_schema(?DESC(get_telemetry_status_api))}
|
#{200 => status_schema(?DESC(get_telemetry_status_api))}
|
||||||
},
|
},
|
||||||
put =>
|
put =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(update_telemetry_status_api),
|
description => ?DESC(update_telemetry_status_api),
|
||||||
|
tags => [<<"Telemetry">>],
|
||||||
'requestBody' => status_schema(?DESC(update_telemetry_status_api)),
|
'requestBody' => status_schema(?DESC(update_telemetry_status_api)),
|
||||||
responses =>
|
responses =>
|
||||||
#{
|
#{
|
||||||
|
@ -71,6 +73,7 @@ schema("/telemetry/data") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => ?DESC(get_telemetry_data_api),
|
description => ?DESC(get_telemetry_data_api),
|
||||||
|
tags => [<<"Telemetry">>],
|
||||||
responses =>
|
responses =>
|
||||||
#{200 => mk(ref(?MODULE, telemetry), #{desc => ?DESC(get_telemetry_data_api)})}
|
#{200 => mk(ref(?MODULE, telemetry), #{desc => ?DESC(get_telemetry_data_api)})}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-define(SCHEMA_MODULE, emqx_prometheus_schema).
|
-define(SCHEMA_MODULE, emqx_prometheus_schema).
|
||||||
|
-define(TAGS, [<<"monitor">>]).
|
||||||
|
|
||||||
api_spec() ->
|
api_spec() ->
|
||||||
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true}).
|
emqx_dashboard_swagger:spec(?MODULE, #{check_schema => true}).
|
||||||
|
@ -50,12 +51,14 @@ schema("/prometheus") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Get Prometheus config info">>,
|
description => <<"Get Prometheus config info">>,
|
||||||
|
tags => ?TAGS,
|
||||||
responses =>
|
responses =>
|
||||||
#{200 => prometheus_config_schema()}
|
#{200 => prometheus_config_schema()}
|
||||||
},
|
},
|
||||||
put =>
|
put =>
|
||||||
#{
|
#{
|
||||||
description => <<"Update Prometheus config">>,
|
description => <<"Update Prometheus config">>,
|
||||||
|
tags => ?TAGS,
|
||||||
'requestBody' => prometheus_config_schema(),
|
'requestBody' => prometheus_config_schema(),
|
||||||
responses =>
|
responses =>
|
||||||
#{200 => prometheus_config_schema()}
|
#{200 => prometheus_config_schema()}
|
||||||
|
@ -67,6 +70,7 @@ schema("/prometheus/stats") ->
|
||||||
get =>
|
get =>
|
||||||
#{
|
#{
|
||||||
description => <<"Get Prometheus Data">>,
|
description => <<"Get Prometheus Data">>,
|
||||||
|
tags => ?TAGS,
|
||||||
security => [],
|
security => [],
|
||||||
responses =>
|
responses =>
|
||||||
#{200 => prometheus_data_schema()}
|
#{200 => prometheus_data_schema()}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
-export([api_spec/0, paths/0, schema/1, fields/1, namespace/0]).
|
-export([api_spec/0, paths/0, schema/1, fields/1, namespace/0]).
|
||||||
|
|
||||||
-export([slow_subs/2, get_history/0, settings/2]).
|
-export([slow_subs/2, get_history/0, settings/2]).
|
||||||
|
-define(TAGS, [<<"Slow subscriptions">>]).
|
||||||
|
|
||||||
-import(hoconsc, [mk/2, ref/1, ref/2]).
|
-import(hoconsc, [mk/2, ref/1, ref/2]).
|
||||||
-import(emqx_mgmt_util, [bad_request/0]).
|
-import(emqx_mgmt_util, [bad_request/0]).
|
||||||
|
@ -44,14 +45,14 @@ schema(("/slow_subscriptions")) ->
|
||||||
#{
|
#{
|
||||||
'operationId' => slow_subs,
|
'operationId' => slow_subs,
|
||||||
delete => #{
|
delete => #{
|
||||||
tags => [<<"slow subs">>],
|
tags => ?TAGS,
|
||||||
description => ?DESC(clear_records_api),
|
description => ?DESC(clear_records_api),
|
||||||
parameters => [],
|
parameters => [],
|
||||||
'requestBody' => [],
|
'requestBody' => [],
|
||||||
responses => #{204 => <<"No Content">>}
|
responses => #{204 => <<"No Content">>}
|
||||||
},
|
},
|
||||||
get => #{
|
get => #{
|
||||||
tags => [<<"slow subs">>],
|
tags => ?TAGS,
|
||||||
description => ?DESC(get_records_api),
|
description => ?DESC(get_records_api),
|
||||||
parameters => [
|
parameters => [
|
||||||
ref(emqx_dashboard_swagger, page),
|
ref(emqx_dashboard_swagger, page),
|
||||||
|
@ -65,12 +66,12 @@ schema("/slow_subscriptions/settings") ->
|
||||||
#{
|
#{
|
||||||
'operationId' => settings,
|
'operationId' => settings,
|
||||||
get => #{
|
get => #{
|
||||||
tags => [<<"slow subs">>],
|
tags => ?TAGS,
|
||||||
description => ?DESC(get_setting_api),
|
description => ?DESC(get_setting_api),
|
||||||
responses => #{200 => conf_schema()}
|
responses => #{200 => conf_schema()}
|
||||||
},
|
},
|
||||||
put => #{
|
put => #{
|
||||||
tags => [<<"slow subs">>],
|
tags => ?TAGS,
|
||||||
description => ?DESC(update_setting_api),
|
description => ?DESC(update_setting_api),
|
||||||
'requestBody' => conf_schema(),
|
'requestBody' => conf_schema(),
|
||||||
responses => #{200 => conf_schema()}
|
responses => #{200 => conf_schema()}
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
schema/1
|
schema/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-define(API_TAG_STATSD, [<<"statsd">>]).
|
-define(API_TAG_STATSD, [<<"monitor">>]).
|
||||||
-define(SCHEMA_MODULE, emqx_statsd_schema).
|
-define(SCHEMA_MODULE, emqx_statsd_schema).
|
||||||
|
|
||||||
-define(INTERNAL_ERROR, 'INTERNAL_ERROR').
|
-define(INTERNAL_ERROR, 'INTERNAL_ERROR').
|
||||||
|
|
Loading…
Reference in New Issue