1pub mod group;
2pub struct GroupsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> GroupsClient<T>
7where
8T: crate::client::Client,
9{
10pub fn new(client: T, parent_path: &str) -> Self {
11Self {
12 client,
13 path: format!("{}{}", parent_path, "/groups"),
14 }
15 }
16}
17impl<T> GroupsClient<T>
18where
19T: crate::client::Client,
20{
21#[doc = "Get HA groups."]
22pub fn get(&self) -> Result<Vec<GetOutputItems>, T::Error> {
23let path = self.path.to_string();
24self.client.get(&path, &())
25 }
26}
27impl<T> GroupsClient<T>
28where
29T: crate::client::Client,
30{
31#[doc = "Create a new HA group."]
32pub fn post(&self, params: PostParams) -> Result<(), T::Error> {
33let path = self.path.to_string();
34self.client.post(&path, ¶ms)
35 }
36}
37impl GetOutputItems {
38pub fn new(group: String) -> Self {
39Self {
40 group,
41 additional_properties: Default::default(),
42 }
43 }
44}
45#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
46pub struct GetOutputItems {
47pub group: String,
48#[serde(
49 flatten,
50 default,
51 skip_serializing_if = "::std::collections::HashMap::is_empty"
52)]
53pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
54}
55impl PostParams {
56pub fn new(group: String, nodes: String) -> Self {
57Self {
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."]
72pub comment: Option<String>,
73#[doc = "The HA group identifier."]
74pub 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."]
77pub 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."]
84pub 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."]
92pub restricted: Option<bool>,
93#[serde(rename = "type")]
94 #[serde(skip_serializing_if = "Option::is_none", default)]
95 #[doc = "Group type."]
96pub ty: Option<Type>,
97#[serde(
98 flatten,
99 default,
100 skip_serializing_if = "::std::collections::HashMap::is_empty"
101)]
102pub 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")]
107Group,
108}
109impl<T> GroupsClient<T>
110where
111T: crate::client::Client,
112{
113pub fn group(&self, group: &str) -> group::GroupClient<T> {
114 group::GroupClient::<T>::new(self.client.clone(), &self.path, group)
115 }
116}