k8s_openapi_ext/get/container/
status.rs1use super::*;
2
3pub trait ContainerStatusGetExt {
4 fn container_status(&self) -> &corev1::ContainerStatus;
5
6 fn name(&self) -> &str {
7 &self.container_status().name
8 }
9
10 fn allocated_resources(&self) -> Option<&BTreeMap<String, resource::Quantity>> {
11 self.container_status().allocated_resources.as_ref()
12 }
13
14 fn container_id(&self) -> Option<&str> {
15 self.container_status().container_id.as_deref()
16 }
17 fn image(&self) -> &str {
18 &self.container_status().image
19 }
20
21 fn image_id(&self) -> &str {
22 &self.container_status().image_id
23 }
24
25 fn last_state(&self) -> Option<&corev1::ContainerState> {
26 self.container_status().last_state.as_ref()
27 }
28
29 fn ready(&self) -> bool {
30 self.container_status().ready
31 }
32
33 fn resources(&self) -> Option<&corev1::ResourceRequirements> {
34 self.container_status().resources.as_ref()
35 }
36
37 fn restart_count(&self) -> i32 {
38 self.container_status().restart_count
39 }
40
41 fn started(&self) -> Option<bool> {
42 self.container_status().started
43 }
44
45 fn state(&self) -> Option<&corev1::ContainerState> {
46 self.container_status().state.as_ref()
47 }
48
49 openapi::k8s_if_ge_1_31! {
50 fn allocated_resources_status(&self) -> Option<&[corev1::ResourceStatus]> {
51 self.container_status().allocated_resources_status.as_deref()
52 }
53 fn user(&self) -> Option<&corev1::ContainerUser> {
54 self.container_status().user.as_ref()
55 }
56
57 fn volume_mounts(&self) -> Option<&[corev1::VolumeMountStatus]> {
58 self.container_status().volume_mounts.as_deref()
59 }
60 }
61}
62
63impl ContainerStatusGetExt for corev1::ContainerStatus {
64 #[inline(always)]
65 fn container_status(&self) -> &corev1::ContainerStatus {
66 self
67 }
68}