From 5467fd3486b19d9638f29b8801e3db4a1dadfb96 Mon Sep 17 00:00:00 2001 From: wojciechkepka Date: Thu, 11 Mar 2021 19:08:59 +0100 Subject: Add missing fields to ContainerDetails Signed-off-by: Matthias Beyer --- src/container.rs | 173 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 150 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/container.rs b/src/container.rs index 7abb65d..8b00d47 100644 --- a/src/container.rs +++ b/src/container.rs @@ -1202,30 +1202,40 @@ pub struct ContainerInfo { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct ContainerDetails { - pub app_armor_profile: String, - pub args: Vec, - pub config: Config, + pub id: String, #[cfg(feature = "chrono")] pub created: DateTime, #[cfg(not(feature = "chrono"))] pub created: String, - pub driver: String, - // pub ExecIDs: ?? - pub host_config: HostConfig, + pub path: String, + pub args: Vec, + pub state: State, + pub image: String, + pub resolv_conf_path: String, pub hostname_path: String, pub hosts_path: String, pub log_path: String, - pub id: String, - pub image: String, - pub mount_label: String, pub name: String, - pub network_settings: NetworkSettings, - pub path: String, + pub restart_count: i64, + pub driver: String, + pub platform: String, + pub mount_label: String, pub process_label: String, - pub resolv_conf_path: String, - pub restart_count: u64, - pub state: State, + pub app_armor_profile: String, + #[serde(rename = "ExecIDs")] + pub exec_ids: Option>, + pub host_config: HostConfig, + pub graph_driver: GraphDriverData, pub mounts: Vec, + pub config: ContainerConfig, + pub network_settings: NetworkSettings, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct GraphDriverData { + pub name: String, + pub data: HashMap, } #[derive(Clone, Debug, Serialize, Deserialize)] @@ -1263,22 +1273,139 @@ pub struct State { #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct HostConfig { + pub cpu_shares: Option, + pub memory: Option, pub cgroup_parent: Option, - #[serde(rename = "ContainerIDFile")] - pub container_id_file: String, - pub cpu_shares: Option, + pub blkio_weight_device: Option>, + pub blkio_device_read_bps: Option>, + pub blkio_device_write_bps: Option>, + #[serde(rename = "BlkioDeviceReadIOps")] + pub blkio_device_read_iops: Option>, + #[serde(rename = "BlkioDeviceWriteIOps")] + pub blkio_device_write_iops: Option>, + pub cpu_period: Option, + pub cpu_quota: Option, + pub cpu_realtime_period: Option, + pub cpu_realtime_runtime: Option, pub cpuset_cpus: Option, - pub memory: Option, + pub cpuset_mems: Option, + pub devices: Option>, + pub device_cgroup_rules: Option, + pub device_requests: Option>, + #[serde(rename = "KernelMemoryTCP")] + pub kernel_memory_tcp: i64, + pub memory_reservation: Option, pub memory_swap: Option, + pub memory_swappiness: Option, + #[serde(rename = "NanoCPUs")] + pub nano_cpus: Option, + pub oom_kill_disable: bool, + pub init: Option, + pub pids_limit: Option, + pub ulimits: Option>, + pub cpu_count: i64, + pub cpu_percent: i64, + #[serde(rename = "IOMaximumIOps")] + pub io_maximum_iops: u64, + #[serde(rename = "IOMaximumBandwith")] + pub io_maximum_bandwith: Option, + pub binds: Option>, + #[serde(rename = "ContainerIDFile")] + pub container_id_file: String, + pub log_config: LogConfig, pub network_mode: String, + pub port_bindings: Option, + pub restart_policy: RestartPolicy, + pub auto_remove: bool, + pub volume_driver: String, + pub volumes_from: Option>, + pub mounts: Option>, + pub cap_add: Option>, + pub cap_drop: Option>, + pub dns: Option>, + pub dns_options: Option>, + pub dns_search: Option>, + pub extra_hosts: Option>, + pub group_add: Option>, + pub ipc_mode: String, + pub cgroup: String, + pub links: Option>, + pub oom_score_adj: i64, pub pid_mode: Option, - pub port_bindings: Option>>>, pub privileged: bool, pub publish_all_ports: bool, - pub readonly_rootfs: Option, /* pub RestartPolicy: ??? - * pub SecurityOpt: Option, - * pub Ulimits: Option - * pub VolumesFrom: Option */ + pub readonly_rootfs: Option, + pub security_opt: Option>, + pub storage_opt: Option>, + pub tmpfs: Option>, + #[serde(rename = "UTSMode")] + pub uts_mode: String, + pub userns_mode: String, + pub shm_size: u64, + pub sysctls: Option>, + pub runtime: String, + pub console_size: Option>, + pub isolation: String, + pub masked_paths: Option>, + pub readonly_paths: Option>, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct ThrottleDevice { + pub path: String, + pub rate: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct RestartPolicy { + pub name: String, + pub maximum_retry_count: u64, +} + +pub type PortMap = HashMap>>; + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct PortBinding { + pub host_ip: String, + pub host_port: String, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct LogConfig { + #[serde(rename = "Type")] + pub type_: String, + #[serde(rename = "Config")] + pub config: HashMap, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct Ulimit { + pub name: String, + pub soft: u64, + pub hard: u64, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct DeviceMapping { + pub path_on_host: Option, + pub path_in_container: Option, + pub cgroup_permissions: Option, +} + +#[derive(Clone, Debug, Serialize, Deserialize)] +#[serde(rename_all = "PascalCase")] +pub struct DeviceRequest { + pub driver: String, + pub count: u64, + #[serde(rename = "DeviceIDs")] + pub device_ids: Vec, + pub capabilities: Vec, + pub options: Option, } #[derive(Clone, Debug, Serialize, Deserialize)] -- cgit v1.2.3