Skip to main content

proxmox_api/generated/cluster/sdn/vnets/vnet/subnets/
subnet.rs

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