proxmox_api/generated/cluster/jobs/
schedule_analyze.rs1#[derive(Debug, Clone)]
2pub struct ScheduleAnalyzeClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> ScheduleAnalyzeClient<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, "/schedule-analyze"),
14 }
15 }
16}
17impl<T> ScheduleAnalyzeClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Returns a list of future schedule runtimes."]
22 #[doc = ""]
23 pub async fn get(&self, params: GetParams) -> Result<Vec<GetOutputItems>, T::Error> {
24 let path = self.path.to_string();
25 let optional_vec: Option<Vec<GetOutputItems>> = self.client.get(&path, ¶ms).await?;
26 Ok(optional_vec.unwrap_or_default())
27 }
28}
29impl GetOutputItems {
30 pub fn new(timestamp: i64, utc: String) -> Self {
31 Self {
32 timestamp,
33 utc,
34 additional_properties: ::std::default::Default::default(),
35 }
36 }
37}
38#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
39pub struct GetOutputItems {
40 #[serde(
41 serialize_with = "crate::types::serialize_int",
42 deserialize_with = "crate::types::deserialize_int"
43 )]
44 #[doc = "UNIX timestamp for the run."]
45 #[doc = ""]
46 pub timestamp: i64,
47 #[doc = "UTC timestamp for the run."]
48 #[doc = ""]
49 pub utc: String,
50 #[serde(
51 flatten,
52 default,
53 skip_serializing_if = "::std::collections::HashMap::is_empty"
54 )]
55 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
56}
57impl GetParams {
58 pub fn new(schedule: ScheduleStr) -> Self {
59 Self {
60 schedule,
61 iterations: ::std::default::Default::default(),
62 starttime: ::std::default::Default::default(),
63 additional_properties: ::std::default::Default::default(),
64 }
65 }
66}
67#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
68pub struct GetParams {
69 #[serde(skip_serializing_if = "Option::is_none", default)]
70 #[doc = "Number of event-iteration to simulate and return."]
71 #[doc = ""]
72 pub iterations: Option<IterationsInt>,
73 #[doc = "Job schedule. The format is a subset of `systemd` calendar events."]
74 #[doc = ""]
75 pub schedule: ScheduleStr,
76 #[serde(
77 serialize_with = "crate::types::serialize_int_optional",
78 deserialize_with = "crate::types::deserialize_int_optional"
79 )]
80 #[serde(skip_serializing_if = "Option::is_none", default)]
81 #[doc = "UNIX timestamp to start the calculation from. Defaults to the current time."]
82 #[doc = ""]
83 pub starttime: Option<i64>,
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, Copy, PartialEq, PartialOrd)]
92pub struct IterationsInt(i128);
93impl crate::types::bounded_integer::BoundedInteger for IterationsInt {
94 const MIN: Option<i128> = Some(1i128);
95 const MAX: Option<i128> = Some(100i128);
96 const DEFAULT: Option<i128> = Some(10i128);
97 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 100";
98 fn get(&self) -> i128 {
99 self.0
100 }
101 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
102 Self::validate(value)?;
103 Ok(Self(value))
104 }
105}
106impl std::convert::TryFrom<i128> for IterationsInt {
107 type Error = crate::types::bounded_integer::BoundedIntegerError;
108 fn try_from(value: i128) -> Result<Self, Self::Error> {
109 crate::types::bounded_integer::BoundedInteger::new(value)
110 }
111}
112impl ::serde::Serialize for IterationsInt {
113 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
114 where
115 S: ::serde::Serializer,
116 {
117 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
118 }
119}
120impl<'de> ::serde::Deserialize<'de> for IterationsInt {
121 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
122 where
123 D: ::serde::Deserializer<'de>,
124 {
125 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
126 }
127}
128#[derive(Debug, Clone, PartialEq, PartialOrd)]
129pub struct ScheduleStr {
130 value: String,
131}
132impl crate::types::bounded_string::BoundedString for ScheduleStr {
133 const MIN_LENGTH: Option<usize> = None::<usize>;
134 const MAX_LENGTH: Option<usize> = Some(128usize);
135 const DEFAULT: Option<&'static str> = None::<&'static str>;
136 const PATTERN: Option<&'static str> = None::<&'static str>;
137 const TYPE_DESCRIPTION: &'static str = "a string with length at most 128";
138 fn get_value(&self) -> &str {
139 &self.value
140 }
141 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
142 Self::validate(&value)?;
143 Ok(Self { value })
144 }
145}
146impl std::convert::TryFrom<String> for ScheduleStr {
147 type Error = crate::types::bounded_string::BoundedStringError;
148 fn try_from(value: String) -> Result<Self, Self::Error> {
149 crate::types::bounded_string::BoundedString::new(value)
150 }
151}
152impl ::serde::Serialize for ScheduleStr {
153 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
154 where
155 S: ::serde::Serializer,
156 {
157 crate::types::bounded_string::serialize_bounded_string(self, serializer)
158 }
159}
160impl<'de> ::serde::Deserialize<'de> for ScheduleStr {
161 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
162 where
163 D: ::serde::Deserializer<'de>,
164 {
165 crate::types::bounded_string::deserialize_bounded_string(deserializer)
166 }
167}