Skip to main content

proxmox_api/generated/nodes/node/tasks/upid/
log.rs

1#[derive(Debug, Clone)]
2pub struct LogClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> LogClient<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, "/log"),
14        }
15    }
16}
17impl<T> LogClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Read task log."]
22    #[doc = ""]
23    #[doc = "The user needs 'Sys.Audit' permissions on '/nodes/\\<node\\>' if they aren't the owner of the task."]
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, &params).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_bool_optional",
62        deserialize_with = "crate::types::deserialize_bool_optional"
63    )]
64    #[serde(skip_serializing_if = "Option::is_none", default)]
65    #[doc = "Whether the tasklog file should be downloaded. This parameter can't be used in conjunction with other parameters"]
66    #[doc = ""]
67    pub download: Option<bool>,
68    #[serde(skip_serializing_if = "Option::is_none", default)]
69    #[doc = "The number of lines to read from the tasklog."]
70    #[doc = ""]
71    pub limit: Option<LimitInt>,
72    #[serde(
73        serialize_with = "crate::types::serialize_unsigned_int_optional",
74        deserialize_with = "crate::types::deserialize_unsigned_int_optional"
75    )]
76    #[serde(skip_serializing_if = "Option::is_none", default)]
77    #[doc = "Start at this line when reading the tasklog"]
78    #[doc = ""]
79    pub start: Option<u64>,
80    #[serde(
81        flatten,
82        default,
83        skip_serializing_if = "::std::collections::HashMap::is_empty"
84    )]
85    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
86}
87#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
88pub struct LimitInt(i128);
89impl crate::types::bounded_integer::BoundedInteger for LimitInt {
90    const MIN: Option<i128> = Some(0i128);
91    const MAX: Option<i128> = None::<i128>;
92    const DEFAULT: Option<i128> = Some(50i128);
93    const TYPE_DESCRIPTION: &'static str = "an integer greater than or equal to 0";
94    fn get(&self) -> i128 {
95        self.0
96    }
97    fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
98        Self::validate(value)?;
99        Ok(Self(value))
100    }
101}
102impl std::convert::TryFrom<i128> for LimitInt {
103    type Error = crate::types::bounded_integer::BoundedIntegerError;
104    fn try_from(value: i128) -> Result<Self, Self::Error> {
105        crate::types::bounded_integer::BoundedInteger::new(value)
106    }
107}
108impl ::serde::Serialize for LimitInt {
109    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
110    where
111        S: ::serde::Serializer,
112    {
113        crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
114    }
115}
116impl<'de> ::serde::Deserialize<'de> for LimitInt {
117    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
118    where
119        D: ::serde::Deserializer<'de>,
120    {
121        crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
122    }
123}