talos_rust_client/generated/
storage.rs

1// This file is @generated by prost-build.
2/// Disk represents a disk.
3#[derive(serde::Serialize, serde::Deserialize)]
4#[serde(rename_all = "camelCase")]
5#[derive(Clone, PartialEq, ::prost::Message)]
6pub struct Disk {
7    /// Size indicates the disk size in bytes.
8    #[prost(uint64, tag = "1")]
9    pub size: u64,
10    /// Model idicates the disk model.
11    #[prost(string, tag = "2")]
12    pub model: ::prost::alloc::string::String,
13    /// DeviceName indicates the disk name (e.g. `sda`).
14    #[prost(string, tag = "3")]
15    pub device_name: ::prost::alloc::string::String,
16    /// Name as in `/sys/block/<dev>/device/name`.
17    #[prost(string, tag = "4")]
18    pub name: ::prost::alloc::string::String,
19    /// Serial as in `/sys/block/<dev>/device/serial`.
20    #[prost(string, tag = "5")]
21    pub serial: ::prost::alloc::string::String,
22    /// Modalias as in `/sys/block/<dev>/device/modalias`.
23    #[prost(string, tag = "6")]
24    pub modalias: ::prost::alloc::string::String,
25    /// Uuid as in `/sys/block/<dev>/device/uuid`.
26    #[prost(string, tag = "7")]
27    pub uuid: ::prost::alloc::string::String,
28    /// Wwid as in `/sys/block/<dev>/device/wwid`.
29    #[prost(string, tag = "8")]
30    pub wwid: ::prost::alloc::string::String,
31    /// Type is a type of the disk: nvme, ssd, hdd, sd card.
32    #[prost(enumeration = "disk::DiskType", tag = "9")]
33    pub r#type: i32,
34    /// BusPath is the bus path of the disk.
35    #[prost(string, tag = "10")]
36    pub bus_path: ::prost::alloc::string::String,
37    /// SystemDisk indicates that the disk is used as Talos system disk.
38    #[prost(bool, tag = "11")]
39    pub system_disk: bool,
40    /// Subsystem is the symlink path in the `/sys/block/<dev>/subsystem`.
41    #[prost(string, tag = "12")]
42    pub subsystem: ::prost::alloc::string::String,
43    /// Readonly specifies if the disk is read only.
44    #[prost(bool, tag = "13")]
45    pub readonly: bool,
46}
47/// Nested message and enum types in `Disk`.
48pub 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        /// String value of the enum field names used in the ProtoBuf definition.
73        ///
74        /// The values are not transformed in any way and thus are considered stable
75        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
76        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        /// Creates an enum from field names used in the ProtoBuf definition.
87        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/// DisksResponse represents the response of the `Disks` RPC.
101#[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/// BlockDeviceWipeDescriptor represents a single block device to be wiped.
125///
126/// The device can be either a full disk (e.g. vda) or a partition (vda5).
127/// The device should not be used in any of active volumes.
128/// The device should not be used as a secondary (e.g. part of LVM).
129#[derive(serde::Serialize, serde::Deserialize)]
130#[serde(rename_all = "camelCase")]
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct BlockDeviceWipeDescriptor {
133    /// Device name to wipe (e.g. sda or sda5).
134    ///
135    /// The name should be submitted without `/dev/` prefix.
136    #[prost(string, tag = "1")]
137    pub device: ::prost::alloc::string::String,
138    /// Wipe method to use.
139    #[prost(enumeration = "block_device_wipe_descriptor::Method", tag = "2")]
140    pub method: i32,
141    /// Skip the volume in use check.
142    #[prost(bool, tag = "3")]
143    pub skip_volume_check: bool,
144    /// Drop the partition (only applies if the device is a partition).
145    #[prost(bool, tag = "4")]
146    pub drop_partition: bool,
147}
148/// Nested message and enum types in `BlockDeviceWipeDescriptor`.
149pub 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 wipe - wipe only filesystem signatures.
166        Fast = 0,
167        /// Zeroes wipe - wipe by overwriting with zeroes (might be slow depending on the disk size and available hardware features).
168        Zeroes = 1,
169    }
170    impl Method {
171        /// String value of the enum field names used in the ProtoBuf definition.
172        ///
173        /// The values are not transformed in any way and thus are considered stable
174        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
175        pub fn as_str_name(&self) -> &'static str {
176            match self {
177                Self::Fast => "FAST",
178                Self::Zeroes => "ZEROES",
179            }
180        }
181        /// Creates an enum from field names used in the ProtoBuf definition.
182        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}
205/// Generated client implementations.
206pub 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    /// StorageService represents the storage service.
217    #[derive(Debug, Clone)]
218    pub struct StorageServiceClient<T> {
219        inner: tonic::client::Grpc<T>,
220    }
221    impl StorageServiceClient<tonic::transport::Channel> {
222        /// Attempt to create a new client by connecting to a given endpoint.
223        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        /// Compress requests with the given encoding.
267        ///
268        /// This requires the server to support it otherwise it might respond with an
269        /// error.
270        #[must_use]
271        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
272            self.inner = self.inner.send_compressed(encoding);
273            self
274        }
275        /// Enable decompressing responses.
276        #[must_use]
277        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
278            self.inner = self.inner.accept_compressed(encoding);
279            self
280        }
281        /// Limits the maximum size of a decoded message.
282        ///
283        /// Default: `4MB`
284        #[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        /// Limits the maximum size of an encoded message.
290        ///
291        /// Default: `usize::MAX`
292        #[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        /// BlockDeviceWipe performs a wipe of the blockdevice (partition or disk).
319        ///
320        /// The method doesn't require a reboot, and it can only wipe blockdevices which are not
321        /// being used as volumes at the moment.
322        /// Wiping of volumes requires a different API.
323        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}