proxmox_api/generated/cluster/notifications/endpoints/smtp/
name.rs

1pub struct NameClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> NameClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, name: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, name),
13        }
14    }
15}
16impl<T> NameClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Remove smtp endpoint"]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> NameClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Return a specific smtp endpoint"]
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> NameClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Update existing smtp endpoint"]
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(from_address: String, name: String, server: String) -> Self {
48        Self {
49            from_address,
50            name,
51            server,
52            author: Default::default(),
53            comment: Default::default(),
54            digest: Default::default(),
55            disable: Default::default(),
56            mailto: Default::default(),
57            mailto_user: Default::default(),
58            mode: Default::default(),
59            port: Default::default(),
60            username: Default::default(),
61            additional_properties: Default::default(),
62        }
63    }
64}
65#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
66pub struct GetOutput {
67    #[serde(skip_serializing_if = "Option::is_none", default)]
68    #[doc = "Author of the mail. Defaults to 'Proxmox VE'."]
69    pub author: Option<String>,
70    #[serde(skip_serializing_if = "Option::is_none", default)]
71    #[doc = "Comment"]
72    pub comment: Option<String>,
73    #[serde(skip_serializing_if = "Option::is_none", default)]
74    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
75    pub digest: Option<String>,
76    #[serde(
77        serialize_with = "crate::types::serialize_bool_optional",
78        deserialize_with = "crate::types::deserialize_bool_optional"
79    )]
80    #[serde(skip_serializing_if = "Option::is_none", default)]
81    #[doc = "Disable this target"]
82    pub disable: Option<bool>,
83    #[serde(rename = "from-address")]
84    #[doc = "`From` address for the mail"]
85    pub from_address: String,
86    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
87    #[doc = "List of email recipients"]
88    pub mailto: Vec<String>,
89    #[serde(rename = "mailto-user")]
90    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
91    #[doc = "List of users"]
92    pub mailto_user: Vec<String>,
93    #[serde(skip_serializing_if = "Option::is_none", default)]
94    #[doc = "Determine which encryption method shall be used for the connection."]
95    pub mode: Option<Mode>,
96    #[doc = "The name of the endpoint."]
97    pub name: String,
98    #[serde(
99        serialize_with = "crate::types::serialize_int_optional",
100        deserialize_with = "crate::types::deserialize_int_optional"
101    )]
102    #[serde(skip_serializing_if = "Option::is_none", default)]
103    #[doc = "The port to be used. Defaults to 465 for TLS based connections, 587 for STARTTLS based connections and port 25 for insecure plain-text connections."]
104    pub port: Option<u64>,
105    #[doc = "The address of the SMTP server."]
106    pub server: String,
107    #[serde(skip_serializing_if = "Option::is_none", default)]
108    #[doc = "Username for SMTP authentication"]
109    pub username: Option<String>,
110    #[serde(
111        flatten,
112        default,
113        skip_serializing_if = "::std::collections::HashMap::is_empty"
114    )]
115    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
116}
117#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
118pub struct PutParams {
119    #[serde(skip_serializing_if = "Option::is_none", default)]
120    #[doc = "Author of the mail. Defaults to 'Proxmox VE'."]
121    pub author: Option<String>,
122    #[serde(skip_serializing_if = "Option::is_none", default)]
123    #[doc = "Comment"]
124    pub comment: Option<String>,
125    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
126    #[doc = "A list of settings you want to delete."]
127    pub delete: Vec<String>,
128    #[serde(skip_serializing_if = "Option::is_none", default)]
129    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
130    pub digest: Option<String>,
131    #[serde(
132        serialize_with = "crate::types::serialize_bool_optional",
133        deserialize_with = "crate::types::deserialize_bool_optional"
134    )]
135    #[serde(skip_serializing_if = "Option::is_none", default)]
136    #[doc = "Disable this target"]
137    pub disable: Option<bool>,
138    #[serde(rename = "from-address")]
139    #[serde(skip_serializing_if = "Option::is_none", default)]
140    #[doc = "`From` address for the mail"]
141    pub from_address: Option<String>,
142    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
143    #[doc = "List of email recipients"]
144    pub mailto: Vec<String>,
145    #[serde(rename = "mailto-user")]
146    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
147    #[doc = "List of users"]
148    pub mailto_user: Vec<String>,
149    #[serde(skip_serializing_if = "Option::is_none", default)]
150    #[doc = "Determine which encryption method shall be used for the connection."]
151    pub mode: Option<Mode>,
152    #[serde(skip_serializing_if = "Option::is_none", default)]
153    #[doc = "Password for SMTP authentication"]
154    pub password: Option<String>,
155    #[serde(
156        serialize_with = "crate::types::serialize_int_optional",
157        deserialize_with = "crate::types::deserialize_int_optional"
158    )]
159    #[serde(skip_serializing_if = "Option::is_none", default)]
160    #[doc = "The port to be used. Defaults to 465 for TLS based connections, 587 for STARTTLS based connections and port 25 for insecure plain-text connections."]
161    pub port: Option<u64>,
162    #[serde(skip_serializing_if = "Option::is_none", default)]
163    #[doc = "The address of the SMTP server."]
164    pub server: Option<String>,
165    #[serde(skip_serializing_if = "Option::is_none", default)]
166    #[doc = "Username for SMTP authentication"]
167    pub username: Option<String>,
168    #[serde(
169        flatten,
170        default,
171        skip_serializing_if = "::std::collections::HashMap::is_empty"
172    )]
173    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
174}
175#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
176pub enum Mode {
177    #[serde(rename = "insecure")]
178    Insecure,
179    #[serde(rename = "starttls")]
180    Starttls,
181    #[serde(rename = "tls")]
182    Tls,
183}
184impl Default for Mode {
185    fn default() -> Self {
186        Self::Tls
187    }
188}