@@ -220,6 +220,16 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
220220 PASSWORD_GUIDE_URL
221221 ) )
222222 . subcommands ( passwords_subcommands ( pre_flight_settings. clone ( ) ) ) ;
223+ let permissions_group = Command :: new ( "permissions" )
224+ . about ( "Operations on user permissions" )
225+ . infer_subcommands ( pre_flight_settings. infer_subcommands )
226+ . infer_long_args ( pre_flight_settings. infer_long_options )
227+ . after_help ( color_print:: cformat!(
228+ "<bold>Doc guide</bold>: {}" ,
229+ ACCESS_CONTROL_GUIDE_URL
230+ ) )
231+ . subcommand_value_name ( "permission" )
232+ . subcommands ( permissions_subcommands ( pre_flight_settings. clone ( ) ) ) ;
223233 let policies_group = Command :: new ( "policies" )
224234 . about ( "Operations on policies" )
225235 . infer_subcommands ( pre_flight_settings. infer_subcommands )
@@ -304,11 +314,31 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
304314 ) )
305315 . subcommand_value_name ( "subcommand" )
306316 . subcommands ( users_subcommands ( pre_flight_settings. clone ( ) ) ) ;
317+ let user_limits_group = Command :: new ( "user_limits" )
318+ . about ( "Operations on per-user (resource) limits" )
319+ . infer_subcommands ( pre_flight_settings. infer_subcommands )
320+ . infer_long_args ( pre_flight_settings. infer_long_options )
321+ . after_help ( color_print:: cformat!(
322+ "<bold>Doc guide</bold>: {}" ,
323+ USER_LIMIT_GUIDE_URL
324+ ) )
325+ . subcommand_value_name ( "user_limit" )
326+ . subcommands ( user_limits_subcommands ( pre_flight_settings. clone ( ) ) ) ;
307327 let vhosts_group = Command :: new ( "vhosts" )
308328 . about ( "Virtual host operations" )
309329 . infer_subcommands ( pre_flight_settings. infer_subcommands )
310330 . infer_long_args ( pre_flight_settings. infer_long_options )
311331 . subcommands ( vhosts_subcommands ( pre_flight_settings. clone ( ) ) ) ;
332+ let vhost_limits_group = Command :: new ( "vhost_limits" )
333+ . about ( "Operations on virtual host (resource) limits" )
334+ . infer_subcommands ( pre_flight_settings. infer_subcommands )
335+ . infer_long_args ( pre_flight_settings. infer_long_options )
336+ . after_help ( color_print:: cformat!(
337+ "<bold>Doc guide</bold>: {}" ,
338+ VIRTUAL_HOST_LIMIT_GUIDE_URL
339+ ) )
340+ . subcommand_value_name ( "vhost_limit" )
341+ . subcommands ( vhost_limits_subcommands ( pre_flight_settings. clone ( ) ) ) ;
312342
313343 let command_groups = [
314344 bindings_group,
@@ -332,6 +362,7 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
332362 operator_policies_group,
333363 parameters_group,
334364 passwords_group,
365+ permissions_group,
335366 policies_group,
336367 publish_group,
337368 purge_group,
@@ -342,7 +373,9 @@ pub fn parser(pre_flight_settings: PreFlightSettings) -> Command {
342373 streams_group,
343374 tanzu_group,
344375 users_group,
376+ user_limits_group,
345377 vhosts_group,
378+ vhost_limits_group,
346379 ] ;
347380
348381 Command :: new ( "rabbitmqadmin" )
@@ -2948,6 +2981,162 @@ pub fn passwords_subcommands(pre_flight_settings: PreFlightSettings) -> [Command
29482981 [ hash_password] . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
29492982}
29502983
2984+ pub fn permissions_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 3 ] {
2985+ let idempotently_arg = Arg :: new ( "idempotently" )
2986+ . long ( "idempotently" )
2987+ . value_parser ( value_parser ! ( bool ) )
2988+ . action ( ArgAction :: SetTrue )
2989+ . help ( "do not consider 404 Not Found API responses to be errors" )
2990+ . required ( false ) ;
2991+
2992+ let list_cmd = Command :: new ( "list" )
2993+ . long_about ( "Lists user permissions" )
2994+ . after_help ( color_print:: cformat!(
2995+ "<bold>Doc guide</bold>: {}" ,
2996+ ACCESS_CONTROL_GUIDE_URL
2997+ ) ) ;
2998+
2999+ let declare_cmd = Command :: new ( "declare" )
3000+ . about ( "grants permissions to a user" )
3001+ . after_help ( color_print:: cformat!(
3002+ "<bold>Doc guide:</bold>: {}" ,
3003+ ACCESS_CONTROL_GUIDE_URL
3004+ ) )
3005+ . arg (
3006+ Arg :: new ( "user" )
3007+ . long ( "user" )
3008+ . help ( "username" )
3009+ . required ( true ) ,
3010+ )
3011+ . arg (
3012+ Arg :: new ( "configure" )
3013+ . long ( "configure" )
3014+ . help ( "name pattern for configuration access" )
3015+ . required ( true ) ,
3016+ )
3017+ . arg (
3018+ Arg :: new ( "read" )
3019+ . long ( "read" )
3020+ . help ( "name pattern for read access" )
3021+ . required ( true ) ,
3022+ )
3023+ . arg (
3024+ Arg :: new ( "write" )
3025+ . long ( "write" )
3026+ . help ( "name pattern for write access" )
3027+ . required ( true ) ,
3028+ ) ;
3029+
3030+ let delete_cmd = Command :: new ( "delete" )
3031+ . about ( "Revokes user permissions to a given vhost" )
3032+ . arg (
3033+ Arg :: new ( "user" )
3034+ . long ( "user" )
3035+ . help ( "username" )
3036+ . required ( true ) ,
3037+ )
3038+ . arg ( idempotently_arg. clone ( ) ) ;
3039+
3040+ [ list_cmd, declare_cmd, delete_cmd]
3041+ . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
3042+ }
3043+
3044+ pub fn user_limits_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 3 ] {
3045+ let list_cmd = Command :: new ( "list" )
3046+ . long_about ( "Lists per-user (resource) limits" )
3047+ . after_help ( color_print:: cformat!(
3048+ "<bold>Doc guide</bold>: {}" ,
3049+ USER_LIMIT_GUIDE_URL
3050+ ) )
3051+ . arg (
3052+ Arg :: new ( "user" )
3053+ . long ( "user" )
3054+ . help ( "username" )
3055+ . required ( false ) ,
3056+ ) ;
3057+
3058+ let declare_cmd = Command :: new ( "declare" )
3059+ . about ( "Set a user limit" )
3060+ . after_help ( color_print:: cformat!(
3061+ "<bold>Doc guide:</bold>: {}" ,
3062+ USER_LIMIT_GUIDE_URL
3063+ ) )
3064+ . arg (
3065+ Arg :: new ( "user" )
3066+ . long ( "user" )
3067+ . help ( "username" )
3068+ . required ( true ) ,
3069+ )
3070+ . arg (
3071+ Arg :: new ( "name" )
3072+ . long ( "name" )
3073+ . help ( "limit name (eg. max-connections, max-queues)" )
3074+ . required ( true ) ,
3075+ )
3076+ . arg (
3077+ Arg :: new ( "value" )
3078+ . long ( "value" )
3079+ . help ( "limit value" )
3080+ . required ( true ) ,
3081+ ) ;
3082+
3083+ let delete_cmd = Command :: new ( "delete" )
3084+ . about ( "Clears a user limit" )
3085+ . arg (
3086+ Arg :: new ( "user" )
3087+ . long ( "user" )
3088+ . help ( "username" )
3089+ . required ( true ) ,
3090+ )
3091+ . arg (
3092+ Arg :: new ( "name" )
3093+ . long ( "name" )
3094+ . help ( "limit name (eg. max-connections, max-queues)" )
3095+ . required ( true ) ,
3096+ ) ;
3097+
3098+ [ list_cmd, declare_cmd, delete_cmd]
3099+ . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
3100+ }
3101+
3102+ pub fn vhost_limits_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 3 ] {
3103+ let list_cmd = Command :: new ( "list" )
3104+ . long_about ( "Lists virtual host (resource) limits" )
3105+ . after_help ( color_print:: cformat!(
3106+ "<bold>Doc guide</bold>: {}" ,
3107+ VIRTUAL_HOST_GUIDE_URL
3108+ ) ) ;
3109+
3110+ let declare_cmd = Command :: new ( "declare" )
3111+ . about ( "Set a vhost limit" )
3112+ . after_help ( color_print:: cformat!(
3113+ "<bold>Doc guide:</bold>: {}" ,
3114+ VIRTUAL_HOST_LIMIT_GUIDE_URL
3115+ ) )
3116+ . arg (
3117+ Arg :: new ( "name" )
3118+ . long ( "name" )
3119+ . help ( "limit name (eg. max-connections, max-queues)" )
3120+ . required ( true ) ,
3121+ )
3122+ . arg (
3123+ Arg :: new ( "value" )
3124+ . long ( "value" )
3125+ . help ( "limit value" )
3126+ . required ( true ) ,
3127+ ) ;
3128+
3129+ let delete_cmd = Command :: new ( "delete" ) . about ( "delete a vhost limit" ) . arg (
3130+ Arg :: new ( "name" )
3131+ . long ( "name" )
3132+ . help ( "limit name (eg. max-connections, max-queues)" )
3133+ . required ( true ) ,
3134+ ) ;
3135+
3136+ [ list_cmd, declare_cmd, delete_cmd]
3137+ . map ( |cmd| cmd. infer_long_args ( pre_flight_settings. infer_long_options ) )
3138+ }
3139+
29513140pub fn publish_subcommands ( pre_flight_settings : PreFlightSettings ) -> [ Command ; 1 ] {
29523141 [ Command :: new ( "message" )
29533142 . about ( color_print:: cstr!( "Publishes (<red>inefficiently</red>) message(s) to a queue or a stream. <bold><red>Only suitable for development and test environments</red></bold>. Prefer messaging or streaming protocol clients!" ) )
0 commit comments