proxmox_api/generated/cluster/firewall/
options.rs1#[derive(Debug, Clone)]
2pub struct OptionsClient<T> {
3 client: T,
4 path: String,
5}
6impl<T> OptionsClient<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, "/options"),
14 }
15 }
16}
17impl<T> OptionsClient<T>
18where
19 T: crate::client::Client,
20{
21 #[doc = "Get Firewall options."]
22 #[doc = ""]
23 #[doc = "Permission check: perm(\"/\", [\"Sys.Audit\"])"]
24 pub async fn get(&self) -> Result<GetOutput, T::Error> {
25 let path = self.path.to_string();
26 self.client.get(&path, &()).await
27 }
28}
29impl<T> OptionsClient<T>
30where
31 T: crate::client::Client,
32{
33 #[doc = "Set Firewall options."]
34 #[doc = ""]
35 #[doc = "Permission check: perm(\"/\", [\"Sys.Modify\"])"]
36 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
37 let path = self.path.to_string();
38 self.client.put(&path, ¶ms).await
39 }
40}
41#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
42pub struct GetOutput {
43 #[serde(
44 serialize_with = "crate::types::serialize_bool_optional",
45 deserialize_with = "crate::types::deserialize_bool_optional"
46 )]
47 #[serde(skip_serializing_if = "Option::is_none", default)]
48 #[doc = "Enable ebtables rules cluster wide."]
49 #[doc = ""]
50 pub ebtables: Option<bool>,
51 #[serde(
52 serialize_with = "crate::types::serialize_unsigned_int_optional",
53 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
54 )]
55 #[serde(skip_serializing_if = "Option::is_none", default)]
56 #[doc = "Enable or disable the firewall cluster wide."]
57 #[doc = ""]
58 pub enable: Option<u64>,
59 #[serde(skip_serializing_if = "Option::is_none", default)]
60 #[doc = "Log ratelimiting settings"]
61 #[doc = ""]
62 pub log_ratelimit: Option<String>,
63 #[serde(skip_serializing_if = "Option::is_none", default)]
64 #[doc = "Forward policy."]
65 #[doc = ""]
66 pub policy_forward: Option<PolicyForward>,
67 #[serde(skip_serializing_if = "Option::is_none", default)]
68 #[doc = "Input policy."]
69 #[doc = ""]
70 pub policy_in: Option<PolicyIn>,
71 #[serde(skip_serializing_if = "Option::is_none", default)]
72 #[doc = "Output policy."]
73 #[doc = ""]
74 pub policy_out: Option<PolicyOut>,
75 #[serde(
76 flatten,
77 default,
78 skip_serializing_if = "::std::collections::HashMap::is_empty"
79 )]
80 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
81}
82#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
83pub struct PutParams {
84 #[serde(skip_serializing_if = "Option::is_none", default)]
85 #[doc = "A list of settings you want to delete."]
86 #[doc = ""]
87 pub delete: Option<String>,
88 #[serde(skip_serializing_if = "Option::is_none", default)]
89 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
90 #[doc = ""]
91 pub digest: Option<DigestStr>,
92 #[serde(
93 serialize_with = "crate::types::serialize_bool_optional",
94 deserialize_with = "crate::types::deserialize_bool_optional"
95 )]
96 #[serde(skip_serializing_if = "Option::is_none", default)]
97 #[doc = "Enable ebtables rules cluster wide."]
98 #[doc = ""]
99 pub ebtables: Option<bool>,
100 #[serde(
101 serialize_with = "crate::types::serialize_unsigned_int_optional",
102 deserialize_with = "crate::types::deserialize_unsigned_int_optional"
103 )]
104 #[serde(skip_serializing_if = "Option::is_none", default)]
105 #[doc = "Enable or disable the firewall cluster wide."]
106 #[doc = ""]
107 pub enable: Option<u64>,
108 #[serde(skip_serializing_if = "Option::is_none", default)]
109 #[doc = "Log ratelimiting settings"]
110 #[doc = ""]
111 pub log_ratelimit: Option<String>,
112 #[serde(skip_serializing_if = "Option::is_none", default)]
113 #[doc = "Forward policy."]
114 #[doc = ""]
115 pub policy_forward: Option<PolicyForward>,
116 #[serde(skip_serializing_if = "Option::is_none", default)]
117 #[doc = "Input policy."]
118 #[doc = ""]
119 pub policy_in: Option<PolicyIn>,
120 #[serde(skip_serializing_if = "Option::is_none", default)]
121 #[doc = "Output policy."]
122 #[doc = ""]
123 pub policy_out: Option<PolicyOut>,
124 #[serde(
125 flatten,
126 default,
127 skip_serializing_if = "::std::collections::HashMap::is_empty"
128 )]
129 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
130}
131#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
132#[doc = "Forward policy."]
133#[doc = ""]
134pub enum PolicyForward {
135 ACCEPT,
136 DROP,
137}
138impl TryFrom<&str> for PolicyForward {
139 type Error = String;
140 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
141 match value {
142 "ACCEPT" => Ok(Self::ACCEPT),
143 "DROP" => Ok(Self::DROP),
144 v => Err(format!("Unknown variant {v}")),
145 }
146 }
147}
148#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
149#[doc = "Input policy."]
150#[doc = ""]
151pub enum PolicyIn {
152 ACCEPT,
153 DROP,
154 REJECT,
155}
156impl TryFrom<&str> for PolicyIn {
157 type Error = String;
158 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
159 match value {
160 "ACCEPT" => Ok(Self::ACCEPT),
161 "DROP" => Ok(Self::DROP),
162 "REJECT" => Ok(Self::REJECT),
163 v => Err(format!("Unknown variant {v}")),
164 }
165 }
166}
167#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
168#[doc = "Output policy."]
169#[doc = ""]
170pub enum PolicyOut {
171 ACCEPT,
172 DROP,
173 REJECT,
174}
175impl TryFrom<&str> for PolicyOut {
176 type Error = String;
177 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
178 match value {
179 "ACCEPT" => Ok(Self::ACCEPT),
180 "DROP" => Ok(Self::DROP),
181 "REJECT" => Ok(Self::REJECT),
182 v => Err(format!("Unknown variant {v}")),
183 }
184 }
185}
186#[derive(Debug, Clone, PartialEq, PartialOrd)]
187pub struct DigestStr {
188 value: String,
189}
190impl crate::types::bounded_string::BoundedString for DigestStr {
191 const MIN_LENGTH: Option<usize> = None::<usize>;
192 const MAX_LENGTH: Option<usize> = Some(64usize);
193 const DEFAULT: Option<&'static str> = None::<&'static str>;
194 const PATTERN: Option<&'static str> = None::<&'static str>;
195 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
196 fn get_value(&self) -> &str {
197 &self.value
198 }
199 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
200 Self::validate(&value)?;
201 Ok(Self { value })
202 }
203}
204impl std::convert::TryFrom<String> for DigestStr {
205 type Error = crate::types::bounded_string::BoundedStringError;
206 fn try_from(value: String) -> Result<Self, Self::Error> {
207 crate::types::bounded_string::BoundedString::new(value)
208 }
209}
210impl ::serde::Serialize for DigestStr {
211 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
212 where
213 S: ::serde::Serializer,
214 {
215 crate::types::bounded_string::serialize_bounded_string(self, serializer)
216 }
217}
218impl<'de> ::serde::Deserialize<'de> for DigestStr {
219 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
220 where
221 D: ::serde::Deserializer<'de>,
222 {
223 crate::types::bounded_string::deserialize_bounded_string(deserializer)
224 }
225}