#[derive(
Clone,
Default,
PartialEq,
serde::Deserialize,
serde::Serialize,
std::fmt::Debug
)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct DeviceTolerationAc {
#[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 operator: Option<std::string::String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub toleration_seconds: Option<i64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub value: Option<std::string::String>,
}
#[automatically_derived]
impl crate::Optionable for k8s_openapi027::api::resource::v1::DeviceToleration {
type Optioned = DeviceTolerationAc;
}
#[automatically_derived]
impl crate::Optionable for DeviceTolerationAc {
type Optioned = DeviceTolerationAc;
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionableConvert for k8s_openapi027::api::resource::v1::DeviceToleration {
fn into_optioned(self) -> DeviceTolerationAc {
DeviceTolerationAc {
effect: self.effect,
key: self.key,
operator: self.operator,
toleration_seconds: self.toleration_seconds,
value: self.value,
}
}
fn try_from_optioned(value: DeviceTolerationAc) -> Result<Self, crate::Error> {
Ok(Self {
effect: value.effect,
key: value.key,
operator: value.operator,
toleration_seconds: value.toleration_seconds,
value: value.value,
})
}
fn merge(&mut self, other: DeviceTolerationAc) -> Result<(), crate::Error> {
if self.effect.is_none() {
self.effect = crate::OptionableConvert::try_from_optioned(other.effect)?;
} else if let Some(self_value) = self.effect.as_mut()
&& let Some(other_value) = other.effect
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.key.is_none() {
self.key = crate::OptionableConvert::try_from_optioned(other.key)?;
} else if let Some(self_value) = self.key.as_mut()
&& let Some(other_value) = other.key
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.operator.is_none() {
self.operator = crate::OptionableConvert::try_from_optioned(other.operator)?;
} else if let Some(self_value) = self.operator.as_mut()
&& let Some(other_value) = other.operator
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.toleration_seconds.is_none() {
self.toleration_seconds = crate::OptionableConvert::try_from_optioned(
other.toleration_seconds,
)?;
} else if let Some(self_value) = self.toleration_seconds.as_mut()
&& let Some(other_value) = other.toleration_seconds
{
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::DeviceToleration>
for DeviceTolerationAc {
fn from_optionable(
value: k8s_openapi027::api::resource::v1::DeviceToleration,
) -> Self {
crate::OptionableConvert::into_optioned(value)
}
fn try_into_optionable(
self,
) -> Result<k8s_openapi027::api::resource::v1::DeviceToleration, crate::Error> {
crate::OptionableConvert::try_from_optioned(self)
}
fn merge_into(
self,
other: &mut k8s_openapi027::api::resource::v1::DeviceToleration,
) -> Result<(), crate::Error> {
crate::OptionableConvert::merge(other, self)
}
}