#[derive(
Clone,
Default,
PartialEq,
serde::Deserialize,
serde::Serialize,
std::fmt::Debug
)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct EndpointAc {
#[serde(skip_serializing_if = "Option::is_none")]
pub addresses: Option<std::vec::Vec<std::string::String>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub conditions: Option<
<::k8s_openapi027::api::discovery::v1::EndpointConditions as crate::Optionable>::Optioned,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub deprecated_topology: Option<
std::collections::BTreeMap<std::string::String, std::string::String>,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hints: Option<
<::k8s_openapi027::api::discovery::v1::EndpointHints as crate::Optionable>::Optioned,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub hostname: Option<std::string::String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub node_name: Option<std::string::String>,
#[serde(skip_serializing_if = "Option::is_none")]
pub target_ref: Option<
<::k8s_openapi027::api::core::v1::ObjectReference as crate::Optionable>::Optioned,
>,
#[serde(skip_serializing_if = "Option::is_none")]
pub zone: Option<std::string::String>,
}
#[automatically_derived]
impl crate::Optionable for k8s_openapi027::api::discovery::v1::Endpoint {
type Optioned = EndpointAc;
}
#[automatically_derived]
impl crate::Optionable for EndpointAc {
type Optioned = EndpointAc;
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionableConvert for k8s_openapi027::api::discovery::v1::Endpoint {
fn into_optioned(self) -> EndpointAc {
EndpointAc {
addresses: Some(self.addresses),
conditions: crate::OptionableConvert::into_optioned(self.conditions),
deprecated_topology: self.deprecated_topology,
hints: crate::OptionableConvert::into_optioned(self.hints),
hostname: self.hostname,
node_name: self.node_name,
target_ref: crate::OptionableConvert::into_optioned(self.target_ref),
zone: self.zone,
}
}
fn try_from_optioned(value: EndpointAc) -> Result<Self, crate::Error> {
Ok(Self {
addresses: value
.addresses
.ok_or(crate::Error {
missing_field: "addresses",
})?,
conditions: crate::OptionableConvert::try_from_optioned(value.conditions)?,
deprecated_topology: value.deprecated_topology,
hints: crate::OptionableConvert::try_from_optioned(value.hints)?,
hostname: value.hostname,
node_name: value.node_name,
target_ref: crate::OptionableConvert::try_from_optioned(value.target_ref)?,
zone: value.zone,
})
}
fn merge(&mut self, other: EndpointAc) -> Result<(), crate::Error> {
if let Some(other_value) = other.addresses {
crate::merge::try_merge_optioned_set(&mut self.addresses, other_value)?;
}
if self.conditions.is_none() {
self.conditions = crate::OptionableConvert::try_from_optioned(
other.conditions,
)?;
} else if let Some(self_value) = self.conditions.as_mut()
&& let Some(other_value) = other.conditions
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.deprecated_topology.is_none() {
self.deprecated_topology = crate::OptionableConvert::try_from_optioned(
other.deprecated_topology,
)?;
} else if let Some(self_value) = self.deprecated_topology.as_mut()
&& let Some(other_value) = other.deprecated_topology
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.hints.is_none() {
self.hints = crate::OptionableConvert::try_from_optioned(other.hints)?;
} else if let Some(self_value) = self.hints.as_mut()
&& let Some(other_value) = other.hints
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.hostname.is_none() {
self.hostname = crate::OptionableConvert::try_from_optioned(other.hostname)?;
} else if let Some(self_value) = self.hostname.as_mut()
&& let Some(other_value) = other.hostname
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.node_name.is_none() {
self.node_name = crate::OptionableConvert::try_from_optioned(
other.node_name,
)?;
} else if let Some(self_value) = self.node_name.as_mut()
&& let Some(other_value) = other.node_name
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.target_ref.is_none() {
self.target_ref = crate::OptionableConvert::try_from_optioned(
other.target_ref,
)?;
} else if let Some(self_value) = self.target_ref.as_mut()
&& let Some(other_value) = other.target_ref
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
if self.zone.is_none() {
self.zone = crate::OptionableConvert::try_from_optioned(other.zone)?;
} else if let Some(self_value) = self.zone.as_mut()
&& let Some(other_value) = other.zone
{
crate::OptionableConvert::merge(self_value, other_value)?;
}
Ok(())
}
}
#[automatically_derived]
#[cfg(feature = "k8s_openapi_convert")]
impl crate::OptionedConvert<k8s_openapi027::api::discovery::v1::Endpoint>
for EndpointAc {
fn from_optionable(value: k8s_openapi027::api::discovery::v1::Endpoint) -> Self {
crate::OptionableConvert::into_optioned(value)
}
fn try_into_optionable(
self,
) -> Result<k8s_openapi027::api::discovery::v1::Endpoint, crate::Error> {
crate::OptionableConvert::try_from_optioned(self)
}
fn merge_into(
self,
other: &mut k8s_openapi027::api::discovery::v1::Endpoint,
) -> Result<(), crate::Error> {
crate::OptionableConvert::merge(other, self)
}
}