Skip to content

Commit 7bc9718

Browse files
0.23.0
1 parent bdcd2fd commit 7bc9718

File tree

6 files changed

+43
-13
lines changed

6 files changed

+43
-13
lines changed

CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# rabbitmqadmin-ng Change Log
22

3-
## v0.23.0 (in development)
3+
## v0.24.0 (in development)
4+
5+
## v0.23.0 (Feb 2, 2025)
46

57
### Enhancements
68

@@ -12,6 +14,14 @@
1214
rabbitmqadmin --vhost="production" list user_connections --username "web.45cf7dc28"
1315
```
1416

17+
* `close user_connections` is a new command that closes connections of a specific user:
18+
19+
```
20+
rabbitmqadmin --vhost="/" close user_connections --username "monitoring.2"
21+
22+
rabbitmqadmin --vhost="production" close user_connections --username "web.94ee67772"
23+
```
24+
1525
* New general option `--table-style`, can be used to change output table styling.
1626

1727
By default, the following style is used:

Cargo.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rabbitmqadmin"
3-
version = "0.22.0"
3+
version = "0.23.0"
44
edition = "2021"
55

66
description = "rabbitmqadmin v2 is a major revision of rabbitmqadmin, one of the RabbitMQ CLI tools that target the HTTP API"
@@ -17,7 +17,7 @@ reqwest = { version = "0.12.12", features = [
1717
"__rustls",
1818
"rustls-tls-native-roots"
1919
]}
20-
rabbitmq_http_client = { version = "0.19.0", features = [
20+
rabbitmq_http_client = { version = "0.20.0", features = [
2121
"core",
2222
"blocking",
2323
"tabled"

src/cli.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,15 +1109,25 @@ fn rebalance_subcommands() -> [Command; 1] {
11091109
[Command::new("queues").about("rebalances queue leaders")]
11101110
}
11111111

1112-
fn close_subcommands() -> [Command; 1] {
1113-
[Command::new("connection")
1112+
fn close_subcommands() -> [Command; 2] {
1113+
let close_connection = Command::new("connection")
11141114
.about("closes a client connection")
11151115
.arg(
11161116
Arg::new("name")
11171117
.long("name")
11181118
.help("connection name (identifying string)")
11191119
.required(true),
1120-
)]
1120+
);
1121+
let close_user_connections = Command::new("user_connections")
1122+
.about("closes all connections that authenticated with a specific username")
1123+
.arg(
1124+
Arg::new("username")
1125+
.short('u')
1126+
.long("username")
1127+
.help("Name of the user whose connections to close")
1128+
.required(true),
1129+
);
1130+
[close_connection, close_user_connections]
11211131
}
11221132

11231133
fn definitions_subcommands() -> [Command; 2] {

src/commands.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,12 @@ pub fn close_connection(client: APIClient, command_args: &ArgMatches) -> ClientR
672672
client.close_connection(name, Some("closed via rabbitmqadmin v2"))
673673
}
674674

675+
pub fn close_user_connections(client: APIClient, command_args: &ArgMatches) -> ClientResult<()> {
676+
// the flag is required
677+
let username = command_args.get_one::<String>("username").unwrap();
678+
client.close_user_connections(username, Some("closed via rabbitmqadmin v2"))
679+
}
680+
675681
pub fn rebalance_queues(client: APIClient) -> ClientResult<()> {
676682
client.rebalance_queue_leaders()
677683
}

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,10 @@ fn dispatch_common_subcommand(
493493
let result = commands::close_connection(client, second_level_args);
494494
res_handler.no_output_on_success(result);
495495
}
496+
("close", "user_connections") => {
497+
let result = commands::close_user_connections(client, second_level_args);
498+
res_handler.no_output_on_success(result);
499+
}
496500
("definitions", "export") => {
497501
let result = commands::export_definitions(client, second_level_args);
498502
res_handler.no_output_on_success(result);

0 commit comments

Comments
 (0)