Skip to main content

proxmox_api/generated/nodes/node/disks/
initgpt.rs

1#[derive(Debug, Clone)]
2pub struct InitgptClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> InitgptClient<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, "/initgpt"),
14        }
15    }
16}
17impl<T> InitgptClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Initialize Disk with GPT"]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
24    pub async fn post(&self, params: PostParams) -> Result<String, T::Error> {
25        let path = self.path.to_string();
26        self.client.post(&path, &params).await
27    }
28}
29impl PostParams {
30    pub fn new(disk: DiskStr) -> Self {
31        Self {
32            disk,
33            uuid: ::std::default::Default::default(),
34            additional_properties: ::std::default::Default::default(),
35        }
36    }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct PostParams {
40    #[doc = "Block device name"]
41    #[doc = ""]
42    pub disk: DiskStr,
43    #[serde(skip_serializing_if = "Option::is_none", default)]
44    #[doc = "UUID for the GPT table"]
45    #[doc = ""]
46    pub uuid: Option<UuidStr>,
47    #[serde(
48        flatten,
49        default,
50        skip_serializing_if = "::std::collections::HashMap::is_empty"
51    )]
52    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
53}
54#[derive(Debug, Clone, PartialEq, PartialOrd)]
55pub struct DiskStr {
56    value: String,
57}
58impl crate::types::bounded_string::BoundedString for DiskStr {
59    const MIN_LENGTH: Option<usize> = None::<usize>;
60    const MAX_LENGTH: Option<usize> = None::<usize>;
61    const DEFAULT: Option<&'static str> = None::<&'static str>;
62    const PATTERN: Option<&'static str> = Some("^/dev/[a-zA-Z0-9\\/]+$");
63    const TYPE_DESCRIPTION: &'static str =
64        "a string with pattern r\"^/dev/[a-zA-Z0-9\\/]+$\" and no length constraints";
65    fn get_value(&self) -> &str {
66        &self.value
67    }
68    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
69        Self::validate(&value)?;
70        Ok(Self { value })
71    }
72}
73impl std::convert::TryFrom<String> for DiskStr {
74    type Error = crate::types::bounded_string::BoundedStringError;
75    fn try_from(value: String) -> Result<Self, Self::Error> {
76        crate::types::bounded_string::BoundedString::new(value)
77    }
78}
79impl ::serde::Serialize for DiskStr {
80    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
81    where
82        S: ::serde::Serializer,
83    {
84        crate::types::bounded_string::serialize_bounded_string(self, serializer)
85    }
86}
87impl<'de> ::serde::Deserialize<'de> for DiskStr {
88    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
89    where
90        D: ::serde::Deserializer<'de>,
91    {
92        crate::types::bounded_string::deserialize_bounded_string(deserializer)
93    }
94}
95#[derive(Debug, Clone, PartialEq, PartialOrd)]
96pub struct UuidStr {
97    value: String,
98}
99impl crate::types::bounded_string::BoundedString for UuidStr {
100    const MIN_LENGTH: Option<usize> = None::<usize>;
101    const MAX_LENGTH: Option<usize> = Some(36usize);
102    const DEFAULT: Option<&'static str> = None::<&'static str>;
103    const PATTERN: Option<&'static str> = Some("[a-fA-F0-9\\-]+");
104    const TYPE_DESCRIPTION: &'static str =
105        "a string with pattern r\"[a-fA-F0-9\\-]+\" and length at most 36";
106    fn get_value(&self) -> &str {
107        &self.value
108    }
109    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
110        Self::validate(&value)?;
111        Ok(Self { value })
112    }
113}
114impl std::convert::TryFrom<String> for UuidStr {
115    type Error = crate::types::bounded_string::BoundedStringError;
116    fn try_from(value: String) -> Result<Self, Self::Error> {
117        crate::types::bounded_string::BoundedString::new(value)
118    }
119}
120impl ::serde::Serialize for UuidStr {
121    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
122    where
123        S: ::serde::Serializer,
124    {
125        crate::types::bounded_string::serialize_bounded_string(self, serializer)
126    }
127}
128impl<'de> ::serde::Deserialize<'de> for UuidStr {
129    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
130    where
131        D: ::serde::Deserializer<'de>,
132    {
133        crate::types::bounded_string::deserialize_bounded_string(deserializer)
134    }
135}