proxmox_api/generated/cluster/notifications/endpoints/
smtp.rs1pub mod name;
2pub struct SmtpClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> SmtpClient<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, "/smtp"),
14 }
15 }
16}
17impl<T> SmtpClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Returns a list of all smtp endpoints"]
22 pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, &())
25 }
26}
27impl<T> SmtpClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a new smtp endpoint"]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(from_address: String, name: String, origin: Origin, server: String) -> Self {
39 Self {
40 from_address,
41 name,
42 origin,
43 server,
44 author: Default::default(),
45 comment: Default::default(),
46 disable: Default::default(),
47 mailto: Default::default(),
48 mailto_user: Default::default(),
49 mode: Default::default(),
50 port: Default::default(),
51 username: Default::default(),
52 additional_properties: Default::default(),
53 }
54 }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
57pub struct GetOutputItems {
58 #[serde(skip_serializing_if = "Option::is_none", default)]
59 #[doc = "Author of the mail. Defaults to 'Proxmox VE'."]
60 pub author: Option<String>,
61 #[serde(skip_serializing_if = "Option::is_none", default)]
62 #[doc = "Comment"]
63 pub comment: Option<String>,
64 #[serde(
65 serialize_with = "crate::types::serialize_bool_optional",
66 deserialize_with = "crate::types::deserialize_bool_optional"
67 )]
68 #[serde(skip_serializing_if = "Option::is_none", default)]
69 #[doc = "Disable this target"]
70 pub disable: Option<bool>,
71 #[serde(rename = "from-address")]
72 #[doc = "`From` address for the mail"]
73 pub from_address: String,
74 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
75 #[doc = "List of email recipients"]
76 pub mailto: Vec<String>,
77 #[serde(rename = "mailto-user")]
78 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
79 #[doc = "List of users"]
80 pub mailto_user: Vec<String>,
81 #[serde(skip_serializing_if = "Option::is_none", default)]
82 #[doc = "Determine which encryption method shall be used for the connection."]
83 pub mode: Option<Mode>,
84 #[doc = "The name of the endpoint."]
85 pub name: String,
86 #[doc = "Show if this entry was created by a user or was built-in"]
87 pub origin: Origin,
88 #[serde(
89 serialize_with = "crate::types::serialize_int_optional",
90 deserialize_with = "crate::types::deserialize_int_optional"
91 )]
92 #[serde(skip_serializing_if = "Option::is_none", default)]
93 #[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."]
94 pub port: Option<u64>,
95 #[doc = "The address of the SMTP server."]
96 pub server: String,
97 #[serde(skip_serializing_if = "Option::is_none", default)]
98 #[doc = "Username for SMTP authentication"]
99 pub username: Option<String>,
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}
107impl PostParams {
108 pub fn new(from_address: String, name: String, server: String) -> Self {
109 Self {
110 from_address,
111 name,
112 server,
113 author: Default::default(),
114 comment: Default::default(),
115 disable: Default::default(),
116 mailto: Default::default(),
117 mailto_user: Default::default(),
118 mode: Default::default(),
119 password: Default::default(),
120 port: Default::default(),
121 username: Default::default(),
122 additional_properties: Default::default(),
123 }
124 }
125}
126#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
127pub struct PostParams {
128 #[serde(skip_serializing_if = "Option::is_none", default)]
129 #[doc = "Author of the mail. Defaults to 'Proxmox VE'."]
130 pub author: Option<String>,
131 #[serde(skip_serializing_if = "Option::is_none", default)]
132 #[doc = "Comment"]
133 pub comment: Option<String>,
134 #[serde(
135 serialize_with = "crate::types::serialize_bool_optional",
136 deserialize_with = "crate::types::deserialize_bool_optional"
137 )]
138 #[serde(skip_serializing_if = "Option::is_none", default)]
139 #[doc = "Disable this target"]
140 pub disable: Option<bool>,
141 #[serde(rename = "from-address")]
142 #[doc = "`From` address for the mail"]
143 pub from_address: String,
144 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
145 #[doc = "List of email recipients"]
146 pub mailto: Vec<String>,
147 #[serde(rename = "mailto-user")]
148 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
149 #[doc = "List of users"]
150 pub mailto_user: Vec<String>,
151 #[serde(skip_serializing_if = "Option::is_none", default)]
152 #[doc = "Determine which encryption method shall be used for the connection."]
153 pub mode: Option<Mode>,
154 #[doc = "The name of the endpoint."]
155 pub name: String,
156 #[serde(skip_serializing_if = "Option::is_none", default)]
157 #[doc = "Password for SMTP authentication"]
158 pub password: Option<String>,
159 #[serde(
160 serialize_with = "crate::types::serialize_int_optional",
161 deserialize_with = "crate::types::deserialize_int_optional"
162 )]
163 #[serde(skip_serializing_if = "Option::is_none", default)]
164 #[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."]
165 pub port: Option<u64>,
166 #[doc = "The address of the SMTP server."]
167 pub server: String,
168 #[serde(skip_serializing_if = "Option::is_none", default)]
169 #[doc = "Username for SMTP authentication"]
170 pub username: Option<String>,
171 #[serde(
172 flatten,
173 default,
174 skip_serializing_if = "::std::collections::HashMap::is_empty"
175 )]
176 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
177}
178#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
179pub enum Mode {
180 #[serde(rename = "insecure")]
181 Insecure,
182 #[serde(rename = "starttls")]
183 Starttls,
184 #[serde(rename = "tls")]
185 Tls,
186}
187impl Default for Mode {
188 fn default() -> Self {
189 Self::Tls
190 }
191}
192#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
193pub enum Origin {
194 #[serde(rename = "builtin")]
195 Builtin,
196 #[serde(rename = "modified-builtin")]
197 ModifiedBuiltin,
198 #[serde(rename = "user-created")]
199 UserCreated,
200}
201impl<T> SmtpClient<T>
202where
203 T: crate::client::Client,
204{
205 pub fn name(&self, name: &str) -> name::NameClient<T> {
206 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
207 }
208}