Skip to main content

manta_shared/types/params/
power.rs

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