proxmox_api/generated/nodes/node/network/
iface.rs

1pub struct IfaceClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> IfaceClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, iface: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, iface),
13        }
14    }
15}
16impl<T> IfaceClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Delete network device configuration"]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> IfaceClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Read network device configuration"]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> IfaceClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Update network device configuration"]
41    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.put(&path, &params)
44    }
45}
46impl GetOutput {
47    pub fn new(method: String, ty: String) -> Self {
48        Self {
49            method,
50            ty,
51            additional_properties: Default::default(),
52        }
53    }
54}
55#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
56pub struct GetOutput {
57    pub method: String,
58    #[serde(rename = "type")]
59    pub ty: 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}
67impl PutParams {
68    pub fn new(ty: Type) -> Self {
69        Self {
70            ty,
71            address: Default::default(),
72            address6: Default::default(),
73            autostart: Default::default(),
74            bond_primary: Default::default(),
75            bond_mode: Default::default(),
76            bond_xmit_hash_policy: Default::default(),
77            bridge_ports: Default::default(),
78            bridge_vlan_aware: Default::default(),
79            cidr: Default::default(),
80            cidr6: Default::default(),
81            comments: Default::default(),
82            comments6: Default::default(),
83            delete: Default::default(),
84            gateway: Default::default(),
85            gateway6: Default::default(),
86            mtu: Default::default(),
87            netmask: Default::default(),
88            netmask6: Default::default(),
89            ovs_bonds: Default::default(),
90            ovs_bridge: Default::default(),
91            ovs_options: Default::default(),
92            ovs_ports: Default::default(),
93            ovs_tag: Default::default(),
94            slaves: Default::default(),
95            vlan_id: Default::default(),
96            vlan_raw_device: Default::default(),
97            additional_properties: Default::default(),
98        }
99    }
100}
101#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
102pub struct PutParams {
103    #[serde(skip_serializing_if = "Option::is_none", default)]
104    #[doc = "IP address."]
105    pub address: Option<::std::net::Ipv4Addr>,
106    #[serde(skip_serializing_if = "Option::is_none", default)]
107    #[doc = "IP address."]
108    pub address6: Option<::std::net::Ipv6Addr>,
109    #[serde(
110        serialize_with = "crate::types::serialize_bool_optional",
111        deserialize_with = "crate::types::deserialize_bool_optional"
112    )]
113    #[serde(skip_serializing_if = "Option::is_none", default)]
114    #[doc = "Automatically start interface on boot."]
115    pub autostart: Option<bool>,
116    #[serde(rename = "bond-primary")]
117    #[serde(skip_serializing_if = "Option::is_none", default)]
118    #[doc = "Specify the primary interface for active-backup bond."]
119    pub bond_primary: Option<String>,
120    #[serde(skip_serializing_if = "Option::is_none", default)]
121    #[doc = "Bonding mode."]
122    pub bond_mode: Option<BondMode>,
123    #[serde(skip_serializing_if = "Option::is_none", default)]
124    #[doc = "Selects the transmit hash policy to use for slave selection in balance-xor and 802.3ad modes."]
125    pub bond_xmit_hash_policy: Option<BondXmitHashPolicy>,
126    #[serde(skip_serializing_if = "Option::is_none", default)]
127    #[doc = "Specify the interfaces you want to add to your bridge."]
128    pub bridge_ports: Option<String>,
129    #[serde(
130        serialize_with = "crate::types::serialize_bool_optional",
131        deserialize_with = "crate::types::deserialize_bool_optional"
132    )]
133    #[serde(skip_serializing_if = "Option::is_none", default)]
134    #[doc = "Enable bridge vlan support."]
135    pub bridge_vlan_aware: Option<bool>,
136    #[serde(skip_serializing_if = "Option::is_none", default)]
137    #[doc = "IPv4 CIDR."]
138    pub cidr: Option<String>,
139    #[serde(skip_serializing_if = "Option::is_none", default)]
140    #[doc = "IPv6 CIDR."]
141    pub cidr6: Option<String>,
142    #[serde(skip_serializing_if = "Option::is_none", default)]
143    #[doc = "Comments"]
144    pub comments: Option<String>,
145    #[serde(skip_serializing_if = "Option::is_none", default)]
146    #[doc = "Comments"]
147    pub comments6: Option<String>,
148    #[serde(skip_serializing_if = "Option::is_none", default)]
149    #[doc = "A list of settings you want to delete."]
150    pub delete: Option<String>,
151    #[serde(skip_serializing_if = "Option::is_none", default)]
152    #[doc = "Default gateway address."]
153    pub gateway: Option<::std::net::Ipv4Addr>,
154    #[serde(skip_serializing_if = "Option::is_none", default)]
155    #[doc = "Default ipv6 gateway address."]
156    pub gateway6: Option<::std::net::Ipv6Addr>,
157    #[serde(
158        serialize_with = "crate::types::serialize_int_optional",
159        deserialize_with = "crate::types::deserialize_int_optional"
160    )]
161    #[serde(skip_serializing_if = "Option::is_none", default)]
162    #[doc = "MTU."]
163    pub mtu: Option<u64>,
164    #[serde(skip_serializing_if = "Option::is_none", default)]
165    #[doc = "Network mask."]
166    pub netmask: Option<String>,
167    #[serde(
168        serialize_with = "crate::types::serialize_int_optional",
169        deserialize_with = "crate::types::deserialize_int_optional"
170    )]
171    #[serde(skip_serializing_if = "Option::is_none", default)]
172    #[doc = "Network mask."]
173    pub netmask6: Option<u64>,
174    #[serde(skip_serializing_if = "Option::is_none", default)]
175    #[doc = "Specify the interfaces used by the bonding device."]
176    pub ovs_bonds: Option<String>,
177    #[serde(skip_serializing_if = "Option::is_none", default)]
178    #[doc = "The OVS bridge associated with a OVS port. This is required when you create an OVS port."]
179    pub ovs_bridge: Option<String>,
180    #[serde(skip_serializing_if = "Option::is_none", default)]
181    #[doc = "OVS interface options."]
182    pub ovs_options: Option<String>,
183    #[serde(skip_serializing_if = "Option::is_none", default)]
184    #[doc = "Specify the interfaces you want to add to your bridge."]
185    pub ovs_ports: Option<String>,
186    #[serde(
187        serialize_with = "crate::types::serialize_int_optional",
188        deserialize_with = "crate::types::deserialize_int_optional"
189    )]
190    #[serde(skip_serializing_if = "Option::is_none", default)]
191    #[doc = "Specify a VLan tag (used by OVSPort, OVSIntPort, OVSBond)"]
192    pub ovs_tag: Option<u64>,
193    #[serde(skip_serializing_if = "Option::is_none", default)]
194    #[doc = "Specify the interfaces used by the bonding device."]
195    pub slaves: Option<String>,
196    #[serde(rename = "type")]
197    #[doc = "Network interface type"]
198    pub ty: Type,
199    #[serde(rename = "vlan-id")]
200    #[serde(
201        serialize_with = "crate::types::serialize_int_optional",
202        deserialize_with = "crate::types::deserialize_int_optional"
203    )]
204    #[serde(skip_serializing_if = "Option::is_none", default)]
205    #[doc = "vlan-id for a custom named vlan interface (ifupdown2 only)."]
206    pub vlan_id: Option<u64>,
207    #[serde(rename = "vlan-raw-device")]
208    #[serde(skip_serializing_if = "Option::is_none", default)]
209    #[doc = "Specify the raw interface for the vlan interface."]
210    pub vlan_raw_device: Option<String>,
211    #[serde(
212        flatten,
213        default,
214        skip_serializing_if = "::std::collections::HashMap::is_empty"
215    )]
216    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
217}
218#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
219pub enum BondMode {
220    #[serde(rename = "802.3ad")]
221    _8023ad,
222    #[serde(rename = "active-backup")]
223    ActiveBackup,
224    #[serde(rename = "balance-alb")]
225    BalanceAlb,
226    #[serde(rename = "balance-rr")]
227    BalanceRr,
228    #[serde(rename = "balance-slb")]
229    BalanceSlb,
230    #[serde(rename = "balance-tlb")]
231    BalanceTlb,
232    #[serde(rename = "balance-xor")]
233    BalanceXor,
234    #[serde(rename = "broadcast")]
235    Broadcast,
236    #[serde(rename = "lacp-balance-slb")]
237    LacpBalanceSlb,
238    #[serde(rename = "lacp-balance-tcp")]
239    LacpBalanceTcp,
240}
241#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
242pub enum BondXmitHashPolicy {
243    #[serde(rename = "layer2")]
244    Layer2,
245    #[serde(rename = "layer2+3")]
246    Layer23,
247    #[serde(rename = "layer3+4")]
248    Layer34,
249}
250#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
251pub enum Type {
252    OVSBond,
253    OVSBridge,
254    OVSIntPort,
255    OVSPort,
256    #[serde(rename = "alias")]
257    Alias,
258    #[serde(rename = "bond")]
259    Bond,
260    #[serde(rename = "bridge")]
261    Bridge,
262    #[serde(rename = "eth")]
263    Eth,
264    #[serde(rename = "unknown")]
265    Unknown,
266    #[serde(rename = "vlan")]
267    Vlan,
268}