manta_shared/types/api/
migrate.rs

1//! Wire types for the `POST /api/v1/migrate/*` endpoints.
2
3use serde::{Deserialize, Serialize};
4use utoipa::ToSchema;
5
6/// Request body for `POST /api/v1/migrate/nodes`.
7///
8/// Paired with [`super::responses::MigrateNodesResponse`] on success.
9/// `target_hsm_names` and `parent_hsm_names` are length-matched: each
10/// `parent_hsm_names[i]` donates members to `target_hsm_names[i]`.
11///
12/// # Wire shape
13///
14/// ```json
15/// {
16///   "target_hsm_names": ["zinal"],
17///   "parent_hsm_names": ["alps"],
18///   "hosts_expression": "x3000c0s1b0n[0-3]",
19///   "dry_run": false,
20///   "create_hsm_group": false
21/// }
22/// ```
23#[derive(Debug, Serialize, Deserialize, ToSchema)]
24pub struct MigrateNodesRequest {
25  /// Destination HSM group names to move nodes into.
26  pub target_hsm_names: Vec<String>,
27  /// Source HSM group names the nodes currently belong to.
28  pub parent_hsm_names: Vec<String>,
29  /// Node-set expression (xnames, NIDs, or hostlist notation)
30  /// selecting which nodes to migrate.
31  pub hosts_expression: String,
32  /// When true, validate the migration plan without modifying any
33  /// group membership.
34  #[serde(default)]
35  pub dry_run: bool,
36  /// Create the target HSM group if it does not already exist.
37  #[serde(default)]
38  pub create_hsm_group: bool,
39}
40
41/// Request body for `POST /api/v1/migrate/backup`.
42///
43/// Paired with [`super::responses::CompletedResponse`] on success.
44#[derive(Debug, Serialize, Deserialize, ToSchema)]
45pub struct MigrateBackupRequest {
46  /// BOS session template name (or filter) to back up.
47  pub bos: Option<String>,
48  /// Filesystem path where backup files will be written.
49  pub destination: Option<String>,
50}
51
52/// Request body for `POST /api/v1/migrate/restore`.
53///
54/// Paired with [`super::responses::CompletedResponse`] on success.
55/// Every `*_file` field is optional independently — supplying only
56/// `cfs_file` restores CFS configurations and leaves BOS, HSM, IMS,
57/// and image layers untouched.
58#[derive(Debug, Serialize, Deserialize, ToSchema)]
59pub struct MigrateRestoreRequest {
60  /// Path to the BOS session template backup file.
61  pub bos_file: Option<String>,
62  /// Path to the CFS configuration backup file.
63  pub cfs_file: Option<String>,
64  /// Path to the HSM group backup file.
65  pub hsm_file: Option<String>,
66  /// Path to the IMS image metadata backup file.
67  pub ims_file: Option<String>,
68  /// Directory containing the image layer tarballs.
69  pub image_dir: Option<String>,
70  /// When true, overwrite existing resources that conflict with the
71  /// backup.
72  #[serde(default)]
73  pub overwrite: bool,
74}