diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2019-11-14 04:00:34 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2019-11-14 04:00:34 +0300 |
| commit | 343f486783382f9a3337963bd3523f41b4c2af9e (patch) | |
| tree | c2092d9e20bf2a96ccf488137e3fb6bf3fab91bb /src | |
| parent | b1c43ee74b9481a758d1558ba2ffc6ca66d87f15 (diff) | |
| download | rabbitmq-server-git-343f486783382f9a3337963bd3523f41b4c2af9e.tar.gz | |
Export runtime parameters and policies
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_definitions.erl | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/rabbit_definitions.erl b/src/rabbit_definitions.erl index c979da40aa..47ac6a4992 100644 --- a/src/rabbit_definitions.erl +++ b/src/rabbit_definitions.erl @@ -55,6 +55,9 @@ all_definitions() -> %% Users = list_users(), VHosts = list_vhosts(), + Params = list_runtime_parameters(), + GParams = list_global_runtime_parameters(), + Pols = list_policies(), {ok, Vsn} = application:get_key(rabbit, vsn), #{ @@ -63,9 +66,9 @@ all_definitions() -> vhosts => VHosts, %% permissions => Perms, %% topic_permissions => TPerms, -%% parameters => Params, -%% global_parameters => GParams, -%% policies => Pols, + parameters => Params, + global_parameters => GParams, + policies => Pols, queues => Qs, %% bindings => Bs, exchanges => Xs @@ -537,5 +540,35 @@ list_users() -> } end || U <- rabbit_auth_backend_internal:list_users()]. +list_runtime_parameters() -> + [runtime_parameter_definition(P) || P <- rabbit_runtime_parameters:list()]. + +runtime_parameter_definition(Param) -> + #{ + <<"vhost">> => pget(vhost, Param), + <<"component">> => pget(component, Param), + <<"name">> => pget(name, Param), + <<"value">> => maps:from_list(pget(value, Param)) + }. + +list_global_runtime_parameters() -> + [global_runtime_parameter_definition(P) || P <- rabbit_runtime_parameters:list_global()]. + +global_runtime_parameter_definition(Param) -> + maps:from_list(Param). + +list_policies() -> + [policy_definition(P) || P <- rabbit_policy:list()]. + +policy_definition(Policy) -> + #{ + <<"vhost">> => pget(vhost, Policy), + <<"name">> => pget(name, Policy), + <<"pattern">> => pget(pattern, Policy), + <<"apply-to">> => pget('apply-to', Policy), + <<"priority">> => pget(priority, Policy), + <<"definition">> => maps:from_list(pget(definition, Policy)) + }. + tags_as_binaries(Tags) -> list_to_binary(string:join([atom_to_list(T) || T <- Tags], ",")). |
