nethsm/cli/command/
health.rs1use clap::{Parser, Subcommand};
2use expression_format::ex_format;
3
4use crate::SystemState::{Locked, Operational, Unprovisioned};
5
6#[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 Alive(AliveCommand),
17 Ready(ReadyCommand),
19 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;