k8s_openapi/v1_35/api/resource/v1alpha3/
device_taint_rule_status.rs1#[derive(Clone, Debug, Default, PartialEq)]
5pub struct DeviceTaintRuleStatus {
6 pub conditions: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::Condition>>,
17}
18
19impl crate::DeepMerge for DeviceTaintRuleStatus {
20 fn merge_from(&mut self, other: Self) {
21 crate::merge_strategies::list::map(
22 &mut self.conditions,
23 other.conditions,
24 &[|lhs, rhs| lhs.type_ == rhs.type_],
25 |current_item, other_item| {
26 crate::DeepMerge::merge_from(current_item, other_item);
27 },
28 );
29 }
30}
31
32impl<'de> crate::serde::Deserialize<'de> for DeviceTaintRuleStatus {
33 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
34 #[allow(non_camel_case_types)]
35 enum Field {
36 Key_conditions,
37 Other,
38 }
39
40 impl<'de> crate::serde::Deserialize<'de> for Field {
41 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
42 struct Visitor;
43
44 impl crate::serde::de::Visitor<'_> for Visitor {
45 type Value = Field;
46
47 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
48 f.write_str("field identifier")
49 }
50
51 fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
52 Ok(match v {
53 "conditions" => Field::Key_conditions,
54 _ => Field::Other,
55 })
56 }
57 }
58
59 deserializer.deserialize_identifier(Visitor)
60 }
61 }
62
63 struct Visitor;
64
65 impl<'de> crate::serde::de::Visitor<'de> for Visitor {
66 type Value = DeviceTaintRuleStatus;
67
68 fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
69 f.write_str("DeviceTaintRuleStatus")
70 }
71
72 fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
73 let mut value_conditions: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::Condition>> = None;
74
75 while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
76 match key {
77 Field::Key_conditions => value_conditions = crate::serde::de::MapAccess::next_value(&mut map)?,
78 Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
79 }
80 }
81
82 Ok(DeviceTaintRuleStatus {
83 conditions: value_conditions,
84 })
85 }
86 }
87
88 deserializer.deserialize_struct(
89 "DeviceTaintRuleStatus",
90 &[
91 "conditions",
92 ],
93 Visitor,
94 )
95 }
96}
97
98impl crate::serde::Serialize for DeviceTaintRuleStatus {
99 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
100 let mut state = serializer.serialize_struct(
101 "DeviceTaintRuleStatus",
102 self.conditions.as_ref().map_or(0, |_| 1),
103 )?;
104 if let Some(value) = &self.conditions {
105 crate::serde::ser::SerializeStruct::serialize_field(&mut state, "conditions", value)?;
106 }
107 crate::serde::ser::SerializeStruct::end(state)
108 }
109}
110
111#[cfg(feature = "schemars")]
112impl crate::schemars::JsonSchema for DeviceTaintRuleStatus {
113 fn schema_name() -> std::borrow::Cow<'static, str> {
114 "io.k8s.api.resource.v1alpha3.DeviceTaintRuleStatus".into()
115 }
116
117 fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
118 crate::schemars::json_schema!({
119 "description": "DeviceTaintRuleStatus provides information about an on-going pod eviction.",
120 "type": "object",
121 "properties": {
122 "conditions": {
123 "description": "Conditions provide information about the state of the DeviceTaintRule and the cluster at some point in time, in a machine-readable and human-readable format.\n\nThe following condition is currently defined as part of this API, more may get added: - Type: EvictionInProgress - Status: True if there are currently pods which need to be evicted, False otherwise\n (includes the effects which don't cause eviction).\n- Reason: not specified, may change - Message: includes information about number of pending pods and already evicted pods\n in a human-readable format, updated periodically, may change\n\nFor `effect: None`, the condition above gets set once for each change to the spec, with the message containing information about what would happen if the effect was `NoExecute`. This feedback can be used to decide whether changing the effect to `NoExecute` will work as intended. It only gets set once to avoid having to constantly update the status.\n\nMust have 8 or fewer entries.",
124 "type": "array",
125 "items": (__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::Condition>()),
126 },
127 },
128 })
129 }
130}