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

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginInfo {
    pub id: Option<String>,
    pub name: String,
    pub enabled: bool,
    pub settings: PluginSettings,
    pub plugin_reference: Option<String>,
    pub config: PluginConfig,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginSettings {
    pub mounts: Vec<PluginMount>,
    pub env: Vec<String>,
    pub args: Vec<String>,
    pub devices: Vec<PluginDevice>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginMount {
    pub name: String,
    pub description: String,
    pub settable: Vec<String>,
    pub source: String,
    pub destination: String,
    #[serde(rename = "Type")]
    pub type_: String,
    pub options: Vec<String>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginDevice {
    pub name: String,
    pub description: String,
    pub settable: Vec<String>,
    pub path: String,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginConfig {
    pub docker_version: Option<String>,
    pub description: String,
    pub documentation: String,
    pub interface: PluginInterface,
    pub entrypoint: Vec<String>,
    pub work_dir: String,
    pub user: Option<User>,
    pub network: PluginNetwork,
    pub linux: LinuxInfo,
    pub propagated_mount: String,
    pub ipc_host: bool,
    pub pid_host: bool,
    pub mounts: Vec<PluginMount>,
    pub env: Vec<PluginEnv>,
    pub args: PluginArgs,
    pub rootfs: Option<PluginRootfs>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct User {
    #[serde(rename = "UID")]
    pub uid: u32,
    #[serde(rename = "GID")]
    pub gid: u32,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct LinuxInfo {
    pub capabilities: Vec<String>,
    pub allow_all_devices: bool,
    pub devices: Vec<PluginDevice>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct PluginNetwork {
    #[serde(rename = "Type")]
    pub type_: String,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginInterface {
    pub types: Vec<PluginInterfaceType>,
    pub socket: String,
    pub protocol_scheme: Option<String>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginInterfaceType {
    pub prefix: String,
    pub capability: String,
    pub version: String,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginEnv {
    pub name: String,
    pub description: String,
    pub settable: Vec<String>,
    pub value: String,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginArgs {
    pub name: String,
    pub description: String,
    pub settable: Vec<String>,
    pub value: Vec<String>,
}

#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "PascalCase")]
pub struct PluginRootfs {
    #[serde(rename = "type")]
    pub type_: Option<String>,
    pub diff_ids: Option<Vec<String>>,
}