Skip to main content

proxmox_api/generated/nodes/node/
network.rs

1pub mod iface;
2#[derive(Debug, Clone)]
3pub struct NetworkClient<T> {
4    client: T,
5    path: String,
6}
7impl<T> NetworkClient<T>
8where
9    T: crate::client::Client,
10{
11    pub fn new(client: T, parent_path: &str) -> Self {
12        Self {
13            client,
14            path: format!("{}{}", parent_path, "/network"),
15        }
16    }
17}
18impl<T> NetworkClient<T>
19where
20    T: crate::client::Client,
21{
22    #[doc = "Revert network configuration changes."]
23    #[doc = ""]
24    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Modify\"])"]
25    pub async fn delete(&self) -> Result<(), T::Error> {
26        let path = self.path.to_string();
27        self.client.delete(&path, &()).await
28    }
29}
30impl<T> NetworkClient<T>
31where
32    T: crate::client::Client,
33{
34    #[doc = "List available networks"]
35    #[doc = ""]
36    pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
37        let path = self.path.to_string();
38        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &params).await?;
39        Ok(optional_vec.unwrap_or_default())
40    }
41}
42impl<T> NetworkClient<T>
43where
44    T: crate::client::Client,
45{
46    #[doc = "Create network device configuration"]
47    #[doc = ""]
48    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Modify\"])"]
49    pub async fn post(&self, params: PostParams) -> Result<(), T::Error> {
50        let path = self.path.to_string();
51        self.client.post(&path, &params).await
52    }
53}
54impl<T> NetworkClient<T>
55where
56    T: crate::client::Client,
57{
58    #[doc = "Reload network configuration"]
59    #[doc = ""]
60    #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Modify\"])"]
61    pub async fn put(&self, params: PutParams) -> Result<String, T::Error> {
62        let path = self.path.to_string();
63        self.client.put(&path, &params).await
64    }
65}
66impl GetOutputItems {
67    pub fn new(iface: IfaceStr, ty: Type2) -> Self {
68        Self {
69            iface,
70            ty,
71            active: ::std::default::Default::default(),
72            address: ::std::default::Default::default(),
73            address6: ::std::default::Default::default(),
74            autostart: ::std::default::Default::default(),
75            bond_primary: ::std::default::Default::default(),
76            bond_mode: ::std::default::Default::default(),
77            bond_xmit_hash_policy: ::std::default::Default::default(),
78            bridge_access: ::std::default::Default::default(),
79            bridge_arp_nd_suppress: ::std::default::Default::default(),
80            bridge_learning: ::std::default::Default::default(),
81            bridge_multicast_flood: ::std::default::Default::default(),
82            bridge_unicast_flood: ::std::default::Default::default(),
83            bridge_ports: ::std::default::Default::default(),
84            bridge_vids: ::std::default::Default::default(),
85            bridge_vlan_aware: ::std::default::Default::default(),
86            cidr: ::std::default::Default::default(),
87            cidr6: ::std::default::Default::default(),
88            comments: ::std::default::Default::default(),
89            comments6: ::std::default::Default::default(),
90            exists: ::std::default::Default::default(),
91            families: ::std::default::Default::default(),
92            gateway: ::std::default::Default::default(),
93            gateway6: ::std::default::Default::default(),
94            link_type: ::std::default::Default::default(),
95            method: ::std::default::Default::default(),
96            method6: ::std::default::Default::default(),
97            mtu: ::std::default::Default::default(),
98            netmask: ::std::default::Default::default(),
99            netmask6: ::std::default::Default::default(),
100            options: ::std::default::Default::default(),
101            options6: ::std::default::Default::default(),
102            ovs_bonds: ::std::default::Default::default(),
103            ovs_bridge: ::std::default::Default::default(),
104            ovs_options: ::std::default::Default::default(),
105            ovs_ports: ::std::default::Default::default(),
106            ovs_tag: ::std::default::Default::default(),
107            priority: ::std::default::Default::default(),
108            slaves: ::std::default::Default::default(),
109            uplink_id: ::std::default::Default::default(),
110            vlan_id: ::std::default::Default::default(),
111            vlan_protocol: ::std::default::Default::default(),
112            vlan_raw_device: ::std::default::Default::default(),
113            vxlan_id: ::std::default::Default::default(),
114            vxlan_local_tunnelip: ::std::default::Default::default(),
115            vxlan_physdev: ::std::default::Default::default(),
116            vxlan_svcnodeip: ::std::default::Default::default(),
117            additional_properties: ::std::default::Default::default(),
118        }
119    }
120}
121#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
122pub struct GetOutputItems {
123    #[serde(
124        serialize_with = "crate::types::serialize_bool_optional",
125        deserialize_with = "crate::types::deserialize_bool_optional"
126    )]
127    #[serde(skip_serializing_if = "Option::is_none", default)]
128    #[doc = "Set to true if the interface is active."]
129    #[doc = ""]
130    pub active: Option<bool>,
131    #[serde(skip_serializing_if = "Option::is_none", default)]
132    #[doc = "IP address."]
133    #[doc = ""]
134    pub address: Option<::std::net::Ipv4Addr>,
135    #[serde(skip_serializing_if = "Option::is_none", default)]
136    #[doc = "IP address."]
137    #[doc = ""]
138    pub address6: Option<::std::net::Ipv6Addr>,
139    #[serde(
140        serialize_with = "crate::types::serialize_bool_optional",
141        deserialize_with = "crate::types::deserialize_bool_optional"
142    )]
143    #[serde(skip_serializing_if = "Option::is_none", default)]
144    #[doc = "Automatically start interface on boot."]
145    #[doc = ""]
146    pub autostart: Option<bool>,
147    #[serde(rename = "bond-primary")]
148    #[serde(skip_serializing_if = "Option::is_none", default)]
149    #[doc = "Specify the primary interface for active-backup bond."]
150    #[doc = ""]
151    pub bond_primary: Option<String>,
152    #[serde(skip_serializing_if = "Option::is_none", default)]
153    #[doc = "Bonding mode."]
154    #[doc = ""]
155    pub bond_mode: Option<BondMode>,
156    #[serde(skip_serializing_if = "Option::is_none", default)]
157    #[doc = "Selects the transmit hash policy to use for slave selection in balance-xor and 802.3ad modes."]
158    #[doc = ""]
159    pub bond_xmit_hash_policy: Option<BondXmitHashPolicy>,
160    #[serde(rename = "bridge-access")]
161    #[serde(
162        serialize_with = "crate::types::serialize_int_optional",
163        deserialize_with = "crate::types::deserialize_int_optional"
164    )]
165    #[serde(skip_serializing_if = "Option::is_none", default)]
166    #[doc = "The bridge port access VLAN."]
167    #[doc = ""]
168    pub bridge_access: Option<i64>,
169    #[serde(rename = "bridge-arp-nd-suppress")]
170    #[serde(
171        serialize_with = "crate::types::serialize_bool_optional",
172        deserialize_with = "crate::types::deserialize_bool_optional"
173    )]
174    #[serde(skip_serializing_if = "Option::is_none", default)]
175    #[doc = "Bridge port ARP/ND suppress flag."]
176    #[doc = ""]
177    pub bridge_arp_nd_suppress: Option<bool>,
178    #[serde(rename = "bridge-learning")]
179    #[serde(
180        serialize_with = "crate::types::serialize_bool_optional",
181        deserialize_with = "crate::types::deserialize_bool_optional"
182    )]
183    #[serde(skip_serializing_if = "Option::is_none", default)]
184    #[doc = "Bridge port learning flag."]
185    #[doc = ""]
186    pub bridge_learning: Option<bool>,
187    #[serde(rename = "bridge-multicast-flood")]
188    #[serde(
189        serialize_with = "crate::types::serialize_bool_optional",
190        deserialize_with = "crate::types::deserialize_bool_optional"
191    )]
192    #[serde(skip_serializing_if = "Option::is_none", default)]
193    #[doc = "Bridge port multicast flood flag."]
194    #[doc = ""]
195    pub bridge_multicast_flood: Option<bool>,
196    #[serde(rename = "bridge-unicast-flood")]
197    #[serde(
198        serialize_with = "crate::types::serialize_bool_optional",
199        deserialize_with = "crate::types::deserialize_bool_optional"
200    )]
201    #[serde(skip_serializing_if = "Option::is_none", default)]
202    #[doc = "Bridge port unicast flood flag."]
203    #[doc = ""]
204    pub bridge_unicast_flood: Option<bool>,
205    #[serde(skip_serializing_if = "Option::is_none", default)]
206    #[doc = "Specify the interfaces you want to add to your bridge."]
207    #[doc = ""]
208    pub bridge_ports: Option<String>,
209    #[serde(skip_serializing_if = "Option::is_none", default)]
210    #[doc = "Specify the allowed VLANs. For example: '2 4 100-200'. Only used if the bridge is VLAN aware."]
211    #[doc = ""]
212    pub bridge_vids: Option<String>,
213    #[serde(
214        serialize_with = "crate::types::serialize_bool_optional",
215        deserialize_with = "crate::types::deserialize_bool_optional"
216    )]
217    #[serde(skip_serializing_if = "Option::is_none", default)]
218    #[doc = "Enable bridge vlan support."]
219    #[doc = ""]
220    pub bridge_vlan_aware: Option<bool>,
221    #[serde(skip_serializing_if = "Option::is_none", default)]
222    #[doc = "IPv4 CIDR."]
223    #[doc = ""]
224    pub cidr: Option<String>,
225    #[serde(skip_serializing_if = "Option::is_none", default)]
226    #[doc = "IPv6 CIDR."]
227    #[doc = ""]
228    pub cidr6: Option<String>,
229    #[serde(skip_serializing_if = "Option::is_none", default)]
230    #[doc = "Comments"]
231    #[doc = ""]
232    pub comments: Option<String>,
233    #[serde(skip_serializing_if = "Option::is_none", default)]
234    #[doc = "Comments"]
235    #[doc = ""]
236    pub comments6: Option<String>,
237    #[serde(
238        serialize_with = "crate::types::serialize_bool_optional",
239        deserialize_with = "crate::types::deserialize_bool_optional"
240    )]
241    #[serde(skip_serializing_if = "Option::is_none", default)]
242    #[doc = "Set to true if the interface physically exists."]
243    #[doc = ""]
244    pub exists: Option<bool>,
245    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
246    #[doc = "The network families."]
247    #[doc = ""]
248    pub families: Vec<Families>,
249    #[serde(skip_serializing_if = "Option::is_none", default)]
250    #[doc = "Default gateway address."]
251    #[doc = ""]
252    pub gateway: Option<::std::net::Ipv4Addr>,
253    #[serde(skip_serializing_if = "Option::is_none", default)]
254    #[doc = "Default ipv6 gateway address."]
255    #[doc = ""]
256    pub gateway6: Option<::std::net::Ipv6Addr>,
257    #[doc = "Network interface name."]
258    #[doc = ""]
259    pub iface: IfaceStr,
260    #[serde(rename = "link-type")]
261    #[serde(skip_serializing_if = "Option::is_none", default)]
262    #[doc = "The link type."]
263    #[doc = ""]
264    pub link_type: Option<String>,
265    #[serde(skip_serializing_if = "Option::is_none", default)]
266    #[doc = "The network configuration method for IPv4."]
267    #[doc = ""]
268    pub method: Option<Method>,
269    #[serde(skip_serializing_if = "Option::is_none", default)]
270    #[doc = "The network configuration method for IPv6."]
271    #[doc = ""]
272    pub method6: Option<Method6>,
273    #[serde(skip_serializing_if = "Option::is_none", default)]
274    #[doc = "MTU."]
275    #[doc = ""]
276    pub mtu: Option<MtuInt>,
277    #[serde(skip_serializing_if = "Option::is_none", default)]
278    #[doc = "Network mask."]
279    #[doc = ""]
280    pub netmask: Option<String>,
281    #[serde(skip_serializing_if = "Option::is_none", default)]
282    #[doc = "Network mask."]
283    #[doc = ""]
284    pub netmask6: Option<Netmask6Int>,
285    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
286    #[doc = "A list of additional interface options for IPv4."]
287    #[doc = ""]
288    pub options: Vec<String>,
289    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
290    #[doc = "A list of additional interface options for IPv6."]
291    #[doc = ""]
292    pub options6: Vec<String>,
293    #[serde(skip_serializing_if = "Option::is_none", default)]
294    #[doc = "Specify the interfaces used by the bonding device."]
295    #[doc = ""]
296    pub ovs_bonds: Option<String>,
297    #[serde(skip_serializing_if = "Option::is_none", default)]
298    #[doc = "The OVS bridge associated with a OVS port. This is required when you create an OVS port."]
299    #[doc = ""]
300    pub ovs_bridge: Option<String>,
301    #[serde(skip_serializing_if = "Option::is_none", default)]
302    #[doc = "OVS interface options."]
303    #[doc = ""]
304    pub ovs_options: Option<OvsOptionsStr>,
305    #[serde(skip_serializing_if = "Option::is_none", default)]
306    #[doc = "Specify the interfaces you want to add to your bridge."]
307    #[doc = ""]
308    pub ovs_ports: Option<String>,
309    #[serde(skip_serializing_if = "Option::is_none", default)]
310    #[doc = "Specify a VLan tag (used by OVSPort, OVSIntPort, OVSBond)"]
311    #[doc = ""]
312    pub ovs_tag: Option<OvsTagInt>,
313    #[serde(
314        serialize_with = "crate::types::serialize_int_optional",
315        deserialize_with = "crate::types::deserialize_int_optional"
316    )]
317    #[serde(skip_serializing_if = "Option::is_none", default)]
318    #[doc = "The order of the interface."]
319    #[doc = ""]
320    pub priority: Option<i64>,
321    #[serde(skip_serializing_if = "Option::is_none", default)]
322    #[doc = "Specify the interfaces used by the bonding device."]
323    #[doc = ""]
324    pub slaves: Option<String>,
325    #[serde(rename = "type")]
326    #[doc = "Network interface type"]
327    #[doc = ""]
328    pub ty: Type2,
329    #[serde(rename = "uplink-id")]
330    #[serde(skip_serializing_if = "Option::is_none", default)]
331    #[doc = "The uplink ID."]
332    #[doc = ""]
333    pub uplink_id: Option<String>,
334    #[serde(rename = "vlan-id")]
335    #[serde(skip_serializing_if = "Option::is_none", default)]
336    #[doc = "vlan-id for a custom named vlan interface (ifupdown2 only)."]
337    #[doc = ""]
338    pub vlan_id: Option<VlanIdInt>,
339    #[serde(rename = "vlan-protocol")]
340    #[serde(skip_serializing_if = "Option::is_none", default)]
341    #[doc = "The VLAN protocol."]
342    #[doc = ""]
343    pub vlan_protocol: Option<VlanProtocol>,
344    #[serde(rename = "vlan-raw-device")]
345    #[serde(skip_serializing_if = "Option::is_none", default)]
346    #[doc = "Specify the raw interface for the vlan interface."]
347    #[doc = ""]
348    pub vlan_raw_device: Option<String>,
349    #[serde(rename = "vxlan-id")]
350    #[serde(
351        serialize_with = "crate::types::serialize_int_optional",
352        deserialize_with = "crate::types::deserialize_int_optional"
353    )]
354    #[serde(skip_serializing_if = "Option::is_none", default)]
355    #[doc = "The VXLAN ID."]
356    #[doc = ""]
357    pub vxlan_id: Option<i64>,
358    #[serde(rename = "vxlan-local-tunnelip")]
359    #[serde(skip_serializing_if = "Option::is_none", default)]
360    #[doc = "The VXLAN local tunnel IP."]
361    #[doc = ""]
362    pub vxlan_local_tunnelip: Option<String>,
363    #[serde(rename = "vxlan-physdev")]
364    #[serde(skip_serializing_if = "Option::is_none", default)]
365    #[doc = "The physical device for the VXLAN tunnel."]
366    #[doc = ""]
367    pub vxlan_physdev: Option<String>,
368    #[serde(rename = "vxlan-svcnodeip")]
369    #[serde(skip_serializing_if = "Option::is_none", default)]
370    #[doc = "The VXLAN SVC node IP."]
371    #[doc = ""]
372    pub vxlan_svcnodeip: Option<String>,
373    #[serde(
374        flatten,
375        default,
376        skip_serializing_if = "::std::collections::HashMap::is_empty"
377    )]
378    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
379}
380#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
381pub struct GetParams {
382    #[serde(rename = "type")]
383    #[serde(skip_serializing_if = "Option::is_none", default)]
384    #[doc = "Only list specific interface types."]
385    #[doc = ""]
386    pub ty: Option<Type>,
387    #[serde(
388        flatten,
389        default,
390        skip_serializing_if = "::std::collections::HashMap::is_empty"
391    )]
392    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
393}
394impl PostParams {
395    pub fn new(iface: IfaceStr, ty: Type3) -> Self {
396        Self {
397            iface,
398            ty,
399            address: ::std::default::Default::default(),
400            address6: ::std::default::Default::default(),
401            autostart: ::std::default::Default::default(),
402            bond_primary: ::std::default::Default::default(),
403            bond_mode: ::std::default::Default::default(),
404            bond_xmit_hash_policy: ::std::default::Default::default(),
405            bridge_ports: ::std::default::Default::default(),
406            bridge_vids: ::std::default::Default::default(),
407            bridge_vlan_aware: ::std::default::Default::default(),
408            cidr: ::std::default::Default::default(),
409            cidr6: ::std::default::Default::default(),
410            comments: ::std::default::Default::default(),
411            comments6: ::std::default::Default::default(),
412            gateway: ::std::default::Default::default(),
413            gateway6: ::std::default::Default::default(),
414            mtu: ::std::default::Default::default(),
415            netmask: ::std::default::Default::default(),
416            netmask6: ::std::default::Default::default(),
417            ovs_bonds: ::std::default::Default::default(),
418            ovs_bridge: ::std::default::Default::default(),
419            ovs_options: ::std::default::Default::default(),
420            ovs_ports: ::std::default::Default::default(),
421            ovs_tag: ::std::default::Default::default(),
422            slaves: ::std::default::Default::default(),
423            vlan_id: ::std::default::Default::default(),
424            vlan_raw_device: ::std::default::Default::default(),
425            additional_properties: ::std::default::Default::default(),
426        }
427    }
428}
429#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
430pub struct PostParams {
431    #[serde(skip_serializing_if = "Option::is_none", default)]
432    #[doc = "IP address."]
433    #[doc = ""]
434    pub address: Option<::std::net::Ipv4Addr>,
435    #[serde(skip_serializing_if = "Option::is_none", default)]
436    #[doc = "IP address."]
437    #[doc = ""]
438    pub address6: Option<::std::net::Ipv6Addr>,
439    #[serde(
440        serialize_with = "crate::types::serialize_bool_optional",
441        deserialize_with = "crate::types::deserialize_bool_optional"
442    )]
443    #[serde(skip_serializing_if = "Option::is_none", default)]
444    #[doc = "Automatically start interface on boot."]
445    #[doc = ""]
446    pub autostart: Option<bool>,
447    #[serde(rename = "bond-primary")]
448    #[serde(skip_serializing_if = "Option::is_none", default)]
449    #[doc = "Specify the primary interface for active-backup bond."]
450    #[doc = ""]
451    pub bond_primary: Option<String>,
452    #[serde(skip_serializing_if = "Option::is_none", default)]
453    #[doc = "Bonding mode."]
454    #[doc = ""]
455    pub bond_mode: Option<BondMode>,
456    #[serde(skip_serializing_if = "Option::is_none", default)]
457    #[doc = "Selects the transmit hash policy to use for slave selection in balance-xor and 802.3ad modes."]
458    #[doc = ""]
459    pub bond_xmit_hash_policy: Option<BondXmitHashPolicy>,
460    #[serde(skip_serializing_if = "Option::is_none", default)]
461    #[doc = "Specify the interfaces you want to add to your bridge."]
462    #[doc = ""]
463    pub bridge_ports: Option<String>,
464    #[serde(skip_serializing_if = "Option::is_none", default)]
465    #[doc = "Specify the allowed VLANs. For example: '2 4 100-200'. Only used if the bridge is VLAN aware."]
466    #[doc = ""]
467    pub bridge_vids: Option<String>,
468    #[serde(
469        serialize_with = "crate::types::serialize_bool_optional",
470        deserialize_with = "crate::types::deserialize_bool_optional"
471    )]
472    #[serde(skip_serializing_if = "Option::is_none", default)]
473    #[doc = "Enable bridge vlan support."]
474    #[doc = ""]
475    pub bridge_vlan_aware: Option<bool>,
476    #[serde(skip_serializing_if = "Option::is_none", default)]
477    #[doc = "IPv4 CIDR."]
478    #[doc = ""]
479    pub cidr: Option<String>,
480    #[serde(skip_serializing_if = "Option::is_none", default)]
481    #[doc = "IPv6 CIDR."]
482    #[doc = ""]
483    pub cidr6: Option<String>,
484    #[serde(skip_serializing_if = "Option::is_none", default)]
485    #[doc = "Comments"]
486    #[doc = ""]
487    pub comments: Option<String>,
488    #[serde(skip_serializing_if = "Option::is_none", default)]
489    #[doc = "Comments"]
490    #[doc = ""]
491    pub comments6: Option<String>,
492    #[serde(skip_serializing_if = "Option::is_none", default)]
493    #[doc = "Default gateway address."]
494    #[doc = ""]
495    pub gateway: Option<::std::net::Ipv4Addr>,
496    #[serde(skip_serializing_if = "Option::is_none", default)]
497    #[doc = "Default ipv6 gateway address."]
498    #[doc = ""]
499    pub gateway6: Option<::std::net::Ipv6Addr>,
500    #[doc = "Network interface name."]
501    #[doc = ""]
502    pub iface: IfaceStr,
503    #[serde(skip_serializing_if = "Option::is_none", default)]
504    #[doc = "MTU."]
505    #[doc = ""]
506    pub mtu: Option<MtuInt>,
507    #[serde(skip_serializing_if = "Option::is_none", default)]
508    #[doc = "Network mask."]
509    #[doc = ""]
510    pub netmask: Option<String>,
511    #[serde(skip_serializing_if = "Option::is_none", default)]
512    #[doc = "Network mask."]
513    #[doc = ""]
514    pub netmask6: Option<Netmask6Int>,
515    #[serde(skip_serializing_if = "Option::is_none", default)]
516    #[doc = "Specify the interfaces used by the bonding device."]
517    #[doc = ""]
518    pub ovs_bonds: Option<String>,
519    #[serde(skip_serializing_if = "Option::is_none", default)]
520    #[doc = "The OVS bridge associated with a OVS port. This is required when you create an OVS port."]
521    #[doc = ""]
522    pub ovs_bridge: Option<String>,
523    #[serde(skip_serializing_if = "Option::is_none", default)]
524    #[doc = "OVS interface options."]
525    #[doc = ""]
526    pub ovs_options: Option<OvsOptionsStr>,
527    #[serde(skip_serializing_if = "Option::is_none", default)]
528    #[doc = "Specify the interfaces you want to add to your bridge."]
529    #[doc = ""]
530    pub ovs_ports: Option<String>,
531    #[serde(skip_serializing_if = "Option::is_none", default)]
532    #[doc = "Specify a VLan tag (used by OVSPort, OVSIntPort, OVSBond)"]
533    #[doc = ""]
534    pub ovs_tag: Option<OvsTagInt>,
535    #[serde(skip_serializing_if = "Option::is_none", default)]
536    #[doc = "Specify the interfaces used by the bonding device."]
537    #[doc = ""]
538    pub slaves: Option<String>,
539    #[serde(rename = "type")]
540    #[doc = "Network interface type"]
541    #[doc = ""]
542    pub ty: Type3,
543    #[serde(rename = "vlan-id")]
544    #[serde(skip_serializing_if = "Option::is_none", default)]
545    #[doc = "vlan-id for a custom named vlan interface (ifupdown2 only)."]
546    #[doc = ""]
547    pub vlan_id: Option<VlanIdInt>,
548    #[serde(rename = "vlan-raw-device")]
549    #[serde(skip_serializing_if = "Option::is_none", default)]
550    #[doc = "Specify the raw interface for the vlan interface."]
551    #[doc = ""]
552    pub vlan_raw_device: Option<String>,
553    #[serde(
554        flatten,
555        default,
556        skip_serializing_if = "::std::collections::HashMap::is_empty"
557    )]
558    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
559}
560#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
561pub struct PutParams {
562    #[serde(rename = "regenerate-frr")]
563    #[serde(
564        serialize_with = "crate::types::serialize_bool_optional",
565        deserialize_with = "crate::types::deserialize_bool_optional"
566    )]
567    #[serde(skip_serializing_if = "Option::is_none", default)]
568    #[doc = "Whether FRR config generation should get skipped or not."]
569    #[doc = ""]
570    pub regenerate_frr: Option<bool>,
571    #[serde(
572        flatten,
573        default,
574        skip_serializing_if = "::std::collections::HashMap::is_empty"
575    )]
576    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
577}
578#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
579#[doc = "Bonding mode."]
580#[doc = ""]
581pub enum BondMode {
582    #[serde(rename = "802.3ad")]
583    _8023ad,
584    #[serde(rename = "active-backup")]
585    ActiveBackup,
586    #[serde(rename = "balance-alb")]
587    BalanceAlb,
588    #[serde(rename = "balance-rr")]
589    BalanceRr,
590    #[serde(rename = "balance-slb")]
591    BalanceSlb,
592    #[serde(rename = "balance-tlb")]
593    BalanceTlb,
594    #[serde(rename = "balance-xor")]
595    BalanceXor,
596    #[serde(rename = "broadcast")]
597    Broadcast,
598    #[serde(rename = "lacp-balance-slb")]
599    LacpBalanceSlb,
600    #[serde(rename = "lacp-balance-tcp")]
601    LacpBalanceTcp,
602}
603impl TryFrom<&str> for BondMode {
604    type Error = String;
605    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
606        match value {
607            "802.3ad" => Ok(Self::_8023ad),
608            "active-backup" => Ok(Self::ActiveBackup),
609            "balance-alb" => Ok(Self::BalanceAlb),
610            "balance-rr" => Ok(Self::BalanceRr),
611            "balance-slb" => Ok(Self::BalanceSlb),
612            "balance-tlb" => Ok(Self::BalanceTlb),
613            "balance-xor" => Ok(Self::BalanceXor),
614            "broadcast" => Ok(Self::Broadcast),
615            "lacp-balance-slb" => Ok(Self::LacpBalanceSlb),
616            "lacp-balance-tcp" => Ok(Self::LacpBalanceTcp),
617            v => Err(format!("Unknown variant {v}")),
618        }
619    }
620}
621#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
622#[doc = "Selects the transmit hash policy to use for slave selection in balance-xor and 802.3ad modes."]
623#[doc = ""]
624pub enum BondXmitHashPolicy {
625    #[serde(rename = "layer2")]
626    Layer2,
627    #[serde(rename = "layer2+3")]
628    Layer23,
629    #[serde(rename = "layer3+4")]
630    Layer34,
631}
632impl TryFrom<&str> for BondXmitHashPolicy {
633    type Error = String;
634    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
635        match value {
636            "layer2" => Ok(Self::Layer2),
637            "layer2+3" => Ok(Self::Layer23),
638            "layer3+4" => Ok(Self::Layer34),
639            v => Err(format!("Unknown variant {v}")),
640        }
641    }
642}
643#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
644#[doc = "A network family."]
645#[doc = ""]
646pub enum Families {
647    #[serde(rename = "inet")]
648    Inet,
649    #[serde(rename = "inet6")]
650    Inet6,
651}
652impl TryFrom<&str> for Families {
653    type Error = String;
654    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
655        match value {
656            "inet" => Ok(Self::Inet),
657            "inet6" => Ok(Self::Inet6),
658            v => Err(format!("Unknown variant {v}")),
659        }
660    }
661}
662#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
663#[doc = "The network configuration method for IPv4."]
664#[doc = ""]
665pub enum Method {
666    #[serde(rename = "auto")]
667    Auto,
668    #[serde(rename = "dhcp")]
669    Dhcp,
670    #[serde(rename = "loopback")]
671    Loopback,
672    #[serde(rename = "manual")]
673    Manual,
674    #[serde(rename = "static")]
675    Static,
676}
677impl TryFrom<&str> for Method {
678    type Error = String;
679    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
680        match value {
681            "auto" => Ok(Self::Auto),
682            "dhcp" => Ok(Self::Dhcp),
683            "loopback" => Ok(Self::Loopback),
684            "manual" => Ok(Self::Manual),
685            "static" => Ok(Self::Static),
686            v => Err(format!("Unknown variant {v}")),
687        }
688    }
689}
690#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
691#[doc = "The network configuration method for IPv6."]
692#[doc = ""]
693pub enum Method6 {
694    #[serde(rename = "auto")]
695    Auto,
696    #[serde(rename = "dhcp")]
697    Dhcp,
698    #[serde(rename = "loopback")]
699    Loopback,
700    #[serde(rename = "manual")]
701    Manual,
702    #[serde(rename = "static")]
703    Static,
704}
705impl TryFrom<&str> for Method6 {
706    type Error = String;
707    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
708        match value {
709            "auto" => Ok(Self::Auto),
710            "dhcp" => Ok(Self::Dhcp),
711            "loopback" => Ok(Self::Loopback),
712            "manual" => Ok(Self::Manual),
713            "static" => Ok(Self::Static),
714            v => Err(format!("Unknown variant {v}")),
715        }
716    }
717}
718#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
719#[doc = "Only list specific interface types."]
720#[doc = ""]
721pub enum Type {
722    OVSBond,
723    OVSBridge,
724    OVSIntPort,
725    OVSPort,
726    #[serde(rename = "alias")]
727    Alias,
728    #[serde(rename = "any_bridge")]
729    AnyBridge,
730    #[serde(rename = "any_local_bridge")]
731    AnyLocalBridge,
732    #[serde(rename = "bond")]
733    Bond,
734    #[serde(rename = "bridge")]
735    Bridge,
736    #[serde(rename = "eth")]
737    Eth,
738    #[serde(rename = "fabric")]
739    Fabric,
740    #[serde(rename = "include_sdn")]
741    IncludeSdn,
742    #[serde(rename = "vlan")]
743    Vlan,
744    #[serde(rename = "vnet")]
745    Vnet,
746}
747impl TryFrom<&str> for Type {
748    type Error = String;
749    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
750        match value {
751            "OVSBond" => Ok(Self::OVSBond),
752            "OVSBridge" => Ok(Self::OVSBridge),
753            "OVSIntPort" => Ok(Self::OVSIntPort),
754            "OVSPort" => Ok(Self::OVSPort),
755            "alias" => Ok(Self::Alias),
756            "any_bridge" => Ok(Self::AnyBridge),
757            "any_local_bridge" => Ok(Self::AnyLocalBridge),
758            "bond" => Ok(Self::Bond),
759            "bridge" => Ok(Self::Bridge),
760            "eth" => Ok(Self::Eth),
761            "fabric" => Ok(Self::Fabric),
762            "include_sdn" => Ok(Self::IncludeSdn),
763            "vlan" => Ok(Self::Vlan),
764            "vnet" => Ok(Self::Vnet),
765            v => Err(format!("Unknown variant {v}")),
766        }
767    }
768}
769#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
770#[doc = "Network interface type"]
771#[doc = ""]
772pub enum Type2 {
773    OVSBond,
774    OVSBridge,
775    OVSIntPort,
776    OVSPort,
777    #[serde(rename = "alias")]
778    Alias,
779    #[serde(rename = "bond")]
780    Bond,
781    #[serde(rename = "bridge")]
782    Bridge,
783    #[serde(rename = "eth")]
784    Eth,
785    #[serde(rename = "fabric")]
786    Fabric,
787    #[serde(rename = "unknown")]
788    Unknown,
789    #[serde(rename = "vlan")]
790    Vlan,
791    #[serde(rename = "vnet")]
792    Vnet,
793}
794impl TryFrom<&str> for Type2 {
795    type Error = String;
796    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
797        match value {
798            "OVSBond" => Ok(Self::OVSBond),
799            "OVSBridge" => Ok(Self::OVSBridge),
800            "OVSIntPort" => Ok(Self::OVSIntPort),
801            "OVSPort" => Ok(Self::OVSPort),
802            "alias" => Ok(Self::Alias),
803            "bond" => Ok(Self::Bond),
804            "bridge" => Ok(Self::Bridge),
805            "eth" => Ok(Self::Eth),
806            "fabric" => Ok(Self::Fabric),
807            "unknown" => Ok(Self::Unknown),
808            "vlan" => Ok(Self::Vlan),
809            "vnet" => Ok(Self::Vnet),
810            v => Err(format!("Unknown variant {v}")),
811        }
812    }
813}
814#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
815#[doc = "Network interface type"]
816#[doc = ""]
817pub enum Type3 {
818    OVSBond,
819    OVSBridge,
820    OVSIntPort,
821    OVSPort,
822    #[serde(rename = "alias")]
823    Alias,
824    #[serde(rename = "bond")]
825    Bond,
826    #[serde(rename = "bridge")]
827    Bridge,
828    #[serde(rename = "eth")]
829    Eth,
830    #[serde(rename = "fabric")]
831    Fabric,
832    #[serde(rename = "unknown")]
833    Unknown,
834    #[serde(rename = "vlan")]
835    Vlan,
836    #[serde(rename = "vnet")]
837    Vnet,
838}
839impl TryFrom<&str> for Type3 {
840    type Error = String;
841    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
842        match value {
843            "OVSBond" => Ok(Self::OVSBond),
844            "OVSBridge" => Ok(Self::OVSBridge),
845            "OVSIntPort" => Ok(Self::OVSIntPort),
846            "OVSPort" => Ok(Self::OVSPort),
847            "alias" => Ok(Self::Alias),
848            "bond" => Ok(Self::Bond),
849            "bridge" => Ok(Self::Bridge),
850            "eth" => Ok(Self::Eth),
851            "fabric" => Ok(Self::Fabric),
852            "unknown" => Ok(Self::Unknown),
853            "vlan" => Ok(Self::Vlan),
854            "vnet" => Ok(Self::Vnet),
855            v => Err(format!("Unknown variant {v}")),
856        }
857    }
858}
859#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
860#[doc = "The VLAN protocol."]
861#[doc = ""]
862pub enum VlanProtocol {
863    #[serde(rename = "802.1ad")]
864    _8021ad,
865    #[serde(rename = "802.1q")]
866    _8021q,
867}
868impl TryFrom<&str> for VlanProtocol {
869    type Error = String;
870    fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
871        match value {
872            "802.1ad" => Ok(Self::_8021ad),
873            "802.1q" => Ok(Self::_8021q),
874            v => Err(format!("Unknown variant {v}")),
875        }
876    }
877}
878#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
879pub struct MtuInt(i128);
880impl crate::types::bounded_integer::BoundedInteger for MtuInt {
881    const MIN: Option<i128> = Some(1280i128);
882    const MAX: Option<i128> = Some(65520i128);
883    const DEFAULT: Option<i128> = None::<i128>;
884    const TYPE_DESCRIPTION: &'static str = "an integer between 1280 and 65520";
885    fn get(&self) -> i128 {
886        self.0
887    }
888    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
889        Self::validate(value)?;
890        Ok(Self(value))
891    }
892}
893impl std::convert::TryFrom<i128> for MtuInt {
894    type Error = crate::types::bounded_integer::BoundedIntegerError;
895    fn try_from(value: i128) -> Result<Self, Self::Error> {
896        crate::types::bounded_integer::BoundedInteger::new(value)
897    }
898}
899impl ::serde::Serialize for MtuInt {
900    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
901    where
902        S: ::serde::Serializer,
903    {
904        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
905    }
906}
907impl<'de> ::serde::Deserialize<'de> for MtuInt {
908    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
909    where
910        D: ::serde::Deserializer<'de>,
911    {
912        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
913    }
914}
915#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
916pub struct Netmask6Int(i128);
917impl crate::types::bounded_integer::BoundedInteger for Netmask6Int {
918    const MIN: Option<i128> = Some(0i128);
919    const MAX: Option<i128> = Some(128i128);
920    const DEFAULT: Option<i128> = None::<i128>;
921    const TYPE_DESCRIPTION: &'static str = "an integer between 0 and 128";
922    fn get(&self) -> i128 {
923        self.0
924    }
925    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
926        Self::validate(value)?;
927        Ok(Self(value))
928    }
929}
930impl std::convert::TryFrom<i128> for Netmask6Int {
931    type Error = crate::types::bounded_integer::BoundedIntegerError;
932    fn try_from(value: i128) -> Result<Self, Self::Error> {
933        crate::types::bounded_integer::BoundedInteger::new(value)
934    }
935}
936impl ::serde::Serialize for Netmask6Int {
937    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
938    where
939        S: ::serde::Serializer,
940    {
941        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
942    }
943}
944impl<'de> ::serde::Deserialize<'de> for Netmask6Int {
945    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
946    where
947        D: ::serde::Deserializer<'de>,
948    {
949        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
950    }
951}
952#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
953pub struct OvsTagInt(i128);
954impl crate::types::bounded_integer::BoundedInteger for OvsTagInt {
955    const MIN: Option<i128> = Some(1i128);
956    const MAX: Option<i128> = Some(4094i128);
957    const DEFAULT: Option<i128> = None::<i128>;
958    const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 4094";
959    fn get(&self) -> i128 {
960        self.0
961    }
962    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
963        Self::validate(value)?;
964        Ok(Self(value))
965    }
966}
967impl std::convert::TryFrom<i128> for OvsTagInt {
968    type Error = crate::types::bounded_integer::BoundedIntegerError;
969    fn try_from(value: i128) -> Result<Self, Self::Error> {
970        crate::types::bounded_integer::BoundedInteger::new(value)
971    }
972}
973impl ::serde::Serialize for OvsTagInt {
974    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
975    where
976        S: ::serde::Serializer,
977    {
978        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
979    }
980}
981impl<'de> ::serde::Deserialize<'de> for OvsTagInt {
982    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
983    where
984        D: ::serde::Deserializer<'de>,
985    {
986        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
987    }
988}
989#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
990pub struct VlanIdInt(i128);
991impl crate::types::bounded_integer::BoundedInteger for VlanIdInt {
992    const MIN: Option<i128> = Some(1i128);
993    const MAX: Option<i128> = Some(4094i128);
994    const DEFAULT: Option<i128> = None::<i128>;
995    const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 4094";
996    fn get(&self) -> i128 {
997        self.0
998    }
999    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
1000        Self::validate(value)?;
1001        Ok(Self(value))
1002    }
1003}
1004impl std::convert::TryFrom<i128> for VlanIdInt {
1005    type Error = crate::types::bounded_integer::BoundedIntegerError;
1006    fn try_from(value: i128) -> Result<Self, Self::Error> {
1007        crate::types::bounded_integer::BoundedInteger::new(value)
1008    }
1009}
1010impl ::serde::Serialize for VlanIdInt {
1011    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1012    where
1013        S: ::serde::Serializer,
1014    {
1015        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
1016    }
1017}
1018impl<'de> ::serde::Deserialize<'de> for VlanIdInt {
1019    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1020    where
1021        D: ::serde::Deserializer<'de>,
1022    {
1023        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
1024    }
1025}
1026#[derive(Debug, Clone, PartialEq, PartialOrd)]
1027pub struct IfaceStr {
1028    value: String,
1029}
1030impl crate::types::bounded_string::BoundedString for IfaceStr {
1031    const MIN_LENGTH: Option<usize> = Some(2usize);
1032    const MAX_LENGTH: Option<usize> = Some(20usize);
1033    const DEFAULT: Option<&'static str> = None::<&'static str>;
1034    const PATTERN: Option<&'static str> = None::<&'static str>;
1035    const TYPE_DESCRIPTION: &'static str = "a string with length between 2 and 20";
1036    fn get_value(&self) -> &str {
1037        &self.value
1038    }
1039    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1040        Self::validate(&value)?;
1041        Ok(Self { value })
1042    }
1043}
1044impl std::convert::TryFrom<String> for IfaceStr {
1045    type Error = crate::types::bounded_string::BoundedStringError;
1046    fn try_from(value: String) -> Result<Self, Self::Error> {
1047        crate::types::bounded_string::BoundedString::new(value)
1048    }
1049}
1050impl ::serde::Serialize for IfaceStr {
1051    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1052    where
1053        S: ::serde::Serializer,
1054    {
1055        crate::types::bounded_string::serialize_bounded_string(self, serializer)
1056    }
1057}
1058impl<'de> ::serde::Deserialize<'de> for IfaceStr {
1059    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1060    where
1061        D: ::serde::Deserializer<'de>,
1062    {
1063        crate::types::bounded_string::deserialize_bounded_string(deserializer)
1064    }
1065}
1066#[derive(Debug, Clone, PartialEq, PartialOrd)]
1067pub struct OvsOptionsStr {
1068    value: String,
1069}
1070impl crate::types::bounded_string::BoundedString for OvsOptionsStr {
1071    const MIN_LENGTH: Option<usize> = None::<usize>;
1072    const MAX_LENGTH: Option<usize> = Some(1024usize);
1073    const DEFAULT: Option<&'static str> = None::<&'static str>;
1074    const PATTERN: Option<&'static str> = None::<&'static str>;
1075    const TYPE_DESCRIPTION: &'static str = "a string with length at most 1024";
1076    fn get_value(&self) -> &str {
1077        &self.value
1078    }
1079    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
1080        Self::validate(&value)?;
1081        Ok(Self { value })
1082    }
1083}
1084impl std::convert::TryFrom<String> for OvsOptionsStr {
1085    type Error = crate::types::bounded_string::BoundedStringError;
1086    fn try_from(value: String) -> Result<Self, Self::Error> {
1087        crate::types::bounded_string::BoundedString::new(value)
1088    }
1089}
1090impl ::serde::Serialize for OvsOptionsStr {
1091    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1092    where
1093        S: ::serde::Serializer,
1094    {
1095        crate::types::bounded_string::serialize_bounded_string(self, serializer)
1096    }
1097}
1098impl<'de> ::serde::Deserialize<'de> for OvsOptionsStr {
1099    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1100    where
1101        D: ::serde::Deserializer<'de>,
1102    {
1103        crate::types::bounded_string::deserialize_bounded_string(deserializer)
1104    }
1105}
1106impl<T> NetworkClient<T>
1107where
1108    T: crate::client::Client,
1109{
1110    pub fn iface(&self, iface: &str) -> iface::IfaceClient<T> {
1111        iface::IfaceClient::<T>::new(self.client.clone(), &self.path, iface)
1112    }
1113}