k8s_openapi_ext/get/pod/
condition.rs1use super::*;
2
3pub trait PodConditionGetExt {
4 fn myself(&self) -> &corev1::PodCondition;
5
6 fn status(&self) -> &str {
7 &self.myself().status
8 }
9
10 fn r#type(&self) -> &str {
11 &self.myself().type_
12 }
13
14 fn message(&self) -> Option<&str> {
15 self.myself().message.as_deref()
16 }
17
18 fn reason(&self) -> Option<&str> {
19 self.myself().reason.as_deref()
20 }
21
22 fn last_probe_time(&self) -> Option<&metav1::Time> {
23 self.myself().last_probe_time.as_ref()
24 }
25
26 fn last_transition_time(&self) -> Option<&metav1::Time> {
27 self.myself().last_transition_time.as_ref()
28 }
29
30 fn is_true(&self) -> bool {
31 self.status() == "True"
32 }
33
34 fn is_false(&self) -> bool {
35 self.status() == "False"
36 }
37
38 fn is_unknown(&self) -> bool {
39 self.status() == "Unknown"
40 }
41}
42
43impl PodConditionGetExt for corev1::PodCondition {
44 #[inline(always)]
45 fn myself(&self) -> &corev1::PodCondition {
46 self
47 }
48}