Skip to content

Commit 8e6d76b

Browse files
authored
feat(cli): wcn_admin maintenance (#317)
1 parent d037b7f commit 8e6d76b

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
260209.0
1+
260209.1

crates/admin_cli/src/main.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use {
77
};
88

99
mod deploy;
10+
mod maintenance;
1011
mod migration;
1112
mod operator;
1213
mod ownership;
@@ -39,6 +40,10 @@ enum Command {
3940
#[command(subcommand)]
4041
Migration(migration::Command),
4142

43+
/// Maintenance scheduling
44+
#[command(subcommand)]
45+
Maintenance(maintenance::Command),
46+
4247
/// Cluster settings management
4348
#[command(subcommand)]
4449
Settings(settings::Command),
@@ -137,6 +142,7 @@ async fn main() -> anyhow::Result<()> {
137142
Command::View(args) => view::execute(args).await,
138143
Command::Operator(cmd) => operator::execute(cmd).await,
139144
Command::Migration(cmd) => migration::execute(cmd).await,
145+
Command::Maintenance(cmd) => maintenance::execute(cmd).await,
140146
Command::Settings(cmd) => settings::execute(cmd).await,
141147
Command::Ownership(cmd) => ownership::execute(cmd).await,
142148
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
use {crate::ClusterArgs, anyhow::Context, clap::Subcommand};
2+
3+
#[derive(Debug, Subcommand)]
4+
pub(super) enum Command {
5+
/// Start maintenance
6+
Start(ClusterArgs),
7+
8+
/// Finish maintenance
9+
Finish(ClusterArgs),
10+
}
11+
12+
pub(super) async fn execute(cmd: Command) -> anyhow::Result<()> {
13+
match cmd {
14+
Command::Start(args) => start_maintenance(args).await,
15+
Command::Finish(args) => finish_maintenance(args).await,
16+
}
17+
}
18+
19+
async fn start_maintenance(args: ClusterArgs) -> anyhow::Result<()> {
20+
args.connect()
21+
.await?
22+
.start_maintenance()
23+
.await
24+
.context("Cluster::start_maintenance")
25+
}
26+
27+
async fn finish_maintenance(args: ClusterArgs) -> anyhow::Result<()> {
28+
args.connect()
29+
.await?
30+
.finish_maintenance()
31+
.await
32+
.context("Cluster::finish_maintenance")
33+
}

0 commit comments

Comments
 (0)