1#[derive(serde::Serialize, serde::Deserialize)]
4#[serde(rename_all = "camelCase")]
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct Disk {
7 #[prost(uint64, tag = "1")]
9 pub size: u64,
10 #[prost(string, tag = "2")]
12 pub model: ::prost::alloc::string::String,
13 #[prost(string, tag = "3")]
15 pub device_name: ::prost::alloc::string::String,
16 #[prost(string, tag = "4")]
18 pub name: ::prost::alloc::string::String,
19 #[prost(string, tag = "5")]
21 pub serial: ::prost::alloc::string::String,
22 #[prost(string, tag = "6")]
24 pub modalias: ::prost::alloc::string::String,
25 #[prost(string, tag = "7")]
27 pub uuid: ::prost::alloc::string::String,
28 #[prost(string, tag = "8")]
30 pub wwid: ::prost::alloc::string::String,
31 #[prost(enumeration = "disk::DiskType", tag = "9")]
33 pub r#type: i32,
34 #[prost(string, tag = "10")]
36 pub bus_path: ::prost::alloc::string::String,
37 #[prost(bool, tag = "11")]
39 pub system_disk: bool,
40 #[prost(string, tag = "12")]
42 pub subsystem: ::prost::alloc::string::String,
43 #[prost(bool, tag = "13")]
45 pub readonly: bool,
46}
47pub mod disk {
49 #[derive(serde::Serialize, serde::Deserialize)]
50 #[serde(rename_all = "camelCase")]
51 #[derive(
52 Clone,
53 Copy,
54 Debug,
55 PartialEq,
56 Eq,
57 Hash,
58 PartialOrd,
59 Ord,
60 ::prost::Enumeration
61 )]
62 #[repr(i32)]
63 pub enum DiskType {
64 Unknown = 0,
65 Ssd = 1,
66 Hdd = 2,
67 Nvme = 3,
68 Sd = 4,
69 Cd = 5,
70 }
71 impl DiskType {
72 pub fn as_str_name(&self) -> &'static str {
77 match self {
78 Self::Unknown => "UNKNOWN",
79 Self::Ssd => "SSD",
80 Self::Hdd => "HDD",
81 Self::Nvme => "NVME",
82 Self::Sd => "SD",
83 Self::Cd => "CD",
84 }
85 }
86 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
88 match value {
89 "UNKNOWN" => Some(Self::Unknown),
90 "SSD" => Some(Self::Ssd),
91 "HDD" => Some(Self::Hdd),
92 "NVME" => Some(Self::Nvme),
93 "SD" => Some(Self::Sd),
94 "CD" => Some(Self::Cd),
95 _ => None,
96 }
97 }
98 }
99}
100#[derive(serde::Serialize, serde::Deserialize)]
102#[serde(rename_all = "camelCase")]
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct Disks {
105 #[prost(message, optional, tag = "1")]
106 pub metadata: ::core::option::Option<super::common::Metadata>,
107 #[prost(message, repeated, tag = "2")]
108 pub disks: ::prost::alloc::vec::Vec<Disk>,
109}
110#[derive(serde::Serialize, serde::Deserialize)]
111#[serde(rename_all = "camelCase")]
112#[derive(Clone, PartialEq, ::prost::Message)]
113pub struct DisksResponse {
114 #[prost(message, repeated, tag = "1")]
115 pub messages: ::prost::alloc::vec::Vec<Disks>,
116}
117#[derive(serde::Serialize, serde::Deserialize)]
118#[serde(rename_all = "camelCase")]
119#[derive(Clone, PartialEq, ::prost::Message)]
120pub struct BlockDeviceWipeRequest {
121 #[prost(message, repeated, tag = "1")]
122 pub devices: ::prost::alloc::vec::Vec<BlockDeviceWipeDescriptor>,
123}
124#[derive(serde::Serialize, serde::Deserialize)]
130#[serde(rename_all = "camelCase")]
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct BlockDeviceWipeDescriptor {
133 #[prost(string, tag = "1")]
137 pub device: ::prost::alloc::string::String,
138 #[prost(enumeration = "block_device_wipe_descriptor::Method", tag = "2")]
140 pub method: i32,
141 #[prost(bool, tag = "3")]
143 pub skip_volume_check: bool,
144 #[prost(bool, tag = "4")]
146 pub drop_partition: bool,
147}
148pub mod block_device_wipe_descriptor {
150 #[derive(serde::Serialize, serde::Deserialize)]
151 #[serde(rename_all = "camelCase")]
152 #[derive(
153 Clone,
154 Copy,
155 Debug,
156 PartialEq,
157 Eq,
158 Hash,
159 PartialOrd,
160 Ord,
161 ::prost::Enumeration
162 )]
163 #[repr(i32)]
164 pub enum Method {
165 Fast = 0,
167 Zeroes = 1,
169 }
170 impl Method {
171 pub fn as_str_name(&self) -> &'static str {
176 match self {
177 Self::Fast => "FAST",
178 Self::Zeroes => "ZEROES",
179 }
180 }
181 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
183 match value {
184 "FAST" => Some(Self::Fast),
185 "ZEROES" => Some(Self::Zeroes),
186 _ => None,
187 }
188 }
189 }
190}
191#[derive(serde::Serialize, serde::Deserialize)]
192#[serde(rename_all = "camelCase")]
193#[derive(Clone, PartialEq, ::prost::Message)]
194pub struct BlockDeviceWipeResponse {
195 #[prost(message, repeated, tag = "1")]
196 pub messages: ::prost::alloc::vec::Vec<BlockDeviceWipe>,
197}
198#[derive(serde::Serialize, serde::Deserialize)]
199#[serde(rename_all = "camelCase")]
200#[derive(Clone, PartialEq, ::prost::Message)]
201pub struct BlockDeviceWipe {
202 #[prost(message, optional, tag = "1")]
203 pub metadata: ::core::option::Option<super::common::Metadata>,
204}
205pub mod storage_service_client {
207 #![allow(
208 unused_variables,
209 dead_code,
210 missing_docs,
211 clippy::wildcard_imports,
212 clippy::let_unit_value,
213 )]
214 use tonic::codegen::*;
215 use tonic::codegen::http::Uri;
216 #[derive(Debug, Clone)]
218 pub struct StorageServiceClient<T> {
219 inner: tonic::client::Grpc<T>,
220 }
221 impl StorageServiceClient<tonic::transport::Channel> {
222 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
224 where
225 D: TryInto<tonic::transport::Endpoint>,
226 D::Error: Into<StdError>,
227 {
228 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
229 Ok(Self::new(conn))
230 }
231 }
232 impl<T> StorageServiceClient<T>
233 where
234 T: tonic::client::GrpcService<tonic::body::BoxBody>,
235 T::Error: Into<StdError>,
236 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
237 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
238 {
239 pub fn new(inner: T) -> Self {
240 let inner = tonic::client::Grpc::new(inner);
241 Self { inner }
242 }
243 pub fn with_origin(inner: T, origin: Uri) -> Self {
244 let inner = tonic::client::Grpc::with_origin(inner, origin);
245 Self { inner }
246 }
247 pub fn with_interceptor<F>(
248 inner: T,
249 interceptor: F,
250 ) -> StorageServiceClient<InterceptedService<T, F>>
251 where
252 F: tonic::service::Interceptor,
253 T::ResponseBody: Default,
254 T: tonic::codegen::Service<
255 http::Request<tonic::body::BoxBody>,
256 Response = http::Response<
257 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
258 >,
259 >,
260 <T as tonic::codegen::Service<
261 http::Request<tonic::body::BoxBody>,
262 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
263 {
264 StorageServiceClient::new(InterceptedService::new(inner, interceptor))
265 }
266 #[must_use]
271 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
272 self.inner = self.inner.send_compressed(encoding);
273 self
274 }
275 #[must_use]
277 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
278 self.inner = self.inner.accept_compressed(encoding);
279 self
280 }
281 #[must_use]
285 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
286 self.inner = self.inner.max_decoding_message_size(limit);
287 self
288 }
289 #[must_use]
293 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
294 self.inner = self.inner.max_encoding_message_size(limit);
295 self
296 }
297 pub async fn disks(
298 &mut self,
299 request: impl tonic::IntoRequest<super::super::google::protobuf::Empty>,
300 ) -> std::result::Result<tonic::Response<super::DisksResponse>, tonic::Status> {
301 self.inner
302 .ready()
303 .await
304 .map_err(|e| {
305 tonic::Status::unknown(
306 format!("Service was not ready: {}", e.into()),
307 )
308 })?;
309 let codec = tonic::codec::ProstCodec::default();
310 let path = http::uri::PathAndQuery::from_static(
311 "/storage.StorageService/Disks",
312 );
313 let mut req = request.into_request();
314 req.extensions_mut()
315 .insert(GrpcMethod::new("storage.StorageService", "Disks"));
316 self.inner.unary(req, path, codec).await
317 }
318 pub async fn block_device_wipe(
324 &mut self,
325 request: impl tonic::IntoRequest<super::BlockDeviceWipeRequest>,
326 ) -> std::result::Result<
327 tonic::Response<super::BlockDeviceWipeResponse>,
328 tonic::Status,
329 > {
330 self.inner
331 .ready()
332 .await
333 .map_err(|e| {
334 tonic::Status::unknown(
335 format!("Service was not ready: {}", e.into()),
336 )
337 })?;
338 let codec = tonic::codec::ProstCodec::default();
339 let path = http::uri::PathAndQuery::from_static(
340 "/storage.StorageService/BlockDeviceWipe",
341 );
342 let mut req = request.into_request();
343 req.extensions_mut()
344 .insert(GrpcMethod::new("storage.StorageService", "BlockDeviceWipe"));
345 self.inner.unary(req, path, codec).await
346 }
347 }
348}