Skip to content

Commit

Permalink
feat: Return reconfigured stream (#53)
Browse files Browse the repository at this point in the history
(Update SDK)

```
❯ s2 basin <basin> reconfigure-stream <stream> --retention-policy 5d
✓ Stream reconfigured
{
  "storage_class": "standard",
  "retention_policy": {
    "Age": {
      "secs": 432000,
      "nanos": 0
    }
  }
}
```

Signed-off-by: Vaibhav Rabber <[email protected]>
  • Loading branch information
vrongmeal authored Dec 5, 2024
1 parent bd6ffb5 commit 91bf66d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }

[dependencies.streamstore]
git = "https://github.com/s2-streamstore/s2-sdk-rust.git"
rev = "fdfa5399e465ce127c98f8e6d5df57f40a485316"
rev = "1754135396dcc0ab1bb7256c8d83a46de2adebde"
2 changes: 1 addition & 1 deletion src/basin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl BasinService {
stream: String,
config: StreamConfig,
mask: Vec<String>,
) -> Result<(), ServiceError> {
) -> Result<StreamConfig, ServiceError> {
let reconfigure_stream_req = ReconfigureStreamRequest::new(stream)
.with_config(config)
.with_mask(mask);
Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ async fn run() -> Result<(), S2CliError> {

BasinActions::GetStreamConfig { stream } => {
let basin_client = BasinClient::new(client_config, basin);
let config = BasinService::new(basin_client)
let config: StreamConfig = BasinService::new(basin_client)
.get_stream_config(stream)
.await?;
let config: StreamConfig = config.into();
.await?
.into();
println!("{}", serde_json::to_string_pretty(&config)?);
}

Expand All @@ -522,11 +522,13 @@ async fn run() -> Result<(), S2CliError> {
mask.push("retention_policy".to_string());
};

BasinService::new(basin_client)
let config: StreamConfig = BasinService::new(basin_client)
.reconfigure_stream(stream, config.into(), mask)
.await?;
.await?
.into();

eprintln!("{}", "✓ Stream reconfigured".green().bold());
println!("{}", serde_json::to_string_pretty(&config)?);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub struct StreamConfig {
}

#[derive(ValueEnum, Debug, Clone, Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum StorageClass {
Unspecified,
Standard,
Expand Down

0 comments on commit 91bf66d

Please sign in to comment.