proxmox_api/generated/cluster/ha/
groups.rs1pub mod group;
2pub struct GroupsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> GroupsClient<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, "/groups"),
14 }
15 }
16}
17impl<T> GroupsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get HA groups."]
22 pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23 let path = self.path.to_string();
24 self.client.get(&path, &())
25 }
26}
27impl<T> GroupsClient<T>
28where
29 T: crate::client::Client,
30{
31 #[doc = "Create a new HA group."]
32 pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33 let path = self.path.to_string();
34 self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38 pub fn new(group: String) -> Self {
39 Self {
40 group,
41 additional_properties: Default::default(),
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct GetOutputItems {
47 pub group: String,
48 #[serde(
49 flatten,
50 default,
51 skip_serializing_if = "::std::collections::HashMap::is_empty"
52 )]
53 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
54}
55impl PostParams {
56 pub fn new(group: String, nodes: String) -> Self {
57 Self {
58 group,
59 nodes,
60 comment: Default::default(),
61 nofailback: Default::default(),
62 restricted: Default::default(),
63 ty: Default::default(),
64 additional_properties: Default::default(),
65 }
66 }
67}
68#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
69pub struct PostParams {
70 #[serde(skip_serializing_if = "Option::is_none", default)]
71 #[doc = "Description."]
72 pub comment: Option<String>,
73 #[doc = "The HA group identifier."]
74 pub group: String,
75 #[doc = "List of cluster node names with optional priority."]
76 #[doc = "List of cluster node members, where a priority can be given to each node. A resource bound to a group will run on the available nodes with the highest priority. If there are more nodes in the highest priority class, the services will get distributed to those nodes. The priorities have a relative meaning only."]
77 pub nodes: String,
78 #[serde(
79 serialize_with = "crate::types::serialize_bool_optional",
80 deserialize_with = "crate::types::deserialize_bool_optional"
81 )]
82 #[serde(skip_serializing_if = "Option::is_none", default)]
83 #[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."]
84 pub nofailback: Option<bool>,
85 #[serde(
86 serialize_with = "crate::types::serialize_bool_optional",
87 deserialize_with = "crate::types::deserialize_bool_optional"
88 )]
89 #[serde(skip_serializing_if = "Option::is_none", default)]
90 #[doc = "Resources bound to restricted groups may only run on nodes defined by the group."]
91 #[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."]
92 pub restricted: Option<bool>,
93 #[serde(rename = "type")]
94 #[serde(skip_serializing_if = "Option::is_none", default)]
95 #[doc = "Group type."]
96 pub ty: Option<Type>,
97 #[serde(
98 flatten,
99 default,
100 skip_serializing_if = "::std::collections::HashMap::is_empty"
101 )]
102 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
103}
104#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
105pub enum Type {
106 #[serde(rename = "group")]
107 Group,
108}
109impl<T> GroupsClient<T>
110where
111 T: crate::client::Client,
112{
113 pub fn group(&self, group: &str) -> group::GroupClient<T> {
114 group::GroupClient::<T>::new(self.client.clone(), &self.path, group)
115 }
116}