Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add divviup aggregator update-config subcommand #1197

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions cli/src/aggregators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ pub enum AggregatorAction {
/// new bearer token for this aggregator
bearer_token: String,
},

/// Update the aggregator's configuration
UpdateConfig {
/// uuid for this aggregator
aggregator_id: Uuid,
},
}

impl AggregatorAction {
Expand Down Expand Up @@ -130,6 +136,12 @@ impl AggregatorAction {
.rotate_aggregator_bearer_token(aggregator_id, &bearer_token)
.await?,
),

Self::UpdateConfig { aggregator_id } => output.display(
client
.update_aggregator_configuration(aggregator_id)
.await?,
),
}
Ok(())
}
Expand Down
8 changes: 8 additions & 0 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,14 @@ impl DivviupClient {
.await
}

pub async fn update_aggregator_configuration(
&self,
aggregator_id: Uuid,
) -> ClientResult<Aggregator> {
self.patch(&format!("api/aggregators/{aggregator_id}"), &json!({}))
.await
}

pub async fn delete_aggregator(&self, aggregator_id: Uuid) -> ClientResult {
self.delete(&format!("api/aggregators/{aggregator_id}"))
.await
Expand Down
Loading