proxmox_api/generated/cluster/notifications/endpoints/gotify/
name.rs1#[derive(Debug, Clone)]
2pub struct NameClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> NameClient<T>
7where
8 T: crate::client::Client,
9{
10 pub fn new(client: T, parent_path: &str, name: &str) -> Self {
11 Self {
12 client,
13 path: format!("{}/{}", parent_path, name),
14 }
15 }
16}
17impl<T> NameClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Remove gotify endpoint"]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/mapping/notifications\", [\"Mapping.Modify\"])"]
24 pub async fn delete(&self) -> Result<(), T::Error> {
25 let path = self.path.to_string();
26 self.client.delete(&path, &()).await
27 }
28}
29impl<T> NameClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Return a specific gotify endpoint"]
34 #[doc = ""]
35 #[doc = "Permission check: or(perm(\"/mapping/notifications\", [\"Mapping.Modify\"]), perm(\"/mapping/notifications\", [\"Mapping.Audit\"]))"]
36 pub async fn get(&self) -> Result<GetOutput, T::Error> {
37 let path = self.path.to_string();
38 self.client.get(&path, &()).await
39 }
40}
41impl<T> NameClient<T>
42where
43 T: crate::client::Client,
44{
45 #[doc = "Update existing gotify endpoint"]
46 #[doc = ""]
47 #[doc = "Permission check: and(perm(\"/mapping/notifications\", [\"Mapping.Modify\"]), or(perm(\"/\", [\"Sys.Audit\", \"Sys.Modify\"]), perm(\"/\", [\"Sys.AccessNetwork\"])))"]
48 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
49 let path = self.path.to_string();
50 self.client.put(&path, ¶ms).await
51 }
52}
53impl GetOutput {
54 pub fn new(name: String, server: String) -> Self {
55 Self {
56 name,
57 server,
58 comment: ::std::default::Default::default(),
59 digest: ::std::default::Default::default(),
60 disable: ::std::default::Default::default(),
61 additional_properties: ::std::default::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 = "Comment"]
69 #[doc = ""]
70 pub comment: Option<String>,
71 #[serde(skip_serializing_if = "Option::is_none", default)]
72 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
73 #[doc = ""]
74 pub digest: Option<DigestStr>,
75 #[serde(
76 serialize_with = "crate::types::serialize_bool_optional",
77 deserialize_with = "crate::types::deserialize_bool_optional"
78 )]
79 #[serde(skip_serializing_if = "Option::is_none", default)]
80 #[doc = "Disable this target"]
81 #[doc = ""]
82 pub disable: Option<bool>,
83 #[doc = "The name of the endpoint."]
84 #[doc = ""]
85 pub name: String,
86 #[doc = "Server URL"]
87 #[doc = ""]
88 pub server: String,
89 #[serde(
90 flatten,
91 default,
92 skip_serializing_if = "::std::collections::HashMap::is_empty"
93 )]
94 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
95}
96#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
97pub struct PutParams {
98 #[serde(skip_serializing_if = "Option::is_none", default)]
99 #[doc = "Comment"]
100 #[doc = ""]
101 pub comment: Option<String>,
102 #[serde(skip_serializing_if = "::std::vec::Vec::is_empty", default)]
103 #[doc = "A list of settings you want to delete."]
104 #[doc = ""]
105 pub delete: Vec<String>,
106 #[serde(skip_serializing_if = "Option::is_none", default)]
107 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
108 #[doc = ""]
109 pub digest: Option<DigestStr>,
110 #[serde(
111 serialize_with = "crate::types::serialize_bool_optional",
112 deserialize_with = "crate::types::deserialize_bool_optional"
113 )]
114 #[serde(skip_serializing_if = "Option::is_none", default)]
115 #[doc = "Disable this target"]
116 #[doc = ""]
117 pub disable: Option<bool>,
118 #[serde(skip_serializing_if = "Option::is_none", default)]
119 #[doc = "Server URL"]
120 #[doc = ""]
121 pub server: Option<String>,
122 #[serde(skip_serializing_if = "Option::is_none", default)]
123 #[doc = "Secret token"]
124 #[doc = ""]
125 pub token: Option<String>,
126 #[serde(
127 flatten,
128 default,
129 skip_serializing_if = "::std::collections::HashMap::is_empty"
130 )]
131 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
132}
133#[derive(Debug, Clone, PartialEq, PartialOrd)]
134pub struct DigestStr {
135 value: String,
136}
137impl crate::types::bounded_string::BoundedString for DigestStr {
138 const MIN_LENGTH: Option<usize> = None::<usize>;
139 const MAX_LENGTH: Option<usize> = Some(64usize);
140 const DEFAULT: Option<&'static str> = None::<&'static str>;
141 const PATTERN: Option<&'static str> = None::<&'static str>;
142 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
143 fn get_value(&self) -> &str {
144 &self.value
145 }
146 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
147 Self::validate(&value)?;
148 Ok(Self { value })
149 }
150}
151impl std::convert::TryFrom<String> for DigestStr {
152 type Error = crate::types::bounded_string::BoundedStringError;
153 fn try_from(value: String) -> Result<Self, Self::Error> {
154 crate::types::bounded_string::BoundedString::new(value)
155 }
156}
157impl ::serde::Serialize for DigestStr {
158 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
159 where
160 S: ::serde::Serializer,
161 {
162 crate::types::bounded_string::serialize_bounded_string(self, serializer)
163 }
164}
165impl<'de> ::serde::Deserialize<'de> for DigestStr {
166 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
167 where
168 D: ::serde::Deserializer<'de>,
169 {
170 crate::types::bounded_string::deserialize_bounded_string(deserializer)
171 }
172}