manta_shared/types/api/boot_parameters.rs
1//! HTTP request/response bodies and CLI-built parameter structs for
2//! the boot-parameter endpoints (`/api/v1/boot-config` and
3//! `/api/v1/boot-parameters`).
4
5use serde::{Deserialize, Serialize};
6use utoipa::ToSchema;
7
8/// Request body for `POST /api/v1/boot-config`.
9///
10/// Applies a combined boot configuration (image + runtime config +
11/// kernel parameters) to the nodes named by `hosts_expression`. The
12/// field is a hosts expression — xnames, NIDs, or hostlist notation;
13/// HSM group names are not accepted here (resolve them client-side
14/// first if needed).
15#[derive(Debug, Serialize, Deserialize, ToSchema)]
16pub struct ApplyBootConfigRequest {
17 /// Hosts expression (xnames, NIDs, or hostlist notation) naming
18 /// the target nodes.
19 pub hosts_expression: String,
20 /// IMS image ID to set as the boot image.
21 pub boot_image_id: Option<String>,
22 /// CFS configuration name associated with the boot image; the
23 /// server resolves the most recent image built against this
24 /// configuration when `boot_image_id` is absent.
25 pub boot_image_configuration: Option<String>,
26 /// Kernel command-line parameters to apply.
27 pub kernel_parameters: Option<String>,
28 /// CFS configuration to assign as the runtime desired-config.
29 pub runtime_configuration: Option<String>,
30 /// When true, return the computed changeset without persisting it.
31 #[serde(default)]
32 pub dry_run: bool,
33}
34
35/// Typed parameters for fetching boot parameters.
36pub struct GetBootParametersParams {
37 /// Group whose members' boot parameters should be returned.
38 pub group_name: Option<String>,
39 /// Hosts expression (xnames, NIDs, or hostlist notation); mutually
40 /// exclusive with `group_name`.
41 pub host_expression: Option<String>,
42 /// Operator default from `cli.toml`'s `hsm_group`, used
43 /// when neither `group_name` nor `host_expression` is supplied.
44 pub settings_group_name: Option<String>,
45}
46
47/// Typed parameters for updating boot parameters.
48#[derive(serde::Deserialize, serde::Serialize, utoipa::ToSchema)]
49pub struct UpdateBootParametersParams {
50 /// Target node xnames.
51 pub hosts: Vec<String>,
52 /// Node IDs corresponding to `hosts` (optional alternate identifier).
53 pub nids: Option<Vec<u32>>,
54 /// MAC addresses corresponding to `hosts` (optional alternate identifier).
55 pub macs: Option<Vec<String>>,
56 /// Kernel command-line parameters string.
57 pub params: String,
58 /// S3 path to the kernel image.
59 pub kernel: String,
60 /// S3 path to the initrd image.
61 pub initrd: String,
62}