nethsm_cli/cli/
health.rs

1use clap::{Parser, Subcommand};
2use expression_format::ex_format;
3use nethsm::SystemState::{Locked, Operational, Unprovisioned};
4
5/// The "netshm health" command.
6#[derive(Debug, Subcommand)]
7#[command(
8    about = "Retrieve health information for a device",
9    long_about = "Retrieve health information for a device
10
11Retrieve alive, ready and state information."
12)]
13pub enum HealthCommand {
14    /// The "netshm health alive" command.
15    Alive(AliveCommand),
16    /// The "netshm health ready" command.
17    Ready(ReadyCommand),
18    /// The "netshm health state" command.
19    State(StateCommand),
20}
21
22#[derive(Debug, Parser)]
23#[command(
24    about = "Check whether a device is in locked or unprovisioned state",
25    long_about = ex_format!("Check whether a device is in locked or unprovisioned state
26
27Returns an error if the target device is not in state \"{Locked}\" or \"{Unprovisioned}\".
28
29Requires no authentication."
30    )
31)]
32pub struct AliveCommand;
33
34#[derive(Debug, Parser)]
35#[command(
36    about = "Check whether a device is in operational state",
37    long_about = ex_format!("Check whether a device is in operational state
38
39Returns an error if the target device is not state \"{Operational}\".
40
41Requires no authentication.")
42)]
43pub struct ReadyCommand;
44
45#[derive(Debug, Parser)]
46#[command(
47    about = "Retrieve the state for a device",
48    long_about = ex_format!("Retrieve the state for a device
49
50* \"{Operational}\" if the target device is in operational state
51* \"{Locked}\" if the target device is locked
52* \"{Unprovisioned}\" if the target device is not yet provisioned
53
54Requires no authentication.")
55)]
56pub struct StateCommand;