Skip to main content

k8s_openapi/v1_36/apimachinery/pkg/apis/meta/v1/
status_details.rs

1// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails
2
3/// StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.
4#[derive(Clone, Debug, Default, PartialEq)]
5pub struct StatusDetails {
6    /// The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.
7    pub causes: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>>,
8
9    /// The group attribute of the resource associated with the status StatusReason.
10    pub group: Option<std::string::String>,
11
12    /// The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
13    pub kind: Option<std::string::String>,
14
15    /// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
16    pub name: Option<std::string::String>,
17
18    /// If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.
19    pub retry_after_seconds: Option<i32>,
20
21    /// UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
22    pub uid: Option<std::string::String>,
23}
24
25impl crate::DeepMerge for StatusDetails {
26    fn merge_from(&mut self, other: Self) {
27        crate::merge_strategies::list::atomic(&mut self.causes, other.causes);
28        crate::DeepMerge::merge_from(&mut self.group, other.group);
29        crate::DeepMerge::merge_from(&mut self.kind, other.kind);
30        crate::DeepMerge::merge_from(&mut self.name, other.name);
31        crate::DeepMerge::merge_from(&mut self.retry_after_seconds, other.retry_after_seconds);
32        crate::DeepMerge::merge_from(&mut self.uid, other.uid);
33    }
34}
35
36impl<'de> crate::serde::Deserialize<'de> for StatusDetails {
37    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
38        #[allow(non_camel_case_types)]
39        enum Field {
40            Key_causes,
41            Key_group,
42            Key_kind,
43            Key_name,
44            Key_retry_after_seconds,
45            Key_uid,
46            Other,
47        }
48
49        impl<'de> crate::serde::Deserialize<'de> for Field {
50            fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
51                struct Visitor;
52
53                impl crate::serde::de::Visitor<'_> for Visitor {
54                    type Value = Field;
55
56                    fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
57                        f.write_str("field identifier")
58                    }
59
60                    fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
61                        Ok(match v {
62                            "causes" => Field::Key_causes,
63                            "group" => Field::Key_group,
64                            "kind" => Field::Key_kind,
65                            "name" => Field::Key_name,
66                            "retryAfterSeconds" => Field::Key_retry_after_seconds,
67                            "uid" => Field::Key_uid,
68                            _ => Field::Other,
69                        })
70                    }
71                }
72
73                deserializer.deserialize_identifier(Visitor)
74            }
75        }
76
77        struct Visitor;
78
79        impl<'de> crate::serde::de::Visitor<'de> for Visitor {
80            type Value = StatusDetails;
81
82            fn expecting(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
83                f.write_str("StatusDetails")
84            }
85
86            fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
87                let mut value_causes: Option<std::vec::Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>> = None;
88                let mut value_group: Option<std::string::String> = None;
89                let mut value_kind: Option<std::string::String> = None;
90                let mut value_name: Option<std::string::String> = None;
91                let mut value_retry_after_seconds: Option<i32> = None;
92                let mut value_uid: Option<std::string::String> = None;
93
94                while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
95                    match key {
96                        Field::Key_causes => value_causes = crate::serde::de::MapAccess::next_value(&mut map)?,
97                        Field::Key_group => value_group = crate::serde::de::MapAccess::next_value(&mut map)?,
98                        Field::Key_kind => value_kind = crate::serde::de::MapAccess::next_value(&mut map)?,
99                        Field::Key_name => value_name = crate::serde::de::MapAccess::next_value(&mut map)?,
100                        Field::Key_retry_after_seconds => value_retry_after_seconds = crate::serde::de::MapAccess::next_value(&mut map)?,
101                        Field::Key_uid => value_uid = crate::serde::de::MapAccess::next_value(&mut map)?,
102                        Field::Other => { let _: crate::serde::de::IgnoredAny = crate::serde::de::MapAccess::next_value(&mut map)?; },
103                    }
104                }
105
106                Ok(StatusDetails {
107                    causes: value_causes,
108                    group: value_group,
109                    kind: value_kind,
110                    name: value_name,
111                    retry_after_seconds: value_retry_after_seconds,
112                    uid: value_uid,
113                })
114            }
115        }
116
117        deserializer.deserialize_struct(
118            "StatusDetails",
119            &[
120                "causes",
121                "group",
122                "kind",
123                "name",
124                "retryAfterSeconds",
125                "uid",
126            ],
127            Visitor,
128        )
129    }
130}
131
132impl crate::serde::Serialize for StatusDetails {
133    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
134        let mut state = serializer.serialize_struct(
135            "StatusDetails",
136            self.causes.as_ref().map_or(0, |_| 1) +
137            self.group.as_ref().map_or(0, |_| 1) +
138            self.kind.as_ref().map_or(0, |_| 1) +
139            self.name.as_ref().map_or(0, |_| 1) +
140            self.retry_after_seconds.as_ref().map_or(0, |_| 1) +
141            self.uid.as_ref().map_or(0, |_| 1),
142        )?;
143        if let Some(value) = &self.causes {
144            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "causes", value)?;
145        }
146        if let Some(value) = &self.group {
147            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?;
148        }
149        if let Some(value) = &self.kind {
150            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?;
151        }
152        if let Some(value) = &self.name {
153            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?;
154        }
155        if let Some(value) = &self.retry_after_seconds {
156            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "retryAfterSeconds", value)?;
157        }
158        if let Some(value) = &self.uid {
159            crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?;
160        }
161        crate::serde::ser::SerializeStruct::end(state)
162    }
163}
164
165#[cfg(feature = "schemars")]
166impl crate::schemars::JsonSchema for StatusDetails {
167    fn schema_name() -> std::borrow::Cow<'static, str> {
168        "io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails".into()
169    }
170
171    fn json_schema(__gen: &mut crate::schemars::SchemaGenerator) -> crate::schemars::Schema {
172        crate::schemars::json_schema!({
173            "description": "StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.",
174            "type": "object",
175            "properties": {
176                "causes": {
177                    "description": "The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.",
178                    "type": "array",
179                    "items": (__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::StatusCause>()),
180                },
181                "group": {
182                    "description": "The group attribute of the resource associated with the status StatusReason.",
183                    "type": "string",
184                },
185                "kind": {
186                    "description": "The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
187                    "type": "string",
188                },
189                "name": {
190                    "description": "The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).",
191                    "type": "string",
192                },
193                "retryAfterSeconds": {
194                    "description": "If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.",
195                    "type": "integer",
196                    "format": "int32",
197                },
198                "uid": {
199                    "description": "UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids",
200                    "type": "string",
201                },
202            },
203        })
204    }
205}
206
207#[cfg(feature = "schemars08")]
208impl crate::schemars08::JsonSchema for StatusDetails {
209    fn schema_name() -> std::string::String {
210        "io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails".into()
211    }
212
213    fn json_schema(__gen: &mut crate::schemars08::gen::SchemaGenerator) -> crate::schemars08::schema::Schema {
214        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
215            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
216                description: Some("StatusDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.".into()),
217                ..Default::default()
218            })),
219            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Object))),
220            object: Some(std::boxed::Box::new(crate::schemars08::schema::ObjectValidation {
221                properties: [
222                    (
223                        "causes".into(),
224                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
225                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
226                                description: Some("The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.".into()),
227                                ..Default::default()
228                            })),
229                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Array))),
230                            array: Some(std::boxed::Box::new(crate::schemars08::schema::ArrayValidation {
231                                items: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::StatusCause>()))),
232                                ..Default::default()
233                            })),
234                            ..Default::default()
235                        }),
236                    ),
237                    (
238                        "group".into(),
239                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
240                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
241                                description: Some("The group attribute of the resource associated with the status StatusReason.".into()),
242                                ..Default::default()
243                            })),
244                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
245                            ..Default::default()
246                        }),
247                    ),
248                    (
249                        "kind".into(),
250                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
251                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
252                                description: Some("The kind attribute of the resource associated with the status StatusReason. On some operations may differ from the requested resource Kind. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds".into()),
253                                ..Default::default()
254                            })),
255                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
256                            ..Default::default()
257                        }),
258                    ),
259                    (
260                        "name".into(),
261                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
262                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
263                                description: Some("The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).".into()),
264                                ..Default::default()
265                            })),
266                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
267                            ..Default::default()
268                        }),
269                    ),
270                    (
271                        "retryAfterSeconds".into(),
272                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
273                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
274                                description: Some("If specified, the time in seconds before the operation should be retried. Some errors may indicate the client must take an alternate action - for those errors this field may indicate how long to wait before taking the alternate action.".into()),
275                                ..Default::default()
276                            })),
277                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::Integer))),
278                            format: Some("int32".into()),
279                            ..Default::default()
280                        }),
281                    ),
282                    (
283                        "uid".into(),
284                        crate::schemars08::schema::Schema::Object(crate::schemars08::schema::SchemaObject {
285                            metadata: Some(std::boxed::Box::new(crate::schemars08::schema::Metadata {
286                                description: Some("UID of the resource. (when there is a single resource which can be described). More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids".into()),
287                                ..Default::default()
288                            })),
289                            instance_type: Some(crate::schemars08::schema::SingleOrVec::Single(std::boxed::Box::new(crate::schemars08::schema::InstanceType::String))),
290                            ..Default::default()
291                        }),
292                    ),
293                ].into(),
294                ..Default::default()
295            })),
296            ..Default::default()
297        })
298    }
299}