proxmox_api/generated/nodes/node/
syslog.rs1#[derive(Debug, Clone)]
2pub struct SyslogClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> SyslogClient<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, "/syslog"),
14 }
15 }
16}
17impl<T> SyslogClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Read system log"]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/nodes/{node}\", [\"Sys.Syslog\"])"]
24 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
25 let path = self.path.to_string();
26 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
27 Ok(optional_vec.unwrap_or_default())
28 }
29}
30impl GetOutputItems {
31 pub fn new(n: i64, t: String) -> Self {
32 Self {
33 n,
34 t,
35 additional_properties: ::std::default::Default::default(),
36 }
37 }
38}
39#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
40pub struct GetOutputItems {
41 #[serde(
42 serialize_with = "crate::types::serialize_int",
43 deserialize_with = "crate::types::deserialize_int"
44 )]
45 #[doc = "Line number"]
46 #[doc = ""]
47 pub n: i64,
48 #[doc = "Line text"]
49 #[doc = ""]
50 pub t: String,
51 #[serde(
52 flatten,
53 default,
54 skip_serializing_if = "::std::collections::HashMap::is_empty"
55 )]
56 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
57}
58#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
59pub struct GetParams {
60 #[serde(
61 serialize_with = "crate::types::serialize_unsigned_int_optional",
62 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
63 )]
64 #[serde(skip_serializing_if = "Option::is_none", default)]
65 pub limit: Option<u64>,
66 #[serde(skip_serializing_if = "Option::is_none", default)]
67 #[doc = "Service ID"]
68 #[doc = ""]
69 pub service: Option<ServiceStr>,
70 #[serde(skip_serializing_if = "Option::is_none", default)]
71 #[doc = "Display all log since this date-time string."]
72 #[doc = ""]
73 pub since: Option<SinceStr>,
74 #[serde(
75 serialize_with = "crate::types::serialize_unsigned_int_optional",
76 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
77 )]
78 #[serde(skip_serializing_if = "Option::is_none", default)]
79 pub start: Option<u64>,
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "Display all log until this date-time string."]
82 #[doc = ""]
83 pub until: Option<UntilStr>,
84 #[serde(
85 flatten,
86 default,
87 skip_serializing_if = "::std::collections::HashMap::is_empty"
88 )]
89 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
90}
91#[derive(Debug, Clone, PartialEq, PartialOrd)]
92pub struct ServiceStr {
93 value: String,
94}
95impl crate::types::bounded_string::BoundedString for ServiceStr {
96 const MIN_LENGTH: Option<usize> = None::<usize>;
97 const MAX_LENGTH: Option<usize> = Some(128usize);
98 const DEFAULT: Option<&'static str> = None::<&'static str>;
99 const PATTERN: Option<&'static str> = None::<&'static str>;
100 const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
101 fn get_value(&self) -> &str {
102 &self.value
103 }
104 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
105 Self::validate(&value)?;
106 Ok(Self { value })
107 }
108}
109impl std::convert::TryFrom<String> for ServiceStr {
110 type Error = crate::types::bounded_string::BoundedStringError;
111 fn try_from(value: String) -> Result<Self, Self::Error> {
112 crate::types::bounded_string::BoundedString::new(value)
113 }
114}
115impl ::serde::Serialize for ServiceStr {
116 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
117 where
118 S: ::serde::Serializer,
119 {
120 crate::types::bounded_string::serialize_bounded_string(self, serializer)
121 }
122}
123impl<'de> ::serde::Deserialize<'de> for ServiceStr {
124 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
125 where
126 D: ::serde::Deserializer<'de>,
127 {
128 crate::types::bounded_string::deserialize_bounded_string(deserializer)
129 }
130}
131#[derive(Debug, Clone, PartialEq, PartialOrd)]
132pub struct SinceStr {
133 value: String,
134}
135impl crate::types::bounded_string::BoundedString for SinceStr {
136 const MIN_LENGTH: Option<usize> = None::<usize>;
137 const MAX_LENGTH: Option<usize> = None::<usize>;
138 const DEFAULT: Option<&'static str> = None::<&'static str>;
139 const PATTERN: Option<&'static str> = Some("^\\d{4}-\\d{2}-\\d{2}( \\d{2}:\\d{2}(:\\d{2})?)?$");
140 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"^\\d{4}-\\d{2}-\\d{2}( \\d{2}:\\d{2}(:\\d{2})?)?$\" and no length constraints";
141 fn get_value(&self) -> &str {
142 &self.value
143 }
144 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
145 Self::validate(&value)?;
146 Ok(Self { value })
147 }
148}
149impl std::convert::TryFrom<String> for SinceStr {
150 type Error = crate::types::bounded_string::BoundedStringError;
151 fn try_from(value: String) -> Result<Self, Self::Error> {
152 crate::types::bounded_string::BoundedString::new(value)
153 }
154}
155impl ::serde::Serialize for SinceStr {
156 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
157 where
158 S: ::serde::Serializer,
159 {
160 crate::types::bounded_string::serialize_bounded_string(self, serializer)
161 }
162}
163impl<'de> ::serde::Deserialize<'de> for SinceStr {
164 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
165 where
166 D: ::serde::Deserializer<'de>,
167 {
168 crate::types::bounded_string::deserialize_bounded_string(deserializer)
169 }
170}
171#[derive(Debug, Clone, PartialEq, PartialOrd)]
172pub struct UntilStr {
173 value: String,
174}
175impl crate::types::bounded_string::BoundedString for UntilStr {
176 const MIN_LENGTH: Option<usize> = None::<usize>;
177 const MAX_LENGTH: Option<usize> = None::<usize>;
178 const DEFAULT: Option<&'static str> = None::<&'static str>;
179 const PATTERN: Option<&'static str> = Some("^\\d{4}-\\d{2}-\\d{2}( \\d{2}:\\d{2}(:\\d{2})?)?$");
180 const TYPE_DESCRIPTION: &'static str = "a string with pattern r\"^\\d{4}-\\d{2}-\\d{2}( \\d{2}:\\d{2}(:\\d{2})?)?$\" and no length constraints";
181 fn get_value(&self) -> &str {
182 &self.value
183 }
184 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
185 Self::validate(&value)?;
186 Ok(Self { value })
187 }
188}
189impl std::convert::TryFrom<String> for UntilStr {
190 type Error = crate::types::bounded_string::BoundedStringError;
191 fn try_from(value: String) -> Result<Self, Self::Error> {
192 crate::types::bounded_string::BoundedString::new(value)
193 }
194}
195impl ::serde::Serialize for UntilStr {
196 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
197 where
198 S: ::serde::Serializer,
199 {
200 crate::types::bounded_string::serialize_bounded_string(self, serializer)
201 }
202}
203impl<'de> ::serde::Deserialize<'de> for UntilStr {
204 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
205 where
206 D: ::serde::Deserializer<'de>,
207 {
208 crate::types::bounded_string::deserialize_bounded_string(deserializer)
209 }
210}