From 0f4719a47ef0969376fbd21f7181354e6806eb58 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Wed, 13 Jul 2022 13:03:27 -0400 Subject: [PATCH 1/2] Do not allow --initial when we are not using aggregate smartmodule --- crates/fluvio-cli/src/consume/mod.rs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/crates/fluvio-cli/src/consume/mod.rs b/crates/fluvio-cli/src/consume/mod.rs index f2a8a20613..361754cf04 100644 --- a/crates/fluvio-cli/src/consume/mod.rs +++ b/crates/fluvio-cli/src/consume/mod.rs @@ -158,29 +158,40 @@ pub struct ConsumeOpt { pub array_map: Option, /// Path to a SmartModule join wasm filee - #[clap(long, group("smartmodule_group"))] + #[clap(long, group("smartmodule_group"), group("join_group"))] pub join: Option, /// Path to a WASM file for aggregation - #[clap(long, group("smartmodule_group"))] + #[clap(long, group("smartmodule_group"), group("aggregate_group"))] pub aggregate: Option, /// Path or name to WASM module. This support any of the other /// smartmodule types: filter, map, array_map, aggregate, join and filter_map - #[clap(long, group("smartmodule_group"))] + #[clap( + long, + group("smartmodule_group"), + group("aggregate_group"), + group("join_group") + )] pub smartmodule: Option, - #[clap(long)] + #[clap(long, requires = "join_group")] pub join_topic: Option, /// (Optional) Path to a file to use as an initial accumulator value with --aggregate - #[clap(long)] + #[clap(long, requires = "aggregate_group")] pub initial: Option, /// (Optional) Extra input parameters passed to the smartmodule module. /// They should be passed using key=value format /// Eg. fluvio consume topic-name --filter filter.wasm -e foo=bar -e key=value -e one=1 - #[clap(short = 'e', long= "extra-params", parse(try_from_str = parse_key_val), number_of_values = 1)] + #[clap( + short = 'e', + requires = "smartmodule_group", + long= "extra-params", + parse(try_from_str = parse_key_val), + number_of_values = 1 + )] pub extra_params: Option>, /// Isolation level that consumer must respect. From 45b0044085bedb51ae2d04fd6a6a4cbb3656a799 Mon Sep 17 00:00:00 2001 From: Luis Moreno Date: Wed, 13 Jul 2022 15:10:58 -0400 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f41c4358b7..962f9c418d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Release Notes ## Platform Version 0.9.32 - UNRELEASED +* Restrict usage of `--initial`, `--extra-params` and `--join-topic` in `fluvio consume`. Those options only should be accepted when using specific smartmodules. ([#2476](https://github.com/infinyon/fluvio/pull/2476)) ## Platform Version 0.9.31 - 2022-07-13 * Move stream publishers to connection-level context ([#2452](https://github.com/infinyon/fluvio/pull/2452))