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
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize)]
pub struct Spec {
    #[serde(rename = "ociVersion")]
    pub version: String,
    pub process: Option<Process>,
    pub root: Option<Root>,
    pub hostname: String,
    pub mounts: Vec<Mount>,
}

#[derive(Serialize, Deserialize)]
pub struct Process {
    terminal: bool,
    console_size: Option<Box>,
    user: User,
    args: Vec<String>,
    env: Vec<String>,
    cwd: String,
    capabilities: Option<Capabilities>,
    rlimits: Vec<RLimit>,
    #[serde(rename = "apparmorProfile")]
    apparmor_profile: String,
    #[serde(rename = "oomScoreAdj")]
    oom_score_adj: u64,
    #[serde(rename = "selinuxLabel")]
    selinux_label: String,
    #[serde(rename = "noNewPrivileges")]
    no_new_privileges: bool,
}

#[derive(Serialize, Deserialize)]
pub struct User {
    uid: u64,
    gid: u64,
    additional_gids: Option<Vec<u64>>,
}

#[derive(Serialize, Deserialize)]
pub struct Root {
    path: String,
    readonly: bool,
}

#[derive(Serialize, Deserialize)]
pub struct Box {
    height: u64,
    width: u64,
}

#[derive(Serialize, Deserialize)]
pub struct Capabilities {
    bounding: Vec<String>,
    permitted: Vec<String>,
    inheritable: Vec<String>,
    effective: Vec<String>,
    ambient: Vec<String>,
}

#[derive(Serialize, Deserialize)]
pub struct Mount {
    destination: String,
    #[serde(rename = "type")]
    fs_type: String,
    source: String,
    options: Option<Vec<String>>,
}

#[derive(Serialize, Deserialize)]
pub struct RLimit {
    #[serde(rename = "type")]
    typ: String,
    soft: u64,
    hard: u64,
}