proxmox_api/generated/cluster/notifications/
targets.rs1pub mod name;
2pub struct TargetsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> TargetsClient<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, "/targets"),
14 }
15 }
16}
17impl<T> TargetsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Returns a list of all entities that can be used as notification targets."]
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 GetOutputItems {
28 pub fn new(name: String, origin: Origin, ty: Type) -> Self {
29 Self {
30 name,
31 origin,
32 ty,
33 comment: Default::default(),
34 disable: Default::default(),
35 additional_properties: Default::default(),
36 }
37 }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct GetOutputItems {
41 #[serde(skip_serializing_if = "Option::is_none", default)]
42 #[doc = "Comment"]
43 pub comment: Option<String>,
44 #[serde(
45 serialize_with = "crate::types::serialize_bool_optional",
46 deserialize_with = "crate::types::deserialize_bool_optional"
47 )]
48 #[serde(skip_serializing_if = "Option::is_none", default)]
49 #[doc = "Show if this target is disabled"]
50 pub disable: Option<bool>,
51 #[doc = "Name of the target."]
52 pub name: String,
53 #[doc = "Show if this entry was created by a user or was built-in"]
54 pub origin: Origin,
55 #[serde(rename = "type")]
56 #[doc = "Type of the target."]
57 pub ty: Type,
58 #[serde(
59 flatten,
60 default,
61 skip_serializing_if = "::std::collections::HashMap::is_empty"
62 )]
63 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
64}
65#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
66pub enum Origin {
67 #[serde(rename = "builtin")]
68 Builtin,
69 #[serde(rename = "modified-builtin")]
70 ModifiedBuiltin,
71 #[serde(rename = "user-created")]
72 UserCreated,
73}
74#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
75pub enum Type {
76 #[serde(rename = "gotify")]
77 Gotify,
78 #[serde(rename = "sendmail")]
79 Sendmail,
80}
81impl<T> TargetsClient<T>
82where
83 T: crate::client::Client,
84{
85 pub fn name(&self, name: &str) -> name::NameClient<T> {
86 name::NameClient::<T>::new(self.client.clone(), &self.path, name)
87 }
88}