pve/cluster/
options.rs

1#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
2pub struct GetResponseItem {}
3
4#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, Default)]
5pub struct PutParameters {
6    #[doc = "Set bandwidth/io limits various operations."]
7    #[serde(skip_serializing_if = "Option::is_none", default)]
8    pub bwlimit: Option<String>,
9    #[doc = "Select the default Console viewer. You can either use the builtin java applet (VNC; deprecated and maps to html5), an external virt-viewer comtatible application (SPICE), an HTML5 based vnc viewer (noVNC), or an HTML5 based console client (xtermjs). If the selected viewer is not available (e.g. SPICE not activated for the VM), the fallback is noVNC."]
10    #[serde(skip_serializing_if = "Option::is_none", default)]
11    pub console: Option<String>,
12    #[doc = "Cluster resource scheduling settings."]
13    #[serde(skip_serializing_if = "Option::is_none", default)]
14    pub crs: Option<String>,
15    #[doc = "A list of settings you want to delete."]
16    #[serde(skip_serializing_if = "Option::is_none", default)]
17    pub delete: Option<String>,
18    #[doc = "Datacenter description. Shown in the web-interface datacenter notes panel. This is saved as comment inside the configuration file."]
19    #[serde(skip_serializing_if = "Option::is_none", default)]
20    pub description: Option<String>,
21    #[doc = "Specify email address to send notification from (default is root@$hostname)"]
22    #[serde(skip_serializing_if = "Option::is_none", default)]
23    pub email_from: Option<String>,
24    #[doc = "Set the fencing mode of the HA cluster. Hardware mode needs a valid configuration of fence devices in /etc/pve/ha/fence.cfg. With both all two modes are used.  WARNING: 'hardware' and 'both' are EXPERIMENTAL & WIP"]
25    #[serde(skip_serializing_if = "Option::is_none", default)]
26    pub fencing: Option<String>,
27    #[doc = "Cluster wide HA settings."]
28    #[serde(skip_serializing_if = "Option::is_none", default)]
29    pub ha: Option<String>,
30    #[doc = "Specify external http proxy which is used for downloads (example: 'http://username:password@host:port/')"]
31    #[serde(skip_serializing_if = "Option::is_none", default)]
32    pub http_proxy: Option<String>,
33    #[doc = "Default keybord layout for vnc server."]
34    #[serde(skip_serializing_if = "Option::is_none", default)]
35    pub keyboard: Option<String>,
36    #[doc = "Default GUI language."]
37    #[serde(skip_serializing_if = "Option::is_none", default)]
38    pub language: Option<String>,
39    #[doc = "Prefix for autogenerated MAC addresses."]
40    #[serde(skip_serializing_if = "Option::is_none", default)]
41    pub mac_prefix: Option<String>,
42    #[doc = "Defines how many workers (per node) are maximal started  on actions like 'stopall VMs' or task from the ha-manager."]
43    #[serde(skip_serializing_if = "Option::is_none", default)]
44    pub max_workers: Option<u64>,
45    #[doc = "For cluster wide migration settings."]
46    #[serde(skip_serializing_if = "Option::is_none", default)]
47    pub migration: Option<String>,
48    #[doc = "Migration is secure using SSH tunnel by default. For secure private networks you can disable it to speed up migration. Deprecated, use the 'migration' property instead!"]
49    #[serde(
50        skip_serializing_if = "Option::is_none",
51        default,
52        deserialize_with = "crate::common::deserialize_option_bool_lax",
53        serialize_with = "crate::common::serialize_option_bool_as_u64"
54    )]
55    pub migration_unsecure: Option<bool>,
56    #[doc = "Control the range for the free VMID auto-selection pool."]
57    #[serde(rename = "next-id", skip_serializing_if = "Option::is_none", default)]
58    pub next_id: Option<String>,
59    #[doc = "Cluster-wide notification settings."]
60    #[serde(skip_serializing_if = "Option::is_none", default)]
61    pub notify: Option<String>,
62    #[doc = "A list of tags that require a `Sys.Modify` on '/' to set and delete. Tags set here that are also in 'user-tag-access' also require `Sys.Modify`."]
63    #[serde(
64        rename = "registered-tags",
65        skip_serializing_if = "Option::is_none",
66        default
67    )]
68    pub registered_tags: Option<String>,
69    #[doc = "Tag style options."]
70    #[serde(rename = "tag-style", skip_serializing_if = "Option::is_none", default)]
71    pub tag_style: Option<String>,
72    #[doc = "u2f"]
73    #[serde(skip_serializing_if = "Option::is_none", default)]
74    pub u2f: Option<String>,
75    #[doc = "Privilege options for user-settable tags"]
76    #[serde(
77        rename = "user-tag-access",
78        skip_serializing_if = "Option::is_none",
79        default
80    )]
81    pub user_tag_access: Option<String>,
82    #[doc = "webauthn configuration"]
83    #[serde(skip_serializing_if = "Option::is_none", default)]
84    pub webauthn: Option<String>,
85}
86
87#[derive(Debug, Clone)]
88pub struct OptionsClient<T> {
89    client: T,
90    path: String,
91}
92
93impl<T> OptionsClient<T>
94where
95    T: Clone,
96{
97    pub fn new(client: T, parent_path: &str) -> Self {
98        Self {
99            client,
100            path: format!("{}/{}", parent_path, "options"),
101        }
102    }
103}
104impl<T> OptionsClient<T>
105where
106    T: crate::client::HttpClient,
107{
108    #[doc = "Get datacenter options. Without 'Sys.Audit' on '/' not all options are returned."]
109    pub fn get(&self) -> Result<GetResponseItem, T::Error> {
110        self.client.get(&self.path, &())
111    }
112
113    #[doc = "Set datacenter options."]
114    pub fn put(&self, parameters: PutParameters) -> Result<(), T::Error> {
115        self.client.put(&self.path, &parameters)
116    }
117}
118#[derive(Debug, Clone)]
119pub struct AsyncOptionsClient<T> {
120    client: T,
121    path: String,
122}
123
124impl<T> AsyncOptionsClient<T>
125where
126    T: Clone,
127{
128    pub fn new(client: T, parent_path: &str) -> Self {
129        Self {
130            client,
131            path: format!("{}/{}", parent_path, "options"),
132        }
133    }
134}
135impl<T> AsyncOptionsClient<T>
136where
137    T: crate::client::AsyncHttpClient,
138{
139    #[doc = "Get datacenter options. Without 'Sys.Audit' on '/' not all options are returned."]
140    pub async fn get(&self) -> Result<GetResponseItem, T::Error> {
141        self.client.get(&self.path, &()).await
142    }
143
144    #[doc = "Set datacenter options."]
145    pub async fn put(&self, parameters: PutParameters) -> Result<(), T::Error> {
146        self.client.put(&self.path, &parameters).await
147    }
148}