#[derive(
Clone,
Default,
PartialEq,
serde::Deserialize,
serde::Serialize,
std::fmt::Debug
)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DeviceTaintAc {
#[serde(skip_serializing_if = "Option::is_none")]
pub effect: Option<std::string::String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub key: Option<std::string::String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub time_added: Option<
<::k8s_openapi027::apimachinery::pkg::apis::meta::v1::Time as crate::Optionable>::Optioned,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<std::string::String>,
}
#[automatically_derived]
impl crate::Optionable for k8s_openapi027::api::resource::v1::DeviceTaint {
type Optioned = DeviceTaintAc;
}
#[automatically_derived]
impl crate::Optionable for DeviceTaintAc {
type Optioned = DeviceTaintAc;
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionableConvert for k8s_openapi027::api::resource::v1::DeviceTaint {
fn into_optioned(self) -> DeviceTaintAc {
DeviceTaintAc {
effect: Some(self.effect),
key: Some(self.key),
time_added: crate::OptionableConvert::into_optioned(self.time_added),
value: self.value,
}
}
fn try_from_optioned(value: DeviceTaintAc) -> Result<Self, crate::Error> {
Ok(Self {
effect: value
.effect
.ok_or(crate::Error {
missing_field: "effect",
})?,
key: value
.key
.ok_or(crate::Error {
missing_field: "key",
})?,
time_added: crate::OptionableConvert::try_from_optioned(value.time_added)?,
value: value.value,
})
}
fn merge(&mut self, other: DeviceTaintAc) -> Result<(), crate::Error> {
if let Some(other_value) = other.effect {
self.effect = crate::OptionableConvert::try_from_optioned(other_value)?;
}
if let Some(other_value) = other.key {
self.key = crate::OptionableConvert::try_from_optioned(other_value)?;
}
if self.time_added.is_none() {
self.time_added = crate::OptionableConvert::try_from_optioned(
other.time_added,
)?;
} else if let Some(self_value) = self.time_added.as_mut()
&& let Some(other_value) = other.time_added
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.value.is_none() {
self.value = crate::OptionableConvert::try_from_optioned(other.value)?;
} else if let Some(self_value) = self.value.as_mut()
&& let Some(other_value) = other.value
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
Ok(())
}
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionedConvert<k8s_openapi027::api::resource::v1::DeviceTaint>
for DeviceTaintAc {
fn from_optionable(value: k8s_openapi027::api::resource::v1::DeviceTaint) -> Self {
crate::OptionableConvert::into_optioned(value)
}
fn try_into_optionable(
self,
) -> Result<k8s_openapi027::api::resource::v1::DeviceTaint, crate::Error> {
crate::OptionableConvert::try_from_optioned(self)
}
fn merge_into(
self,
other: &mut k8s_openapi027::api::resource::v1::DeviceTaint,
) -> Result<(), crate::Error> {
crate::OptionableConvert::merge(other, self)
}
}