manta_server/backend_dispatcher/migrate_restore.rs
1//! [`MigrateRestoreTrait`] impl for [`StaticBackendDispatcher`].
2//!
3//! Inverse of
4//! [`crate::backend_dispatcher::migrate_backup`]: reads the files
5//! written by a previous backup and POSTs the contained HSM group,
6//! CFS configuration, IMS image, and BOS session template back to
7//! the backend. Each `overwrite_*` flag controls whether the
8//! corresponding artifact is replaced if it already exists; without
9//! the flag the backend returns
10//! [`Error::ConfigurationAlreadyExistsError`] / [`Error::Conflict`].
11//! Ochami uses the trait default and returns [`Error::Message`].
12
13use super::*;
14
15impl MigrateRestoreTrait for StaticBackendDispatcher {
16 /// Re-create artifacts from the supplied dump files. Each `*_file`
17 /// is optional so callers can restore a subset (e.g. just IMS
18 /// images). `image_dir` points at the on-disk IMS payload
19 /// directory backed up alongside `ims_file`.
20 async fn migrate_restore(
21 &self,
22 token: &str,
23 bos_file: Option<&str>,
24 cfs_file: Option<&str>,
25 group_file: Option<&str>,
26 ims_file: Option<&str>,
27 image_dir: Option<&str>,
28 overwrite_group: bool,
29 overwrite_configuration: bool,
30 overwrite_image: bool,
31 overwrite_template: bool,
32 ) -> Result<(), Error> {
33 dispatch!(
34 self,
35 migrate_restore,
36 token,
37 bos_file,
38 cfs_file,
39 group_file,
40 ims_file,
41 image_dir,
42 overwrite_group,
43 overwrite_configuration,
44 overwrite_image,
45 overwrite_template
46 )
47 }
48}