proxmox_api/generated/cluster/jobs/realm_sync/
id.rs

1pub struct IdClient<T> {
2    client: T,
3    path: String,
4}
5impl<T> IdClient<T>
6where
7    T: crate::client::Client,
8{
9    pub fn new(client: T, parent_path: &str, id: &str) -> Self {
10        Self {
11            client,
12            path: format!("{}/{}", parent_path, id),
13        }
14    }
15}
16impl<T> IdClient<T>
17where
18    T: crate::client::Client,
19{
20    #[doc = "Delete realm-sync job definition."]
21    pub fn delete(&self) -> Result<(), T::Error> {
22        let path = self.path.to_string();
23        self.client.delete(&path, &())
24    }
25}
26impl<T> IdClient<T>
27where
28    T: crate::client::Client,
29{
30    #[doc = "Read realm-sync job definition."]
31    pub fn get(&self) -> Result<GetOutput, T::Error> {
32        let path = self.path.to_string();
33        self.client.get(&path, &())
34    }
35}
36impl<T> IdClient<T>
37where
38    T: crate::client::Client,
39{
40    #[doc = "Create new realm-sync job."]
41    pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
42        let path = self.path.to_string();
43        self.client.post(&path, &params)
44    }
45}
46impl<T> IdClient<T>
47where
48    T: crate::client::Client,
49{
50    #[doc = "Update realm-sync job definition."]
51    pub fn put(&self, params: PutParams) -> Result<(), T::Error> {
52        let path = self.path.to_string();
53        self.client.put(&path, &params)
54    }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct GetOutput {
58    #[serde(
59        flatten,
60        default,
61        skip_serializing_if = "::std::collections::HashMap::is_empty"
62    )]
63    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
64}
65impl PostParams {
66    pub fn new(schedule: String) -> Self {
67        Self {
68            schedule,
69            comment: Default::default(),
70            enable_new: Default::default(),
71            enabled: Default::default(),
72            realm: Default::default(),
73            remove_vanished: Default::default(),
74            scope: Default::default(),
75            additional_properties: Default::default(),
76        }
77    }
78}
79#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
80pub struct PostParams {
81    #[serde(skip_serializing_if = "Option::is_none", default)]
82    #[doc = "Description for the Job."]
83    pub comment: Option<String>,
84    #[serde(rename = "enable-new")]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    #[doc = "Enable newly synced users immediately."]
87    pub enable_new: Option<()>,
88    #[serde(
89        serialize_with = "crate::types::serialize_bool_optional",
90        deserialize_with = "crate::types::deserialize_bool_optional"
91    )]
92    #[serde(skip_serializing_if = "Option::is_none", default)]
93    #[doc = "Determines if the job is enabled."]
94    pub enabled: Option<bool>,
95    #[serde(skip_serializing_if = "Option::is_none", default)]
96    #[doc = "Authentication domain ID"]
97    pub realm: Option<String>,
98    #[serde(rename = "remove-vanished")]
99    #[serde(skip_serializing_if = "Option::is_none", default)]
100    #[doc = "A semicolon-seperated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
101    pub remove_vanished: Option<String>,
102    #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
103    pub schedule: String,
104    #[serde(skip_serializing_if = "Option::is_none", default)]
105    #[doc = "Select what to sync."]
106    pub scope: Option<Scope>,
107    #[serde(
108        flatten,
109        default,
110        skip_serializing_if = "::std::collections::HashMap::is_empty"
111    )]
112    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
113}
114impl PutParams {
115    pub fn new(schedule: String) -> Self {
116        Self {
117            schedule,
118            comment: Default::default(),
119            delete: Default::default(),
120            enable_new: Default::default(),
121            enabled: Default::default(),
122            remove_vanished: Default::default(),
123            scope: Default::default(),
124            additional_properties: Default::default(),
125        }
126    }
127}
128#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
129pub struct PutParams {
130    #[serde(skip_serializing_if = "Option::is_none", default)]
131    #[doc = "Description for the Job."]
132    pub comment: Option<String>,
133    #[serde(skip_serializing_if = "Option::is_none", default)]
134    #[doc = "A list of settings you want to delete."]
135    pub delete: Option<String>,
136    #[serde(rename = "enable-new")]
137    #[serde(skip_serializing_if = "Option::is_none", default)]
138    #[doc = "Enable newly synced users immediately."]
139    pub enable_new: Option<()>,
140    #[serde(
141        serialize_with = "crate::types::serialize_bool_optional",
142        deserialize_with = "crate::types::deserialize_bool_optional"
143    )]
144    #[serde(skip_serializing_if = "Option::is_none", default)]
145    #[doc = "Determines if the job is enabled."]
146    pub enabled: Option<bool>,
147    #[serde(rename = "remove-vanished")]
148    #[serde(skip_serializing_if = "Option::is_none", default)]
149    #[doc = "A semicolon-seperated list of things to remove when they or the user vanishes during a sync. The following values are possible: 'entry' removes the user/group when not returned from the sync. 'properties' removes the set properties on existing user/group that do not appear in the source (even custom ones). 'acl' removes acls when the user/group is not returned from the sync. Instead of a list it also can be 'none' (the default)."]
150    pub remove_vanished: Option<String>,
151    #[doc = "Backup schedule. The format is a subset of `systemd` calendar events."]
152    pub schedule: String,
153    #[serde(skip_serializing_if = "Option::is_none", default)]
154    #[doc = "Select what to sync."]
155    pub scope: Option<Scope>,
156    #[serde(
157        flatten,
158        default,
159        skip_serializing_if = "::std::collections::HashMap::is_empty"
160    )]
161    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
162}
163#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
164pub enum Scope {
165    #[serde(rename = "both")]
166    Both,
167    #[serde(rename = "groups")]
168    Groups,
169    #[serde(rename = "users")]
170    Users,
171}