1// Generated from definition io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails
23/// 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.
7pub causes: Option<Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>>,
89/// The group attribute of the resource associated with the status StatusReason.
10pub group: Option<String>,
1112/// 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
13pub kind: Option<String>,
1415/// The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).
16pub name: Option<String>,
1718/// 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.
19pub retry_after_seconds: Option<i32>,
2021/// 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
22pub uid: Option<String>,
23}
2425impl crate::DeepMerge for StatusDetails {
26fn merge_from(&mut self, other: Self) {
27crate::merge_strategies::list::atomic(&mut self.causes, other.causes);
28crate::DeepMerge::merge_from(&mut self.group, other.group);
29crate::DeepMerge::merge_from(&mut self.kind, other.kind);
30crate::DeepMerge::merge_from(&mut self.name, other.name);
31crate::DeepMerge::merge_from(&mut self.retry_after_seconds, other.retry_after_seconds);
32crate::DeepMerge::merge_from(&mut self.uid, other.uid);
33 }
34}
3536impl<'de> crate::serde::Deserialize<'de> for StatusDetails {
37fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
38#[allow(non_camel_case_types)]
39enum Field {
40 Key_causes,
41 Key_group,
42 Key_kind,
43 Key_name,
44 Key_retry_after_seconds,
45 Key_uid,
46 Other,
47 }
4849impl<'de> crate::serde::Deserialize<'de> for Field {
50fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: crate::serde::Deserializer<'de> {
51struct Visitor;
5253impl<'de> crate::serde::de::Visitor<'de> for Visitor {
54type Value = Field;
5556fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
57 f.write_str("field identifier")
58 }
5960fn visit_str<E>(self, v: &str) -> Result<Self::Value, E> where E: crate::serde::de::Error {
61Ok(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 }
7273 deserializer.deserialize_identifier(Visitor)
74 }
75 }
7677struct Visitor;
7879impl<'de> crate::serde::de::Visitor<'de> for Visitor {
80type Value = StatusDetails;
8182fn expecting(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
83 f.write_str("StatusDetails")
84 }
8586fn visit_map<A>(self, mut map: A) -> Result<Self::Value, A::Error> where A: crate::serde::de::MapAccess<'de> {
87let mut value_causes: Option<Vec<crate::apimachinery::pkg::apis::meta::v1::StatusCause>> = None;
88let mut value_group: Option<String> = None;
89let mut value_kind: Option<String> = None;
90let mut value_name: Option<String> = None;
91let mut value_retry_after_seconds: Option<i32> = None;
92let mut value_uid: Option<String> = None;
9394while let Some(key) = crate::serde::de::MapAccess::next_key::<Field>(&mut map)? {
95match 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 }
105106Ok(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 }
116117 deserializer.deserialize_struct(
118"StatusDetails",
119&[
120"causes",
121"group",
122"kind",
123"name",
124"retryAfterSeconds",
125"uid",
126 ],
127 Visitor,
128 )
129 }
130}
131132impl crate::serde::Serialize for StatusDetails {
133fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: crate::serde::Serializer {
134let mut state = serializer.serialize_struct(
135"StatusDetails",
136self.causes.as_ref().map_or(0, |_| 1) +
137self.group.as_ref().map_or(0, |_| 1) +
138self.kind.as_ref().map_or(0, |_| 1) +
139self.name.as_ref().map_or(0, |_| 1) +
140self.retry_after_seconds.as_ref().map_or(0, |_| 1) +
141self.uid.as_ref().map_or(0, |_| 1),
142 )?;
143if let Some(value) = &self.causes {
144crate::serde::ser::SerializeStruct::serialize_field(&mut state, "causes", value)?;
145 }
146if let Some(value) = &self.group {
147crate::serde::ser::SerializeStruct::serialize_field(&mut state, "group", value)?;
148 }
149if let Some(value) = &self.kind {
150crate::serde::ser::SerializeStruct::serialize_field(&mut state, "kind", value)?;
151 }
152if let Some(value) = &self.name {
153crate::serde::ser::SerializeStruct::serialize_field(&mut state, "name", value)?;
154 }
155if let Some(value) = &self.retry_after_seconds {
156crate::serde::ser::SerializeStruct::serialize_field(&mut state, "retryAfterSeconds", value)?;
157 }
158if let Some(value) = &self.uid {
159crate::serde::ser::SerializeStruct::serialize_field(&mut state, "uid", value)?;
160 }
161crate::serde::ser::SerializeStruct::end(state)
162 }
163}
164165#[cfg(feature = "schemars")]
166impl crate::schemars::JsonSchema for StatusDetails {
167fn schema_name() -> String {
168"io.k8s.apimachinery.pkg.apis.meta.v1.StatusDetails".to_owned()
169 }
170171fn json_schema(__gen: &mut crate::schemars::gen::SchemaGenerator) -> crate::schemars::schema::Schema {
172crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
173 metadata: Some(Box::new(crate::schemars::schema::Metadata {
174 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.".to_owned()),
175 ..Default::default()
176 })),
177 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Object))),
178 object: Some(Box::new(crate::schemars::schema::ObjectValidation {
179 properties: [
180 (
181"causes".to_owned(),
182crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
183 metadata: Some(Box::new(crate::schemars::schema::Metadata {
184 description: Some("The Causes array includes more details associated with the StatusReason failure. Not all StatusReasons may provide detailed causes.".to_owned()),
185 ..Default::default()
186 })),
187 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Array))),
188 array: Some(Box::new(crate::schemars::schema::ArrayValidation {
189 items: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(__gen.subschema_for::<crate::apimachinery::pkg::apis::meta::v1::StatusCause>()))),
190 ..Default::default()
191 })),
192 ..Default::default()
193 }),
194 ),
195 (
196"group".to_owned(),
197crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
198 metadata: Some(Box::new(crate::schemars::schema::Metadata {
199 description: Some("The group attribute of the resource associated with the status StatusReason.".to_owned()),
200 ..Default::default()
201 })),
202 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
203 ..Default::default()
204 }),
205 ),
206 (
207"kind".to_owned(),
208crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
209 metadata: Some(Box::new(crate::schemars::schema::Metadata {
210 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".to_owned()),
211 ..Default::default()
212 })),
213 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
214 ..Default::default()
215 }),
216 ),
217 (
218"name".to_owned(),
219crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
220 metadata: Some(Box::new(crate::schemars::schema::Metadata {
221 description: Some("The name attribute of the resource associated with the status StatusReason (when there is a single name which can be described).".to_owned()),
222 ..Default::default()
223 })),
224 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
225 ..Default::default()
226 }),
227 ),
228 (
229"retryAfterSeconds".to_owned(),
230crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
231 metadata: Some(Box::new(crate::schemars::schema::Metadata {
232 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.".to_owned()),
233 ..Default::default()
234 })),
235 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::Integer))),
236 format: Some("int32".to_owned()),
237 ..Default::default()
238 }),
239 ),
240 (
241"uid".to_owned(),
242crate::schemars::schema::Schema::Object(crate::schemars::schema::SchemaObject {
243 metadata: Some(Box::new(crate::schemars::schema::Metadata {
244 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".to_owned()),
245 ..Default::default()
246 })),
247 instance_type: Some(crate::schemars::schema::SingleOrVec::Single(Box::new(crate::schemars::schema::InstanceType::String))),
248 ..Default::default()
249 }),
250 ),
251 ].into(),
252 ..Default::default()
253 })),
254 ..Default::default()
255 })
256 }
257}