Skip to main content

proxmox_api/generated/nodes/node/lxc/vmid/
interfaces.rs

1#[derive(Debug, Clone)]
2pub struct InterfacesClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> InterfacesClient<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, "/interfaces"),
14        }
15    }
16}
17impl<T> InterfacesClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Get IP addresses of the specified container interface."]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/vms/{vmid}\", [\"VM.Audit\"])"]
24    pub async fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
25        let path = self.path.to_string();
26        let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, &()).await?;
27        Ok(optional_vec.unwrap_or_default())
28    }
29}
30impl GetOutputItems {
31    pub fn new(
32        hardware_address: String,
33        hwaddr: String,
34        ip_addresses: Vec<IpAddressesGetOutputItemsIpAddressesItems>,
35        name: String,
36    ) -> Self {
37        Self {
38            hardware_address,
39            hwaddr,
40            ip_addresses,
41            name,
42            inet: ::std::default::Default::default(),
43            inet6: ::std::default::Default::default(),
44            additional_properties: ::std::default::Default::default(),
45        }
46    }
47}
48#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
49pub struct GetOutputItems {
50    #[serde(rename = "hardware-address")]
51    #[doc = "The MAC address of the interface"]
52    #[doc = ""]
53    pub hardware_address: String,
54    #[doc = "The MAC address of the interface"]
55    #[doc = ""]
56    pub hwaddr: String,
57    #[serde(skip_serializing_if = "Option::is_none", default)]
58    #[doc = "The IPv4 address of the interface"]
59    #[doc = ""]
60    pub inet: Option<String>,
61    #[serde(skip_serializing_if = "Option::is_none", default)]
62    #[doc = "The IPv6 address of the interface"]
63    #[doc = ""]
64    pub inet6: Option<String>,
65    #[serde(rename = "ip-addresses")]
66    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
67    #[doc = "The addresses of the interface"]
68    #[doc = ""]
69    pub ip_addresses: Vec<IpAddressesGetOutputItemsIpAddressesItems>,
70    #[doc = "The name of the interface"]
71    #[doc = ""]
72    pub name: String,
73    #[serde(
74        flatten,
75        default,
76        skip_serializing_if = "::std::collections::HashMap::is_empty"
77    )]
78    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
79}
80#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
81pub struct IpAddressesGetOutputItemsIpAddressesItems {
82    #[serde(rename = "ip-address")]
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    #[doc = "IP-Address"]
85    #[doc = ""]
86    pub ip_address: Option<String>,
87    #[serde(rename = "ip-address-type")]
88    #[serde(skip_serializing_if = "Option::is_none", default)]
89    #[doc = "IP-Family"]
90    #[doc = ""]
91    pub ip_address_type: Option<String>,
92    #[serde(
93        serialize_with = "crate::types::serialize_int_optional",
94        deserialize_with = "crate::types::deserialize_int_optional"
95    )]
96    #[serde(skip_serializing_if = "Option::is_none", default)]
97    #[doc = "IP-Prefix"]
98    #[doc = ""]
99    pub prefix: Option<i64>,
100    #[serde(
101        flatten,
102        default,
103        skip_serializing_if = "::std::collections::HashMap::is_empty"
104    )]
105    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
106}