Skip to main content

manta_shared/shared/params/
power.rs

1//! Parameters for `POST /power`.
2
3/// The power operation to apply to a list of xnames.
4#[derive(Debug, Clone, Copy)]
5pub enum PowerAction {
6  /// Power on (cold start) the listed xnames.
7  On,
8  /// Power off the listed xnames; graceful unless `force` is set.
9  Off,
10  /// Power-cycle (reset) the listed xnames; graceful unless `force`
11  /// is set.
12  Reset,
13}
14
15/// Whether the caller's `targets_expression` is a hosts expression
16/// (xnames / nids / hostlist) or a single HSM group name whose
17/// members should be targeted.
18#[derive(Debug, Clone, Copy)]
19pub enum PowerTargetType {
20  /// `targets_expression` is a hosts expression.
21  Nodes,
22  /// `targets_expression` is a single HSM group name.
23  Cluster,
24}
25
26/// Typed parameters for the power-action service call.
27pub struct ApplyPowerParams {
28  /// Power operation to perform on every entry in `xnames`.
29  pub action: PowerAction,
30  /// Resolved list of xnames (already expanded from any HSM-group
31  /// or hostlist expression by the caller).
32  pub xnames: Vec<String>,
33  /// When true, perform a hard power off / reset without the
34  /// graceful shutdown path.
35  pub force: bool,
36}