k8s_openapi_ext/get/
service_port.rs

1use super::*;
2
3pub trait ServicePortGetExt {
4    fn myself(&self) -> &corev1::ServicePort;
5
6    fn name(&self) -> Option<&str> {
7        self.myself().name.as_deref()
8    }
9
10    fn port(&self) -> i32 {
11        self.myself().port
12    }
13
14    fn target_port(&self) -> Option<&intstr::IntOrString> {
15        self.myself().target_port.as_ref()
16    }
17
18    fn node_port(&self) -> Option<i32> {
19        self.myself().node_port
20    }
21
22    fn app_protocol(&self) -> Option<&str> {
23        self.myself().app_protocol.as_deref()
24    }
25
26    fn protocol(&self) -> Option<&str> {
27        self.myself().protocol.as_deref()
28    }
29}
30
31impl ServicePortGetExt for corev1::ServicePort {
32    #[inline(always)]
33    fn myself(&self) -> &corev1::ServicePort {
34        self
35    }
36}