diff --git a/src/opts/containers.rs b/src/opts/containers.rs index e803b1f..9bcb2c7 100644 --- a/src/opts/containers.rs +++ b/src/opts/containers.rs @@ -6,6 +6,7 @@ use containers_api::{ impl_str_field, impl_url_bool_field, impl_url_field, impl_url_str_field, impl_url_vec_field, impl_vec_field, }; +use serde::{Deserialize, Serialize}; use std::fmt; impl_opts_builder!(url => @@ -288,7 +289,7 @@ impl_opts_builder!(json => ContainerCreate ); -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// Mode used to configure image volume with /// [`image_volume_mode`](ContainerCreateOptsBuilder::image_volume_mode). #[derive(Default)] @@ -318,11 +319,13 @@ impl fmt::Display for ImageVolumeMode { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// How to handle the `NOTIFY_SOCKET`. Used with /// [`sdnotify_mode`](ContainerCreateOptsBuilder::sdnotify_mode). +#[derive(Default)] pub enum SocketNotifyMode { /// Let the OCI runtime deal with it, advertise conmon's MAINPID. + #[default] Container, /// Advertise conmon's MAINPID, send READY when started, don't pass to OCI. Conmon, @@ -346,7 +349,7 @@ impl fmt::Display for SocketNotifyMode { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// Used with [`ContainerCreateOptsBuilder::seccomp_policy`](ContainerCreateOptsBuilder::seccomp_policy). #[derive(Default)] pub enum SeccompPolicy { @@ -372,7 +375,7 @@ impl fmt::Display for SeccompPolicy { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// Used with [`ContainerCreateOptsBuilder::systemd`](ContainerCreateOptsBuilder::systemd). #[derive(Default)] pub enum SystemdEnabled { @@ -398,7 +401,7 @@ impl fmt::Display for SystemdEnabled { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] /// Used with /// [`ContainerCreateOptsBuilder::restart_policy`](ContainerCreateOptsBuilder::restart_policy). #[derive(Default)]