Skip to main content

nethsm/cli/command/
health.rs

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