1pub mod firewall;
2pub mod ips;
3pub mod subnets;
4#[derive(Debug, Clone)]
5pub struct VnetClient<T> {
6 client: T,
7 path: String,
8}
9impl<T> VnetClient<T>
10where
11 T: crate::client::Client,
12{
13 pub fn new(client: T, parent_path: &str, vnet: &str) -> Self {
14 Self {
15 client,
16 path: format!("{}/{}", parent_path, vnet),
17 }
18 }
19}
20impl<T> VnetClient<T>
21where
22 T: crate::client::Client,
23{
24 #[doc = "Delete sdn vnet object configuration."]
25 #[doc = ""]
26 #[doc = "Require 'SDN.Allocate' permission on '/sdn/zones/\\<zone\\>/\\<vnet\\>'"]
27 pub async fn delete(&self, params: DeleteParams) -> Result<(), T::Error> {
28 let path = self.path.to_string();
29 self.client.delete(&path, ¶ms).await
30 }
31}
32impl<T> VnetClient<T>
33where
34 T: crate::client::Client,
35{
36 #[doc = "Read sdn vnet configuration."]
37 #[doc = ""]
38 #[doc = "Require 'SDN.Audit' or 'SDN.Allocate' permissions on '/sdn/zones/\\<zone\\>/\\<vnet\\>'"]
39 pub async fn get(&self, params: GetParams) -> Result<GetOutput, T::Error> {
40 let path = self.path.to_string();
41 self.client.get(&path, ¶ms).await
42 }
43}
44impl<T> VnetClient<T>
45where
46 T: crate::client::Client,
47{
48 #[doc = "Update sdn vnet object configuration."]
49 #[doc = ""]
50 #[doc = "Require 'SDN.Allocate' permission on '/sdn/zones/\\<zone\\>/\\<vnet\\>'"]
51 pub async fn put(&self, params: PutParams) -> Result<(), T::Error> {
52 let path = self.path.to_string();
53 self.client.put(&path, ¶ms).await
54 }
55}
56#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
57pub struct DeleteParams {
58 #[serde(rename = "lock-token")]
59 #[serde(skip_serializing_if = "Option::is_none", default)]
60 #[doc = "the token for unlocking the global SDN configuration"]
61 #[doc = ""]
62 pub lock_token: Option<String>,
63 #[serde(
64 flatten,
65 default,
66 skip_serializing_if = "::std::collections::HashMap::is_empty"
67 )]
68 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
69}
70impl GetOutput {
71 pub fn new(ty: Type, vnet: String) -> Self {
72 Self {
73 ty,
74 vnet,
75 alias: ::std::default::Default::default(),
76 digest: ::std::default::Default::default(),
77 isolate_ports: ::std::default::Default::default(),
78 pending: ::std::default::Default::default(),
79 state: ::std::default::Default::default(),
80 tag: ::std::default::Default::default(),
81 vlanaware: ::std::default::Default::default(),
82 zone: ::std::default::Default::default(),
83 additional_properties: ::std::default::Default::default(),
84 }
85 }
86}
87#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize)]
88pub struct GetOutput {
89 #[serde(skip_serializing_if = "Option::is_none", default)]
90 #[doc = "Alias name of the VNet."]
91 #[doc = ""]
92 pub alias: Option<AliasStr>,
93 #[serde(skip_serializing_if = "Option::is_none", default)]
94 #[doc = "Digest of the VNet section."]
95 #[doc = ""]
96 pub digest: Option<String>,
97 #[serde(rename = "isolate-ports")]
98 #[serde(
99 serialize_with = "crate::types::serialize_bool_optional",
100 deserialize_with = "crate::types::deserialize_bool_optional"
101 )]
102 #[serde(skip_serializing_if = "Option::is_none", default)]
103 #[doc = "If true, sets the isolated property for all interfaces on the bridge of this VNet."]
104 #[doc = ""]
105 pub isolate_ports: Option<bool>,
106 #[serde(skip_serializing_if = "Option::is_none", default)]
107 #[doc = "Changes that have not yet been applied to the running configuration."]
108 #[doc = ""]
109 pub pending: Option<PendingGetOutputPending>,
110 #[serde(skip_serializing_if = "Option::is_none", default)]
111 #[doc = "State of the SDN configuration object."]
112 #[doc = ""]
113 pub state: Option<State>,
114 #[serde(skip_serializing_if = "Option::is_none", default)]
115 #[doc = "VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN zones)."]
116 #[doc = ""]
117 pub tag: Option<TagInt>,
118 #[serde(rename = "type")]
119 #[doc = "Type of the VNet."]
120 #[doc = ""]
121 pub ty: Type,
122 #[serde(
123 serialize_with = "crate::types::serialize_bool_optional",
124 deserialize_with = "crate::types::deserialize_bool_optional"
125 )]
126 #[serde(skip_serializing_if = "Option::is_none", default)]
127 #[doc = "Allow VLANs to pass through this VNet."]
128 #[doc = ""]
129 pub vlanaware: Option<bool>,
130 #[doc = "Name of the VNet."]
131 #[doc = ""]
132 pub vnet: String,
133 #[serde(skip_serializing_if = "Option::is_none", default)]
134 #[doc = "Name of the zone this VNet belongs to."]
135 #[doc = ""]
136 pub zone: Option<String>,
137 #[serde(
138 flatten,
139 default,
140 skip_serializing_if = "::std::collections::HashMap::is_empty"
141 )]
142 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
143}
144#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
145pub struct GetParams {
146 #[serde(
147 serialize_with = "crate::types::serialize_bool_optional",
148 deserialize_with = "crate::types::deserialize_bool_optional"
149 )]
150 #[serde(skip_serializing_if = "Option::is_none", default)]
151 #[doc = "Display pending config."]
152 #[doc = ""]
153 pub pending: Option<bool>,
154 #[serde(
155 serialize_with = "crate::types::serialize_bool_optional",
156 deserialize_with = "crate::types::deserialize_bool_optional"
157 )]
158 #[serde(skip_serializing_if = "Option::is_none", default)]
159 #[doc = "Display running config."]
160 #[doc = ""]
161 pub running: Option<bool>,
162 #[serde(
163 flatten,
164 default,
165 skip_serializing_if = "::std::collections::HashMap::is_empty"
166 )]
167 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
168}
169#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
170pub struct PendingGetOutputPending {
171 #[serde(skip_serializing_if = "Option::is_none", default)]
172 #[doc = "Alias name of the VNet."]
173 #[doc = ""]
174 pub alias: Option<AliasStr>,
175 #[serde(rename = "isolate-ports")]
176 #[serde(
177 serialize_with = "crate::types::serialize_bool_optional",
178 deserialize_with = "crate::types::deserialize_bool_optional"
179 )]
180 #[serde(skip_serializing_if = "Option::is_none", default)]
181 #[doc = "If true, sets the isolated property for all interfaces on the bridge of this VNet."]
182 #[doc = ""]
183 pub isolate_ports: Option<bool>,
184 #[serde(skip_serializing_if = "Option::is_none", default)]
185 #[doc = "VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN zones)."]
186 #[doc = ""]
187 pub tag: Option<TagInt>,
188 #[serde(
189 serialize_with = "crate::types::serialize_bool_optional",
190 deserialize_with = "crate::types::deserialize_bool_optional"
191 )]
192 #[serde(skip_serializing_if = "Option::is_none", default)]
193 #[doc = "Allow VLANs to pass through this VNet."]
194 #[doc = ""]
195 pub vlanaware: Option<bool>,
196 #[serde(skip_serializing_if = "Option::is_none", default)]
197 #[doc = "Name of the zone this VNet belongs to."]
198 #[doc = ""]
199 pub zone: Option<String>,
200 #[serde(
201 flatten,
202 default,
203 skip_serializing_if = "::std::collections::HashMap::is_empty"
204 )]
205 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
206}
207#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, Default)]
208pub struct PutParams {
209 #[serde(skip_serializing_if = "Option::is_none", default)]
210 #[doc = "Alias name of the VNet."]
211 #[doc = ""]
212 pub alias: Option<AliasStr>,
213 #[serde(skip_serializing_if = "Option::is_none", default)]
214 #[doc = "A list of settings you want to delete."]
215 #[doc = ""]
216 pub delete: Option<DeleteStr>,
217 #[serde(skip_serializing_if = "Option::is_none", default)]
218 #[doc = "Prevent changes if current configuration file has a different digest. This can be used to prevent concurrent modifications."]
219 #[doc = ""]
220 pub digest: Option<DigestStr>,
221 #[serde(rename = "isolate-ports")]
222 #[serde(
223 serialize_with = "crate::types::serialize_bool_optional",
224 deserialize_with = "crate::types::deserialize_bool_optional"
225 )]
226 #[serde(skip_serializing_if = "Option::is_none", default)]
227 #[doc = "If true, sets the isolated property for all interfaces on the bridge of this VNet."]
228 #[doc = ""]
229 pub isolate_ports: Option<bool>,
230 #[serde(rename = "lock-token")]
231 #[serde(skip_serializing_if = "Option::is_none", default)]
232 #[doc = "the token for unlocking the global SDN configuration"]
233 #[doc = ""]
234 pub lock_token: Option<String>,
235 #[serde(skip_serializing_if = "Option::is_none", default)]
236 #[doc = "VLAN Tag (for VLAN or QinQ zones) or VXLAN VNI (for VXLAN or EVPN zones)."]
237 #[doc = ""]
238 pub tag: Option<TagInt>,
239 #[serde(
240 serialize_with = "crate::types::serialize_bool_optional",
241 deserialize_with = "crate::types::deserialize_bool_optional"
242 )]
243 #[serde(skip_serializing_if = "Option::is_none", default)]
244 #[doc = "Allow VLANs to pass through this vnet."]
245 #[doc = ""]
246 pub vlanaware: Option<bool>,
247 #[serde(skip_serializing_if = "Option::is_none", default)]
248 #[doc = "Name of the zone this VNet belongs to."]
249 #[doc = ""]
250 pub zone: Option<String>,
251 #[serde(
252 flatten,
253 default,
254 skip_serializing_if = "::std::collections::HashMap::is_empty"
255 )]
256 pub additional_properties: ::std::collections::HashMap<String, ::serde_json::Value>,
257}
258#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
259#[doc = "State of the SDN configuration object."]
260#[doc = ""]
261pub enum State {
262 #[serde(rename = "changed")]
263 Changed,
264 #[serde(rename = "deleted")]
265 Deleted,
266 #[serde(rename = "new")]
267 New,
268}
269impl TryFrom<&str> for State {
270 type Error = String;
271 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
272 match value {
273 "changed" => Ok(Self::Changed),
274 "deleted" => Ok(Self::Deleted),
275 "new" => Ok(Self::New),
276 v => Err(format!("Unknown variant {v}")),
277 }
278 }
279}
280#[derive(Clone, Debug, :: serde :: Serialize, :: serde :: Deserialize, PartialEq)]
281#[doc = "Type of the VNet."]
282#[doc = ""]
283pub enum Type {
284 #[serde(rename = "vnet")]
285 Vnet,
286}
287impl TryFrom<&str> for Type {
288 type Error = String;
289 fn try_from(value: &str) -> Result<Self, <Self as TryFrom<&str>>::Error> {
290 match value {
291 "vnet" => Ok(Self::Vnet),
292 v => Err(format!("Unknown variant {v}")),
293 }
294 }
295}
296#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
297pub struct TagInt(i128);
298impl crate::types::bounded_integer::BoundedInteger for TagInt {
299 const MIN: Option<i128> = Some(1i128);
300 const MAX: Option<i128> = Some(16777215i128);
301 const DEFAULT: Option<i128> = None::<i128>;
302 const TYPE_DESCRIPTION: &'static str = "an integer between 1 and 16777215";
303 fn get(&self) -> i128 {
304 self.0
305 }
306 fn new(value: i128) -> Result<Self, crate::types::bounded_integer::BoundedIntegerError> {
307 Self::validate(value)?;
308 Ok(Self(value))
309 }
310}
311impl std::convert::TryFrom<i128> for TagInt {
312 type Error = crate::types::bounded_integer::BoundedIntegerError;
313 fn try_from(value: i128) -> Result<Self, Self::Error> {
314 crate::types::bounded_integer::BoundedInteger::new(value)
315 }
316}
317impl ::serde::Serialize for TagInt {
318 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
319 where
320 S: ::serde::Serializer,
321 {
322 crate::types::bounded_integer::serialize_bounded_integer(self, serializer)
323 }
324}
325impl<'de> ::serde::Deserialize<'de> for TagInt {
326 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
327 where
328 D: ::serde::Deserializer<'de>,
329 {
330 crate::types::bounded_integer::deserialize_bounded_integer(deserializer)
331 }
332}
333#[derive(Debug, Clone, PartialEq, PartialOrd)]
334pub struct AliasStr {
335 value: String,
336}
337impl crate::types::bounded_string::BoundedString for AliasStr {
338 const MIN_LENGTH: Option<usize> = None::<usize>;
339 const MAX_LENGTH: Option<usize> = Some(256usize);
340 const DEFAULT: Option<&'static str> = None::<&'static str>;
341 const PATTERN: Option<&'static str> = Some("(?^i:[\\(\\)-_.\\w\\d\\s]{0,256})");
342 const TYPE_DESCRIPTION: &'static str =
343 "a string with pattern r\"(?^i:[\\(\\)-_.\\w\\d\\s]{0,256})\" and length at most 256";
344 fn get_value(&self) -> &str {
345 &self.value
346 }
347 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
348 Self::validate(&value)?;
349 Ok(Self { value })
350 }
351}
352impl std::convert::TryFrom<String> for AliasStr {
353 type Error = crate::types::bounded_string::BoundedStringError;
354 fn try_from(value: String) -> Result<Self, Self::Error> {
355 crate::types::bounded_string::BoundedString::new(value)
356 }
357}
358impl ::serde::Serialize for AliasStr {
359 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
360 where
361 S: ::serde::Serializer,
362 {
363 crate::types::bounded_string::serialize_bounded_string(self, serializer)
364 }
365}
366impl<'de> ::serde::Deserialize<'de> for AliasStr {
367 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
368 where
369 D: ::serde::Deserializer<'de>,
370 {
371 crate::types::bounded_string::deserialize_bounded_string(deserializer)
372 }
373}
374#[derive(Debug, Clone, PartialEq, PartialOrd)]
375pub struct DeleteStr {
376 value: String,
377}
378impl crate::types::bounded_string::BoundedString for DeleteStr {
379 const MIN_LENGTH: Option<usize> = None::<usize>;
380 const MAX_LENGTH: Option<usize> = Some(4096usize);
381 const DEFAULT: Option<&'static str> = None::<&'static str>;
382 const PATTERN: Option<&'static str> = None::<&'static str>;
383 const TYPE_DESCRIPTION: &'static str = "a string with length at most 4096";
384 fn get_value(&self) -> &str {
385 &self.value
386 }
387 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
388 Self::validate(&value)?;
389 Ok(Self { value })
390 }
391}
392impl std::convert::TryFrom<String> for DeleteStr {
393 type Error = crate::types::bounded_string::BoundedStringError;
394 fn try_from(value: String) -> Result<Self, Self::Error> {
395 crate::types::bounded_string::BoundedString::new(value)
396 }
397}
398impl ::serde::Serialize for DeleteStr {
399 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
400 where
401 S: ::serde::Serializer,
402 {
403 crate::types::bounded_string::serialize_bounded_string(self, serializer)
404 }
405}
406impl<'de> ::serde::Deserialize<'de> for DeleteStr {
407 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
408 where
409 D: ::serde::Deserializer<'de>,
410 {
411 crate::types::bounded_string::deserialize_bounded_string(deserializer)
412 }
413}
414#[derive(Debug, Clone, PartialEq, PartialOrd)]
415pub struct DigestStr {
416 value: String,
417}
418impl crate::types::bounded_string::BoundedString for DigestStr {
419 const MIN_LENGTH: Option<usize> = None::<usize>;
420 const MAX_LENGTH: Option<usize> = Some(64usize);
421 const DEFAULT: Option<&'static str> = None::<&'static str>;
422 const PATTERN: Option<&'static str> = None::<&'static str>;
423 const TYPE_DESCRIPTION: &'static str = "a string with length at most 64";
424 fn get_value(&self) -> &str {
425 &self.value
426 }
427 fn new(value: String) -> Result<Self, crate::types::bounded_string::BoundedStringError> {
428 Self::validate(&value)?;
429 Ok(Self { value })
430 }
431}
432impl std::convert::TryFrom<String> for DigestStr {
433 type Error = crate::types::bounded_string::BoundedStringError;
434 fn try_from(value: String) -> Result<Self, Self::Error> {
435 crate::types::bounded_string::BoundedString::new(value)
436 }
437}
438impl ::serde::Serialize for DigestStr {
439 fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
440 where
441 S: ::serde::Serializer,
442 {
443 crate::types::bounded_string::serialize_bounded_string(self, serializer)
444 }
445}
446impl<'de> ::serde::Deserialize<'de> for DigestStr {
447 fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
448 where
449 D: ::serde::Deserializer<'de>,
450 {
451 crate::types::bounded_string::deserialize_bounded_string(deserializer)
452 }
453}
454impl<T> VnetClient<T>
455where
456 T: crate::client::Client,
457{
458 pub fn firewall(&self) -> firewall::FirewallClient<T> {
459 firewall::FirewallClient::<T>::new(self.client.clone(), &self.path)
460 }
461}
462impl<T> VnetClient<T>
463where
464 T: crate::client::Client,
465{
466 pub fn subnets(&self) -> subnets::SubnetsClient<T> {
467 subnets::SubnetsClient::<T>::new(self.client.clone(), &self.path)
468 }
469}
470impl<T> VnetClient<T>
471where
472 T: crate::client::Client,
473{
474 pub fn ips(&self) -> ips::IpsClient<T> {
475 ips::IpsClient::<T>::new(self.client.clone(), &self.path)
476 }
477}