1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
use super::experimental::{OneShotHyperlight, OneShotWindowsSandbox, TestFeature};
use super::network::Network;
use super::primitives::OptionalField;
use super::stable::{
Fallback, Filesystem, Lifecycle, Lxc, Process, ProcessContainer, RuntimeConfig, Seatbelt,
Telemetry, Ui,
};
use super::wslc::OneShotWslc;
use crate::mxc_contract::dev::Version;
string_enum! {
/// Containment selections available in `1.1.0-alpha`.
#[derive(Debug)]
pub enum Containment, schema_name = "OneShotContainment" {
// Stable-candidate values.
/// Select the host's native process-containment backend.
Process => ["process"],
/// Select the Windows ProcessContainer backend.
ProcessContainer => ["processcontainer"],
/// Select the Linux LXC backend.
Lxc => ["lxc"],
/// Select the Linux Bubblewrap backend.
Bubblewrap => ["bubblewrap"],
/// Select the macOS Seatbelt backend.
Seatbelt => ["seatbelt"],
// Development-only values.
/// Select the host's VM-class containment backend.
Vm => ["vm"],
/// Select the Windows Sandbox backend.
WindowsSandbox => ["windows_sandbox"],
/// Select the NanVix micro-VM backend.
Microvm => ["microvm"],
/// Select the Hyperlight micro-VM backend.
Hyperlight => ["hyperlight"],
// Stable values introduced in `0.9.0-alpha`.
/// Select the WSL container backend.
Wslc => ["wslc"],
/// Select the Windows IsolationSession backend.
IsolationSession => ["isolation_session"],
}
}
/// A complete one-shot `1.1.0-alpha` configuration request.
#[derive(Debug, serde::Deserialize)]
#[cfg_attr(feature = "schema-gen", derive(schemars::JsonSchema))]
#[cfg_attr(feature = "schema-gen", schemars(rename = "OneShotRequest"))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Request {
/// Optional JSON Schema reference for editor validation.
#[serde(rename = "$schema", default)]
pub schema: OptionalField<String>,
/// Optional human-readable annotation ignored by the runtime.
#[serde(rename = "_comment", default)]
pub comment: OptionalField<serde_json::Value>,
/// The exact contract version marker.
pub version: Version,
/// Optional externally assigned container identifier.
#[serde(default)]
pub container_id: OptionalField<String>,
/// Optional containment selection.
#[serde(default)]
pub containment: OptionalField<Containment>,
/// Optional lifecycle settings.
#[serde(default)]
pub lifecycle: OptionalField<Lifecycle>,
/// The process to execute.
pub process: Process,
/// Optional filesystem policy.
#[serde(default)]
pub filesystem: OptionalField<Filesystem>,
/// Legacy settings accepted for 1.x compatibility and ignored.
#[serde(default)]
pub fallback: OptionalField<Fallback>,
/// Optional network policy.
#[serde(default)]
pub network: OptionalField<Network>,
/// Optional cross-platform user-interface policy.
#[serde(default)]
pub ui: OptionalField<Ui>,
/// Optional ProcessContainer settings.
#[serde(default)]
pub process_container: OptionalField<ProcessContainer>,
/// Optional LXC distribution settings.
#[serde(default)]
pub lxc: OptionalField<Lxc>,
/// Optional macOS Seatbelt configuration.
#[serde(default)]
pub seatbelt: OptionalField<Seatbelt>,
/// Optional runtime configuration settings.
#[serde(default)]
pub runtime_config: OptionalField<RuntimeConfig>,
/// Optional telemetry configuration.
#[serde(default)]
pub telemetry: OptionalField<Telemetry>,
/// Optional placeholder development feature.
#[serde(default)]
pub test: OptionalField<TestFeature>,
/// Optional one-shot Windows Sandbox compatibility settings.
#[serde(default)]
pub windows_sandbox: OptionalField<OneShotWindowsSandbox>,
/// Optional one-shot WSLC backend settings.
#[serde(default)]
pub wslc: OptionalField<OneShotWslc>,
/// Optional one-shot Hyperlight backend settings.
#[serde(default)]
pub hyperlight: OptionalField<OneShotHyperlight>,
/// Required image selection when containment is MicroVM.
#[serde(default)]
pub microvm: OptionalField<OneShotMicroVm>,
}
/// Creation settings for the development MicroVM backend.
#[derive(Debug, serde::Deserialize)]
#[cfg_attr(feature = "schema-gen", derive(schemars::JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct OneShotMicroVm {
/// Image reference including its registry, resolved by the signed NVX agent.
pub image: super::ImageReference,
/// Optional settings applied when creating the MicroVM.
#[serde(default)]
pub provision: super::OptionalField<super::MicroVmProvision>,
}