Skip to main content

proxmox_api/generated/cluster/sdn/ipams/
ipam.rs

1pub mod status;
2#[derive(Debug, Clone)]
3pub struct IpamClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> IpamClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str, ipam: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}/{}", parent_path, ipam),
15        }
16    }
17}
18impl<T> IpamClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "Delete sdn ipam object configuration."]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/sdn/ipams\", [\"SDN.Allocate\"])"]
25    pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
26        let path = self.path.to_string();
27        self.client.delete(&path, &params).await
28    }
29}
30impl<T> IpamClient<T>
31where
32    T: crate::client::Client,
33{
34    #[doc = "Read sdn ipam configuration."]
35    #[doc = ""]
36    #[doc = "Permission check: perm(\"/sdn/ipams/{ipam}\", [\"SDN.Allocate\"])"]
37    pub async fn get(&self) -> Result<GetOutput, T::Error> {
38        let path = self.path.to_string();
39        self.client.get(&path, &()).await
40    }
41}
42impl<T> IpamClient<T>
43where
44    T: crate::client::Client,
45{
46    #[doc = "Update sdn ipam object configuration."]
47    #[doc = ""]
48    #[doc = "Permission check: perm(\"/sdn/ipams\", [\"SDN.Allocate\"])"]
49    pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
50        let path = self.path.to_string();
51        self.client.put(&path, &params).await
52    }
53}
54#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
55pub struct DeleteParams {
56    #[serde(rename = "lock-token")]
57    #[serde(skip_serializing_if = "Option::is_none", default)]
58    #[doc = "the token for unlocking the global SDN configuration"]
59    #[doc = ""]
60    pub lock_token: Option<String>,
61    #[serde(
62        flatten,
63        default,
64        skip_serializing_if = "::std::collections::HashMap::is_empty"
65    )]
66    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
69pub struct GetOutput {
70    #[serde(
71        flatten,
72        default,
73        skip_serializing_if = "::std::collections::HashMap::is_empty"
74    )]
75    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
76}
77#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
78pub struct PutParams {
79    #[serde(skip_serializing_if = "Option::is_none", default)]
80    #[doc = "A list of settings you want to delete."]
81    #[doc = ""]
82    pub delete: Option<DeleteStr>,
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
85    #[doc = ""]
86    pub digest: Option<DigestStr>,
87    #[serde(skip_serializing_if = "Option::is_none", default)]
88    #[doc = "Certificate SHA 256 fingerprint."]
89    #[doc = ""]
90    pub fingerprint: Option<FingerprintStr>,
91    #[serde(rename = "lock-token")]
92    #[serde(skip_serializing_if = "Option::is_none", default)]
93    #[doc = "the token for unlocking the global SDN configuration"]
94    #[doc = ""]
95    pub lock_token: Option<String>,
96    #[serde(
97        serialize_with = "crate::types::serialize_int_optional",
98        deserialize_with = "crate::types::deserialize_int_optional"
99    )]
100    #[serde(skip_serializing_if = "Option::is_none", default)]
101    pub section: Option<i64>,
102    #[serde(skip_serializing_if = "Option::is_none", default)]
103    pub token: Option<String>,
104    #[serde(skip_serializing_if = "Option::is_none", default)]
105    pub url: Option<String>,
106    #[serde(
107        flatten,
108        default,
109        skip_serializing_if = "::std::collections::HashMap::is_empty"
110    )]
111    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
112}
113#[derive(Debug, Clone, PartialEq, PartialOrd)]
114pub struct DeleteStr {
115    value: String,
116}
117impl crate::types::bounded_string::BoundedString for DeleteStr {
118    const MIN_LENGTH: Option<usize> = None::<usize>;
119    const MAX_LENGTH: Option<usize> = Some(4096usize);
120    const DEFAULT: Option<&'static str> = None::<&'static str>;
121    const PATTERN: Option<&'static str> = None::<&'static str>;
122    const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
123    fn get_value(&self) -> &str {
124        &self.value
125    }
126    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
127        Self::validate(&value)?;
128        Ok(Self { value })
129    }
130}
131impl std::convert::TryFrom<String> for DeleteStr {
132    type Error = crate::types::bounded_string::BoundedStringError;
133    fn try_from(value: String) -> Result<Self, Self::Error> {
134        crate::types::bounded_string::BoundedString::new(value)
135    }
136}
137impl ::serde::Serialize for DeleteStr {
138    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
139    where
140        S: ::serde::Serializer,
141    {
142        crate::types::bounded_string::serialize_bounded_string(self, serializer)
143    }
144}
145impl<'de> ::serde::Deserialize<'de> for DeleteStr {
146    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
147    where
148        D: ::serde::Deserializer<'de>,
149    {
150        crate::types::bounded_string::deserialize_bounded_string(deserializer)
151    }
152}
153#[derive(Debug, Clone, PartialEq, PartialOrd)]
154pub struct DigestStr {
155    value: String,
156}
157impl crate::types::bounded_string::BoundedString for DigestStr {
158    const MIN_LENGTH: Option<usize> = None::<usize>;
159    const MAX_LENGTH: Option<usize> = Some(64usize);
160    const DEFAULT: Option<&'static str> = None::<&'static str>;
161    const PATTERN: Option<&'static str> = None::<&'static str>;
162    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
163    fn get_value(&self) -> &str {
164        &self.value
165    }
166    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
167        Self::validate(&value)?;
168        Ok(Self { value })
169    }
170}
171impl std::convert::TryFrom<String> for DigestStr {
172    type Error = crate::types::bounded_string::BoundedStringError;
173    fn try_from(value: String) -> Result<Self, Self::Error> {
174        crate::types::bounded_string::BoundedString::new(value)
175    }
176}
177impl ::serde::Serialize for DigestStr {
178    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
179    where
180        S: ::serde::Serializer,
181    {
182        crate::types::bounded_string::serialize_bounded_string(self, serializer)
183    }
184}
185impl<'de> ::serde::Deserialize<'de> for DigestStr {
186    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
187    where
188        D: ::serde::Deserializer<'de>,
189    {
190        crate::types::bounded_string::deserialize_bounded_string(deserializer)
191    }
192}
193#[derive(Debug, Clone, PartialEq, PartialOrd)]
194pub struct FingerprintStr {
195    value: String,
196}
197impl crate::types::bounded_string::BoundedString for FingerprintStr {
198    const MIN_LENGTH: Option<usize> = None::<usize>;
199    const MAX_LENGTH: Option<usize> = None::<usize>;
200    const DEFAULT: Option<&'static str> = None::<&'static str>;
201    const PATTERN: Option<&'static str> = Some("([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}");
202    const TYPE_DESCRIPTION: &'static str =
203        "a string with pattern r\"([A-Fa-f0-9]{2}:){31}[A-Fa-f0-9]{2}\" and no length constraints";
204    fn get_value(&self) -> &str {
205        &self.value
206    }
207    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
208        Self::validate(&value)?;
209        Ok(Self { value })
210    }
211}
212impl std::convert::TryFrom<String> for FingerprintStr {
213    type Error = crate::types::bounded_string::BoundedStringError;
214    fn try_from(value: String) -> Result<Self, Self::Error> {
215        crate::types::bounded_string::BoundedString::new(value)
216    }
217}
218impl ::serde::Serialize for FingerprintStr {
219    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
220    where
221        S: ::serde::Serializer,
222    {
223        crate::types::bounded_string::serialize_bounded_string(self, serializer)
224    }
225}
226impl<'de> ::serde::Deserialize<'de> for FingerprintStr {
227    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
228    where
229        D: ::serde::Deserializer<'de>,
230    {
231        crate::types::bounded_string::deserialize_bounded_string(deserializer)
232    }
233}
234impl<T> IpamClient<T>
235where
236    T: crate::client::Client,
237{
238    pub fn status(&self) -> status::StatusClient<T> {
239        status::StatusClient::<T>::new(self.client.clone(), &self.path)
240    }
241}