1#[derive(Debug, Clone)]
5pub struct ClusterContext {
6 pub context_name: String,
8 pub cluster_name: String,
10 pub cluster_server: String,
12 pub namespace: Option<String>,
14 pub user: String,
16}
17
18impl ClusterContext {
19 pub fn new(
21 context_name: String,
22 cluster_name: String,
23 cluster_server: String,
24 namespace: Option<String>,
25 user: String,
26 ) -> Self {
27 Self {
28 context_name,
29 cluster_name,
30 cluster_server,
31 namespace,
32 user,
33 }
34 }
35
36 pub fn display(&self) -> String {
38 format!(
39 "Current Kubernetes context: {} ({})",
40 self.context_name, self.cluster_server
41 )
42 }
43}