Skip to content

Commit 96294ba

Browse files
Merge branch 'federation-support'
2 parents 92f303e + 4273027 commit 96294ba

File tree

6 files changed

+194
-92
lines changed

6 files changed

+194
-92
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli.rs

Lines changed: 110 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -206,116 +206,116 @@ pub fn parser() -> Command {
206206
.subcommand_required(true)
207207
.subcommand_value_name("command")
208208
.subcommands([
209-
Command::new("show")
210-
.about("overview")
211-
.after_long_help(color_print::cformat!(
209+
Command::new("show")
210+
.about("overview")
211+
.after_long_help(color_print::cformat!(
212212
"<bold>Doc guide</bold>: {}",
213213
MONITORING_GUIDE_URL
214214
))
215-
.subcommand_value_name("summary")
216-
.subcommands(show_subcommands()),
217-
Command::new("list")
218-
.about("lists objects by type")
219-
.subcommand_value_name("objects")
220-
.subcommands(list_subcommands()),
221-
Command::new("declare")
222-
.about("creates or declares things")
223-
.subcommand_value_name("object")
224-
.subcommands(declare_subcommands()),
225-
Command::new("delete")
226-
.about("deletes objects")
227-
.subcommand_value_name("object")
228-
.subcommands(delete_subcommands()),
229-
Command::new("purge")
230-
.about("purges queues")
231-
.subcommand_value_name("queue")
232-
.subcommands(purge_subcommands()),
233-
Command::new("policies")
234-
.about("operations on policies")
235-
.subcommand_value_name("policy")
236-
.subcommands(policies_subcommands()),
237-
Command::new("health_check")
238-
.about("runs health checks")
239-
.subcommand_value_name("check")
240-
.subcommands(health_check_subcommands())
241-
.after_long_help(color_print::cformat!(
215+
.subcommand_value_name("summary")
216+
.subcommands(show_subcommands()),
217+
Command::new("list")
218+
.about("lists objects by type")
219+
.subcommand_value_name("objects")
220+
.subcommands(list_subcommands()),
221+
Command::new("declare")
222+
.about("creates or declares things")
223+
.subcommand_value_name("object")
224+
.subcommands(declare_subcommands()),
225+
Command::new("delete")
226+
.about("deletes objects")
227+
.subcommand_value_name("object")
228+
.subcommands(delete_subcommands()),
229+
Command::new("purge")
230+
.about("purges queues")
231+
.subcommand_value_name("queue")
232+
.subcommands(purge_subcommands()),
233+
Command::new("policies")
234+
.about("operations on policies")
235+
.subcommand_value_name("policy")
236+
.subcommands(policies_subcommands()),
237+
Command::new("health_check")
238+
.about("runs health checks")
239+
.subcommand_value_name("check")
240+
.subcommands(health_check_subcommands())
241+
.after_long_help(color_print::cformat!(
242242
r#"<bold>Doc guides</bold>:
243243
244244
* {}
245245
* {}"#,
246246
HEALTH_CHECK_GUIDE_URL,
247247
DEPRECATED_FEATURE_GUIDE_URL
248248
)),
249-
Command::new("close")
250-
.about("closes connections")
251-
.subcommand_value_name("connection")
252-
.subcommands(close_subcommands()),
253-
Command::new("rebalance")
254-
.about("rebalances queue leaders")
255-
.after_long_help(color_print::cformat!(
249+
Command::new("close")
250+
.about("closes connections")
251+
.subcommand_value_name("connection")
252+
.subcommands(close_subcommands()),
253+
Command::new("rebalance")
254+
.about("rebalances queue leaders")
255+
.after_long_help(color_print::cformat!(
256256
"<bold>Doc guide</bold>: {}",
257257
QUORUM_QUEUE_GUIDE_URL
258258
))
259-
.subcommand_value_name("queues")
260-
.subcommands(rebalance_subcommands()),
261-
Command::new("definitions")
262-
.about("operations on definitions (everything except for messages: virtual hosts, queues, streams, exchanges, bindings, users, etc)")
263-
.after_long_help(color_print::cformat!(
259+
.subcommand_value_name("queues")
260+
.subcommands(rebalance_subcommands()),
261+
Command::new("definitions")
262+
.about("operations on definitions (everything except for messages: virtual hosts, queues, streams, exchanges, bindings, users, etc)")
263+
.after_long_help(color_print::cformat!(
264264
"<bold>Doc guide</bold>: {}",
265265
DEFINITION_GUIDE_URL
266266
))
267-
.subcommand_value_name("export")
268-
.subcommands(definitions_subcommands()),
269-
Command::new("export")
270-
.about("see 'definitions export'")
271-
.after_long_help(color_print::cformat!(
267+
.subcommand_value_name("export")
268+
.subcommands(definitions_subcommands()),
269+
Command::new("export")
270+
.about("see 'definitions export'")
271+
.after_long_help(color_print::cformat!(
272272
"<bold>Doc guide</bold>: {}",
273273
DEFINITION_GUIDE_URL
274274
))
275-
.subcommand_value_name("definitions")
276-
.subcommands(export_subcommands()),
277-
Command::new("import")
278-
.about("see 'definitions import'")
279-
.after_long_help(color_print::cformat!(
275+
.subcommand_value_name("definitions")
276+
.subcommands(export_subcommands()),
277+
Command::new("import")
278+
.about("see 'definitions import'")
279+
.after_long_help(color_print::cformat!(
280280
"<bold>Doc guide</bold>: {}",
281281
DEFINITION_GUIDE_URL
282282
))
283-
.subcommand_value_name("definitions")
284-
.subcommands(import_subcommands()),
285-
Command::new("feature_flags")
286-
.about("operations on feature flags")
287-
.after_long_help(color_print::cformat!(
283+
.subcommand_value_name("definitions")
284+
.subcommands(import_subcommands()),
285+
Command::new("feature_flags")
286+
.about("operations on feature flags")
287+
.after_long_help(color_print::cformat!(
288288
"<bold>Doc guide</bold>: {}",
289289
FEATURE_FLAG_GUIDE_URL
290290
))
291-
.subcommand_value_name("feature flag")
292-
.subcommands(feature_flags_subcommands()),
293-
Command::new("deprecated_features")
294-
.about("operations on deprecated features")
295-
.after_long_help(color_print::cformat!(
291+
.subcommand_value_name("feature flag")
292+
.subcommands(feature_flags_subcommands()),
293+
Command::new("deprecated_features")
294+
.about("operations on deprecated features")
295+
.after_long_help(color_print::cformat!(
296296
"<bold>Doc guide</bold>: {}",
297297
DEPRECATED_FEATURE_GUIDE_URL
298298
))
299-
.subcommand_value_name("deprecated feature")
300-
.subcommands(deprecated_features_subcommands()),
301-
Command::new("publish")
302-
.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>."))
303-
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", PUBLISHER_GUIDE_URL))
304-
.subcommand_value_name("message")
305-
.subcommands(publish_subcommands()),
306-
Command::new("get")
307-
.about(color_print::cstr!("fetches message(s) from a queue or stream via <bold><red>polling</red></bold>. <bold><red>Only suitable for development and test environments</red></bold>."))
308-
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", POLLING_CONSUMER_GUIDE_URL))
309-
.subcommand_value_name("message")
310-
.subcommands(get_subcommands()),
311-
Command::new("shovels")
312-
.about("Operations on shovels")
313-
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", SHOVEL_GUIDE_URL))
314-
.subcommand_value_name("shovels")
315-
.subcommands(shovel_subcommands()),
316-
Command::new("federation")
317-
.about("Operations on federation upstreams and links")
318-
.after_long_help(color_print::cformat!(
299+
.subcommand_value_name("deprecated feature")
300+
.subcommands(deprecated_features_subcommands()),
301+
Command::new("publish")
302+
.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>."))
303+
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", PUBLISHER_GUIDE_URL))
304+
.subcommand_value_name("message")
305+
.subcommands(publish_subcommands()),
306+
Command::new("get")
307+
.about(color_print::cstr!("fetches message(s) from a queue or stream via <bold><red>polling</red></bold>. <bold><red>Only suitable for development and test environments</red></bold>."))
308+
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", POLLING_CONSUMER_GUIDE_URL))
309+
.subcommand_value_name("message")
310+
.subcommands(get_subcommands()),
311+
Command::new("shovels")
312+
.about("Operations on shovels")
313+
.after_long_help(color_print::cformat!("<bold>Doc guide</bold>: {}", SHOVEL_GUIDE_URL))
314+
.subcommand_value_name("shovels")
315+
.subcommands(shovel_subcommands()),
316+
Command::new("federation")
317+
.about("Operations on federation upstreams and links")
318+
.after_long_help(color_print::cformat!(
319319
r#"<bold>Doc guides</bold>:
320320
321321
* {}
@@ -327,13 +327,13 @@ pub fn parser() -> Command {
327327
FEDERATED_QUEUES_GUIDE_URL,
328328
FEDERATION_REFERENCE_URL
329329
))
330-
.subcommands(federation_subcommands()),
331-
Command::new("tanzu")
332-
.about("Tanzu RabbitMQ-specific commands")
333-
// TODO: documentation link
334-
.subcommand_value_name("subcommand")
335-
.subcommands(tanzu_subcommands()),
336-
])
330+
.subcommands(federation_subcommands()),
331+
Command::new("tanzu")
332+
.about("Tanzu RabbitMQ-specific commands")
333+
// TODO: documentation link
334+
.subcommand_value_name("subcommand")
335+
.subcommands(tanzu_subcommands()),
336+
])
337337
}
338338

339339
fn list_subcommands() -> [Command; 19] {
@@ -715,6 +715,7 @@ fn declare_subcommands() -> [Command; 12] {
715715
.arg(
716716
Arg::new("apply_to")
717717
.long("apply-to")
718+
.alias("applies-to")
718719
.help("entities to apply to (queues, classic_queues, quorum_queues, streams, exchanges, all)")
719720
.value_parser(value_parser!(PolicyTarget))
720721
.required(true),
@@ -750,6 +751,7 @@ fn declare_subcommands() -> [Command; 12] {
750751
.arg(
751752
Arg::new("apply_to")
752753
.long("apply-to")
754+
.alias("applies-to")
753755
.help("entities to apply to (queues, classic_queues, quorum_queues, streams, exchanges, all)")
754756
.value_parser(value_parser!(PolicyTarget))
755757
.required(true),
@@ -1036,6 +1038,7 @@ fn policies_subcommands() -> [Command; 5] {
10361038
.arg(
10371039
Arg::new("apply_to")
10381040
.long("apply-to")
1041+
.alias("applies-to")
10391042
.help("entities to apply to (queues, classic_queues, quorum_queues, streams, exchanges, all)")
10401043
.value_parser(value_parser!(PolicyTarget))
10411044
.required(true),
@@ -1073,6 +1076,7 @@ fn policies_subcommands() -> [Command; 5] {
10731076
.arg(
10741077
Arg::new("apply_to")
10751078
.long("apply-to")
1079+
.alias("applies-to")
10761080
.value_parser(value_parser!(PolicyTarget)),
10771081
);
10781082

@@ -1601,7 +1605,7 @@ pub fn shovel_subcommands() -> [Command; 4] {
16011605
[list_all_cmd, declare_091_cmd, declare_10_cmd, delete_cmd]
16021606
}
16031607

1604-
fn federation_subcommands() -> [Command; 5] {
1608+
fn federation_subcommands() -> [Command; 6] {
16051609
let list_all_upstreams = Command::new("list_all_upstreams")
16061610
.long_about("Lists federation upstreams in all virtual hosts")
16071611
.after_long_help(color_print::cformat!(
@@ -1898,11 +1902,27 @@ fn federation_subcommands() -> [Command; 5] {
18981902
.required(true),
18991903
);
19001904

1905+
let list_all_links = Command::new("list_all_links")
1906+
.long_about("List federation links in all virtual hosts")
1907+
.after_long_help(color_print::cformat!(
1908+
r#"<bold>Doc guides</bold>:
1909+
1910+
* {}
1911+
* {}
1912+
* {}
1913+
* {}"#,
1914+
FEDERATION_GUIDE_URL,
1915+
FEDERATED_EXCHANGES_GUIDE_URL,
1916+
FEDERATED_QUEUES_GUIDE_URL,
1917+
FEDERATION_REFERENCE_URL
1918+
));
1919+
19011920
[
19021921
list_all_upstreams,
19031922
declare_upstream,
19041923
declare_upstream_for_exchange_federation,
19051924
declare_upstream_for_queue_federation,
19061925
delete_upstream,
1926+
list_all_links,
19071927
]
19081928
}

src/commands.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ pub fn list_federation_upstreams(
374374
client.list_federation_upstreams()
375375
}
376376

377+
pub fn list_federation_links(client: APIClient) -> ClientResult<Vec<responses::FederationLink>> {
378+
client.list_federation_links()
379+
}
380+
377381
pub fn declare_federation_upstream(
378382
client: APIClient,
379383
vhost: &str,

src/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,10 @@ fn dispatch_common_subcommand(
630630
let result = commands::list_federation_upstreams(client);
631631
res_handler.tabular_result(result)
632632
}
633+
("federation", "list_all_links") => {
634+
let result = commands::list_federation_links(client);
635+
res_handler.tabular_result(result)
636+
}
633637
("federation", "declare_upstream") => {
634638
let result = commands::declare_federation_upstream(client, &vhost, second_level_args);
635639
res_handler.no_output_on_success(result);

0 commit comments

Comments
 (0)