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

1pub mod name;
2pub struct GotifyClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> GotifyClient<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, "/gotify"),
14        }
15    }
16}
17impl<T> GotifyClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Returns a list of all gotify 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> GotifyClient<T>
28where
29    T: crate::client::Client,
30{
31    #[doc = "Create a new gotify 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, server: String) -> Self {
39        Self {
40            name,
41            origin,
42            server,
43            comment: Default::default(),
44            disable: Default::default(),
45            additional_properties: Default::default(),
46        }
47    }
48}
49#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
50pub struct GetOutputItems {
51    #[serde(skip_serializing_if = "Option::is_none", default)]
52    #[doc = "Comment"]
53    pub comment: Option<String>,
54    #[serde(
55        serialize_with = "crate::types::serialize_bool_optional",
56        deserialize_with = "crate::types::deserialize_bool_optional"
57    )]
58    #[serde(skip_serializing_if = "Option::is_none", default)]
59    #[doc = "Disable this target"]
60    pub disable: Option<bool>,
61    #[doc = "The name of the endpoint."]
62    pub name: String,
63    #[doc = "Show if this entry was created by a user or was built-in"]
64    pub origin: Origin,
65    #[doc = "Server URL"]
66    pub server: String,
67    #[serde(
68        flatten,
69        default,
70        skip_serializing_if = "::std::collections::HashMap::is_empty"
71    )]
72    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
73}
74impl PostParams {
75    pub fn new(name: String, server: String, token: String) -> Self {
76        Self {
77            name,
78            server,
79            token,
80            comment: Default::default(),
81            disable: Default::default(),
82            additional_properties: Default::default(),
83        }
84    }
85}
86#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
87pub struct PostParams {
88    #[serde(skip_serializing_if = "Option::is_none", default)]
89    #[doc = "Comment"]
90    pub comment: Option<String>,
91    #[serde(
92        serialize_with = "crate::types::serialize_bool_optional",
93        deserialize_with = "crate::types::deserialize_bool_optional"
94    )]
95    #[serde(skip_serializing_if = "Option::is_none", default)]
96    #[doc = "Disable this target"]
97    pub disable: Option<bool>,
98    #[doc = "The name of the endpoint."]
99    pub name: String,
100    #[doc = "Server URL"]
101    pub server: String,
102    #[doc = "Secret token"]
103    pub token: String,
104    #[serde(
105        flatten,
106        default,
107        skip_serializing_if = "::std::collections::HashMap::is_empty"
108    )]
109    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
110}
111#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
112pub enum Origin {
113    #[serde(rename = "builtin")]
114    Builtin,
115    #[serde(rename = "modified-builtin")]
116    ModifiedBuiltin,
117    #[serde(rename = "user-created")]
118    UserCreated,
119}
120impl<T> GotifyClient<T>
121where
122    T: crate::client::Client,
123{
124    pub fn name(&self, name: &str) -> name::NameClient<T> {
125        name::NameClient::<T>::new(self.client.clone(), &self.path, name)
126    }
127}