Skip to content

Commit

Permalink
0.23.0
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelklishin committed Feb 3, 2025
1 parent bdcd2fd commit 7bc9718
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 13 deletions.
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# rabbitmqadmin-ng Change Log

## v0.23.0 (in development)
## v0.24.0 (in development)

## v0.23.0 (Feb 2, 2025)

### Enhancements

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

* `close user_connections` is a new command that closes connections of a specific user:

```
rabbitmqadmin --vhost="/" close user_connections --username "monitoring.2"
rabbitmqadmin --vhost="production" close user_connections --username "web.94ee67772"
```

* New general option `--table-style`, can be used to change output table styling.

By default, the following style is used:
Expand Down
14 changes: 7 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rabbitmqadmin"
version = "0.22.0"
version = "0.23.0"
edition = "2021"

description = "rabbitmqadmin v2 is a major revision of rabbitmqadmin, one of the RabbitMQ CLI tools that target the HTTP API"
Expand All @@ -17,7 +17,7 @@ reqwest = { version = "0.12.12", features = [
"__rustls",
"rustls-tls-native-roots"
]}
rabbitmq_http_client = { version = "0.19.0", features = [
rabbitmq_http_client = { version = "0.20.0", features = [
"core",
"blocking",
"tabled"
Expand Down
16 changes: 13 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1109,15 +1109,25 @@ fn rebalance_subcommands() -> [Command; 1] {
[Command::new("queues").about("rebalances queue leaders")]
}

fn close_subcommands() -> [Command; 1] {
[Command::new("connection")
fn close_subcommands() -> [Command; 2] {
let close_connection = Command::new("connection")
.about("closes a client connection")
.arg(
Arg::new("name")
.long("name")
.help("connection name (identifying string)")
.required(true),
)]
);
let close_user_connections = Command::new("user_connections")
.about("closes all connections that authenticated with a specific username")
.arg(
Arg::new("username")
.short('u')
.long("username")
.help("Name of the user whose connections to close")
.required(true),
);
[close_connection, close_user_connections]
}

fn definitions_subcommands() -> [Command; 2] {
Expand Down
6 changes: 6 additions & 0 deletions src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,12 @@ pub fn close_connection(client: APIClient, command_args: &ArgMatches) -> ClientR
client.close_connection(name, Some("closed via rabbitmqadmin v2"))
}

pub fn close_user_connections(client: APIClient, command_args: &ArgMatches) -> ClientResult<()> {
// the flag is required
let username = command_args.get_one::<String>("username").unwrap();
client.close_user_connections(username, Some("closed via rabbitmqadmin v2"))
}

pub fn rebalance_queues(client: APIClient) -> ClientResult<()> {
client.rebalance_queue_leaders()
}
Expand Down
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ fn dispatch_common_subcommand(
let result = commands::close_connection(client, second_level_args);
res_handler.no_output_on_success(result);
}
("close", "user_connections") => {
let result = commands::close_user_connections(client, second_level_args);
res_handler.no_output_on_success(result);
}
("definitions", "export") => {
let result = commands::export_definitions(client, second_level_args);
res_handler.no_output_on_success(result);
Expand Down

0 comments on commit 7bc9718

Please sign in to comment.