proxmox_api/generated/cluster/notifications/endpoints/
sendmail.rs

1pub mod name;
2pub struct SendmailClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> SendmailClient<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, "/sendmail"),
14        }
15    }
16}
17impl<T> SendmailClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Returns a list of all sendmail 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> SendmailClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create a new sendmail endpoint"]
32    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33        let path = self.path.to_string();
34        self.client.post(&path, &params)
35    }
36}
37impl GetOutputItems {
38    pub fn new(name: String, origin: Origin) -> Self {
39        Self {
40            name,
41            origin,
42            author: Default::default(),
43            comment: Default::default(),
44            disable: Default::default(),
45            from_address: Default::default(),
46            mailto: Default::default(),
47            mailto_user: Default::default(),
48            additional_properties: Default::default(),
49        }
50    }
51}
52#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
53pub struct GetOutputItems {
54    #[serde(skip_serializing_if = "Option::is_none", default)]
55    #[doc = "Author of the mail"]
56    pub author: Option<String>,
57    #[serde(skip_serializing_if = "Option::is_none", default)]
58    #[doc = "Comment"]
59    pub comment: Option<String>,
60    #[serde(
61        serialize_with = "crate::types::serialize_bool_optional",
62        deserialize_with = "crate::types::deserialize_bool_optional"
63    )]
64    #[serde(skip_serializing_if = "Option::is_none", default)]
65    #[doc = "Disable this target"]
66    pub disable: Option<bool>,
67    #[serde(rename = "from-address")]
68    #[serde(skip_serializing_if = "Option::is_none", default)]
69    #[doc = "`From` address for the mail"]
70    pub from_address: Option<String>,
71    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
72    #[doc = "List of email recipients"]
73    pub mailto: Vec<String>,
74    #[serde(rename = "mailto-user")]
75    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
76    #[doc = "List of users"]
77    pub mailto_user: Vec<String>,
78    #[doc = "The name of the endpoint."]
79    pub name: String,
80    #[doc = "Show if this entry was created by a user or was built-in"]
81    pub origin: Origin,
82    #[serde(
83        flatten,
84        default,
85        skip_serializing_if = "::std::collections::HashMap::is_empty"
86    )]
87    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
88}
89impl PostParams {
90    pub fn new(name: String) -> Self {
91        Self {
92            name,
93            author: Default::default(),
94            comment: Default::default(),
95            disable: Default::default(),
96            from_address: Default::default(),
97            mailto: Default::default(),
98            mailto_user: Default::default(),
99            additional_properties: Default::default(),
100        }
101    }
102}
103#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
104pub struct PostParams {
105    #[serde(skip_serializing_if = "Option::is_none", default)]
106    #[doc = "Author of the mail"]
107    pub author: Option<String>,
108    #[serde(skip_serializing_if = "Option::is_none", default)]
109    #[doc = "Comment"]
110    pub comment: Option<String>,
111    #[serde(
112        serialize_with = "crate::types::serialize_bool_optional",
113        deserialize_with = "crate::types::deserialize_bool_optional"
114    )]
115    #[serde(skip_serializing_if = "Option::is_none", default)]
116    #[doc = "Disable this target"]
117    pub disable: Option<bool>,
118    #[serde(rename = "from-address")]
119    #[serde(skip_serializing_if = "Option::is_none", default)]
120    #[doc = "`From` address for the mail"]
121    pub from_address: Option<String>,
122    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
123    #[doc = "List of email recipients"]
124    pub mailto: Vec<String>,
125    #[serde(rename = "mailto-user")]
126    #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
127    #[doc = "List of users"]
128    pub mailto_user: Vec<String>,
129    #[doc = "The name of the endpoint."]
130    pub name: String,
131    #[serde(
132        flatten,
133        default,
134        skip_serializing_if = "::std::collections::HashMap::is_empty"
135    )]
136    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
137}
138#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
139pub enum Origin {
140    #[serde(rename = "builtin")]
141    Builtin,
142    #[serde(rename = "modified-builtin")]
143    ModifiedBuiltin,
144    #[serde(rename = "user-created")]
145    UserCreated,
146}
147impl<T> SendmailClient<T>
148where
149    T: crate::client::Client,
150{
151    pub fn name(&self, name: &str) -> name::NameClient<T> {
152        name::NameClient::<T>::new(self.client.clone(), &self.path, name)
153    }
154}