firepilot_models/models/
snapshot_create_params.rs

1/*
2 * Firecracker API
3 *
4 * RESTful public-facing API. The API is accessible through HTTP calls on specific URLs carrying JSON modeled data. The transport medium is a Unix Domain Socket.
5 *
6 * The version of the OpenAPI document: 1.3.0
7 * Contact: compute-capsule@amazon.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Default, Serialize, Deserialize)]
12pub struct SnapshotCreateParams {
13    /// Path to the file that will contain the guest memory.
14    #[serde(rename = "mem_file_path")]
15    pub mem_file_path: String,
16    /// Path to the file that will contain the microVM state.
17    #[serde(rename = "snapshot_path")]
18    pub snapshot_path: String,
19    /// Type of snapshot to create. It is optional and by default, a full snapshot is created.
20    #[serde(rename = "snapshot_type", skip_serializing_if = "Option::is_none")]
21    pub snapshot_type: Option<SnapshotType>,
22    /// The microVM version for which we want to create the snapshot. It is optional and it defaults to the current version.
23    #[serde(rename = "version", skip_serializing_if = "Option::is_none")]
24    pub version: Option<String>,
25}
26
27impl SnapshotCreateParams {
28    pub fn new(mem_file_path: String, snapshot_path: String) -> SnapshotCreateParams {
29        SnapshotCreateParams {
30            mem_file_path,
31            snapshot_path,
32            snapshot_type: None,
33            version: None,
34        }
35    }
36}
37
38/// Type of snapshot to create. It is optional and by default, a full snapshot is created.
39#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
40pub enum SnapshotType {
41    #[serde(rename = "Full")]
42    Full,
43    #[serde(rename = "Diff")]
44    Diff,
45}
46
47impl Default for SnapshotType {
48    fn default() -> SnapshotType {
49        Self::Full
50    }
51}