proxmox_api/generated/nodes/node/
hosts.rs

1pub struct HostsClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> HostsClient<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, "/hosts"),
13        }
14    }
15}
16impl<T> HostsClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Get the content of /etc/hosts."]
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> HostsClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Write /etc/hosts."]
31    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
32        let path = self.path.to_string();
33        self.client.post(&path, &params)
34    }
35}
36impl GetOutput {
37    pub fn new(data: String) -> Self {
38        Self {
39            data,
40            digest: Default::default(),
41            additional_properties: Default::default(),
42        }
43    }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct GetOutput {
47    #[doc = "The content of /etc/hosts."]
48    pub data: String,
49    #[serde(skip_serializing_if = "Option::is_none", default)]
50    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
51    pub digest: Option<String>,
52    #[serde(
53        flatten,
54        default,
55        skip_serializing_if = "::std::collections::HashMap::is_empty"
56    )]
57    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
58}
59impl PostParams {
60    pub fn new(data: String) -> Self {
61        Self {
62            data,
63            digest: Default::default(),
64            additional_properties: Default::default(),
65        }
66    }
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
69pub struct PostParams {
70    #[doc = "The target content of /etc/hosts."]
71    pub data: String,
72    #[serde(skip_serializing_if = "Option::is_none", default)]
73    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
74    pub digest: Option<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}