proxmox_api/generated/nodes/node/
dns.rs

1pub struct DnsClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> DnsClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}{}", parent_path, "/dns"),
13        }
14    }
15}
16impl<T> DnsClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Read DNS settings."]
21    pub fn get(&self) -> Result<GetOutput, T::Error> {
22        let path = self.path.to_string();
23        self.client.get(&path, &())
24    }
25}
26impl<T> DnsClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Write DNS settings."]
31    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
32        let path = self.path.to_string();
33        self.client.put(&path, &params)
34    }
35}
36#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
37pub struct GetOutput {
38    #[serde(skip_serializing_if = "Option::is_none", default)]
39    #[doc = "First name server IP address."]
40    pub dns1: Option<String>,
41    #[serde(skip_serializing_if = "Option::is_none", default)]
42    #[doc = "Second name server IP address."]
43    pub dns2: Option<String>,
44    #[serde(skip_serializing_if = "Option::is_none", default)]
45    #[doc = "Third name server IP address."]
46    pub dns3: Option<String>,
47    #[serde(skip_serializing_if = "Option::is_none", default)]
48    #[doc = "Search domain for host-name lookup."]
49    pub search: Option<String>,
50}
51impl PutParams {
52    pub fn new(search: String) -> Self {
53        Self {
54            search,
55            dns1: Default::default(),
56            dns2: Default::default(),
57            dns3: Default::default(),
58            additional_properties: Default::default(),
59        }
60    }
61}
62#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
63pub struct PutParams {
64    #[serde(skip_serializing_if = "Option::is_none", default)]
65    #[doc = "First name server IP address."]
66    pub dns1: Option<::std::net::IpAddr>,
67    #[serde(skip_serializing_if = "Option::is_none", default)]
68    #[doc = "Second name server IP address."]
69    pub dns2: Option<::std::net::IpAddr>,
70    #[serde(skip_serializing_if = "Option::is_none", default)]
71    #[doc = "Third name server IP address."]
72    pub dns3: Option<::std::net::IpAddr>,
73    #[doc = "Search domain for host-name lookup."]
74    pub search: String,
75    #[serde(
76        flatten,
77        default,
78        skip_serializing_if = "::std::collections::HashMap::is_empty"
79    )]
80    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
81}