1#[derive(Debug, Deserialize, Clone)]
2pub struct FirmwareCurrent {
3 #[serde(rename = "VersionString")]
4 pub version: String,
5}
6
7#[derive(Debug, Deserialize, Clone)]
8#[serde(rename_all = "PascalCase")]
9pub struct Firmware {
10 pub current: FirmwareCurrent,
11}
12
13#[derive(Debug, Deserialize, Clone)]
14pub struct Href {
15 pub href: String,
16}
17
18#[derive(Debug, Deserialize, Clone)]
19pub struct ExtRef {
20 pub extref: String,
21}
22
23#[derive(Debug, Deserialize, Clone)]
24#[serde(untagged, rename_all = "PascalCase")]
25pub enum LinkType {
26 SelfLink {
27 #[serde(rename = "self")]
28 self_url: Href,
29 },
30 HpLink {
31 fast_power_meter: Href,
32 federated_group_capping: Href,
33 power_meter: Href,
34 },
35 OemHpLink {
36 active_health_system: Href,
37 date_time_service: Href,
38 embedded_media_service: Href,
39 federation_dispatch: ExtRef,
40 federation_groups: Href,
41 federation_peers: Href,
42 license_service: Href,
43 security_service: Href,
44 update_service: Href,
45 #[serde(rename = "VSPLogLocation")]
46 vsp_log_location: ExtRef,
47 },
48 SerdeJson {
49 #[serde(rename = "links")]
50 links: serde_json::Value,
51 },
52 EnclosuresLinks {
53 member: Vec<Href>,
54 #[serde(rename = "self")]
55 self_url: Href,
56 },
57 ManagerLink {
58 #[serde(rename = "EthernetNICs")]
59 ethernet_nics: Href,
60 logs: Href,
61 manager_for_chassis: Vec<Href>,
62 manager_for_servers: Vec<Href>,
63 network_service: Href,
64 virtual_media: Href,
65 #[serde(rename = "self")]
66 self_url: Href,
67 },
68 StorageLink {
69 logical_drives: Href,
70 physical_drives: Href,
71 storage_enclosures: Href,
72 unconfigured_drives: Href,
73 #[serde(rename = "self")]
74 self_url: Href,
75 },
76}
77
78#[derive(Debug, Deserialize, Clone)]
79pub struct ODataLinks {
80 #[serde(rename = "@odata.context")]
81 pub odata_context: String,
82 #[serde(rename = "@odata.id")]
83 pub odata_id: String,
84 #[serde(rename = "@odata.type")]
85 pub odata_type: String,
86 #[serde(rename = "links")]
87 pub links: LinkType,
88}
89
90#[derive(Debug, Deserialize, Clone)]
91pub struct ODataId {
92 #[serde(rename = "@odata.id")]
93 pub odata_id: String,
94}
95
96#[derive(Debug, Deserialize, Clone)]
97pub struct ODataContext {
98 #[serde(rename = "@odata.context")]
99 pub odata_context: String,
100 #[serde(rename = "links")]
101 pub links: LinkType,
102}
103
104#[derive(Debug, Deserialize, Clone)]
105#[serde(rename_all = "PascalCase")]
106pub struct AllStatus {
107 pub health: String,
108 pub state: String,
109}
110
111#[derive(Debug, Deserialize, Clone)]
112#[serde(rename_all = "PascalCase")]
113pub struct SomeStatus {
114 pub health: Option<String>,
115 pub state: String,
116}
117
118#[derive(Debug, Deserialize, Clone)]
119#[serde(rename_all = "PascalCase")]
120pub struct HpType {
121 #[serde(rename = "@odata.type")]
122 pub odata_type: String,
123 #[serde(rename = "Type")]
124 pub hp_type: String,
125}
126
127pub trait Status {
128 fn health(&self) -> String;
129 fn state(&self) -> String;
130}
131
132impl Status for SomeStatus {
133 fn health(&self) -> String {
134 match &self.health {
135 Some(s) => s.clone(),
136 None => "OK".to_string(),
137 }
138 }
139 fn state(&self) -> String {
140 self.state.clone()
141 }
142}
143
144impl Status for AllStatus {
145 fn health(&self) -> String {
146 self.health.clone()
147 }
148 fn state(&self) -> String {
149 self.state.clone()
150 }
151}
152
153pub trait StatusVec {
154 fn get_vec(&self) -> Vec<Box<dyn Status>>;
155}