Skip to content

Commit

Permalink
fix: Update output for reconfigure basin and create basin results (#86)
Browse files Browse the repository at this point in the history
Signed-off-by: Vaibhav Rabber <[email protected]>
  • Loading branch information
vrongmeal authored Dec 18, 2024
1 parent d720992 commit 0f41f43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,13 @@ impl AccountService {
basin: BasinName,
basin_config: BasinConfig,
mask: Vec<String>,
) -> Result<(), ServiceError> {
) -> Result<BasinConfig, ServiceError> {
let reconfigure_basin_req = ReconfigureBasinRequest::new(basin)
.with_config(basin_config)
.with_mask(mask);
self.client
.reconfigure_basin(reconfigure_basin_req)
.await
.map_err(|e| ServiceError::new(ServiceErrorContext::ReconfigureBasin, e))?;

Ok(())
.map_err(|e| ServiceError::new(ServiceErrorContext::ReconfigureBasin, e))
}
}
17 changes: 13 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,17 @@ async fn run() -> Result<(), S2CliError> {
}
None => (None, None),
};
account_service
let BasinInfo { state, .. } = account_service
.create_basin(basin.into(), storage_class, retention_policy)
.await?;

eprintln!("{}", "✓ Basin created".green().bold());
let message = match state {
streamstore::types::BasinState::Creating => {
"✓ Basin creation requested".yellow().bold()
}
_ => "✓ Basin created".green().bold(),
};
eprintln!("{message}");
}

Commands::DeleteBasin { basin } => {
Expand Down Expand Up @@ -519,9 +525,12 @@ async fn run() -> Result<(), S2CliError> {
}
}

account_service
let config: BasinConfig = account_service
.reconfigure_basin(basin.into(), config.into(), mask)
.await?;
.await?
.into();
eprintln!("{}", "✓ Basin reconfigured".green().bold());
println!("{}", serde_json::to_string_pretty(&config)?);
}

Commands::ListStreams {
Expand Down

0 comments on commit 0f41f43

Please sign in to comment.