proxmox_api/generated/nodes/node/disks/
wipedisk.rs1#[derive(Debug, Clone)]
2pub struct WipediskClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> WipediskClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}{}", parent_path, "/wipedisk"),
14 }
15 }
16}
17impl<T> WipediskClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Wipe a disk or partition."]
22 #[doc = ""]
23 pub async fn put(&self, params: PutParams) -> Result<String, T::Error> {
24 let path = self.path.to_string();
25 self.client.put(&path, ¶ms).await
26 }
27}
28impl PutParams {
29 pub fn new(disk: DiskStr) -> Self {
30 Self {
31 disk,
32 additional_properties: ::std::default::Default::default(),
33 }
34 }
35}
36#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
37pub struct PutParams {
38 #[doc = "Block device name"]
39 #[doc = ""]
40 pub disk: DiskStr,
41 #[serde(
42 flatten,
43 default,
44 skip_serializing_if = "::std::collections::HashMap::is_empty"
45 )]
46 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
47}
48#[derive(Debug, Clone, PartialEq, PartialOrd)]
49pub struct DiskStr {
50 value: String,
51}
52impl crate::types::bounded_string::BoundedString for DiskStr {
53 const MIN_LENGTH: Option<usize> = None::<usize>;
54 const MAX_LENGTH: Option<usize> = None::<usize>;
55 const DEFAULT: Option<&'static str> = None::<&'static str>;
56 const PATTERN: Option<&'static str> = Some("^/dev/[a-zA-Z0-9\\/]+$");
57 const TYPE_DESCRIPTION: &'static str =
58 "a string with pattern r\"^/dev/[a-zA-Z0-9\\/]+$\" and no length constraints";
59 fn get_value(&self) -> &str {
60 &self.value
61 }
62 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
63 Self::validate(&value)?;
64 Ok(Self { value })
65 }
66}
67impl std::convert::TryFrom<String> for DiskStr {
68 type Error = crate::types::bounded_string::BoundedStringError;
69 fn try_from(value: String) -> Result<Self, Self::Error> {
70 crate::types::bounded_string::BoundedString::new(value)
71 }
72}
73impl ::serde::Serialize for DiskStr {
74 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
75 where
76 S: ::serde::Serializer,
77 {
78 crate::types::bounded_string::serialize_bounded_string(self, serializer)
79 }
80}
81impl<'de> ::serde::Deserialize<'de> for DiskStr {
82 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
83 where
84 D: ::serde::Deserializer<'de>,
85 {
86 crate::types::bounded_string::deserialize_bounded_string(deserializer)
87 }
88}