Skip to main content

proxmox_api/generated/cluster/ha/groups/
group.rs

1#[derive(Debug, Clone)]
2pub struct GroupClient<T> {
3    client: T,
4    path: String,
5}
6impl<T> GroupClient<T>
7where
8    T: crate::client::Client,
9{
10    pub fn new(client: T, parent_path: &str, group: &str) -> Self {
11        Self {
12            client,
13            path: format!("{}/{}", parent_path, group),
14        }
15    }
16}
17impl<T> GroupClient<T>
18where
19    T: crate::client::Client,
20{
21    #[doc = "Delete ha group configuration. (deprecated in favor of HA rules)"]
22    #[doc = ""]
23    #[doc = "Permission check: perm(\"/\", [\"Sys.Console\"])"]
24    pub async fn delete(&self) -> Result<(), T::Error> {
25        let path = self.path.to_string();
26        self.client.delete(&path, &()).await
27    }
28}
29impl<T> GroupClient<T>
30where
31    T: crate::client::Client,
32{
33    #[doc = "Read ha group configuration. (deprecated in favor of HA rules)"]
34    #[doc = ""]
35    #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
36    pub async fn get(&self) -> Result<(), T::Error> {
37        let path = self.path.to_string();
38        self.client.get(&path, &()).await
39    }
40}
41impl<T> GroupClient<T>
42where
43    T: crate::client::Client,
44{
45    #[doc = "Update ha group configuration. (deprecated in favor of HA rules)"]
46    #[doc = ""]
47    #[doc = "Permission check: perm(\"/\", [\"Sys.Console\"])"]
48    pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
49        let path = self.path.to_string();
50        self.client.put(&path, &params).await
51    }
52}
53#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
54pub struct PutParams {
55    #[serde(skip_serializing_if = "Option::is_none", default)]
56    #[doc = "Description."]
57    #[doc = ""]
58    pub comment: Option<CommentStr>,
59    #[serde(skip_serializing_if = "Option::is_none", default)]
60    #[doc = "A list of settings you want to delete."]
61    #[doc = ""]
62    pub delete: Option<DeleteStr>,
63    #[serde(skip_serializing_if = "Option::is_none", default)]
64    #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
65    #[doc = ""]
66    pub digest: Option<DigestStr>,
67    #[serde(skip_serializing_if = "Option::is_none", default)]
68    #[doc = "List of cluster node names with optional priority."]
69    #[doc = ""]
70    #[doc = "List of cluster node members, where a priority can be given to each node. A resource will run on the available nodes with the highest priority. If there are more nodes in the highest priority class, the resources will get distributed to those nodes. The priorities have a relative meaning only. The higher the number, the higher the priority."]
71    #[doc = ""]
72    pub nodes: Option<String>,
73    #[serde(
74        serialize_with = "crate::types::serialize_bool_optional",
75        deserialize_with = "crate::types::deserialize_bool_optional"
76    )]
77    #[serde(skip_serializing_if = "Option::is_none", default)]
78    #[doc = "The CRM tries to run services on the node with the highest priority. If a node with higher priority comes online, the CRM migrates the service to that node. Enabling nofailback prevents that behavior."]
79    #[doc = ""]
80    pub nofailback: Option<bool>,
81    #[serde(
82        serialize_with = "crate::types::serialize_bool_optional",
83        deserialize_with = "crate::types::deserialize_bool_optional"
84    )]
85    #[serde(skip_serializing_if = "Option::is_none", default)]
86    #[doc = "Resources bound to restricted groups may only run on nodes defined by the group."]
87    #[doc = ""]
88    #[doc = "Resources bound to restricted groups may only run on nodes defined by the group. The resource will be placed in the stopped state if no group node member is online. Resources on unrestricted groups may run on any cluster node if all group members are offline, but they will migrate back as soon as a group member comes online. One can implement a 'preferred node' behavior using an unrestricted group with only one member."]
89    #[doc = ""]
90    pub restricted: Option<bool>,
91    #[serde(
92        flatten,
93        default,
94        skip_serializing_if = "::std::collections::HashMap::is_empty"
95    )]
96    pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
97}
98#[derive(Debug, Clone, PartialEq, PartialOrd)]
99pub struct CommentStr {
100    value: String,
101}
102impl crate::types::bounded_string::BoundedString for CommentStr {
103    const MIN_LENGTH: Option<usize> = None::<usize>;
104    const MAX_LENGTH: Option<usize> = Some(4096usize);
105    const DEFAULT: Option<&'static str> = None::<&'static str>;
106    const PATTERN: Option<&'static str> = None::<&'static str>;
107    const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
108    fn get_value(&self) -> &str {
109        &self.value
110    }
111    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
112        Self::validate(&value)?;
113        Ok(Self { value })
114    }
115}
116impl std::convert::TryFrom<String> for CommentStr {
117    type Error = crate::types::bounded_string::BoundedStringError;
118    fn try_from(value: String) -> Result<Self, Self::Error> {
119        crate::types::bounded_string::BoundedString::new(value)
120    }
121}
122impl ::serde::Serialize for CommentStr {
123    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
124    where
125        S: ::serde::Serializer,
126    {
127        crate::types::bounded_string::serialize_bounded_string(self, serializer)
128    }
129}
130impl<'de> ::serde::Deserialize<'de> for CommentStr {
131    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
132    where
133        D: ::serde::Deserializer<'de>,
134    {
135        crate::types::bounded_string::deserialize_bounded_string(deserializer)
136    }
137}
138#[derive(Debug, Clone, PartialEq, PartialOrd)]
139pub struct DeleteStr {
140    value: String,
141}
142impl crate::types::bounded_string::BoundedString for DeleteStr {
143    const MIN_LENGTH: Option<usize> = None::<usize>;
144    const MAX_LENGTH: Option<usize> = Some(4096usize);
145    const DEFAULT: Option<&'static str> = None::<&'static str>;
146    const PATTERN: Option<&'static str> = None::<&'static str>;
147    const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
148    fn get_value(&self) -> &str {
149        &self.value
150    }
151    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
152        Self::validate(&value)?;
153        Ok(Self { value })
154    }
155}
156impl std::convert::TryFrom<String> for DeleteStr {
157    type Error = crate::types::bounded_string::BoundedStringError;
158    fn try_from(value: String) -> Result<Self, Self::Error> {
159        crate::types::bounded_string::BoundedString::new(value)
160    }
161}
162impl ::serde::Serialize for DeleteStr {
163    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
164    where
165        S: ::serde::Serializer,
166    {
167        crate::types::bounded_string::serialize_bounded_string(self, serializer)
168    }
169}
170impl<'de> ::serde::Deserialize<'de> for DeleteStr {
171    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
172    where
173        D: ::serde::Deserializer<'de>,
174    {
175        crate::types::bounded_string::deserialize_bounded_string(deserializer)
176    }
177}
178#[derive(Debug, Clone, PartialEq, PartialOrd)]
179pub struct DigestStr {
180    value: String,
181}
182impl crate::types::bounded_string::BoundedString for DigestStr {
183    const MIN_LENGTH: Option<usize> = None::<usize>;
184    const MAX_LENGTH: Option<usize> = Some(64usize);
185    const DEFAULT: Option<&'static str> = None::<&'static str>;
186    const PATTERN: Option<&'static str> = None::<&'static str>;
187    const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
188    fn get_value(&self) -> &str {
189        &self.value
190    }
191    fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
192        Self::validate(&value)?;
193        Ok(Self { value })
194    }
195}
196impl std::convert::TryFrom<String> for DigestStr {
197    type Error = crate::types::bounded_string::BoundedStringError;
198    fn try_from(value: String) -> Result<Self, Self::Error> {
199        crate::types::bounded_string::BoundedString::new(value)
200    }
201}
202impl ::serde::Serialize for DigestStr {
203    fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
204    where
205        S: ::serde::Serializer,
206    {
207        crate::types::bounded_string::serialize_bounded_string(self, serializer)
208    }
209}
210impl<'de> ::serde::Deserialize<'de> for DigestStr {
211    fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
212    where
213        D: ::serde::Deserializer<'de>,
214    {
215        crate::types::bounded_string::deserialize_bounded_string(deserializer)
216    }
217}