openstack_types/block_storage/v3/cluster/response/
get.rs1use serde::{Deserialize, Serialize};
20use structable::{StructTable, StructTableOptions};
21
22#[derive(Clone, Deserialize, Serialize, StructTable)]
24pub struct ClusterResponse {
25 #[serde(default)]
27 #[structable(optional)]
28 pub active_backend_id: Option<String>,
29
30 #[serde(default)]
32 #[structable(optional)]
33 pub binary: Option<String>,
34
35 #[serde(default)]
37 #[structable(optional)]
38 pub created_at: Option<String>,
39
40 #[serde(default)]
42 #[structable(optional)]
43 pub disabled_reason: Option<String>,
44
45 #[serde(default)]
47 #[structable(optional)]
48 pub frozen: Option<bool>,
49
50 #[serde(default)]
52 #[structable(optional)]
53 pub last_heartbeat: Option<String>,
54
55 #[serde(default)]
57 #[structable(optional)]
58 pub name: Option<String>,
59
60 #[serde(default)]
62 #[structable(optional)]
63 pub num_down_hosts: Option<i32>,
64
65 #[serde(default)]
67 #[structable(optional)]
68 pub num_hosts: Option<i32>,
69
70 #[serde(default)]
73 #[structable(optional, serialize)]
74 pub replication_status: Option<ReplicationStatus>,
75
76 #[serde(default)]
78 #[structable(optional, serialize)]
79 pub state: Option<State>,
80
81 #[serde(default)]
83 #[structable(optional, serialize)]
84 pub status: Option<Status>,
85
86 #[serde(default)]
88 #[structable(optional)]
89 pub updated_at: Option<String>,
90}
91
92#[derive(Debug, Deserialize, Clone, Serialize)]
93pub enum ReplicationStatus {
94 #[serde(rename = "disabled")]
96 Disabled,
97
98 #[serde(rename = "enabled")]
100 Enabled,
101}
102
103impl std::str::FromStr for ReplicationStatus {
104 type Err = ();
105 fn from_str(input: &str) -> Result<Self, Self::Err> {
106 match input {
107 "disabled" => Ok(Self::Disabled),
108 "enabled" => Ok(Self::Enabled),
109 _ => Err(()),
110 }
111 }
112}
113
114#[derive(Debug, Deserialize, Clone, Serialize)]
115pub enum State {
116 #[serde(rename = "down")]
118 Down,
119
120 #[serde(rename = "up")]
122 Up,
123}
124
125impl std::str::FromStr for State {
126 type Err = ();
127 fn from_str(input: &str) -> Result<Self, Self::Err> {
128 match input {
129 "down" => Ok(Self::Down),
130 "up" => Ok(Self::Up),
131 _ => Err(()),
132 }
133 }
134}
135
136#[derive(Debug, Deserialize, Clone, Serialize)]
137pub enum Status {
138 #[serde(rename = "disabled")]
140 Disabled,
141
142 #[serde(rename = "enabled")]
144 Enabled,
145}
146
147impl std::str::FromStr for Status {
148 type Err = ();
149 fn from_str(input: &str) -> Result<Self, Self::Err> {
150 match input {
151 "disabled" => Ok(Self::Disabled),
152 "enabled" => Ok(Self::Enabled),
153 _ => Err(()),
154 }
155 }
156}