nethsm_cli/cli/
health.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use clap::{Parser, Subcommand};
use expression_format::ex_format;
use nethsm::SystemState::{Locked, Operational, Unprovisioned};

#[derive(Debug, Subcommand)]
#[command(
    about = "Retrieve health information for a device",
    long_about = "Retrieve health information for a device

Retrieve alive, ready and state information."
)]
pub enum HealthCommand {
    Alive(AliveCommand),
    Ready(ReadyCommand),
    State(StateCommand),
}

#[derive(Debug, Parser)]
#[command(
    about = "Check whether a device is in locked or unprovisioned state",
    long_about = ex_format!("Check whether a device is in locked or unprovisioned state

Returns an error if the target device is not in state \"{Locked}\" or \"{Unprovisioned}\".

Requires no authentication."
    )
)]
pub struct AliveCommand;

#[derive(Debug, Parser)]
#[command(
    about = "Check whether a device is in operational state",
    long_about = ex_format!("Check whether a device is in operational state

Returns an error if the target device is not state \"{Operational}\".

Requires no authentication.")
)]
pub struct ReadyCommand;

#[derive(Debug, Parser)]
#[command(
    about = "Retrieve the state for a device",
    long_about = ex_format!("Retrieve the state for a device

* \"{Operational}\" if the target device is in operational state
* \"{Locked}\" if the target device is locked
* \"{Unprovisioned}\" if the target device is not yet provisioned

Requires no authentication.")
)]
pub struct StateCommand;