proxmox_api/generated/nodes/node/
time.rs1pub struct TimeClient<T> {
2 client: T,
3 path: String,
4}
5impl<T> TimeClient<T>
6where
7 T: crate::client::Client,
8{
9 pub fn new(client: T, parent_path: &str) -> Self {
10 Self {
11 client,
12 path: format!("{}{}", parent_path, "/time"),
13 }
14 }
15}
16impl<T> TimeClient<T>
17where
18 T: crate::client::Client,
19{
20 #[doc = "Read server time and time zone settings."]
21 pub fn get(&self) -> Result<GetOutput, T::Error> {
22 let path = self.path.to_string();
23 self.client.get(&path, &())
24 }
25}
26impl<T> TimeClient<T>
27where
28 T: crate::client::Client,
29{
30 #[doc = "Set time zone."]
31 pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
32 let path = self.path.to_string();
33 self.client.put(&path, ¶ms)
34 }
35}
36impl GetOutput {
37 pub fn new(localtime: u64, time: u64, timezone: String) -> Self {
38 Self {
39 localtime,
40 time,
41 timezone,
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct GetOutput {
47 #[serde(
48 serialize_with = "crate::types::serialize_int",
49 deserialize_with = "crate::types::deserialize_int"
50 )]
51 #[doc = "Seconds since 1970-01-01 00:00:00 (local time)"]
52 pub localtime: u64,
53 #[serde(
54 serialize_with = "crate::types::serialize_int",
55 deserialize_with = "crate::types::deserialize_int"
56 )]
57 #[doc = "Seconds since 1970-01-01 00:00:00 UTC."]
58 pub time: u64,
59 #[doc = "Time zone"]
60 pub timezone: String,
61}
62impl PutParams {
63 pub fn new(timezone: String) -> Self {
64 Self {
65 timezone,
66 additional_properties: Default::default(),
67 }
68 }
69}
70#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
71pub struct PutParams {
72 #[doc = "Time zone. The file '/usr/share/zoneinfo/zone.tab' contains the list of valid names."]
73 pub timezone: String,
74 #[serde(
75 flatten,
76 default,
77 skip_serializing_if = "::std::collections::HashMap::is_empty"
78 )]
79 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
80}