1#![allow(unused_qualifications)]
2
3use http::HeaderValue;
4use validator::Validate;
5
6#[cfg(feature = "server")]
7use crate::header;
8use crate::{models, types::*};
9
10
11
12
13
14
15
16
17
18
19#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21pub struct Affinity {
22 #[serde(rename = "nodeAffinity")]
23 #[serde(skip_serializing_if="Option::is_none")]
24 pub node_affinity: Option<models::NodeAffinity>,
25
26 #[serde(rename = "podAffinity")]
27 #[serde(skip_serializing_if="Option::is_none")]
28 pub pod_affinity: Option<models::PodAffinity>,
29
30 #[serde(rename = "podAntiAffinity")]
31 #[serde(skip_serializing_if="Option::is_none")]
32 pub pod_anti_affinity: Option<models::PodAntiAffinity>,
33
34}
35
36
37impl Affinity {
38 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
39 pub fn new() -> Affinity {
40 Affinity {
41 node_affinity: None,
42 pod_affinity: None,
43 pod_anti_affinity: None,
44 }
45 }
46}
47
48impl std::string::ToString for Affinity {
52 fn to_string(&self) -> String {
53 let params: Vec<Option<String>> = vec![
54 ];
61
62 params.into_iter().flatten().collect::<Vec<_>>().join(",")
63 }
64}
65
66impl std::str::FromStr for Affinity {
70 type Err = String;
71
72 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
73 #[derive(Default)]
75 #[allow(dead_code)]
76 struct IntermediateRep {
77 pub node_affinity: Vec<models::NodeAffinity>,
78 pub pod_affinity: Vec<models::PodAffinity>,
79 pub pod_anti_affinity: Vec<models::PodAntiAffinity>,
80 }
81
82 let mut intermediate_rep = IntermediateRep::default();
83
84 let mut string_iter = s.split(',');
86 let mut key_result = string_iter.next();
87
88 while key_result.is_some() {
89 let val = match string_iter.next() {
90 Some(x) => x,
91 None => return std::result::Result::Err("Missing value while parsing Affinity".to_string())
92 };
93
94 if let Some(key) = key_result {
95 #[allow(clippy::match_single_binding)]
96 match key {
97 #[allow(clippy::redundant_clone)]
98 "nodeAffinity" => intermediate_rep.node_affinity.push(<models::NodeAffinity as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
99 #[allow(clippy::redundant_clone)]
100 "podAffinity" => intermediate_rep.pod_affinity.push(<models::PodAffinity as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
101 #[allow(clippy::redundant_clone)]
102 "podAntiAffinity" => intermediate_rep.pod_anti_affinity.push(<models::PodAntiAffinity as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
103 _ => return std::result::Result::Err("Unexpected key while parsing Affinity".to_string())
104 }
105 }
106
107 key_result = string_iter.next();
109 }
110
111 std::result::Result::Ok(Affinity {
113 node_affinity: intermediate_rep.node_affinity.into_iter().next(),
114 pod_affinity: intermediate_rep.pod_affinity.into_iter().next(),
115 pod_anti_affinity: intermediate_rep.pod_anti_affinity.into_iter().next(),
116 })
117 }
118}
119
120#[cfg(feature = "server")]
123impl std::convert::TryFrom<header::IntoHeaderValue<Affinity>> for HeaderValue {
124 type Error = String;
125
126 fn try_from(hdr_value: header::IntoHeaderValue<Affinity>) -> std::result::Result<Self, Self::Error> {
127 let hdr_value = hdr_value.to_string();
128 match HeaderValue::from_str(&hdr_value) {
129 std::result::Result::Ok(value) => std::result::Result::Ok(value),
130 std::result::Result::Err(e) => std::result::Result::Err(
131 format!("Invalid header value for Affinity - value: {} is invalid {}",
132 hdr_value, e))
133 }
134 }
135}
136
137#[cfg(feature = "server")]
138impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Affinity> {
139 type Error = String;
140
141 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
142 match hdr_value.to_str() {
143 std::result::Result::Ok(value) => {
144 match <Affinity as std::str::FromStr>::from_str(value) {
145 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
146 std::result::Result::Err(err) => std::result::Result::Err(
147 format!("Unable to convert header value '{}' into Affinity - {}",
148 value, err))
149 }
150 },
151 std::result::Result::Err(e) => std::result::Result::Err(
152 format!("Unable to convert header: {:?} to string: {}",
153 hdr_value, e))
154 }
155 }
156}
157
158
159
160
161#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
166#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
167pub struct AppConfig {
168 #[serde(rename = "backend")]
169 #[serde(skip_serializing_if="Option::is_none")]
170 pub backend: Option<String>,
171
172 #[serde(rename = "docker")]
173 #[serde(skip_serializing_if="Option::is_none")]
174 pub docker: Option<models::DockerConfig>,
175
176#[serde(rename = "dockerrun")]
178 #[serde(skip_serializing_if="Option::is_none")]
179 pub dockerrun: Option<crate::types::Object>,
180
181 #[serde(rename = "health")]
182 #[serde(skip_serializing_if="Option::is_none")]
183 pub health: Option<models::HealthConfig>,
184
185 #[serde(rename = "kubernetes")]
186 #[serde(skip_serializing_if="Option::is_none")]
187 pub kubernetes: Option<models::KubernetesConfig>,
188
189#[serde(rename = "kuberun")]
191 #[serde(skip_serializing_if="Option::is_none")]
192 pub kuberun: Option<crate::types::Object>,
193
194 #[serde(rename = "security")]
195 #[serde(skip_serializing_if="Option::is_none")]
196 pub security: Option<models::SecurityConfig>,
197
198 #[serde(rename = "sshproxy")]
199 #[serde(skip_serializing_if="Option::is_none")]
200 pub sshproxy: Option<models::SshProxyConfig>,
201
202}
203
204
205impl AppConfig {
206 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
207 pub fn new() -> AppConfig {
208 AppConfig {
209 backend: None,
210 docker: None,
211 dockerrun: None,
212 health: None,
213 kubernetes: None,
214 kuberun: None,
215 security: None,
216 sshproxy: None,
217 }
218 }
219}
220
221impl std::string::ToString for AppConfig {
225 fn to_string(&self) -> String {
226 let params: Vec<Option<String>> = vec![
227
228 self.backend.as_ref().map(|backend| {
229 [
230 "backend".to_string(),
231 backend.to_string(),
232 ].join(",")
233 }),
234
235 ];
250
251 params.into_iter().flatten().collect::<Vec<_>>().join(",")
252 }
253}
254
255impl std::str::FromStr for AppConfig {
259 type Err = String;
260
261 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
262 #[derive(Default)]
264 #[allow(dead_code)]
265 struct IntermediateRep {
266 pub backend: Vec<String>,
267 pub docker: Vec<models::DockerConfig>,
268 pub dockerrun: Vec<crate::types::Object>,
269 pub health: Vec<models::HealthConfig>,
270 pub kubernetes: Vec<models::KubernetesConfig>,
271 pub kuberun: Vec<crate::types::Object>,
272 pub security: Vec<models::SecurityConfig>,
273 pub sshproxy: Vec<models::SshProxyConfig>,
274 }
275
276 let mut intermediate_rep = IntermediateRep::default();
277
278 let mut string_iter = s.split(',');
280 let mut key_result = string_iter.next();
281
282 while key_result.is_some() {
283 let val = match string_iter.next() {
284 Some(x) => x,
285 None => return std::result::Result::Err("Missing value while parsing AppConfig".to_string())
286 };
287
288 if let Some(key) = key_result {
289 #[allow(clippy::match_single_binding)]
290 match key {
291 #[allow(clippy::redundant_clone)]
292 "backend" => intermediate_rep.backend.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
293 #[allow(clippy::redundant_clone)]
294 "docker" => intermediate_rep.docker.push(<models::DockerConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
295 #[allow(clippy::redundant_clone)]
296 "dockerrun" => intermediate_rep.dockerrun.push(<crate::types::Object as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
297 #[allow(clippy::redundant_clone)]
298 "health" => intermediate_rep.health.push(<models::HealthConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
299 #[allow(clippy::redundant_clone)]
300 "kubernetes" => intermediate_rep.kubernetes.push(<models::KubernetesConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
301 #[allow(clippy::redundant_clone)]
302 "kuberun" => intermediate_rep.kuberun.push(<crate::types::Object as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
303 #[allow(clippy::redundant_clone)]
304 "security" => intermediate_rep.security.push(<models::SecurityConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
305 #[allow(clippy::redundant_clone)]
306 "sshproxy" => intermediate_rep.sshproxy.push(<models::SshProxyConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
307 _ => return std::result::Result::Err("Unexpected key while parsing AppConfig".to_string())
308 }
309 }
310
311 key_result = string_iter.next();
313 }
314
315 std::result::Result::Ok(AppConfig {
317 backend: intermediate_rep.backend.into_iter().next(),
318 docker: intermediate_rep.docker.into_iter().next(),
319 dockerrun: intermediate_rep.dockerrun.into_iter().next(),
320 health: intermediate_rep.health.into_iter().next(),
321 kubernetes: intermediate_rep.kubernetes.into_iter().next(),
322 kuberun: intermediate_rep.kuberun.into_iter().next(),
323 security: intermediate_rep.security.into_iter().next(),
324 sshproxy: intermediate_rep.sshproxy.into_iter().next(),
325 })
326 }
327}
328
329#[cfg(feature = "server")]
332impl std::convert::TryFrom<header::IntoHeaderValue<AppConfig>> for HeaderValue {
333 type Error = String;
334
335 fn try_from(hdr_value: header::IntoHeaderValue<AppConfig>) -> std::result::Result<Self, Self::Error> {
336 let hdr_value = hdr_value.to_string();
337 match HeaderValue::from_str(&hdr_value) {
338 std::result::Result::Ok(value) => std::result::Result::Ok(value),
339 std::result::Result::Err(e) => std::result::Result::Err(
340 format!("Invalid header value for AppConfig - value: {} is invalid {}",
341 hdr_value, e))
342 }
343 }
344}
345
346#[cfg(feature = "server")]
347impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AppConfig> {
348 type Error = String;
349
350 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
351 match hdr_value.to_str() {
352 std::result::Result::Ok(value) => {
353 match <AppConfig as std::str::FromStr>::from_str(value) {
354 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
355 std::result::Result::Err(err) => std::result::Result::Err(
356 format!("Unable to convert header value '{}' into AppConfig - {}",
357 value, err))
358 }
359 },
360 std::result::Result::Err(e) => std::result::Result::Err(
361 format!("Unable to convert header: {:?} to string: {}",
362 hdr_value, e))
363 }
364 }
365}
366
367
368
369
370#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
375#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
376pub struct AuthConfig {
377 #[serde(rename = "auth")]
378 #[serde(skip_serializing_if="Option::is_none")]
379 pub auth: Option<String>,
380
381#[serde(rename = "email")]
383 #[serde(skip_serializing_if="Option::is_none")]
384 pub email: Option<String>,
385
386#[serde(rename = "identitytoken")]
388 #[serde(skip_serializing_if="Option::is_none")]
389 pub identitytoken: Option<String>,
390
391 #[serde(rename = "password")]
392 #[serde(skip_serializing_if="Option::is_none")]
393 pub password: Option<String>,
394
395#[serde(rename = "registrytoken")]
397 #[serde(skip_serializing_if="Option::is_none")]
398 pub registrytoken: Option<String>,
399
400 #[serde(rename = "serveraddress")]
401 #[serde(skip_serializing_if="Option::is_none")]
402 pub serveraddress: Option<String>,
403
404 #[serde(rename = "username")]
405 #[serde(skip_serializing_if="Option::is_none")]
406 pub username: Option<String>,
407
408}
409
410
411impl AuthConfig {
412 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
413 pub fn new() -> AuthConfig {
414 AuthConfig {
415 auth: None,
416 email: None,
417 identitytoken: None,
418 password: None,
419 registrytoken: None,
420 serveraddress: None,
421 username: None,
422 }
423 }
424}
425
426impl std::string::ToString for AuthConfig {
430 fn to_string(&self) -> String {
431 let params: Vec<Option<String>> = vec![
432
433 self.auth.as_ref().map(|auth| {
434 [
435 "auth".to_string(),
436 auth.to_string(),
437 ].join(",")
438 }),
439
440
441 self.email.as_ref().map(|email| {
442 [
443 "email".to_string(),
444 email.to_string(),
445 ].join(",")
446 }),
447
448
449 self.identitytoken.as_ref().map(|identitytoken| {
450 [
451 "identitytoken".to_string(),
452 identitytoken.to_string(),
453 ].join(",")
454 }),
455
456
457 self.password.as_ref().map(|password| {
458 [
459 "password".to_string(),
460 password.to_string(),
461 ].join(",")
462 }),
463
464
465 self.registrytoken.as_ref().map(|registrytoken| {
466 [
467 "registrytoken".to_string(),
468 registrytoken.to_string(),
469 ].join(",")
470 }),
471
472
473 self.serveraddress.as_ref().map(|serveraddress| {
474 [
475 "serveraddress".to_string(),
476 serveraddress.to_string(),
477 ].join(",")
478 }),
479
480
481 self.username.as_ref().map(|username| {
482 [
483 "username".to_string(),
484 username.to_string(),
485 ].join(",")
486 }),
487
488 ];
489
490 params.into_iter().flatten().collect::<Vec<_>>().join(",")
491 }
492}
493
494impl std::str::FromStr for AuthConfig {
498 type Err = String;
499
500 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
501 #[derive(Default)]
503 #[allow(dead_code)]
504 struct IntermediateRep {
505 pub auth: Vec<String>,
506 pub email: Vec<String>,
507 pub identitytoken: Vec<String>,
508 pub password: Vec<String>,
509 pub registrytoken: Vec<String>,
510 pub serveraddress: Vec<String>,
511 pub username: Vec<String>,
512 }
513
514 let mut intermediate_rep = IntermediateRep::default();
515
516 let mut string_iter = s.split(',');
518 let mut key_result = string_iter.next();
519
520 while key_result.is_some() {
521 let val = match string_iter.next() {
522 Some(x) => x,
523 None => return std::result::Result::Err("Missing value while parsing AuthConfig".to_string())
524 };
525
526 if let Some(key) = key_result {
527 #[allow(clippy::match_single_binding)]
528 match key {
529 #[allow(clippy::redundant_clone)]
530 "auth" => intermediate_rep.auth.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
531 #[allow(clippy::redundant_clone)]
532 "email" => intermediate_rep.email.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
533 #[allow(clippy::redundant_clone)]
534 "identitytoken" => intermediate_rep.identitytoken.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
535 #[allow(clippy::redundant_clone)]
536 "password" => intermediate_rep.password.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
537 #[allow(clippy::redundant_clone)]
538 "registrytoken" => intermediate_rep.registrytoken.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
539 #[allow(clippy::redundant_clone)]
540 "serveraddress" => intermediate_rep.serveraddress.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
541 #[allow(clippy::redundant_clone)]
542 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
543 _ => return std::result::Result::Err("Unexpected key while parsing AuthConfig".to_string())
544 }
545 }
546
547 key_result = string_iter.next();
549 }
550
551 std::result::Result::Ok(AuthConfig {
553 auth: intermediate_rep.auth.into_iter().next(),
554 email: intermediate_rep.email.into_iter().next(),
555 identitytoken: intermediate_rep.identitytoken.into_iter().next(),
556 password: intermediate_rep.password.into_iter().next(),
557 registrytoken: intermediate_rep.registrytoken.into_iter().next(),
558 serveraddress: intermediate_rep.serveraddress.into_iter().next(),
559 username: intermediate_rep.username.into_iter().next(),
560 })
561 }
562}
563
564#[cfg(feature = "server")]
567impl std::convert::TryFrom<header::IntoHeaderValue<AuthConfig>> for HeaderValue {
568 type Error = String;
569
570 fn try_from(hdr_value: header::IntoHeaderValue<AuthConfig>) -> std::result::Result<Self, Self::Error> {
571 let hdr_value = hdr_value.to_string();
572 match HeaderValue::from_str(&hdr_value) {
573 std::result::Result::Ok(value) => std::result::Result::Ok(value),
574 std::result::Result::Err(e) => std::result::Result::Err(
575 format!("Invalid header value for AuthConfig - value: {} is invalid {}",
576 hdr_value, e))
577 }
578 }
579}
580
581#[cfg(feature = "server")]
582impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AuthConfig> {
583 type Error = String;
584
585 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
586 match hdr_value.to_str() {
587 std::result::Result::Ok(value) => {
588 match <AuthConfig as std::str::FromStr>::from_str(value) {
589 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
590 std::result::Result::Err(err) => std::result::Result::Err(
591 format!("Unable to convert header value '{}' into AuthConfig - {}",
592 value, err))
593 }
594 },
595 std::result::Result::Err(e) => std::result::Result::Err(
596 format!("Unable to convert header: {:?} to string: {}",
597 hdr_value, e))
598 }
599 }
600}
601
602
603
604
605
606
607
608#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
609#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
610pub struct AuthResponseBody {
611#[serde(rename = "authenticatedUsername")]
613 #[serde(skip_serializing_if="Option::is_none")]
614 pub authenticated_username: Option<String>,
615
616#[serde(rename = "clientVersion")]
618 #[serde(skip_serializing_if="Option::is_none")]
619 pub client_version: Option<String>,
620
621#[serde(rename = "connectionId")]
623 pub connection_id: String,
624
625#[serde(rename = "environment")]
627 #[serde(skip_serializing_if="Option::is_none")]
628 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
629
630#[serde(rename = "files")]
632 #[serde(skip_serializing_if="Option::is_none")]
633 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
634
635#[serde(rename = "metadata")]
637 #[serde(skip_serializing_if="Option::is_none")]
638 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
639
640#[serde(rename = "remoteAddress")]
642 pub remote_address: String,
643
644#[serde(rename = "success")]
646 pub success: bool,
647
648#[serde(rename = "username")]
650 pub username: String,
651
652}
653
654
655impl AuthResponseBody {
656 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
657 pub fn new(connection_id: String, remote_address: String, success: bool, username: String, ) -> AuthResponseBody {
658 AuthResponseBody {
659 authenticated_username: None,
660 client_version: None,
661 connection_id,
662 environment: None,
663 files: None,
664 metadata: None,
665 remote_address,
666 success,
667 username,
668 }
669 }
670}
671
672impl std::string::ToString for AuthResponseBody {
676 fn to_string(&self) -> String {
677 let params: Vec<Option<String>> = vec![
678
679 self.authenticated_username.as_ref().map(|authenticated_username| {
680 [
681 "authenticatedUsername".to_string(),
682 authenticated_username.to_string(),
683 ].join(",")
684 }),
685
686
687 self.client_version.as_ref().map(|client_version| {
688 [
689 "clientVersion".to_string(),
690 client_version.to_string(),
691 ].join(",")
692 }),
693
694
695 Some("connectionId".to_string()),
696 Some(self.connection_id.to_string()),
697
698 Some("remoteAddress".to_string()),
709 Some(self.remote_address.to_string()),
710
711
712 Some("success".to_string()),
713 Some(self.success.to_string()),
714
715
716 Some("username".to_string()),
717 Some(self.username.to_string()),
718
719 ];
720
721 params.into_iter().flatten().collect::<Vec<_>>().join(",")
722 }
723}
724
725impl std::str::FromStr for AuthResponseBody {
729 type Err = String;
730
731 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
732 #[derive(Default)]
734 #[allow(dead_code)]
735 struct IntermediateRep {
736 pub authenticated_username: Vec<String>,
737 pub client_version: Vec<String>,
738 pub connection_id: Vec<String>,
739 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
740 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
741 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
742 pub remote_address: Vec<String>,
743 pub success: Vec<bool>,
744 pub username: Vec<String>,
745 }
746
747 let mut intermediate_rep = IntermediateRep::default();
748
749 let mut string_iter = s.split(',');
751 let mut key_result = string_iter.next();
752
753 while key_result.is_some() {
754 let val = match string_iter.next() {
755 Some(x) => x,
756 None => return std::result::Result::Err("Missing value while parsing AuthResponseBody".to_string())
757 };
758
759 if let Some(key) = key_result {
760 #[allow(clippy::match_single_binding)]
761 match key {
762 #[allow(clippy::redundant_clone)]
763 "authenticatedUsername" => intermediate_rep.authenticated_username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
764 #[allow(clippy::redundant_clone)]
765 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
766 #[allow(clippy::redundant_clone)]
767 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
768 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthResponseBody".to_string()),
769 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthResponseBody".to_string()),
770 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthResponseBody".to_string()),
771 #[allow(clippy::redundant_clone)]
772 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
773 #[allow(clippy::redundant_clone)]
774 "success" => intermediate_rep.success.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
775 #[allow(clippy::redundant_clone)]
776 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
777 _ => return std::result::Result::Err("Unexpected key while parsing AuthResponseBody".to_string())
778 }
779 }
780
781 key_result = string_iter.next();
783 }
784
785 std::result::Result::Ok(AuthResponseBody {
787 authenticated_username: intermediate_rep.authenticated_username.into_iter().next(),
788 client_version: intermediate_rep.client_version.into_iter().next(),
789 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in AuthResponseBody".to_string())?,
790 environment: intermediate_rep.environment.into_iter().next(),
791 files: intermediate_rep.files.into_iter().next(),
792 metadata: intermediate_rep.metadata.into_iter().next(),
793 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in AuthResponseBody".to_string())?,
794 success: intermediate_rep.success.into_iter().next().ok_or_else(|| "success missing in AuthResponseBody".to_string())?,
795 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in AuthResponseBody".to_string())?,
796 })
797 }
798}
799
800#[cfg(feature = "server")]
803impl std::convert::TryFrom<header::IntoHeaderValue<AuthResponseBody>> for HeaderValue {
804 type Error = String;
805
806 fn try_from(hdr_value: header::IntoHeaderValue<AuthResponseBody>) -> std::result::Result<Self, Self::Error> {
807 let hdr_value = hdr_value.to_string();
808 match HeaderValue::from_str(&hdr_value) {
809 std::result::Result::Ok(value) => std::result::Result::Ok(value),
810 std::result::Result::Err(e) => std::result::Result::Err(
811 format!("Invalid header value for AuthResponseBody - value: {} is invalid {}",
812 hdr_value, e))
813 }
814 }
815}
816
817#[cfg(feature = "server")]
818impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AuthResponseBody> {
819 type Error = String;
820
821 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
822 match hdr_value.to_str() {
823 std::result::Result::Ok(value) => {
824 match <AuthResponseBody as std::str::FromStr>::from_str(value) {
825 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
826 std::result::Result::Err(err) => std::result::Result::Err(
827 format!("Unable to convert header value '{}' into AuthResponseBody - {}",
828 value, err))
829 }
830 },
831 std::result::Result::Err(e) => std::result::Result::Err(
832 format!("Unable to convert header: {:?} to string: {}",
833 hdr_value, e))
834 }
835 }
836}
837
838
839
840
841#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
846#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
847pub struct AuthenticateOkBody {
848#[serde(rename = "IdentityToken")]
850 pub identity_token: String,
851
852#[serde(rename = "Status")]
854 pub status: String,
855
856}
857
858
859impl AuthenticateOkBody {
860 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
861 pub fn new(identity_token: String, status: String, ) -> AuthenticateOkBody {
862 AuthenticateOkBody {
863 identity_token,
864 status,
865 }
866 }
867}
868
869impl std::string::ToString for AuthenticateOkBody {
873 fn to_string(&self) -> String {
874 let params: Vec<Option<String>> = vec![
875
876 Some("IdentityToken".to_string()),
877 Some(self.identity_token.to_string()),
878
879
880 Some("Status".to_string()),
881 Some(self.status.to_string()),
882
883 ];
884
885 params.into_iter().flatten().collect::<Vec<_>>().join(",")
886 }
887}
888
889impl std::str::FromStr for AuthenticateOkBody {
893 type Err = String;
894
895 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
896 #[derive(Default)]
898 #[allow(dead_code)]
899 struct IntermediateRep {
900 pub identity_token: Vec<String>,
901 pub status: Vec<String>,
902 }
903
904 let mut intermediate_rep = IntermediateRep::default();
905
906 let mut string_iter = s.split(',');
908 let mut key_result = string_iter.next();
909
910 while key_result.is_some() {
911 let val = match string_iter.next() {
912 Some(x) => x,
913 None => return std::result::Result::Err("Missing value while parsing AuthenticateOkBody".to_string())
914 };
915
916 if let Some(key) = key_result {
917 #[allow(clippy::match_single_binding)]
918 match key {
919 #[allow(clippy::redundant_clone)]
920 "IdentityToken" => intermediate_rep.identity_token.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
921 #[allow(clippy::redundant_clone)]
922 "Status" => intermediate_rep.status.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
923 _ => return std::result::Result::Err("Unexpected key while parsing AuthenticateOkBody".to_string())
924 }
925 }
926
927 key_result = string_iter.next();
929 }
930
931 std::result::Result::Ok(AuthenticateOkBody {
933 identity_token: intermediate_rep.identity_token.into_iter().next().ok_or_else(|| "IdentityToken missing in AuthenticateOkBody".to_string())?,
934 status: intermediate_rep.status.into_iter().next().ok_or_else(|| "Status missing in AuthenticateOkBody".to_string())?,
935 })
936 }
937}
938
939#[cfg(feature = "server")]
942impl std::convert::TryFrom<header::IntoHeaderValue<AuthenticateOkBody>> for HeaderValue {
943 type Error = String;
944
945 fn try_from(hdr_value: header::IntoHeaderValue<AuthenticateOkBody>) -> std::result::Result<Self, Self::Error> {
946 let hdr_value = hdr_value.to_string();
947 match HeaderValue::from_str(&hdr_value) {
948 std::result::Result::Ok(value) => std::result::Result::Ok(value),
949 std::result::Result::Err(e) => std::result::Result::Err(
950 format!("Invalid header value for AuthenticateOkBody - value: {} is invalid {}",
951 hdr_value, e))
952 }
953 }
954}
955
956#[cfg(feature = "server")]
957impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AuthenticateOkBody> {
958 type Error = String;
959
960 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
961 match hdr_value.to_str() {
962 std::result::Result::Ok(value) => {
963 match <AuthenticateOkBody as std::str::FromStr>::from_str(value) {
964 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
965 std::result::Result::Err(err) => std::result::Result::Err(
966 format!("Unable to convert header value '{}' into AuthenticateOkBody - {}",
967 value, err))
968 }
969 },
970 std::result::Result::Err(e) => std::result::Result::Err(
971 format!("Unable to convert header: {:?} to string: {}",
972 hdr_value, e))
973 }
974 }
975}
976
977
978
979
980#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
985#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
986pub struct AuthorizationRequest {
987#[serde(rename = "authenticatedUsername")]
989 #[serde(skip_serializing_if="Option::is_none")]
990 pub authenticated_username: Option<String>,
991
992#[serde(rename = "clientVersion")]
994 #[serde(skip_serializing_if="Option::is_none")]
995 pub client_version: Option<String>,
996
997#[serde(rename = "connectionId")]
999 pub connection_id: String,
1000
1001#[serde(rename = "environment")]
1003 #[serde(skip_serializing_if="Option::is_none")]
1004 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
1005
1006#[serde(rename = "files")]
1008 #[serde(skip_serializing_if="Option::is_none")]
1009 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
1010
1011#[serde(rename = "metadata")]
1013 #[serde(skip_serializing_if="Option::is_none")]
1014 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
1015
1016#[serde(rename = "remoteAddress")]
1018 pub remote_address: String,
1019
1020#[serde(rename = "username")]
1022 pub username: String,
1023
1024}
1025
1026
1027impl AuthorizationRequest {
1028 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
1029 pub fn new(connection_id: String, remote_address: String, username: String, ) -> AuthorizationRequest {
1030 AuthorizationRequest {
1031 authenticated_username: None,
1032 client_version: None,
1033 connection_id,
1034 environment: None,
1035 files: None,
1036 metadata: None,
1037 remote_address,
1038 username,
1039 }
1040 }
1041}
1042
1043impl std::string::ToString for AuthorizationRequest {
1047 fn to_string(&self) -> String {
1048 let params: Vec<Option<String>> = vec![
1049
1050 self.authenticated_username.as_ref().map(|authenticated_username| {
1051 [
1052 "authenticatedUsername".to_string(),
1053 authenticated_username.to_string(),
1054 ].join(",")
1055 }),
1056
1057
1058 self.client_version.as_ref().map(|client_version| {
1059 [
1060 "clientVersion".to_string(),
1061 client_version.to_string(),
1062 ].join(",")
1063 }),
1064
1065
1066 Some("connectionId".to_string()),
1067 Some(self.connection_id.to_string()),
1068
1069 Some("remoteAddress".to_string()),
1080 Some(self.remote_address.to_string()),
1081
1082
1083 Some("username".to_string()),
1084 Some(self.username.to_string()),
1085
1086 ];
1087
1088 params.into_iter().flatten().collect::<Vec<_>>().join(",")
1089 }
1090}
1091
1092impl std::str::FromStr for AuthorizationRequest {
1096 type Err = String;
1097
1098 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1099 #[derive(Default)]
1101 #[allow(dead_code)]
1102 struct IntermediateRep {
1103 pub authenticated_username: Vec<String>,
1104 pub client_version: Vec<String>,
1105 pub connection_id: Vec<String>,
1106 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
1107 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
1108 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
1109 pub remote_address: Vec<String>,
1110 pub username: Vec<String>,
1111 }
1112
1113 let mut intermediate_rep = IntermediateRep::default();
1114
1115 let mut string_iter = s.split(',');
1117 let mut key_result = string_iter.next();
1118
1119 while key_result.is_some() {
1120 let val = match string_iter.next() {
1121 Some(x) => x,
1122 None => return std::result::Result::Err("Missing value while parsing AuthorizationRequest".to_string())
1123 };
1124
1125 if let Some(key) = key_result {
1126 #[allow(clippy::match_single_binding)]
1127 match key {
1128 #[allow(clippy::redundant_clone)]
1129 "authenticatedUsername" => intermediate_rep.authenticated_username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1130 #[allow(clippy::redundant_clone)]
1131 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1132 #[allow(clippy::redundant_clone)]
1133 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1134 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthorizationRequest".to_string()),
1135 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthorizationRequest".to_string()),
1136 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in AuthorizationRequest".to_string()),
1137 #[allow(clippy::redundant_clone)]
1138 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1139 #[allow(clippy::redundant_clone)]
1140 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1141 _ => return std::result::Result::Err("Unexpected key while parsing AuthorizationRequest".to_string())
1142 }
1143 }
1144
1145 key_result = string_iter.next();
1147 }
1148
1149 std::result::Result::Ok(AuthorizationRequest {
1151 authenticated_username: intermediate_rep.authenticated_username.into_iter().next(),
1152 client_version: intermediate_rep.client_version.into_iter().next(),
1153 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in AuthorizationRequest".to_string())?,
1154 environment: intermediate_rep.environment.into_iter().next(),
1155 files: intermediate_rep.files.into_iter().next(),
1156 metadata: intermediate_rep.metadata.into_iter().next(),
1157 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in AuthorizationRequest".to_string())?,
1158 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in AuthorizationRequest".to_string())?,
1159 })
1160 }
1161}
1162
1163#[cfg(feature = "server")]
1166impl std::convert::TryFrom<header::IntoHeaderValue<AuthorizationRequest>> for HeaderValue {
1167 type Error = String;
1168
1169 fn try_from(hdr_value: header::IntoHeaderValue<AuthorizationRequest>) -> std::result::Result<Self, Self::Error> {
1170 let hdr_value = hdr_value.to_string();
1171 match HeaderValue::from_str(&hdr_value) {
1172 std::result::Result::Ok(value) => std::result::Result::Ok(value),
1173 std::result::Result::Err(e) => std::result::Result::Err(
1174 format!("Invalid header value for AuthorizationRequest - value: {} is invalid {}",
1175 hdr_value, e))
1176 }
1177 }
1178}
1179
1180#[cfg(feature = "server")]
1181impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AuthorizationRequest> {
1182 type Error = String;
1183
1184 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
1185 match hdr_value.to_str() {
1186 std::result::Result::Ok(value) => {
1187 match <AuthorizationRequest as std::str::FromStr>::from_str(value) {
1188 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
1189 std::result::Result::Err(err) => std::result::Result::Err(
1190 format!("Unable to convert header value '{}' into AuthorizationRequest - {}",
1191 value, err))
1192 }
1193 },
1194 std::result::Result::Err(e) => std::result::Result::Err(
1195 format!("Unable to convert header: {:?} to string: {}",
1196 hdr_value, e))
1197 }
1198 }
1199}
1200
1201
1202
1203
1204#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
1209#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1210pub struct AwsElasticBlockStoreVolumeSource {
1211#[serde(rename = "fsType")]
1213 #[serde(skip_serializing_if="Option::is_none")]
1214 pub fs_type: Option<String>,
1215
1216#[serde(rename = "partition")]
1218 #[serde(skip_serializing_if="Option::is_none")]
1219 pub partition: Option<i32>,
1220
1221#[serde(rename = "readOnly")]
1223 #[serde(skip_serializing_if="Option::is_none")]
1224 pub read_only: Option<bool>,
1225
1226#[serde(rename = "volumeID")]
1228 #[serde(skip_serializing_if="Option::is_none")]
1229 pub volume_id: Option<String>,
1230
1231}
1232
1233
1234impl AwsElasticBlockStoreVolumeSource {
1235 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
1236 pub fn new() -> AwsElasticBlockStoreVolumeSource {
1237 AwsElasticBlockStoreVolumeSource {
1238 fs_type: None,
1239 partition: None,
1240 read_only: None,
1241 volume_id: None,
1242 }
1243 }
1244}
1245
1246impl std::string::ToString for AwsElasticBlockStoreVolumeSource {
1250 fn to_string(&self) -> String {
1251 let params: Vec<Option<String>> = vec![
1252
1253 self.fs_type.as_ref().map(|fs_type| {
1254 [
1255 "fsType".to_string(),
1256 fs_type.to_string(),
1257 ].join(",")
1258 }),
1259
1260
1261 self.partition.as_ref().map(|partition| {
1262 [
1263 "partition".to_string(),
1264 partition.to_string(),
1265 ].join(",")
1266 }),
1267
1268
1269 self.read_only.as_ref().map(|read_only| {
1270 [
1271 "readOnly".to_string(),
1272 read_only.to_string(),
1273 ].join(",")
1274 }),
1275
1276
1277 self.volume_id.as_ref().map(|volume_id| {
1278 [
1279 "volumeID".to_string(),
1280 volume_id.to_string(),
1281 ].join(",")
1282 }),
1283
1284 ];
1285
1286 params.into_iter().flatten().collect::<Vec<_>>().join(",")
1287 }
1288}
1289
1290impl std::str::FromStr for AwsElasticBlockStoreVolumeSource {
1294 type Err = String;
1295
1296 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1297 #[derive(Default)]
1299 #[allow(dead_code)]
1300 struct IntermediateRep {
1301 pub fs_type: Vec<String>,
1302 pub partition: Vec<i32>,
1303 pub read_only: Vec<bool>,
1304 pub volume_id: Vec<String>,
1305 }
1306
1307 let mut intermediate_rep = IntermediateRep::default();
1308
1309 let mut string_iter = s.split(',');
1311 let mut key_result = string_iter.next();
1312
1313 while key_result.is_some() {
1314 let val = match string_iter.next() {
1315 Some(x) => x,
1316 None => return std::result::Result::Err("Missing value while parsing AwsElasticBlockStoreVolumeSource".to_string())
1317 };
1318
1319 if let Some(key) = key_result {
1320 #[allow(clippy::match_single_binding)]
1321 match key {
1322 #[allow(clippy::redundant_clone)]
1323 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1324 #[allow(clippy::redundant_clone)]
1325 "partition" => intermediate_rep.partition.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1326 #[allow(clippy::redundant_clone)]
1327 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1328 #[allow(clippy::redundant_clone)]
1329 "volumeID" => intermediate_rep.volume_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1330 _ => return std::result::Result::Err("Unexpected key while parsing AwsElasticBlockStoreVolumeSource".to_string())
1331 }
1332 }
1333
1334 key_result = string_iter.next();
1336 }
1337
1338 std::result::Result::Ok(AwsElasticBlockStoreVolumeSource {
1340 fs_type: intermediate_rep.fs_type.into_iter().next(),
1341 partition: intermediate_rep.partition.into_iter().next(),
1342 read_only: intermediate_rep.read_only.into_iter().next(),
1343 volume_id: intermediate_rep.volume_id.into_iter().next(),
1344 })
1345 }
1346}
1347
1348#[cfg(feature = "server")]
1351impl std::convert::TryFrom<header::IntoHeaderValue<AwsElasticBlockStoreVolumeSource>> for HeaderValue {
1352 type Error = String;
1353
1354 fn try_from(hdr_value: header::IntoHeaderValue<AwsElasticBlockStoreVolumeSource>) -> std::result::Result<Self, Self::Error> {
1355 let hdr_value = hdr_value.to_string();
1356 match HeaderValue::from_str(&hdr_value) {
1357 std::result::Result::Ok(value) => std::result::Result::Ok(value),
1358 std::result::Result::Err(e) => std::result::Result::Err(
1359 format!("Invalid header value for AwsElasticBlockStoreVolumeSource - value: {} is invalid {}",
1360 hdr_value, e))
1361 }
1362 }
1363}
1364
1365#[cfg(feature = "server")]
1366impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AwsElasticBlockStoreVolumeSource> {
1367 type Error = String;
1368
1369 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
1370 match hdr_value.to_str() {
1371 std::result::Result::Ok(value) => {
1372 match <AwsElasticBlockStoreVolumeSource as std::str::FromStr>::from_str(value) {
1373 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
1374 std::result::Result::Err(err) => std::result::Result::Err(
1375 format!("Unable to convert header value '{}' into AwsElasticBlockStoreVolumeSource - {}",
1376 value, err))
1377 }
1378 },
1379 std::result::Result::Err(e) => std::result::Result::Err(
1380 format!("Unable to convert header: {:?} to string: {}",
1381 hdr_value, e))
1382 }
1383 }
1384}
1385
1386
1387
1388
1389#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
1391#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1392pub struct AzureDataDiskCachingMode(String);
1393
1394impl validator::Validate for AzureDataDiskCachingMode {
1395 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
1396 std::result::Result::Ok(())
1397 }
1398}
1399
1400impl std::convert::From<String> for AzureDataDiskCachingMode {
1401 fn from(x: String) -> Self {
1402 AzureDataDiskCachingMode(x)
1403 }
1404}
1405
1406impl std::string::ToString for AzureDataDiskCachingMode {
1407 fn to_string(&self) -> String {
1408 self.0.to_string()
1409 }
1410}
1411
1412impl std::str::FromStr for AzureDataDiskCachingMode {
1413 type Err = std::string::ParseError;
1414 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
1415 std::result::Result::Ok(AzureDataDiskCachingMode(x.to_string()))
1416 }
1417}
1418
1419impl std::convert::From<AzureDataDiskCachingMode> for String {
1420 fn from(x: AzureDataDiskCachingMode) -> Self {
1421 x.0
1422 }
1423}
1424
1425impl std::ops::Deref for AzureDataDiskCachingMode {
1426 type Target = String;
1427 fn deref(&self) -> &String {
1428 &self.0
1429 }
1430}
1431
1432impl std::ops::DerefMut for AzureDataDiskCachingMode {
1433 fn deref_mut(&mut self) -> &mut String {
1434 &mut self.0
1435 }
1436}
1437
1438
1439
1440#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
1442#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1443pub struct AzureDataDiskKind(String);
1444
1445impl validator::Validate for AzureDataDiskKind {
1446 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
1447 std::result::Result::Ok(())
1448 }
1449}
1450
1451impl std::convert::From<String> for AzureDataDiskKind {
1452 fn from(x: String) -> Self {
1453 AzureDataDiskKind(x)
1454 }
1455}
1456
1457impl std::string::ToString for AzureDataDiskKind {
1458 fn to_string(&self) -> String {
1459 self.0.to_string()
1460 }
1461}
1462
1463impl std::str::FromStr for AzureDataDiskKind {
1464 type Err = std::string::ParseError;
1465 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
1466 std::result::Result::Ok(AzureDataDiskKind(x.to_string()))
1467 }
1468}
1469
1470impl std::convert::From<AzureDataDiskKind> for String {
1471 fn from(x: AzureDataDiskKind) -> Self {
1472 x.0
1473 }
1474}
1475
1476impl std::ops::Deref for AzureDataDiskKind {
1477 type Target = String;
1478 fn deref(&self) -> &String {
1479 &self.0
1480 }
1481}
1482
1483impl std::ops::DerefMut for AzureDataDiskKind {
1484 fn deref_mut(&mut self) -> &mut String {
1485 &mut self.0
1486 }
1487}
1488
1489
1490
1491
1492
1493
1494#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
1495#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1496pub struct AzureDiskVolumeSource {
1497#[serde(rename = "cachingMode")]
1499 #[serde(skip_serializing_if="Option::is_none")]
1500 pub caching_mode: Option<String>,
1501
1502#[serde(rename = "diskName")]
1504 #[serde(skip_serializing_if="Option::is_none")]
1505 pub disk_name: Option<String>,
1506
1507#[serde(rename = "diskURI")]
1509 #[serde(skip_serializing_if="Option::is_none")]
1510 pub disk_uri: Option<String>,
1511
1512#[serde(rename = "fsType")]
1514 #[serde(skip_serializing_if="Option::is_none")]
1515 pub fs_type: Option<String>,
1516
1517#[serde(rename = "kind")]
1519 #[serde(skip_serializing_if="Option::is_none")]
1520 pub kind: Option<String>,
1521
1522#[serde(rename = "readOnly")]
1524 #[serde(skip_serializing_if="Option::is_none")]
1525 pub read_only: Option<bool>,
1526
1527}
1528
1529
1530impl AzureDiskVolumeSource {
1531 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
1532 pub fn new() -> AzureDiskVolumeSource {
1533 AzureDiskVolumeSource {
1534 caching_mode: None,
1535 disk_name: None,
1536 disk_uri: None,
1537 fs_type: None,
1538 kind: None,
1539 read_only: None,
1540 }
1541 }
1542}
1543
1544impl std::string::ToString for AzureDiskVolumeSource {
1548 fn to_string(&self) -> String {
1549 let params: Vec<Option<String>> = vec![
1550
1551 self.caching_mode.as_ref().map(|caching_mode| {
1552 [
1553 "cachingMode".to_string(),
1554 caching_mode.to_string(),
1555 ].join(",")
1556 }),
1557
1558
1559 self.disk_name.as_ref().map(|disk_name| {
1560 [
1561 "diskName".to_string(),
1562 disk_name.to_string(),
1563 ].join(",")
1564 }),
1565
1566
1567 self.disk_uri.as_ref().map(|disk_uri| {
1568 [
1569 "diskURI".to_string(),
1570 disk_uri.to_string(),
1571 ].join(",")
1572 }),
1573
1574
1575 self.fs_type.as_ref().map(|fs_type| {
1576 [
1577 "fsType".to_string(),
1578 fs_type.to_string(),
1579 ].join(",")
1580 }),
1581
1582
1583 self.kind.as_ref().map(|kind| {
1584 [
1585 "kind".to_string(),
1586 kind.to_string(),
1587 ].join(",")
1588 }),
1589
1590
1591 self.read_only.as_ref().map(|read_only| {
1592 [
1593 "readOnly".to_string(),
1594 read_only.to_string(),
1595 ].join(",")
1596 }),
1597
1598 ];
1599
1600 params.into_iter().flatten().collect::<Vec<_>>().join(",")
1601 }
1602}
1603
1604impl std::str::FromStr for AzureDiskVolumeSource {
1608 type Err = String;
1609
1610 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1611 #[derive(Default)]
1613 #[allow(dead_code)]
1614 struct IntermediateRep {
1615 pub caching_mode: Vec<String>,
1616 pub disk_name: Vec<String>,
1617 pub disk_uri: Vec<String>,
1618 pub fs_type: Vec<String>,
1619 pub kind: Vec<String>,
1620 pub read_only: Vec<bool>,
1621 }
1622
1623 let mut intermediate_rep = IntermediateRep::default();
1624
1625 let mut string_iter = s.split(',');
1627 let mut key_result = string_iter.next();
1628
1629 while key_result.is_some() {
1630 let val = match string_iter.next() {
1631 Some(x) => x,
1632 None => return std::result::Result::Err("Missing value while parsing AzureDiskVolumeSource".to_string())
1633 };
1634
1635 if let Some(key) = key_result {
1636 #[allow(clippy::match_single_binding)]
1637 match key {
1638 #[allow(clippy::redundant_clone)]
1639 "cachingMode" => intermediate_rep.caching_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1640 #[allow(clippy::redundant_clone)]
1641 "diskName" => intermediate_rep.disk_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1642 #[allow(clippy::redundant_clone)]
1643 "diskURI" => intermediate_rep.disk_uri.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1644 #[allow(clippy::redundant_clone)]
1645 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1646 #[allow(clippy::redundant_clone)]
1647 "kind" => intermediate_rep.kind.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1648 #[allow(clippy::redundant_clone)]
1649 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1650 _ => return std::result::Result::Err("Unexpected key while parsing AzureDiskVolumeSource".to_string())
1651 }
1652 }
1653
1654 key_result = string_iter.next();
1656 }
1657
1658 std::result::Result::Ok(AzureDiskVolumeSource {
1660 caching_mode: intermediate_rep.caching_mode.into_iter().next(),
1661 disk_name: intermediate_rep.disk_name.into_iter().next(),
1662 disk_uri: intermediate_rep.disk_uri.into_iter().next(),
1663 fs_type: intermediate_rep.fs_type.into_iter().next(),
1664 kind: intermediate_rep.kind.into_iter().next(),
1665 read_only: intermediate_rep.read_only.into_iter().next(),
1666 })
1667 }
1668}
1669
1670#[cfg(feature = "server")]
1673impl std::convert::TryFrom<header::IntoHeaderValue<AzureDiskVolumeSource>> for HeaderValue {
1674 type Error = String;
1675
1676 fn try_from(hdr_value: header::IntoHeaderValue<AzureDiskVolumeSource>) -> std::result::Result<Self, Self::Error> {
1677 let hdr_value = hdr_value.to_string();
1678 match HeaderValue::from_str(&hdr_value) {
1679 std::result::Result::Ok(value) => std::result::Result::Ok(value),
1680 std::result::Result::Err(e) => std::result::Result::Err(
1681 format!("Invalid header value for AzureDiskVolumeSource - value: {} is invalid {}",
1682 hdr_value, e))
1683 }
1684 }
1685}
1686
1687#[cfg(feature = "server")]
1688impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AzureDiskVolumeSource> {
1689 type Error = String;
1690
1691 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
1692 match hdr_value.to_str() {
1693 std::result::Result::Ok(value) => {
1694 match <AzureDiskVolumeSource as std::str::FromStr>::from_str(value) {
1695 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
1696 std::result::Result::Err(err) => std::result::Result::Err(
1697 format!("Unable to convert header value '{}' into AzureDiskVolumeSource - {}",
1698 value, err))
1699 }
1700 },
1701 std::result::Result::Err(e) => std::result::Result::Err(
1702 format!("Unable to convert header: {:?} to string: {}",
1703 hdr_value, e))
1704 }
1705 }
1706}
1707
1708
1709
1710
1711
1712
1713
1714#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
1715#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1716pub struct AzureFileVolumeSource {
1717#[serde(rename = "readOnly")]
1719 #[serde(skip_serializing_if="Option::is_none")]
1720 pub read_only: Option<bool>,
1721
1722#[serde(rename = "secretName")]
1724 #[serde(skip_serializing_if="Option::is_none")]
1725 pub secret_name: Option<String>,
1726
1727#[serde(rename = "shareName")]
1729 #[serde(skip_serializing_if="Option::is_none")]
1730 pub share_name: Option<String>,
1731
1732}
1733
1734
1735impl AzureFileVolumeSource {
1736 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
1737 pub fn new() -> AzureFileVolumeSource {
1738 AzureFileVolumeSource {
1739 read_only: None,
1740 secret_name: None,
1741 share_name: None,
1742 }
1743 }
1744}
1745
1746impl std::string::ToString for AzureFileVolumeSource {
1750 fn to_string(&self) -> String {
1751 let params: Vec<Option<String>> = vec![
1752
1753 self.read_only.as_ref().map(|read_only| {
1754 [
1755 "readOnly".to_string(),
1756 read_only.to_string(),
1757 ].join(",")
1758 }),
1759
1760
1761 self.secret_name.as_ref().map(|secret_name| {
1762 [
1763 "secretName".to_string(),
1764 secret_name.to_string(),
1765 ].join(",")
1766 }),
1767
1768
1769 self.share_name.as_ref().map(|share_name| {
1770 [
1771 "shareName".to_string(),
1772 share_name.to_string(),
1773 ].join(",")
1774 }),
1775
1776 ];
1777
1778 params.into_iter().flatten().collect::<Vec<_>>().join(",")
1779 }
1780}
1781
1782impl std::str::FromStr for AzureFileVolumeSource {
1786 type Err = String;
1787
1788 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1789 #[derive(Default)]
1791 #[allow(dead_code)]
1792 struct IntermediateRep {
1793 pub read_only: Vec<bool>,
1794 pub secret_name: Vec<String>,
1795 pub share_name: Vec<String>,
1796 }
1797
1798 let mut intermediate_rep = IntermediateRep::default();
1799
1800 let mut string_iter = s.split(',');
1802 let mut key_result = string_iter.next();
1803
1804 while key_result.is_some() {
1805 let val = match string_iter.next() {
1806 Some(x) => x,
1807 None => return std::result::Result::Err("Missing value while parsing AzureFileVolumeSource".to_string())
1808 };
1809
1810 if let Some(key) = key_result {
1811 #[allow(clippy::match_single_binding)]
1812 match key {
1813 #[allow(clippy::redundant_clone)]
1814 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1815 #[allow(clippy::redundant_clone)]
1816 "secretName" => intermediate_rep.secret_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1817 #[allow(clippy::redundant_clone)]
1818 "shareName" => intermediate_rep.share_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
1819 _ => return std::result::Result::Err("Unexpected key while parsing AzureFileVolumeSource".to_string())
1820 }
1821 }
1822
1823 key_result = string_iter.next();
1825 }
1826
1827 std::result::Result::Ok(AzureFileVolumeSource {
1829 read_only: intermediate_rep.read_only.into_iter().next(),
1830 secret_name: intermediate_rep.secret_name.into_iter().next(),
1831 share_name: intermediate_rep.share_name.into_iter().next(),
1832 })
1833 }
1834}
1835
1836#[cfg(feature = "server")]
1839impl std::convert::TryFrom<header::IntoHeaderValue<AzureFileVolumeSource>> for HeaderValue {
1840 type Error = String;
1841
1842 fn try_from(hdr_value: header::IntoHeaderValue<AzureFileVolumeSource>) -> std::result::Result<Self, Self::Error> {
1843 let hdr_value = hdr_value.to_string();
1844 match HeaderValue::from_str(&hdr_value) {
1845 std::result::Result::Ok(value) => std::result::Result::Ok(value),
1846 std::result::Result::Err(e) => std::result::Result::Err(
1847 format!("Invalid header value for AzureFileVolumeSource - value: {} is invalid {}",
1848 hdr_value, e))
1849 }
1850 }
1851}
1852
1853#[cfg(feature = "server")]
1854impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<AzureFileVolumeSource> {
1855 type Error = String;
1856
1857 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
1858 match hdr_value.to_str() {
1859 std::result::Result::Ok(value) => {
1860 match <AzureFileVolumeSource as std::str::FromStr>::from_str(value) {
1861 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
1862 std::result::Result::Err(err) => std::result::Result::Err(
1863 format!("Unable to convert header value '{}' into AzureFileVolumeSource - {}",
1864 value, err))
1865 }
1866 },
1867 std::result::Result::Err(e) => std::result::Result::Err(
1868 format!("Unable to convert header: {:?} to string: {}",
1869 hdr_value, e))
1870 }
1871 }
1872}
1873
1874
1875
1876
1877#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
1878#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1879pub struct Backend(String);
1880
1881impl validator::Validate for Backend {
1882 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
1883 std::result::Result::Ok(())
1884 }
1885}
1886
1887impl std::convert::From<String> for Backend {
1888 fn from(x: String) -> Self {
1889 Backend(x)
1890 }
1891}
1892
1893impl std::string::ToString for Backend {
1894 fn to_string(&self) -> String {
1895 self.0.to_string()
1896 }
1897}
1898
1899impl std::str::FromStr for Backend {
1900 type Err = std::string::ParseError;
1901 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
1902 std::result::Result::Ok(Backend(x.to_string()))
1903 }
1904}
1905
1906impl std::convert::From<Backend> for String {
1907 fn from(x: Backend) -> Self {
1908 x.0
1909 }
1910}
1911
1912impl std::ops::Deref for Backend {
1913 type Target = String;
1914 fn deref(&self) -> &String {
1915 &self.0
1916 }
1917}
1918
1919impl std::ops::DerefMut for Backend {
1920 fn deref_mut(&mut self) -> &mut String {
1921 &mut self.0
1922 }
1923}
1924
1925
1926
1927
1928
1929
1930#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
1931#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
1932pub struct BinaryMetadataValue {
1933#[serde(rename = "sensitive")]
1935 #[serde(skip_serializing_if="Option::is_none")]
1936 pub sensitive: Option<bool>,
1937
1938#[serde(rename = "value")]
1940 pub value: Vec<i32>,
1941
1942}
1943
1944
1945impl BinaryMetadataValue {
1946 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
1947 pub fn new(value: Vec<i32>, ) -> BinaryMetadataValue {
1948 BinaryMetadataValue {
1949 sensitive: None,
1950 value,
1951 }
1952 }
1953}
1954
1955impl std::string::ToString for BinaryMetadataValue {
1959 fn to_string(&self) -> String {
1960 let params: Vec<Option<String>> = vec![
1961
1962 self.sensitive.as_ref().map(|sensitive| {
1963 [
1964 "sensitive".to_string(),
1965 sensitive.to_string(),
1966 ].join(",")
1967 }),
1968
1969
1970 Some("value".to_string()),
1971 Some(self.value.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
1972
1973 ];
1974
1975 params.into_iter().flatten().collect::<Vec<_>>().join(",")
1976 }
1977}
1978
1979impl std::str::FromStr for BinaryMetadataValue {
1983 type Err = String;
1984
1985 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
1986 #[derive(Default)]
1988 #[allow(dead_code)]
1989 struct IntermediateRep {
1990 pub sensitive: Vec<bool>,
1991 pub value: Vec<Vec<i32>>,
1992 }
1993
1994 let mut intermediate_rep = IntermediateRep::default();
1995
1996 let mut string_iter = s.split(',');
1998 let mut key_result = string_iter.next();
1999
2000 while key_result.is_some() {
2001 let val = match string_iter.next() {
2002 Some(x) => x,
2003 None => return std::result::Result::Err("Missing value while parsing BinaryMetadataValue".to_string())
2004 };
2005
2006 if let Some(key) = key_result {
2007 #[allow(clippy::match_single_binding)]
2008 match key {
2009 #[allow(clippy::redundant_clone)]
2010 "sensitive" => intermediate_rep.sensitive.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2011 "value" => return std::result::Result::Err("Parsing a container in this style is not supported in BinaryMetadataValue".to_string()),
2012 _ => return std::result::Result::Err("Unexpected key while parsing BinaryMetadataValue".to_string())
2013 }
2014 }
2015
2016 key_result = string_iter.next();
2018 }
2019
2020 std::result::Result::Ok(BinaryMetadataValue {
2022 sensitive: intermediate_rep.sensitive.into_iter().next(),
2023 value: intermediate_rep.value.into_iter().next().ok_or_else(|| "value missing in BinaryMetadataValue".to_string())?,
2024 })
2025 }
2026}
2027
2028#[cfg(feature = "server")]
2031impl std::convert::TryFrom<header::IntoHeaderValue<BinaryMetadataValue>> for HeaderValue {
2032 type Error = String;
2033
2034 fn try_from(hdr_value: header::IntoHeaderValue<BinaryMetadataValue>) -> std::result::Result<Self, Self::Error> {
2035 let hdr_value = hdr_value.to_string();
2036 match HeaderValue::from_str(&hdr_value) {
2037 std::result::Result::Ok(value) => std::result::Result::Ok(value),
2038 std::result::Result::Err(e) => std::result::Result::Err(
2039 format!("Invalid header value for BinaryMetadataValue - value: {} is invalid {}",
2040 hdr_value, e))
2041 }
2042 }
2043}
2044
2045#[cfg(feature = "server")]
2046impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<BinaryMetadataValue> {
2047 type Error = String;
2048
2049 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
2050 match hdr_value.to_str() {
2051 std::result::Result::Ok(value) => {
2052 match <BinaryMetadataValue as std::str::FromStr>::from_str(value) {
2053 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
2054 std::result::Result::Err(err) => std::result::Result::Err(
2055 format!("Unable to convert header value '{}' into BinaryMetadataValue - {}",
2056 value, err))
2057 }
2058 },
2059 std::result::Result::Err(e) => std::result::Result::Err(
2060 format!("Unable to convert header: {:?} to string: {}",
2061 hdr_value, e))
2062 }
2063 }
2064}
2065
2066
2067
2068
2069
2070
2071
2072#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
2073#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2074pub struct BindOptions {
2075 #[serde(rename = "NonRecursive")]
2076 #[serde(skip_serializing_if="Option::is_none")]
2077 pub non_recursive: Option<bool>,
2078
2079 #[serde(rename = "Propagation")]
2080 #[serde(skip_serializing_if="Option::is_none")]
2081 pub propagation: Option<String>,
2082
2083}
2084
2085
2086impl BindOptions {
2087 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
2088 pub fn new() -> BindOptions {
2089 BindOptions {
2090 non_recursive: None,
2091 propagation: None,
2092 }
2093 }
2094}
2095
2096impl std::string::ToString for BindOptions {
2100 fn to_string(&self) -> String {
2101 let params: Vec<Option<String>> = vec![
2102
2103 self.non_recursive.as_ref().map(|non_recursive| {
2104 [
2105 "NonRecursive".to_string(),
2106 non_recursive.to_string(),
2107 ].join(",")
2108 }),
2109
2110
2111 self.propagation.as_ref().map(|propagation| {
2112 [
2113 "Propagation".to_string(),
2114 propagation.to_string(),
2115 ].join(",")
2116 }),
2117
2118 ];
2119
2120 params.into_iter().flatten().collect::<Vec<_>>().join(",")
2121 }
2122}
2123
2124impl std::str::FromStr for BindOptions {
2128 type Err = String;
2129
2130 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
2131 #[derive(Default)]
2133 #[allow(dead_code)]
2134 struct IntermediateRep {
2135 pub non_recursive: Vec<bool>,
2136 pub propagation: Vec<String>,
2137 }
2138
2139 let mut intermediate_rep = IntermediateRep::default();
2140
2141 let mut string_iter = s.split(',');
2143 let mut key_result = string_iter.next();
2144
2145 while key_result.is_some() {
2146 let val = match string_iter.next() {
2147 Some(x) => x,
2148 None => return std::result::Result::Err("Missing value while parsing BindOptions".to_string())
2149 };
2150
2151 if let Some(key) = key_result {
2152 #[allow(clippy::match_single_binding)]
2153 match key {
2154 #[allow(clippy::redundant_clone)]
2155 "NonRecursive" => intermediate_rep.non_recursive.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2156 #[allow(clippy::redundant_clone)]
2157 "Propagation" => intermediate_rep.propagation.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2158 _ => return std::result::Result::Err("Unexpected key while parsing BindOptions".to_string())
2159 }
2160 }
2161
2162 key_result = string_iter.next();
2164 }
2165
2166 std::result::Result::Ok(BindOptions {
2168 non_recursive: intermediate_rep.non_recursive.into_iter().next(),
2169 propagation: intermediate_rep.propagation.into_iter().next(),
2170 })
2171 }
2172}
2173
2174#[cfg(feature = "server")]
2177impl std::convert::TryFrom<header::IntoHeaderValue<BindOptions>> for HeaderValue {
2178 type Error = String;
2179
2180 fn try_from(hdr_value: header::IntoHeaderValue<BindOptions>) -> std::result::Result<Self, Self::Error> {
2181 let hdr_value = hdr_value.to_string();
2182 match HeaderValue::from_str(&hdr_value) {
2183 std::result::Result::Ok(value) => std::result::Result::Ok(value),
2184 std::result::Result::Err(e) => std::result::Result::Err(
2185 format!("Invalid header value for BindOptions - value: {} is invalid {}",
2186 hdr_value, e))
2187 }
2188 }
2189}
2190
2191#[cfg(feature = "server")]
2192impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<BindOptions> {
2193 type Error = String;
2194
2195 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
2196 match hdr_value.to_str() {
2197 std::result::Result::Ok(value) => {
2198 match <BindOptions as std::str::FromStr>::from_str(value) {
2199 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
2200 std::result::Result::Err(err) => std::result::Result::Err(
2201 format!("Unable to convert header value '{}' into BindOptions - {}",
2202 value, err))
2203 }
2204 },
2205 std::result::Result::Err(e) => std::result::Result::Err(
2206 format!("Unable to convert header: {:?} to string: {}",
2207 hdr_value, e))
2208 }
2209 }
2210}
2211
2212
2213
2214
2215
2216
2217
2218#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
2219#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2220pub struct Capabilities {
2221#[serde(rename = "add")]
2223 #[serde(skip_serializing_if="Option::is_none")]
2224 pub add: Option<Vec<models::Capability>>,
2225
2226#[serde(rename = "drop")]
2228 #[serde(skip_serializing_if="Option::is_none")]
2229 pub drop: Option<Vec<models::Capability>>,
2230
2231}
2232
2233
2234impl Capabilities {
2235 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
2236 pub fn new() -> Capabilities {
2237 Capabilities {
2238 add: None,
2239 drop: None,
2240 }
2241 }
2242}
2243
2244impl std::string::ToString for Capabilities {
2248 fn to_string(&self) -> String {
2249 let params: Vec<Option<String>> = vec![
2250
2251 self.add.as_ref().map(|add| {
2252 [
2253 "add".to_string(),
2254 add.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
2255 ].join(",")
2256 }),
2257
2258
2259 self.drop.as_ref().map(|drop| {
2260 [
2261 "drop".to_string(),
2262 drop.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
2263 ].join(",")
2264 }),
2265
2266 ];
2267
2268 params.into_iter().flatten().collect::<Vec<_>>().join(",")
2269 }
2270}
2271
2272impl std::str::FromStr for Capabilities {
2276 type Err = String;
2277
2278 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
2279 #[derive(Default)]
2281 #[allow(dead_code)]
2282 struct IntermediateRep {
2283 pub add: Vec<Vec<models::Capability>>,
2284 pub drop: Vec<Vec<models::Capability>>,
2285 }
2286
2287 let mut intermediate_rep = IntermediateRep::default();
2288
2289 let mut string_iter = s.split(',');
2291 let mut key_result = string_iter.next();
2292
2293 while key_result.is_some() {
2294 let val = match string_iter.next() {
2295 Some(x) => x,
2296 None => return std::result::Result::Err("Missing value while parsing Capabilities".to_string())
2297 };
2298
2299 if let Some(key) = key_result {
2300 #[allow(clippy::match_single_binding)]
2301 match key {
2302 "add" => return std::result::Result::Err("Parsing a container in this style is not supported in Capabilities".to_string()),
2303 "drop" => return std::result::Result::Err("Parsing a container in this style is not supported in Capabilities".to_string()),
2304 _ => return std::result::Result::Err("Unexpected key while parsing Capabilities".to_string())
2305 }
2306 }
2307
2308 key_result = string_iter.next();
2310 }
2311
2312 std::result::Result::Ok(Capabilities {
2314 add: intermediate_rep.add.into_iter().next(),
2315 drop: intermediate_rep.drop.into_iter().next(),
2316 })
2317 }
2318}
2319
2320#[cfg(feature = "server")]
2323impl std::convert::TryFrom<header::IntoHeaderValue<Capabilities>> for HeaderValue {
2324 type Error = String;
2325
2326 fn try_from(hdr_value: header::IntoHeaderValue<Capabilities>) -> std::result::Result<Self, Self::Error> {
2327 let hdr_value = hdr_value.to_string();
2328 match HeaderValue::from_str(&hdr_value) {
2329 std::result::Result::Ok(value) => std::result::Result::Ok(value),
2330 std::result::Result::Err(e) => std::result::Result::Err(
2331 format!("Invalid header value for Capabilities - value: {} is invalid {}",
2332 hdr_value, e))
2333 }
2334 }
2335}
2336
2337#[cfg(feature = "server")]
2338impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Capabilities> {
2339 type Error = String;
2340
2341 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
2342 match hdr_value.to_str() {
2343 std::result::Result::Ok(value) => {
2344 match <Capabilities as std::str::FromStr>::from_str(value) {
2345 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
2346 std::result::Result::Err(err) => std::result::Result::Err(
2347 format!("Unable to convert header value '{}' into Capabilities - {}",
2348 value, err))
2349 }
2350 },
2351 std::result::Result::Err(e) => std::result::Result::Err(
2352 format!("Unable to convert header: {:?} to string: {}",
2353 hdr_value, e))
2354 }
2355 }
2356}
2357
2358
2359
2360
2361#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
2363#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2364pub struct Capability(String);
2365
2366impl validator::Validate for Capability {
2367 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
2368 std::result::Result::Ok(())
2369 }
2370}
2371
2372impl std::convert::From<String> for Capability {
2373 fn from(x: String) -> Self {
2374 Capability(x)
2375 }
2376}
2377
2378impl std::string::ToString for Capability {
2379 fn to_string(&self) -> String {
2380 self.0.to_string()
2381 }
2382}
2383
2384impl std::str::FromStr for Capability {
2385 type Err = std::string::ParseError;
2386 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
2387 std::result::Result::Ok(Capability(x.to_string()))
2388 }
2389}
2390
2391impl std::convert::From<Capability> for String {
2392 fn from(x: Capability) -> Self {
2393 x.0
2394 }
2395}
2396
2397impl std::ops::Deref for Capability {
2398 type Target = String;
2399 fn deref(&self) -> &String {
2400 &self.0
2401 }
2402}
2403
2404impl std::ops::DerefMut for Capability {
2405 fn deref_mut(&mut self) -> &mut String {
2406 &mut self.0
2407 }
2408}
2409
2410
2411
2412#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
2417#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2418pub struct CephFsVolumeSource {
2419#[serde(rename = "monitors")]
2421 #[serde(skip_serializing_if="Option::is_none")]
2422 pub monitors: Option<Vec<String>>,
2423
2424#[serde(rename = "path")]
2426 #[serde(skip_serializing_if="Option::is_none")]
2427 pub path: Option<String>,
2428
2429#[serde(rename = "readOnly")]
2431 #[serde(skip_serializing_if="Option::is_none")]
2432 pub read_only: Option<bool>,
2433
2434#[serde(rename = "secretFile")]
2436 #[serde(skip_serializing_if="Option::is_none")]
2437 pub secret_file: Option<String>,
2438
2439 #[serde(rename = "secretRef")]
2440 #[serde(skip_serializing_if="Option::is_none")]
2441 pub secret_ref: Option<models::LocalObjectReference>,
2442
2443#[serde(rename = "user")]
2445 #[serde(skip_serializing_if="Option::is_none")]
2446 pub user: Option<String>,
2447
2448}
2449
2450
2451impl CephFsVolumeSource {
2452 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
2453 pub fn new() -> CephFsVolumeSource {
2454 CephFsVolumeSource {
2455 monitors: None,
2456 path: None,
2457 read_only: None,
2458 secret_file: None,
2459 secret_ref: None,
2460 user: None,
2461 }
2462 }
2463}
2464
2465impl std::string::ToString for CephFsVolumeSource {
2469 fn to_string(&self) -> String {
2470 let params: Vec<Option<String>> = vec![
2471
2472 self.monitors.as_ref().map(|monitors| {
2473 [
2474 "monitors".to_string(),
2475 monitors.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
2476 ].join(",")
2477 }),
2478
2479
2480 self.path.as_ref().map(|path| {
2481 [
2482 "path".to_string(),
2483 path.to_string(),
2484 ].join(",")
2485 }),
2486
2487
2488 self.read_only.as_ref().map(|read_only| {
2489 [
2490 "readOnly".to_string(),
2491 read_only.to_string(),
2492 ].join(",")
2493 }),
2494
2495
2496 self.secret_file.as_ref().map(|secret_file| {
2497 [
2498 "secretFile".to_string(),
2499 secret_file.to_string(),
2500 ].join(",")
2501 }),
2502
2503 self.user.as_ref().map(|user| {
2507 [
2508 "user".to_string(),
2509 user.to_string(),
2510 ].join(",")
2511 }),
2512
2513 ];
2514
2515 params.into_iter().flatten().collect::<Vec<_>>().join(",")
2516 }
2517}
2518
2519impl std::str::FromStr for CephFsVolumeSource {
2523 type Err = String;
2524
2525 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
2526 #[derive(Default)]
2528 #[allow(dead_code)]
2529 struct IntermediateRep {
2530 pub monitors: Vec<Vec<String>>,
2531 pub path: Vec<String>,
2532 pub read_only: Vec<bool>,
2533 pub secret_file: Vec<String>,
2534 pub secret_ref: Vec<models::LocalObjectReference>,
2535 pub user: Vec<String>,
2536 }
2537
2538 let mut intermediate_rep = IntermediateRep::default();
2539
2540 let mut string_iter = s.split(',');
2542 let mut key_result = string_iter.next();
2543
2544 while key_result.is_some() {
2545 let val = match string_iter.next() {
2546 Some(x) => x,
2547 None => return std::result::Result::Err("Missing value while parsing CephFsVolumeSource".to_string())
2548 };
2549
2550 if let Some(key) = key_result {
2551 #[allow(clippy::match_single_binding)]
2552 match key {
2553 "monitors" => return std::result::Result::Err("Parsing a container in this style is not supported in CephFsVolumeSource".to_string()),
2554 #[allow(clippy::redundant_clone)]
2555 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2556 #[allow(clippy::redundant_clone)]
2557 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2558 #[allow(clippy::redundant_clone)]
2559 "secretFile" => intermediate_rep.secret_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2560 #[allow(clippy::redundant_clone)]
2561 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2562 #[allow(clippy::redundant_clone)]
2563 "user" => intermediate_rep.user.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2564 _ => return std::result::Result::Err("Unexpected key while parsing CephFsVolumeSource".to_string())
2565 }
2566 }
2567
2568 key_result = string_iter.next();
2570 }
2571
2572 std::result::Result::Ok(CephFsVolumeSource {
2574 monitors: intermediate_rep.monitors.into_iter().next(),
2575 path: intermediate_rep.path.into_iter().next(),
2576 read_only: intermediate_rep.read_only.into_iter().next(),
2577 secret_file: intermediate_rep.secret_file.into_iter().next(),
2578 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
2579 user: intermediate_rep.user.into_iter().next(),
2580 })
2581 }
2582}
2583
2584#[cfg(feature = "server")]
2587impl std::convert::TryFrom<header::IntoHeaderValue<CephFsVolumeSource>> for HeaderValue {
2588 type Error = String;
2589
2590 fn try_from(hdr_value: header::IntoHeaderValue<CephFsVolumeSource>) -> std::result::Result<Self, Self::Error> {
2591 let hdr_value = hdr_value.to_string();
2592 match HeaderValue::from_str(&hdr_value) {
2593 std::result::Result::Ok(value) => std::result::Result::Ok(value),
2594 std::result::Result::Err(e) => std::result::Result::Err(
2595 format!("Invalid header value for CephFsVolumeSource - value: {} is invalid {}",
2596 hdr_value, e))
2597 }
2598 }
2599}
2600
2601#[cfg(feature = "server")]
2602impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<CephFsVolumeSource> {
2603 type Error = String;
2604
2605 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
2606 match hdr_value.to_str() {
2607 std::result::Result::Ok(value) => {
2608 match <CephFsVolumeSource as std::str::FromStr>::from_str(value) {
2609 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
2610 std::result::Result::Err(err) => std::result::Result::Err(
2611 format!("Unable to convert header value '{}' into CephFsVolumeSource - {}",
2612 value, err))
2613 }
2614 },
2615 std::result::Result::Err(e) => std::result::Result::Err(
2616 format!("Unable to convert header: {:?} to string: {}",
2617 hdr_value, e))
2618 }
2619 }
2620}
2621
2622
2623
2624
2625#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
2626#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2627pub struct CgroupSpec(String);
2628
2629impl validator::Validate for CgroupSpec {
2630 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
2631 std::result::Result::Ok(())
2632 }
2633}
2634
2635impl std::convert::From<String> for CgroupSpec {
2636 fn from(x: String) -> Self {
2637 CgroupSpec(x)
2638 }
2639}
2640
2641impl std::string::ToString for CgroupSpec {
2642 fn to_string(&self) -> String {
2643 self.0.to_string()
2644 }
2645}
2646
2647impl std::str::FromStr for CgroupSpec {
2648 type Err = std::string::ParseError;
2649 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
2650 std::result::Result::Ok(CgroupSpec(x.to_string()))
2651 }
2652}
2653
2654impl std::convert::From<CgroupSpec> for String {
2655 fn from(x: CgroupSpec) -> Self {
2656 x.0
2657 }
2658}
2659
2660impl std::ops::Deref for CgroupSpec {
2661 type Target = String;
2662 fn deref(&self) -> &String {
2663 &self.0
2664 }
2665}
2666
2667impl std::ops::DerefMut for CgroupSpec {
2668 fn deref_mut(&mut self) -> &mut String {
2669 &mut self.0
2670 }
2671}
2672
2673
2674
2675#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
2677#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2678pub struct CgroupnsMode(String);
2679
2680impl validator::Validate for CgroupnsMode {
2681 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
2682 std::result::Result::Ok(())
2683 }
2684}
2685
2686impl std::convert::From<String> for CgroupnsMode {
2687 fn from(x: String) -> Self {
2688 CgroupnsMode(x)
2689 }
2690}
2691
2692impl std::string::ToString for CgroupnsMode {
2693 fn to_string(&self) -> String {
2694 self.0.to_string()
2695 }
2696}
2697
2698impl std::str::FromStr for CgroupnsMode {
2699 type Err = std::string::ParseError;
2700 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
2701 std::result::Result::Ok(CgroupnsMode(x.to_string()))
2702 }
2703}
2704
2705impl std::convert::From<CgroupnsMode> for String {
2706 fn from(x: CgroupnsMode) -> Self {
2707 x.0
2708 }
2709}
2710
2711impl std::ops::Deref for CgroupnsMode {
2712 type Target = String;
2713 fn deref(&self) -> &String {
2714 &self.0
2715 }
2716}
2717
2718impl std::ops::DerefMut for CgroupnsMode {
2719 fn deref_mut(&mut self) -> &mut String {
2720 &mut self.0
2721 }
2722}
2723
2724
2725
2726#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
2731#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2732pub struct CinderVolumeSource {
2733#[serde(rename = "fsType")]
2735 #[serde(skip_serializing_if="Option::is_none")]
2736 pub fs_type: Option<String>,
2737
2738#[serde(rename = "readOnly")]
2740 #[serde(skip_serializing_if="Option::is_none")]
2741 pub read_only: Option<bool>,
2742
2743 #[serde(rename = "secretRef")]
2744 #[serde(skip_serializing_if="Option::is_none")]
2745 pub secret_ref: Option<models::LocalObjectReference>,
2746
2747#[serde(rename = "volumeID")]
2749 #[serde(skip_serializing_if="Option::is_none")]
2750 pub volume_id: Option<String>,
2751
2752}
2753
2754
2755impl CinderVolumeSource {
2756 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
2757 pub fn new() -> CinderVolumeSource {
2758 CinderVolumeSource {
2759 fs_type: None,
2760 read_only: None,
2761 secret_ref: None,
2762 volume_id: None,
2763 }
2764 }
2765}
2766
2767impl std::string::ToString for CinderVolumeSource {
2771 fn to_string(&self) -> String {
2772 let params: Vec<Option<String>> = vec![
2773
2774 self.fs_type.as_ref().map(|fs_type| {
2775 [
2776 "fsType".to_string(),
2777 fs_type.to_string(),
2778 ].join(",")
2779 }),
2780
2781
2782 self.read_only.as_ref().map(|read_only| {
2783 [
2784 "readOnly".to_string(),
2785 read_only.to_string(),
2786 ].join(",")
2787 }),
2788
2789 self.volume_id.as_ref().map(|volume_id| {
2793 [
2794 "volumeID".to_string(),
2795 volume_id.to_string(),
2796 ].join(",")
2797 }),
2798
2799 ];
2800
2801 params.into_iter().flatten().collect::<Vec<_>>().join(",")
2802 }
2803}
2804
2805impl std::str::FromStr for CinderVolumeSource {
2809 type Err = String;
2810
2811 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
2812 #[derive(Default)]
2814 #[allow(dead_code)]
2815 struct IntermediateRep {
2816 pub fs_type: Vec<String>,
2817 pub read_only: Vec<bool>,
2818 pub secret_ref: Vec<models::LocalObjectReference>,
2819 pub volume_id: Vec<String>,
2820 }
2821
2822 let mut intermediate_rep = IntermediateRep::default();
2823
2824 let mut string_iter = s.split(',');
2826 let mut key_result = string_iter.next();
2827
2828 while key_result.is_some() {
2829 let val = match string_iter.next() {
2830 Some(x) => x,
2831 None => return std::result::Result::Err("Missing value while parsing CinderVolumeSource".to_string())
2832 };
2833
2834 if let Some(key) = key_result {
2835 #[allow(clippy::match_single_binding)]
2836 match key {
2837 #[allow(clippy::redundant_clone)]
2838 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2839 #[allow(clippy::redundant_clone)]
2840 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2841 #[allow(clippy::redundant_clone)]
2842 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2843 #[allow(clippy::redundant_clone)]
2844 "volumeID" => intermediate_rep.volume_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
2845 _ => return std::result::Result::Err("Unexpected key while parsing CinderVolumeSource".to_string())
2846 }
2847 }
2848
2849 key_result = string_iter.next();
2851 }
2852
2853 std::result::Result::Ok(CinderVolumeSource {
2855 fs_type: intermediate_rep.fs_type.into_iter().next(),
2856 read_only: intermediate_rep.read_only.into_iter().next(),
2857 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
2858 volume_id: intermediate_rep.volume_id.into_iter().next(),
2859 })
2860 }
2861}
2862
2863#[cfg(feature = "server")]
2866impl std::convert::TryFrom<header::IntoHeaderValue<CinderVolumeSource>> for HeaderValue {
2867 type Error = String;
2868
2869 fn try_from(hdr_value: header::IntoHeaderValue<CinderVolumeSource>) -> std::result::Result<Self, Self::Error> {
2870 let hdr_value = hdr_value.to_string();
2871 match HeaderValue::from_str(&hdr_value) {
2872 std::result::Result::Ok(value) => std::result::Result::Ok(value),
2873 std::result::Result::Err(e) => std::result::Result::Err(
2874 format!("Invalid header value for CinderVolumeSource - value: {} is invalid {}",
2875 hdr_value, e))
2876 }
2877 }
2878}
2879
2880#[cfg(feature = "server")]
2881impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<CinderVolumeSource> {
2882 type Error = String;
2883
2884 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
2885 match hdr_value.to_str() {
2886 std::result::Result::Ok(value) => {
2887 match <CinderVolumeSource as std::str::FromStr>::from_str(value) {
2888 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
2889 std::result::Result::Err(err) => std::result::Result::Err(
2890 format!("Unable to convert header value '{}' into CinderVolumeSource - {}",
2891 value, err))
2892 }
2893 },
2894 std::result::Result::Err(e) => std::result::Result::Err(
2895 format!("Unable to convert header: {:?} to string: {}",
2896 hdr_value, e))
2897 }
2898 }
2899}
2900
2901
2902
2903
2904#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
2905#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2906pub struct CipherSuite(String);
2907
2908impl validator::Validate for CipherSuite {
2909 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
2910 std::result::Result::Ok(())
2911 }
2912}
2913
2914impl std::convert::From<String> for CipherSuite {
2915 fn from(x: String) -> Self {
2916 CipherSuite(x)
2917 }
2918}
2919
2920impl std::string::ToString for CipherSuite {
2921 fn to_string(&self) -> String {
2922 self.0.to_string()
2923 }
2924}
2925
2926impl std::str::FromStr for CipherSuite {
2927 type Err = std::string::ParseError;
2928 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
2929 std::result::Result::Ok(CipherSuite(x.to_string()))
2930 }
2931}
2932
2933impl std::convert::From<CipherSuite> for String {
2934 fn from(x: CipherSuite) -> Self {
2935 x.0
2936 }
2937}
2938
2939impl std::ops::Deref for CipherSuite {
2940 type Target = String;
2941 fn deref(&self) -> &String {
2942 &self.0
2943 }
2944}
2945
2946impl std::ops::DerefMut for CipherSuite {
2947 fn deref_mut(&mut self) -> &mut String {
2948 &mut self.0
2949 }
2950}
2951
2952
2953
2954
2955
2956
2957#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
2958#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
2959pub struct CommandConfig {
2960#[serde(rename = "allow")]
2962 #[serde(skip_serializing_if="Option::is_none")]
2963 pub allow: Option<Vec<String>>,
2964
2965 #[serde(rename = "mode")]
2966 #[serde(skip_serializing_if="Option::is_none")]
2967 pub mode: Option<String>,
2968
2969}
2970
2971
2972impl CommandConfig {
2973 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
2974 pub fn new() -> CommandConfig {
2975 CommandConfig {
2976 allow: None,
2977 mode: None,
2978 }
2979 }
2980}
2981
2982impl std::string::ToString for CommandConfig {
2986 fn to_string(&self) -> String {
2987 let params: Vec<Option<String>> = vec![
2988
2989 self.allow.as_ref().map(|allow| {
2990 [
2991 "allow".to_string(),
2992 allow.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
2993 ].join(",")
2994 }),
2995
2996
2997 self.mode.as_ref().map(|mode| {
2998 [
2999 "mode".to_string(),
3000 mode.to_string(),
3001 ].join(",")
3002 }),
3003
3004 ];
3005
3006 params.into_iter().flatten().collect::<Vec<_>>().join(",")
3007 }
3008}
3009
3010impl std::str::FromStr for CommandConfig {
3014 type Err = String;
3015
3016 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
3017 #[derive(Default)]
3019 #[allow(dead_code)]
3020 struct IntermediateRep {
3021 pub allow: Vec<Vec<String>>,
3022 pub mode: Vec<String>,
3023 }
3024
3025 let mut intermediate_rep = IntermediateRep::default();
3026
3027 let mut string_iter = s.split(',');
3029 let mut key_result = string_iter.next();
3030
3031 while key_result.is_some() {
3032 let val = match string_iter.next() {
3033 Some(x) => x,
3034 None => return std::result::Result::Err("Missing value while parsing CommandConfig".to_string())
3035 };
3036
3037 if let Some(key) = key_result {
3038 #[allow(clippy::match_single_binding)]
3039 match key {
3040 "allow" => return std::result::Result::Err("Parsing a container in this style is not supported in CommandConfig".to_string()),
3041 #[allow(clippy::redundant_clone)]
3042 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3043 _ => return std::result::Result::Err("Unexpected key while parsing CommandConfig".to_string())
3044 }
3045 }
3046
3047 key_result = string_iter.next();
3049 }
3050
3051 std::result::Result::Ok(CommandConfig {
3053 allow: intermediate_rep.allow.into_iter().next(),
3054 mode: intermediate_rep.mode.into_iter().next(),
3055 })
3056 }
3057}
3058
3059#[cfg(feature = "server")]
3062impl std::convert::TryFrom<header::IntoHeaderValue<CommandConfig>> for HeaderValue {
3063 type Error = String;
3064
3065 fn try_from(hdr_value: header::IntoHeaderValue<CommandConfig>) -> std::result::Result<Self, Self::Error> {
3066 let hdr_value = hdr_value.to_string();
3067 match HeaderValue::from_str(&hdr_value) {
3068 std::result::Result::Ok(value) => std::result::Result::Ok(value),
3069 std::result::Result::Err(e) => std::result::Result::Err(
3070 format!("Invalid header value for CommandConfig - value: {} is invalid {}",
3071 hdr_value, e))
3072 }
3073 }
3074}
3075
3076#[cfg(feature = "server")]
3077impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<CommandConfig> {
3078 type Error = String;
3079
3080 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
3081 match hdr_value.to_str() {
3082 std::result::Result::Ok(value) => {
3083 match <CommandConfig as std::str::FromStr>::from_str(value) {
3084 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
3085 std::result::Result::Err(err) => std::result::Result::Err(
3086 format!("Unable to convert header value '{}' into CommandConfig - {}",
3087 value, err))
3088 }
3089 },
3090 std::result::Result::Err(e) => std::result::Result::Err(
3091 format!("Unable to convert header: {:?} to string: {}",
3092 hdr_value, e))
3093 }
3094 }
3095}
3096
3097
3098
3099
3100#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
3105#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
3106pub struct Config {
3107 #[serde(rename = "ArgsEscaped")]
3108 #[serde(skip_serializing_if="Option::is_none")]
3109 pub args_escaped: Option<bool>,
3110
3111 #[serde(rename = "AttachStderr")]
3112 #[serde(skip_serializing_if="Option::is_none")]
3113 pub attach_stderr: Option<bool>,
3114
3115 #[serde(rename = "AttachStdin")]
3116 #[serde(skip_serializing_if="Option::is_none")]
3117 pub attach_stdin: Option<bool>,
3118
3119 #[serde(rename = "AttachStdout")]
3120 #[serde(skip_serializing_if="Option::is_none")]
3121 pub attach_stdout: Option<bool>,
3122
3123#[serde(rename = "Cmd")]
3125 #[serde(skip_serializing_if="Option::is_none")]
3126 pub cmd: Option<Vec<String>>,
3127
3128 #[serde(rename = "Domainname")]
3129 #[serde(skip_serializing_if="Option::is_none")]
3130 pub domainname: Option<String>,
3131
3132#[serde(rename = "Entrypoint")]
3134 #[serde(skip_serializing_if="Option::is_none")]
3135 pub entrypoint: Option<Vec<String>>,
3136
3137 #[serde(rename = "Env")]
3138 #[serde(skip_serializing_if="Option::is_none")]
3139 pub env: Option<Vec<String>>,
3140
3141#[serde(rename = "ExposedPorts")]
3143 #[serde(skip_serializing_if="Option::is_none")]
3144 pub exposed_ports: Option<std::collections::HashMap<String, crate::types::Object>>,
3145
3146 #[serde(rename = "Healthcheck")]
3147 #[serde(skip_serializing_if="Option::is_none")]
3148 pub healthcheck: Option<models::HealthConfig>,
3149
3150 #[serde(rename = "Hostname")]
3151 #[serde(skip_serializing_if="Option::is_none")]
3152 pub hostname: Option<String>,
3153
3154 #[serde(rename = "Image")]
3155 #[serde(skip_serializing_if="Option::is_none")]
3156 pub image: Option<String>,
3157
3158 #[serde(rename = "Labels")]
3159 #[serde(skip_serializing_if="Option::is_none")]
3160 pub labels: Option<std::collections::HashMap<String, String>>,
3161
3162 #[serde(rename = "MacAddress")]
3163 #[serde(skip_serializing_if="Option::is_none")]
3164 pub mac_address: Option<String>,
3165
3166 #[serde(rename = "NetworkDisabled")]
3167 #[serde(skip_serializing_if="Option::is_none")]
3168 pub network_disabled: Option<bool>,
3169
3170 #[serde(rename = "OnBuild")]
3171 #[serde(skip_serializing_if="Option::is_none")]
3172 pub on_build: Option<Vec<String>>,
3173
3174 #[serde(rename = "OpenStdin")]
3175 #[serde(skip_serializing_if="Option::is_none")]
3176 pub open_stdin: Option<bool>,
3177
3178#[serde(rename = "Shell")]
3180 #[serde(skip_serializing_if="Option::is_none")]
3181 pub shell: Option<Vec<String>>,
3182
3183 #[serde(rename = "StdinOnce")]
3184 #[serde(skip_serializing_if="Option::is_none")]
3185 pub stdin_once: Option<bool>,
3186
3187 #[serde(rename = "StopSignal")]
3188 #[serde(skip_serializing_if="Option::is_none")]
3189 pub stop_signal: Option<String>,
3190
3191 #[serde(rename = "StopTimeout")]
3192 #[serde(skip_serializing_if="Option::is_none")]
3193 pub stop_timeout: Option<i64>,
3194
3195 #[serde(rename = "Tty")]
3196 #[serde(skip_serializing_if="Option::is_none")]
3197 pub tty: Option<bool>,
3198
3199 #[serde(rename = "User")]
3200 #[serde(skip_serializing_if="Option::is_none")]
3201 pub user: Option<String>,
3202
3203 #[serde(rename = "Volumes")]
3204 #[serde(skip_serializing_if="Option::is_none")]
3205 pub volumes: Option<std::collections::HashMap<String, crate::types::Object>>,
3206
3207 #[serde(rename = "WorkingDir")]
3208 #[serde(skip_serializing_if="Option::is_none")]
3209 pub working_dir: Option<String>,
3210
3211}
3212
3213
3214impl Config {
3215 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
3216 pub fn new() -> Config {
3217 Config {
3218 args_escaped: None,
3219 attach_stderr: None,
3220 attach_stdin: None,
3221 attach_stdout: None,
3222 cmd: None,
3223 domainname: None,
3224 entrypoint: None,
3225 env: None,
3226 exposed_ports: None,
3227 healthcheck: None,
3228 hostname: None,
3229 image: None,
3230 labels: None,
3231 mac_address: None,
3232 network_disabled: None,
3233 on_build: None,
3234 open_stdin: None,
3235 shell: None,
3236 stdin_once: None,
3237 stop_signal: None,
3238 stop_timeout: None,
3239 tty: None,
3240 user: None,
3241 volumes: None,
3242 working_dir: None,
3243 }
3244 }
3245}
3246
3247impl std::string::ToString for Config {
3251 fn to_string(&self) -> String {
3252 let params: Vec<Option<String>> = vec![
3253
3254 self.args_escaped.as_ref().map(|args_escaped| {
3255 [
3256 "ArgsEscaped".to_string(),
3257 args_escaped.to_string(),
3258 ].join(",")
3259 }),
3260
3261
3262 self.attach_stderr.as_ref().map(|attach_stderr| {
3263 [
3264 "AttachStderr".to_string(),
3265 attach_stderr.to_string(),
3266 ].join(",")
3267 }),
3268
3269
3270 self.attach_stdin.as_ref().map(|attach_stdin| {
3271 [
3272 "AttachStdin".to_string(),
3273 attach_stdin.to_string(),
3274 ].join(",")
3275 }),
3276
3277
3278 self.attach_stdout.as_ref().map(|attach_stdout| {
3279 [
3280 "AttachStdout".to_string(),
3281 attach_stdout.to_string(),
3282 ].join(",")
3283 }),
3284
3285
3286 self.cmd.as_ref().map(|cmd| {
3287 [
3288 "Cmd".to_string(),
3289 cmd.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
3290 ].join(",")
3291 }),
3292
3293
3294 self.domainname.as_ref().map(|domainname| {
3295 [
3296 "Domainname".to_string(),
3297 domainname.to_string(),
3298 ].join(",")
3299 }),
3300
3301
3302 self.entrypoint.as_ref().map(|entrypoint| {
3303 [
3304 "Entrypoint".to_string(),
3305 entrypoint.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
3306 ].join(",")
3307 }),
3308
3309
3310 self.env.as_ref().map(|env| {
3311 [
3312 "Env".to_string(),
3313 env.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
3314 ].join(",")
3315 }),
3316
3317 self.hostname.as_ref().map(|hostname| {
3324 [
3325 "Hostname".to_string(),
3326 hostname.to_string(),
3327 ].join(",")
3328 }),
3329
3330
3331 self.image.as_ref().map(|image| {
3332 [
3333 "Image".to_string(),
3334 image.to_string(),
3335 ].join(",")
3336 }),
3337
3338 self.mac_address.as_ref().map(|mac_address| {
3342 [
3343 "MacAddress".to_string(),
3344 mac_address.to_string(),
3345 ].join(",")
3346 }),
3347
3348
3349 self.network_disabled.as_ref().map(|network_disabled| {
3350 [
3351 "NetworkDisabled".to_string(),
3352 network_disabled.to_string(),
3353 ].join(",")
3354 }),
3355
3356
3357 self.on_build.as_ref().map(|on_build| {
3358 [
3359 "OnBuild".to_string(),
3360 on_build.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
3361 ].join(",")
3362 }),
3363
3364
3365 self.open_stdin.as_ref().map(|open_stdin| {
3366 [
3367 "OpenStdin".to_string(),
3368 open_stdin.to_string(),
3369 ].join(",")
3370 }),
3371
3372
3373 self.shell.as_ref().map(|shell| {
3374 [
3375 "Shell".to_string(),
3376 shell.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
3377 ].join(",")
3378 }),
3379
3380
3381 self.stdin_once.as_ref().map(|stdin_once| {
3382 [
3383 "StdinOnce".to_string(),
3384 stdin_once.to_string(),
3385 ].join(",")
3386 }),
3387
3388
3389 self.stop_signal.as_ref().map(|stop_signal| {
3390 [
3391 "StopSignal".to_string(),
3392 stop_signal.to_string(),
3393 ].join(",")
3394 }),
3395
3396
3397 self.stop_timeout.as_ref().map(|stop_timeout| {
3398 [
3399 "StopTimeout".to_string(),
3400 stop_timeout.to_string(),
3401 ].join(",")
3402 }),
3403
3404
3405 self.tty.as_ref().map(|tty| {
3406 [
3407 "Tty".to_string(),
3408 tty.to_string(),
3409 ].join(",")
3410 }),
3411
3412
3413 self.user.as_ref().map(|user| {
3414 [
3415 "User".to_string(),
3416 user.to_string(),
3417 ].join(",")
3418 }),
3419
3420 self.working_dir.as_ref().map(|working_dir| {
3425 [
3426 "WorkingDir".to_string(),
3427 working_dir.to_string(),
3428 ].join(",")
3429 }),
3430
3431 ];
3432
3433 params.into_iter().flatten().collect::<Vec<_>>().join(",")
3434 }
3435}
3436
3437impl std::str::FromStr for Config {
3441 type Err = String;
3442
3443 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
3444 #[derive(Default)]
3446 #[allow(dead_code)]
3447 struct IntermediateRep {
3448 pub args_escaped: Vec<bool>,
3449 pub attach_stderr: Vec<bool>,
3450 pub attach_stdin: Vec<bool>,
3451 pub attach_stdout: Vec<bool>,
3452 pub cmd: Vec<Vec<String>>,
3453 pub domainname: Vec<String>,
3454 pub entrypoint: Vec<Vec<String>>,
3455 pub env: Vec<Vec<String>>,
3456 pub exposed_ports: Vec<std::collections::HashMap<String, crate::types::Object>>,
3457 pub healthcheck: Vec<models::HealthConfig>,
3458 pub hostname: Vec<String>,
3459 pub image: Vec<String>,
3460 pub labels: Vec<std::collections::HashMap<String, String>>,
3461 pub mac_address: Vec<String>,
3462 pub network_disabled: Vec<bool>,
3463 pub on_build: Vec<Vec<String>>,
3464 pub open_stdin: Vec<bool>,
3465 pub shell: Vec<Vec<String>>,
3466 pub stdin_once: Vec<bool>,
3467 pub stop_signal: Vec<String>,
3468 pub stop_timeout: Vec<i64>,
3469 pub tty: Vec<bool>,
3470 pub user: Vec<String>,
3471 pub volumes: Vec<std::collections::HashMap<String, crate::types::Object>>,
3472 pub working_dir: Vec<String>,
3473 }
3474
3475 let mut intermediate_rep = IntermediateRep::default();
3476
3477 let mut string_iter = s.split(',');
3479 let mut key_result = string_iter.next();
3480
3481 while key_result.is_some() {
3482 let val = match string_iter.next() {
3483 Some(x) => x,
3484 None => return std::result::Result::Err("Missing value while parsing Config".to_string())
3485 };
3486
3487 if let Some(key) = key_result {
3488 #[allow(clippy::match_single_binding)]
3489 match key {
3490 #[allow(clippy::redundant_clone)]
3491 "ArgsEscaped" => intermediate_rep.args_escaped.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3492 #[allow(clippy::redundant_clone)]
3493 "AttachStderr" => intermediate_rep.attach_stderr.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3494 #[allow(clippy::redundant_clone)]
3495 "AttachStdin" => intermediate_rep.attach_stdin.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3496 #[allow(clippy::redundant_clone)]
3497 "AttachStdout" => intermediate_rep.attach_stdout.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3498 "Cmd" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3499 #[allow(clippy::redundant_clone)]
3500 "Domainname" => intermediate_rep.domainname.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3501 "Entrypoint" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3502 "Env" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3503 "ExposedPorts" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3504 #[allow(clippy::redundant_clone)]
3505 "Healthcheck" => intermediate_rep.healthcheck.push(<models::HealthConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3506 #[allow(clippy::redundant_clone)]
3507 "Hostname" => intermediate_rep.hostname.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3508 #[allow(clippy::redundant_clone)]
3509 "Image" => intermediate_rep.image.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3510 "Labels" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3511 #[allow(clippy::redundant_clone)]
3512 "MacAddress" => intermediate_rep.mac_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3513 #[allow(clippy::redundant_clone)]
3514 "NetworkDisabled" => intermediate_rep.network_disabled.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3515 "OnBuild" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3516 #[allow(clippy::redundant_clone)]
3517 "OpenStdin" => intermediate_rep.open_stdin.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3518 "Shell" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3519 #[allow(clippy::redundant_clone)]
3520 "StdinOnce" => intermediate_rep.stdin_once.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3521 #[allow(clippy::redundant_clone)]
3522 "StopSignal" => intermediate_rep.stop_signal.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3523 #[allow(clippy::redundant_clone)]
3524 "StopTimeout" => intermediate_rep.stop_timeout.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3525 #[allow(clippy::redundant_clone)]
3526 "Tty" => intermediate_rep.tty.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3527 #[allow(clippy::redundant_clone)]
3528 "User" => intermediate_rep.user.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3529 "Volumes" => return std::result::Result::Err("Parsing a container in this style is not supported in Config".to_string()),
3530 #[allow(clippy::redundant_clone)]
3531 "WorkingDir" => intermediate_rep.working_dir.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3532 _ => return std::result::Result::Err("Unexpected key while parsing Config".to_string())
3533 }
3534 }
3535
3536 key_result = string_iter.next();
3538 }
3539
3540 std::result::Result::Ok(Config {
3542 args_escaped: intermediate_rep.args_escaped.into_iter().next(),
3543 attach_stderr: intermediate_rep.attach_stderr.into_iter().next(),
3544 attach_stdin: intermediate_rep.attach_stdin.into_iter().next(),
3545 attach_stdout: intermediate_rep.attach_stdout.into_iter().next(),
3546 cmd: intermediate_rep.cmd.into_iter().next(),
3547 domainname: intermediate_rep.domainname.into_iter().next(),
3548 entrypoint: intermediate_rep.entrypoint.into_iter().next(),
3549 env: intermediate_rep.env.into_iter().next(),
3550 exposed_ports: intermediate_rep.exposed_ports.into_iter().next(),
3551 healthcheck: intermediate_rep.healthcheck.into_iter().next(),
3552 hostname: intermediate_rep.hostname.into_iter().next(),
3553 image: intermediate_rep.image.into_iter().next(),
3554 labels: intermediate_rep.labels.into_iter().next(),
3555 mac_address: intermediate_rep.mac_address.into_iter().next(),
3556 network_disabled: intermediate_rep.network_disabled.into_iter().next(),
3557 on_build: intermediate_rep.on_build.into_iter().next(),
3558 open_stdin: intermediate_rep.open_stdin.into_iter().next(),
3559 shell: intermediate_rep.shell.into_iter().next(),
3560 stdin_once: intermediate_rep.stdin_once.into_iter().next(),
3561 stop_signal: intermediate_rep.stop_signal.into_iter().next(),
3562 stop_timeout: intermediate_rep.stop_timeout.into_iter().next(),
3563 tty: intermediate_rep.tty.into_iter().next(),
3564 user: intermediate_rep.user.into_iter().next(),
3565 volumes: intermediate_rep.volumes.into_iter().next(),
3566 working_dir: intermediate_rep.working_dir.into_iter().next(),
3567 })
3568 }
3569}
3570
3571#[cfg(feature = "server")]
3574impl std::convert::TryFrom<header::IntoHeaderValue<Config>> for HeaderValue {
3575 type Error = String;
3576
3577 fn try_from(hdr_value: header::IntoHeaderValue<Config>) -> std::result::Result<Self, Self::Error> {
3578 let hdr_value = hdr_value.to_string();
3579 match HeaderValue::from_str(&hdr_value) {
3580 std::result::Result::Ok(value) => std::result::Result::Ok(value),
3581 std::result::Result::Err(e) => std::result::Result::Err(
3582 format!("Invalid header value for Config - value: {} is invalid {}",
3583 hdr_value, e))
3584 }
3585 }
3586}
3587
3588#[cfg(feature = "server")]
3589impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Config> {
3590 type Error = String;
3591
3592 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
3593 match hdr_value.to_str() {
3594 std::result::Result::Ok(value) => {
3595 match <Config as std::str::FromStr>::from_str(value) {
3596 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
3597 std::result::Result::Err(err) => std::result::Result::Err(
3598 format!("Unable to convert header value '{}' into Config - {}",
3599 value, err))
3600 }
3601 },
3602 std::result::Result::Err(e) => std::result::Result::Err(
3603 format!("Unable to convert header: {:?} to string: {}",
3604 hdr_value, e))
3605 }
3606 }
3607}
3608
3609
3610
3611
3612#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
3617#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
3618pub struct ConfigMapEnvSource {
3619#[serde(rename = "name")]
3621 #[serde(skip_serializing_if="Option::is_none")]
3622 pub name: Option<String>,
3623
3624#[serde(rename = "optional")]
3626 #[serde(skip_serializing_if="Option::is_none")]
3627 pub optional: Option<bool>,
3628
3629}
3630
3631
3632impl ConfigMapEnvSource {
3633 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
3634 pub fn new() -> ConfigMapEnvSource {
3635 ConfigMapEnvSource {
3636 name: None,
3637 optional: None,
3638 }
3639 }
3640}
3641
3642impl std::string::ToString for ConfigMapEnvSource {
3646 fn to_string(&self) -> String {
3647 let params: Vec<Option<String>> = vec![
3648
3649 self.name.as_ref().map(|name| {
3650 [
3651 "name".to_string(),
3652 name.to_string(),
3653 ].join(",")
3654 }),
3655
3656
3657 self.optional.as_ref().map(|optional| {
3658 [
3659 "optional".to_string(),
3660 optional.to_string(),
3661 ].join(",")
3662 }),
3663
3664 ];
3665
3666 params.into_iter().flatten().collect::<Vec<_>>().join(",")
3667 }
3668}
3669
3670impl std::str::FromStr for ConfigMapEnvSource {
3674 type Err = String;
3675
3676 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
3677 #[derive(Default)]
3679 #[allow(dead_code)]
3680 struct IntermediateRep {
3681 pub name: Vec<String>,
3682 pub optional: Vec<bool>,
3683 }
3684
3685 let mut intermediate_rep = IntermediateRep::default();
3686
3687 let mut string_iter = s.split(',');
3689 let mut key_result = string_iter.next();
3690
3691 while key_result.is_some() {
3692 let val = match string_iter.next() {
3693 Some(x) => x,
3694 None => return std::result::Result::Err("Missing value while parsing ConfigMapEnvSource".to_string())
3695 };
3696
3697 if let Some(key) = key_result {
3698 #[allow(clippy::match_single_binding)]
3699 match key {
3700 #[allow(clippy::redundant_clone)]
3701 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3702 #[allow(clippy::redundant_clone)]
3703 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3704 _ => return std::result::Result::Err("Unexpected key while parsing ConfigMapEnvSource".to_string())
3705 }
3706 }
3707
3708 key_result = string_iter.next();
3710 }
3711
3712 std::result::Result::Ok(ConfigMapEnvSource {
3714 name: intermediate_rep.name.into_iter().next(),
3715 optional: intermediate_rep.optional.into_iter().next(),
3716 })
3717 }
3718}
3719
3720#[cfg(feature = "server")]
3723impl std::convert::TryFrom<header::IntoHeaderValue<ConfigMapEnvSource>> for HeaderValue {
3724 type Error = String;
3725
3726 fn try_from(hdr_value: header::IntoHeaderValue<ConfigMapEnvSource>) -> std::result::Result<Self, Self::Error> {
3727 let hdr_value = hdr_value.to_string();
3728 match HeaderValue::from_str(&hdr_value) {
3729 std::result::Result::Ok(value) => std::result::Result::Ok(value),
3730 std::result::Result::Err(e) => std::result::Result::Err(
3731 format!("Invalid header value for ConfigMapEnvSource - value: {} is invalid {}",
3732 hdr_value, e))
3733 }
3734 }
3735}
3736
3737#[cfg(feature = "server")]
3738impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigMapEnvSource> {
3739 type Error = String;
3740
3741 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
3742 match hdr_value.to_str() {
3743 std::result::Result::Ok(value) => {
3744 match <ConfigMapEnvSource as std::str::FromStr>::from_str(value) {
3745 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
3746 std::result::Result::Err(err) => std::result::Result::Err(
3747 format!("Unable to convert header value '{}' into ConfigMapEnvSource - {}",
3748 value, err))
3749 }
3750 },
3751 std::result::Result::Err(e) => std::result::Result::Err(
3752 format!("Unable to convert header: {:?} to string: {}",
3753 hdr_value, e))
3754 }
3755 }
3756}
3757
3758
3759
3760
3761#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
3766#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
3767pub struct ConfigMapKeySelector {
3768#[serde(rename = "key")]
3770 #[serde(skip_serializing_if="Option::is_none")]
3771 pub key: Option<String>,
3772
3773#[serde(rename = "name")]
3775 #[serde(skip_serializing_if="Option::is_none")]
3776 pub name: Option<String>,
3777
3778#[serde(rename = "optional")]
3780 #[serde(skip_serializing_if="Option::is_none")]
3781 pub optional: Option<bool>,
3782
3783}
3784
3785
3786impl ConfigMapKeySelector {
3787 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
3788 pub fn new() -> ConfigMapKeySelector {
3789 ConfigMapKeySelector {
3790 key: None,
3791 name: None,
3792 optional: None,
3793 }
3794 }
3795}
3796
3797impl std::string::ToString for ConfigMapKeySelector {
3801 fn to_string(&self) -> String {
3802 let params: Vec<Option<String>> = vec![
3803
3804 self.key.as_ref().map(|key| {
3805 [
3806 "key".to_string(),
3807 key.to_string(),
3808 ].join(",")
3809 }),
3810
3811
3812 self.name.as_ref().map(|name| {
3813 [
3814 "name".to_string(),
3815 name.to_string(),
3816 ].join(",")
3817 }),
3818
3819
3820 self.optional.as_ref().map(|optional| {
3821 [
3822 "optional".to_string(),
3823 optional.to_string(),
3824 ].join(",")
3825 }),
3826
3827 ];
3828
3829 params.into_iter().flatten().collect::<Vec<_>>().join(",")
3830 }
3831}
3832
3833impl std::str::FromStr for ConfigMapKeySelector {
3837 type Err = String;
3838
3839 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
3840 #[derive(Default)]
3842 #[allow(dead_code)]
3843 struct IntermediateRep {
3844 pub key: Vec<String>,
3845 pub name: Vec<String>,
3846 pub optional: Vec<bool>,
3847 }
3848
3849 let mut intermediate_rep = IntermediateRep::default();
3850
3851 let mut string_iter = s.split(',');
3853 let mut key_result = string_iter.next();
3854
3855 while key_result.is_some() {
3856 let val = match string_iter.next() {
3857 Some(x) => x,
3858 None => return std::result::Result::Err("Missing value while parsing ConfigMapKeySelector".to_string())
3859 };
3860
3861 if let Some(key) = key_result {
3862 #[allow(clippy::match_single_binding)]
3863 match key {
3864 #[allow(clippy::redundant_clone)]
3865 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3866 #[allow(clippy::redundant_clone)]
3867 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3868 #[allow(clippy::redundant_clone)]
3869 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
3870 _ => return std::result::Result::Err("Unexpected key while parsing ConfigMapKeySelector".to_string())
3871 }
3872 }
3873
3874 key_result = string_iter.next();
3876 }
3877
3878 std::result::Result::Ok(ConfigMapKeySelector {
3880 key: intermediate_rep.key.into_iter().next(),
3881 name: intermediate_rep.name.into_iter().next(),
3882 optional: intermediate_rep.optional.into_iter().next(),
3883 })
3884 }
3885}
3886
3887#[cfg(feature = "server")]
3890impl std::convert::TryFrom<header::IntoHeaderValue<ConfigMapKeySelector>> for HeaderValue {
3891 type Error = String;
3892
3893 fn try_from(hdr_value: header::IntoHeaderValue<ConfigMapKeySelector>) -> std::result::Result<Self, Self::Error> {
3894 let hdr_value = hdr_value.to_string();
3895 match HeaderValue::from_str(&hdr_value) {
3896 std::result::Result::Ok(value) => std::result::Result::Ok(value),
3897 std::result::Result::Err(e) => std::result::Result::Err(
3898 format!("Invalid header value for ConfigMapKeySelector - value: {} is invalid {}",
3899 hdr_value, e))
3900 }
3901 }
3902}
3903
3904#[cfg(feature = "server")]
3905impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigMapKeySelector> {
3906 type Error = String;
3907
3908 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
3909 match hdr_value.to_str() {
3910 std::result::Result::Ok(value) => {
3911 match <ConfigMapKeySelector as std::str::FromStr>::from_str(value) {
3912 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
3913 std::result::Result::Err(err) => std::result::Result::Err(
3914 format!("Unable to convert header value '{}' into ConfigMapKeySelector - {}",
3915 value, err))
3916 }
3917 },
3918 std::result::Result::Err(e) => std::result::Result::Err(
3919 format!("Unable to convert header: {:?} to string: {}",
3920 hdr_value, e))
3921 }
3922 }
3923}
3924
3925
3926
3927
3928#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
3933#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
3934pub struct ConfigMapProjection {
3935#[serde(rename = "items")]
3937 #[serde(skip_serializing_if="Option::is_none")]
3938 pub items: Option<Vec<models::KeyToPath>>,
3939
3940#[serde(rename = "name")]
3942 #[serde(skip_serializing_if="Option::is_none")]
3943 pub name: Option<String>,
3944
3945#[serde(rename = "optional")]
3947 #[serde(skip_serializing_if="Option::is_none")]
3948 pub optional: Option<bool>,
3949
3950}
3951
3952
3953impl ConfigMapProjection {
3954 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
3955 pub fn new() -> ConfigMapProjection {
3956 ConfigMapProjection {
3957 items: None,
3958 name: None,
3959 optional: None,
3960 }
3961 }
3962}
3963
3964impl std::string::ToString for ConfigMapProjection {
3968 fn to_string(&self) -> String {
3969 let params: Vec<Option<String>> = vec![
3970 self.name.as_ref().map(|name| {
3974 [
3975 "name".to_string(),
3976 name.to_string(),
3977 ].join(",")
3978 }),
3979
3980
3981 self.optional.as_ref().map(|optional| {
3982 [
3983 "optional".to_string(),
3984 optional.to_string(),
3985 ].join(",")
3986 }),
3987
3988 ];
3989
3990 params.into_iter().flatten().collect::<Vec<_>>().join(",")
3991 }
3992}
3993
3994impl std::str::FromStr for ConfigMapProjection {
3998 type Err = String;
3999
4000 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
4001 #[derive(Default)]
4003 #[allow(dead_code)]
4004 struct IntermediateRep {
4005 pub items: Vec<Vec<models::KeyToPath>>,
4006 pub name: Vec<String>,
4007 pub optional: Vec<bool>,
4008 }
4009
4010 let mut intermediate_rep = IntermediateRep::default();
4011
4012 let mut string_iter = s.split(',');
4014 let mut key_result = string_iter.next();
4015
4016 while key_result.is_some() {
4017 let val = match string_iter.next() {
4018 Some(x) => x,
4019 None => return std::result::Result::Err("Missing value while parsing ConfigMapProjection".to_string())
4020 };
4021
4022 if let Some(key) = key_result {
4023 #[allow(clippy::match_single_binding)]
4024 match key {
4025 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigMapProjection".to_string()),
4026 #[allow(clippy::redundant_clone)]
4027 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4028 #[allow(clippy::redundant_clone)]
4029 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4030 _ => return std::result::Result::Err("Unexpected key while parsing ConfigMapProjection".to_string())
4031 }
4032 }
4033
4034 key_result = string_iter.next();
4036 }
4037
4038 std::result::Result::Ok(ConfigMapProjection {
4040 items: intermediate_rep.items.into_iter().next(),
4041 name: intermediate_rep.name.into_iter().next(),
4042 optional: intermediate_rep.optional.into_iter().next(),
4043 })
4044 }
4045}
4046
4047#[cfg(feature = "server")]
4050impl std::convert::TryFrom<header::IntoHeaderValue<ConfigMapProjection>> for HeaderValue {
4051 type Error = String;
4052
4053 fn try_from(hdr_value: header::IntoHeaderValue<ConfigMapProjection>) -> std::result::Result<Self, Self::Error> {
4054 let hdr_value = hdr_value.to_string();
4055 match HeaderValue::from_str(&hdr_value) {
4056 std::result::Result::Ok(value) => std::result::Result::Ok(value),
4057 std::result::Result::Err(e) => std::result::Result::Err(
4058 format!("Invalid header value for ConfigMapProjection - value: {} is invalid {}",
4059 hdr_value, e))
4060 }
4061 }
4062}
4063
4064#[cfg(feature = "server")]
4065impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigMapProjection> {
4066 type Error = String;
4067
4068 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
4069 match hdr_value.to_str() {
4070 std::result::Result::Ok(value) => {
4071 match <ConfigMapProjection as std::str::FromStr>::from_str(value) {
4072 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
4073 std::result::Result::Err(err) => std::result::Result::Err(
4074 format!("Unable to convert header value '{}' into ConfigMapProjection - {}",
4075 value, err))
4076 }
4077 },
4078 std::result::Result::Err(e) => std::result::Result::Err(
4079 format!("Unable to convert header: {:?} to string: {}",
4080 hdr_value, e))
4081 }
4082 }
4083}
4084
4085
4086
4087
4088#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
4093#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
4094pub struct ConfigMapVolumeSource {
4095#[serde(rename = "defaultMode")]
4097 #[serde(skip_serializing_if="Option::is_none")]
4098 pub default_mode: Option<i32>,
4099
4100#[serde(rename = "items")]
4102 #[serde(skip_serializing_if="Option::is_none")]
4103 pub items: Option<Vec<models::KeyToPath>>,
4104
4105#[serde(rename = "name")]
4107 #[serde(skip_serializing_if="Option::is_none")]
4108 pub name: Option<String>,
4109
4110#[serde(rename = "optional")]
4112 #[serde(skip_serializing_if="Option::is_none")]
4113 pub optional: Option<bool>,
4114
4115}
4116
4117
4118impl ConfigMapVolumeSource {
4119 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
4120 pub fn new() -> ConfigMapVolumeSource {
4121 ConfigMapVolumeSource {
4122 default_mode: None,
4123 items: None,
4124 name: None,
4125 optional: None,
4126 }
4127 }
4128}
4129
4130impl std::string::ToString for ConfigMapVolumeSource {
4134 fn to_string(&self) -> String {
4135 let params: Vec<Option<String>> = vec![
4136
4137 self.default_mode.as_ref().map(|default_mode| {
4138 [
4139 "defaultMode".to_string(),
4140 default_mode.to_string(),
4141 ].join(",")
4142 }),
4143
4144 self.name.as_ref().map(|name| {
4148 [
4149 "name".to_string(),
4150 name.to_string(),
4151 ].join(",")
4152 }),
4153
4154
4155 self.optional.as_ref().map(|optional| {
4156 [
4157 "optional".to_string(),
4158 optional.to_string(),
4159 ].join(",")
4160 }),
4161
4162 ];
4163
4164 params.into_iter().flatten().collect::<Vec<_>>().join(",")
4165 }
4166}
4167
4168impl std::str::FromStr for ConfigMapVolumeSource {
4172 type Err = String;
4173
4174 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
4175 #[derive(Default)]
4177 #[allow(dead_code)]
4178 struct IntermediateRep {
4179 pub default_mode: Vec<i32>,
4180 pub items: Vec<Vec<models::KeyToPath>>,
4181 pub name: Vec<String>,
4182 pub optional: Vec<bool>,
4183 }
4184
4185 let mut intermediate_rep = IntermediateRep::default();
4186
4187 let mut string_iter = s.split(',');
4189 let mut key_result = string_iter.next();
4190
4191 while key_result.is_some() {
4192 let val = match string_iter.next() {
4193 Some(x) => x,
4194 None => return std::result::Result::Err("Missing value while parsing ConfigMapVolumeSource".to_string())
4195 };
4196
4197 if let Some(key) = key_result {
4198 #[allow(clippy::match_single_binding)]
4199 match key {
4200 #[allow(clippy::redundant_clone)]
4201 "defaultMode" => intermediate_rep.default_mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4202 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigMapVolumeSource".to_string()),
4203 #[allow(clippy::redundant_clone)]
4204 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4205 #[allow(clippy::redundant_clone)]
4206 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4207 _ => return std::result::Result::Err("Unexpected key while parsing ConfigMapVolumeSource".to_string())
4208 }
4209 }
4210
4211 key_result = string_iter.next();
4213 }
4214
4215 std::result::Result::Ok(ConfigMapVolumeSource {
4217 default_mode: intermediate_rep.default_mode.into_iter().next(),
4218 items: intermediate_rep.items.into_iter().next(),
4219 name: intermediate_rep.name.into_iter().next(),
4220 optional: intermediate_rep.optional.into_iter().next(),
4221 })
4222 }
4223}
4224
4225#[cfg(feature = "server")]
4228impl std::convert::TryFrom<header::IntoHeaderValue<ConfigMapVolumeSource>> for HeaderValue {
4229 type Error = String;
4230
4231 fn try_from(hdr_value: header::IntoHeaderValue<ConfigMapVolumeSource>) -> std::result::Result<Self, Self::Error> {
4232 let hdr_value = hdr_value.to_string();
4233 match HeaderValue::from_str(&hdr_value) {
4234 std::result::Result::Ok(value) => std::result::Result::Ok(value),
4235 std::result::Result::Err(e) => std::result::Result::Err(
4236 format!("Invalid header value for ConfigMapVolumeSource - value: {} is invalid {}",
4237 hdr_value, e))
4238 }
4239 }
4240}
4241
4242#[cfg(feature = "server")]
4243impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigMapVolumeSource> {
4244 type Error = String;
4245
4246 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
4247 match hdr_value.to_str() {
4248 std::result::Result::Ok(value) => {
4249 match <ConfigMapVolumeSource as std::str::FromStr>::from_str(value) {
4250 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
4251 std::result::Result::Err(err) => std::result::Result::Err(
4252 format!("Unable to convert header value '{}' into ConfigMapVolumeSource - {}",
4253 value, err))
4254 }
4255 },
4256 std::result::Result::Err(e) => std::result::Result::Err(
4257 format!("Unable to convert header: {:?} to string: {}",
4258 hdr_value, e))
4259 }
4260 }
4261}
4262
4263
4264
4265
4266
4267
4268
4269#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
4270#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
4271pub struct ConfigRequest {
4272#[serde(rename = "authenticatedUsername")]
4274 #[serde(skip_serializing_if="Option::is_none")]
4275 pub authenticated_username: Option<String>,
4276
4277#[serde(rename = "clientVersion")]
4279 #[serde(skip_serializing_if="Option::is_none")]
4280 pub client_version: Option<String>,
4281
4282#[serde(rename = "connectionId")]
4284 pub connection_id: String,
4285
4286#[serde(rename = "environment")]
4288 #[serde(skip_serializing_if="Option::is_none")]
4289 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
4290
4291#[serde(rename = "files")]
4293 #[serde(skip_serializing_if="Option::is_none")]
4294 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4295
4296#[serde(rename = "metadata")]
4298 #[serde(skip_serializing_if="Option::is_none")]
4299 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
4300
4301#[serde(rename = "remoteAddress")]
4303 pub remote_address: String,
4304
4305#[serde(rename = "username")]
4307 pub username: String,
4308
4309}
4310
4311
4312impl ConfigRequest {
4313 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
4314 pub fn new(connection_id: String, remote_address: String, username: String, ) -> ConfigRequest {
4315 ConfigRequest {
4316 authenticated_username: None,
4317 client_version: None,
4318 connection_id,
4319 environment: None,
4320 files: None,
4321 metadata: None,
4322 remote_address,
4323 username,
4324 }
4325 }
4326}
4327
4328impl std::string::ToString for ConfigRequest {
4332 fn to_string(&self) -> String {
4333 let params: Vec<Option<String>> = vec![
4334
4335 self.authenticated_username.as_ref().map(|authenticated_username| {
4336 [
4337 "authenticatedUsername".to_string(),
4338 authenticated_username.to_string(),
4339 ].join(",")
4340 }),
4341
4342
4343 self.client_version.as_ref().map(|client_version| {
4344 [
4345 "clientVersion".to_string(),
4346 client_version.to_string(),
4347 ].join(",")
4348 }),
4349
4350
4351 Some("connectionId".to_string()),
4352 Some(self.connection_id.to_string()),
4353
4354 Some("remoteAddress".to_string()),
4365 Some(self.remote_address.to_string()),
4366
4367
4368 Some("username".to_string()),
4369 Some(self.username.to_string()),
4370
4371 ];
4372
4373 params.into_iter().flatten().collect::<Vec<_>>().join(",")
4374 }
4375}
4376
4377impl std::str::FromStr for ConfigRequest {
4381 type Err = String;
4382
4383 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
4384 #[derive(Default)]
4386 #[allow(dead_code)]
4387 struct IntermediateRep {
4388 pub authenticated_username: Vec<String>,
4389 pub client_version: Vec<String>,
4390 pub connection_id: Vec<String>,
4391 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4392 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4393 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4394 pub remote_address: Vec<String>,
4395 pub username: Vec<String>,
4396 }
4397
4398 let mut intermediate_rep = IntermediateRep::default();
4399
4400 let mut string_iter = s.split(',');
4402 let mut key_result = string_iter.next();
4403
4404 while key_result.is_some() {
4405 let val = match string_iter.next() {
4406 Some(x) => x,
4407 None => return std::result::Result::Err("Missing value while parsing ConfigRequest".to_string())
4408 };
4409
4410 if let Some(key) = key_result {
4411 #[allow(clippy::match_single_binding)]
4412 match key {
4413 #[allow(clippy::redundant_clone)]
4414 "authenticatedUsername" => intermediate_rep.authenticated_username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4415 #[allow(clippy::redundant_clone)]
4416 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4417 #[allow(clippy::redundant_clone)]
4418 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4419 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigRequest".to_string()),
4420 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigRequest".to_string()),
4421 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigRequest".to_string()),
4422 #[allow(clippy::redundant_clone)]
4423 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4424 #[allow(clippy::redundant_clone)]
4425 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4426 _ => return std::result::Result::Err("Unexpected key while parsing ConfigRequest".to_string())
4427 }
4428 }
4429
4430 key_result = string_iter.next();
4432 }
4433
4434 std::result::Result::Ok(ConfigRequest {
4436 authenticated_username: intermediate_rep.authenticated_username.into_iter().next(),
4437 client_version: intermediate_rep.client_version.into_iter().next(),
4438 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in ConfigRequest".to_string())?,
4439 environment: intermediate_rep.environment.into_iter().next(),
4440 files: intermediate_rep.files.into_iter().next(),
4441 metadata: intermediate_rep.metadata.into_iter().next(),
4442 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in ConfigRequest".to_string())?,
4443 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in ConfigRequest".to_string())?,
4444 })
4445 }
4446}
4447
4448#[cfg(feature = "server")]
4451impl std::convert::TryFrom<header::IntoHeaderValue<ConfigRequest>> for HeaderValue {
4452 type Error = String;
4453
4454 fn try_from(hdr_value: header::IntoHeaderValue<ConfigRequest>) -> std::result::Result<Self, Self::Error> {
4455 let hdr_value = hdr_value.to_string();
4456 match HeaderValue::from_str(&hdr_value) {
4457 std::result::Result::Ok(value) => std::result::Result::Ok(value),
4458 std::result::Result::Err(e) => std::result::Result::Err(
4459 format!("Invalid header value for ConfigRequest - value: {} is invalid {}",
4460 hdr_value, e))
4461 }
4462 }
4463}
4464
4465#[cfg(feature = "server")]
4466impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigRequest> {
4467 type Error = String;
4468
4469 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
4470 match hdr_value.to_str() {
4471 std::result::Result::Ok(value) => {
4472 match <ConfigRequest as std::str::FromStr>::from_str(value) {
4473 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
4474 std::result::Result::Err(err) => std::result::Result::Err(
4475 format!("Unable to convert header value '{}' into ConfigRequest - {}",
4476 value, err))
4477 }
4478 },
4479 std::result::Result::Err(e) => std::result::Result::Err(
4480 format!("Unable to convert header: {:?} to string: {}",
4481 hdr_value, e))
4482 }
4483 }
4484}
4485
4486
4487
4488
4489
4490
4491
4492#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
4493#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
4494pub struct ConfigResponseBody {
4495#[serde(rename = "authenticatedUsername")]
4497 #[serde(skip_serializing_if="Option::is_none")]
4498 pub authenticated_username: Option<String>,
4499
4500#[serde(rename = "clientVersion")]
4502 #[serde(skip_serializing_if="Option::is_none")]
4503 pub client_version: Option<String>,
4504
4505 #[serde(rename = "config")]
4506 pub config: models::AppConfig,
4507
4508#[serde(rename = "connectionId")]
4510 pub connection_id: String,
4511
4512#[serde(rename = "environment")]
4514 #[serde(skip_serializing_if="Option::is_none")]
4515 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
4516
4517#[serde(rename = "files")]
4519 #[serde(skip_serializing_if="Option::is_none")]
4520 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4521
4522#[serde(rename = "metadata")]
4524 #[serde(skip_serializing_if="Option::is_none")]
4525 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
4526
4527#[serde(rename = "remoteAddress")]
4529 pub remote_address: String,
4530
4531#[serde(rename = "username")]
4533 pub username: String,
4534
4535}
4536
4537
4538impl ConfigResponseBody {
4539 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
4540 pub fn new(config: models::AppConfig, connection_id: String, remote_address: String, username: String, ) -> ConfigResponseBody {
4541 ConfigResponseBody {
4542 authenticated_username: None,
4543 client_version: None,
4544 config,
4545 connection_id,
4546 environment: None,
4547 files: None,
4548 metadata: None,
4549 remote_address,
4550 username,
4551 }
4552 }
4553}
4554
4555impl std::string::ToString for ConfigResponseBody {
4559 fn to_string(&self) -> String {
4560 let params: Vec<Option<String>> = vec![
4561
4562 self.authenticated_username.as_ref().map(|authenticated_username| {
4563 [
4564 "authenticatedUsername".to_string(),
4565 authenticated_username.to_string(),
4566 ].join(",")
4567 }),
4568
4569
4570 self.client_version.as_ref().map(|client_version| {
4571 [
4572 "clientVersion".to_string(),
4573 client_version.to_string(),
4574 ].join(",")
4575 }),
4576
4577 Some("connectionId".to_string()),
4581 Some(self.connection_id.to_string()),
4582
4583 Some("remoteAddress".to_string()),
4594 Some(self.remote_address.to_string()),
4595
4596
4597 Some("username".to_string()),
4598 Some(self.username.to_string()),
4599
4600 ];
4601
4602 params.into_iter().flatten().collect::<Vec<_>>().join(",")
4603 }
4604}
4605
4606impl std::str::FromStr for ConfigResponseBody {
4610 type Err = String;
4611
4612 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
4613 #[derive(Default)]
4615 #[allow(dead_code)]
4616 struct IntermediateRep {
4617 pub authenticated_username: Vec<String>,
4618 pub client_version: Vec<String>,
4619 pub config: Vec<models::AppConfig>,
4620 pub connection_id: Vec<String>,
4621 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4622 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4623 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4624 pub remote_address: Vec<String>,
4625 pub username: Vec<String>,
4626 }
4627
4628 let mut intermediate_rep = IntermediateRep::default();
4629
4630 let mut string_iter = s.split(',');
4632 let mut key_result = string_iter.next();
4633
4634 while key_result.is_some() {
4635 let val = match string_iter.next() {
4636 Some(x) => x,
4637 None => return std::result::Result::Err("Missing value while parsing ConfigResponseBody".to_string())
4638 };
4639
4640 if let Some(key) = key_result {
4641 #[allow(clippy::match_single_binding)]
4642 match key {
4643 #[allow(clippy::redundant_clone)]
4644 "authenticatedUsername" => intermediate_rep.authenticated_username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4645 #[allow(clippy::redundant_clone)]
4646 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4647 #[allow(clippy::redundant_clone)]
4648 "config" => intermediate_rep.config.push(<models::AppConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4649 #[allow(clippy::redundant_clone)]
4650 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4651 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigResponseBody".to_string()),
4652 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigResponseBody".to_string()),
4653 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in ConfigResponseBody".to_string()),
4654 #[allow(clippy::redundant_clone)]
4655 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4656 #[allow(clippy::redundant_clone)]
4657 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4658 _ => return std::result::Result::Err("Unexpected key while parsing ConfigResponseBody".to_string())
4659 }
4660 }
4661
4662 key_result = string_iter.next();
4664 }
4665
4666 std::result::Result::Ok(ConfigResponseBody {
4668 authenticated_username: intermediate_rep.authenticated_username.into_iter().next(),
4669 client_version: intermediate_rep.client_version.into_iter().next(),
4670 config: intermediate_rep.config.into_iter().next().ok_or_else(|| "config missing in ConfigResponseBody".to_string())?,
4671 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in ConfigResponseBody".to_string())?,
4672 environment: intermediate_rep.environment.into_iter().next(),
4673 files: intermediate_rep.files.into_iter().next(),
4674 metadata: intermediate_rep.metadata.into_iter().next(),
4675 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in ConfigResponseBody".to_string())?,
4676 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in ConfigResponseBody".to_string())?,
4677 })
4678 }
4679}
4680
4681#[cfg(feature = "server")]
4684impl std::convert::TryFrom<header::IntoHeaderValue<ConfigResponseBody>> for HeaderValue {
4685 type Error = String;
4686
4687 fn try_from(hdr_value: header::IntoHeaderValue<ConfigResponseBody>) -> std::result::Result<Self, Self::Error> {
4688 let hdr_value = hdr_value.to_string();
4689 match HeaderValue::from_str(&hdr_value) {
4690 std::result::Result::Ok(value) => std::result::Result::Ok(value),
4691 std::result::Result::Err(e) => std::result::Result::Err(
4692 format!("Invalid header value for ConfigResponseBody - value: {} is invalid {}",
4693 hdr_value, e))
4694 }
4695 }
4696}
4697
4698#[cfg(feature = "server")]
4699impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConfigResponseBody> {
4700 type Error = String;
4701
4702 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
4703 match hdr_value.to_str() {
4704 std::result::Result::Ok(value) => {
4705 match <ConfigResponseBody as std::str::FromStr>::from_str(value) {
4706 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
4707 std::result::Result::Err(err) => std::result::Result::Err(
4708 format!("Unable to convert header value '{}' into ConfigResponseBody - {}",
4709 value, err))
4710 }
4711 },
4712 std::result::Result::Err(e) => std::result::Result::Err(
4713 format!("Unable to convert header: {:?} to string: {}",
4714 hdr_value, e))
4715 }
4716 }
4717}
4718
4719
4720
4721
4722#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
4727#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
4728pub struct ConnectionAuthPendingMetadata {
4729#[serde(rename = "clientVersion")]
4731 #[serde(skip_serializing_if="Option::is_none")]
4732 pub client_version: Option<String>,
4733
4734#[serde(rename = "connectionId")]
4736 pub connection_id: String,
4737
4738#[serde(rename = "environment")]
4740 #[serde(skip_serializing_if="Option::is_none")]
4741 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
4742
4743#[serde(rename = "files")]
4745 #[serde(skip_serializing_if="Option::is_none")]
4746 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4747
4748#[serde(rename = "metadata")]
4750 #[serde(skip_serializing_if="Option::is_none")]
4751 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
4752
4753#[serde(rename = "remoteAddress")]
4755 pub remote_address: String,
4756
4757#[serde(rename = "username")]
4759 pub username: String,
4760
4761}
4762
4763
4764impl ConnectionAuthPendingMetadata {
4765 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
4766 pub fn new(connection_id: String, remote_address: String, username: String, ) -> ConnectionAuthPendingMetadata {
4767 ConnectionAuthPendingMetadata {
4768 client_version: None,
4769 connection_id,
4770 environment: None,
4771 files: None,
4772 metadata: None,
4773 remote_address,
4774 username,
4775 }
4776 }
4777}
4778
4779impl std::string::ToString for ConnectionAuthPendingMetadata {
4783 fn to_string(&self) -> String {
4784 let params: Vec<Option<String>> = vec![
4785
4786 self.client_version.as_ref().map(|client_version| {
4787 [
4788 "clientVersion".to_string(),
4789 client_version.to_string(),
4790 ].join(",")
4791 }),
4792
4793
4794 Some("connectionId".to_string()),
4795 Some(self.connection_id.to_string()),
4796
4797 Some("remoteAddress".to_string()),
4808 Some(self.remote_address.to_string()),
4809
4810
4811 Some("username".to_string()),
4812 Some(self.username.to_string()),
4813
4814 ];
4815
4816 params.into_iter().flatten().collect::<Vec<_>>().join(",")
4817 }
4818}
4819
4820impl std::str::FromStr for ConnectionAuthPendingMetadata {
4824 type Err = String;
4825
4826 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
4827 #[derive(Default)]
4829 #[allow(dead_code)]
4830 struct IntermediateRep {
4831 pub client_version: Vec<String>,
4832 pub connection_id: Vec<String>,
4833 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4834 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4835 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
4836 pub remote_address: Vec<String>,
4837 pub username: Vec<String>,
4838 }
4839
4840 let mut intermediate_rep = IntermediateRep::default();
4841
4842 let mut string_iter = s.split(',');
4844 let mut key_result = string_iter.next();
4845
4846 while key_result.is_some() {
4847 let val = match string_iter.next() {
4848 Some(x) => x,
4849 None => return std::result::Result::Err("Missing value while parsing ConnectionAuthPendingMetadata".to_string())
4850 };
4851
4852 if let Some(key) = key_result {
4853 #[allow(clippy::match_single_binding)]
4854 match key {
4855 #[allow(clippy::redundant_clone)]
4856 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4857 #[allow(clippy::redundant_clone)]
4858 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4859 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthPendingMetadata".to_string()),
4860 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthPendingMetadata".to_string()),
4861 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthPendingMetadata".to_string()),
4862 #[allow(clippy::redundant_clone)]
4863 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4864 #[allow(clippy::redundant_clone)]
4865 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
4866 _ => return std::result::Result::Err("Unexpected key while parsing ConnectionAuthPendingMetadata".to_string())
4867 }
4868 }
4869
4870 key_result = string_iter.next();
4872 }
4873
4874 std::result::Result::Ok(ConnectionAuthPendingMetadata {
4876 client_version: intermediate_rep.client_version.into_iter().next(),
4877 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in ConnectionAuthPendingMetadata".to_string())?,
4878 environment: intermediate_rep.environment.into_iter().next(),
4879 files: intermediate_rep.files.into_iter().next(),
4880 metadata: intermediate_rep.metadata.into_iter().next(),
4881 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in ConnectionAuthPendingMetadata".to_string())?,
4882 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in ConnectionAuthPendingMetadata".to_string())?,
4883 })
4884 }
4885}
4886
4887#[cfg(feature = "server")]
4890impl std::convert::TryFrom<header::IntoHeaderValue<ConnectionAuthPendingMetadata>> for HeaderValue {
4891 type Error = String;
4892
4893 fn try_from(hdr_value: header::IntoHeaderValue<ConnectionAuthPendingMetadata>) -> std::result::Result<Self, Self::Error> {
4894 let hdr_value = hdr_value.to_string();
4895 match HeaderValue::from_str(&hdr_value) {
4896 std::result::Result::Ok(value) => std::result::Result::Ok(value),
4897 std::result::Result::Err(e) => std::result::Result::Err(
4898 format!("Invalid header value for ConnectionAuthPendingMetadata - value: {} is invalid {}",
4899 hdr_value, e))
4900 }
4901 }
4902}
4903
4904#[cfg(feature = "server")]
4905impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConnectionAuthPendingMetadata> {
4906 type Error = String;
4907
4908 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
4909 match hdr_value.to_str() {
4910 std::result::Result::Ok(value) => {
4911 match <ConnectionAuthPendingMetadata as std::str::FromStr>::from_str(value) {
4912 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
4913 std::result::Result::Err(err) => std::result::Result::Err(
4914 format!("Unable to convert header value '{}' into ConnectionAuthPendingMetadata - {}",
4915 value, err))
4916 }
4917 },
4918 std::result::Result::Err(e) => std::result::Result::Err(
4919 format!("Unable to convert header: {:?} to string: {}",
4920 hdr_value, e))
4921 }
4922 }
4923}
4924
4925
4926
4927
4928#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
4933#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
4934pub struct ConnectionAuthenticatedMetadata {
4935#[serde(rename = "authenticatedUsername")]
4937 #[serde(skip_serializing_if="Option::is_none")]
4938 pub authenticated_username: Option<String>,
4939
4940#[serde(rename = "clientVersion")]
4942 #[serde(skip_serializing_if="Option::is_none")]
4943 pub client_version: Option<String>,
4944
4945#[serde(rename = "connectionId")]
4947 pub connection_id: String,
4948
4949#[serde(rename = "environment")]
4951 #[serde(skip_serializing_if="Option::is_none")]
4952 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
4953
4954#[serde(rename = "files")]
4956 #[serde(skip_serializing_if="Option::is_none")]
4957 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
4958
4959#[serde(rename = "metadata")]
4961 #[serde(skip_serializing_if="Option::is_none")]
4962 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
4963
4964#[serde(rename = "remoteAddress")]
4966 pub remote_address: String,
4967
4968#[serde(rename = "username")]
4970 pub username: String,
4971
4972}
4973
4974
4975impl ConnectionAuthenticatedMetadata {
4976 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
4977 pub fn new(connection_id: String, remote_address: String, username: String, ) -> ConnectionAuthenticatedMetadata {
4978 ConnectionAuthenticatedMetadata {
4979 authenticated_username: None,
4980 client_version: None,
4981 connection_id,
4982 environment: None,
4983 files: None,
4984 metadata: None,
4985 remote_address,
4986 username,
4987 }
4988 }
4989}
4990
4991impl std::string::ToString for ConnectionAuthenticatedMetadata {
4995 fn to_string(&self) -> String {
4996 let params: Vec<Option<String>> = vec![
4997
4998 self.authenticated_username.as_ref().map(|authenticated_username| {
4999 [
5000 "authenticatedUsername".to_string(),
5001 authenticated_username.to_string(),
5002 ].join(",")
5003 }),
5004
5005
5006 self.client_version.as_ref().map(|client_version| {
5007 [
5008 "clientVersion".to_string(),
5009 client_version.to_string(),
5010 ].join(",")
5011 }),
5012
5013
5014 Some("connectionId".to_string()),
5015 Some(self.connection_id.to_string()),
5016
5017 Some("remoteAddress".to_string()),
5028 Some(self.remote_address.to_string()),
5029
5030
5031 Some("username".to_string()),
5032 Some(self.username.to_string()),
5033
5034 ];
5035
5036 params.into_iter().flatten().collect::<Vec<_>>().join(",")
5037 }
5038}
5039
5040impl std::str::FromStr for ConnectionAuthenticatedMetadata {
5044 type Err = String;
5045
5046 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
5047 #[derive(Default)]
5049 #[allow(dead_code)]
5050 struct IntermediateRep {
5051 pub authenticated_username: Vec<String>,
5052 pub client_version: Vec<String>,
5053 pub connection_id: Vec<String>,
5054 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
5055 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
5056 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
5057 pub remote_address: Vec<String>,
5058 pub username: Vec<String>,
5059 }
5060
5061 let mut intermediate_rep = IntermediateRep::default();
5062
5063 let mut string_iter = s.split(',');
5065 let mut key_result = string_iter.next();
5066
5067 while key_result.is_some() {
5068 let val = match string_iter.next() {
5069 Some(x) => x,
5070 None => return std::result::Result::Err("Missing value while parsing ConnectionAuthenticatedMetadata".to_string())
5071 };
5072
5073 if let Some(key) = key_result {
5074 #[allow(clippy::match_single_binding)]
5075 match key {
5076 #[allow(clippy::redundant_clone)]
5077 "authenticatedUsername" => intermediate_rep.authenticated_username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5078 #[allow(clippy::redundant_clone)]
5079 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5080 #[allow(clippy::redundant_clone)]
5081 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5082 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthenticatedMetadata".to_string()),
5083 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthenticatedMetadata".to_string()),
5084 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionAuthenticatedMetadata".to_string()),
5085 #[allow(clippy::redundant_clone)]
5086 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5087 #[allow(clippy::redundant_clone)]
5088 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5089 _ => return std::result::Result::Err("Unexpected key while parsing ConnectionAuthenticatedMetadata".to_string())
5090 }
5091 }
5092
5093 key_result = string_iter.next();
5095 }
5096
5097 std::result::Result::Ok(ConnectionAuthenticatedMetadata {
5099 authenticated_username: intermediate_rep.authenticated_username.into_iter().next(),
5100 client_version: intermediate_rep.client_version.into_iter().next(),
5101 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in ConnectionAuthenticatedMetadata".to_string())?,
5102 environment: intermediate_rep.environment.into_iter().next(),
5103 files: intermediate_rep.files.into_iter().next(),
5104 metadata: intermediate_rep.metadata.into_iter().next(),
5105 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in ConnectionAuthenticatedMetadata".to_string())?,
5106 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in ConnectionAuthenticatedMetadata".to_string())?,
5107 })
5108 }
5109}
5110
5111#[cfg(feature = "server")]
5114impl std::convert::TryFrom<header::IntoHeaderValue<ConnectionAuthenticatedMetadata>> for HeaderValue {
5115 type Error = String;
5116
5117 fn try_from(hdr_value: header::IntoHeaderValue<ConnectionAuthenticatedMetadata>) -> std::result::Result<Self, Self::Error> {
5118 let hdr_value = hdr_value.to_string();
5119 match HeaderValue::from_str(&hdr_value) {
5120 std::result::Result::Ok(value) => std::result::Result::Ok(value),
5121 std::result::Result::Err(e) => std::result::Result::Err(
5122 format!("Invalid header value for ConnectionAuthenticatedMetadata - value: {} is invalid {}",
5123 hdr_value, e))
5124 }
5125 }
5126}
5127
5128#[cfg(feature = "server")]
5129impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConnectionAuthenticatedMetadata> {
5130 type Error = String;
5131
5132 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
5133 match hdr_value.to_str() {
5134 std::result::Result::Ok(value) => {
5135 match <ConnectionAuthenticatedMetadata as std::str::FromStr>::from_str(value) {
5136 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
5137 std::result::Result::Err(err) => std::result::Result::Err(
5138 format!("Unable to convert header value '{}' into ConnectionAuthenticatedMetadata - {}",
5139 value, err))
5140 }
5141 },
5142 std::result::Result::Err(e) => std::result::Result::Err(
5143 format!("Unable to convert header: {:?} to string: {}",
5144 hdr_value, e))
5145 }
5146 }
5147}
5148
5149
5150
5151
5152#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
5157#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
5158pub struct ConnectionMetadata {
5159#[serde(rename = "connectionId")]
5161 pub connection_id: String,
5162
5163#[serde(rename = "environment")]
5165 #[serde(skip_serializing_if="Option::is_none")]
5166 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
5167
5168#[serde(rename = "files")]
5170 #[serde(skip_serializing_if="Option::is_none")]
5171 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
5172
5173#[serde(rename = "metadata")]
5175 #[serde(skip_serializing_if="Option::is_none")]
5176 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
5177
5178#[serde(rename = "remoteAddress")]
5180 pub remote_address: String,
5181
5182}
5183
5184
5185impl ConnectionMetadata {
5186 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
5187 pub fn new(connection_id: String, remote_address: String, ) -> ConnectionMetadata {
5188 ConnectionMetadata {
5189 connection_id,
5190 environment: None,
5191 files: None,
5192 metadata: None,
5193 remote_address,
5194 }
5195 }
5196}
5197
5198impl std::string::ToString for ConnectionMetadata {
5202 fn to_string(&self) -> String {
5203 let params: Vec<Option<String>> = vec![
5204
5205 Some("connectionId".to_string()),
5206 Some(self.connection_id.to_string()),
5207
5208 Some("remoteAddress".to_string()),
5219 Some(self.remote_address.to_string()),
5220
5221 ];
5222
5223 params.into_iter().flatten().collect::<Vec<_>>().join(",")
5224 }
5225}
5226
5227impl std::str::FromStr for ConnectionMetadata {
5231 type Err = String;
5232
5233 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
5234 #[derive(Default)]
5236 #[allow(dead_code)]
5237 struct IntermediateRep {
5238 pub connection_id: Vec<String>,
5239 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
5240 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
5241 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
5242 pub remote_address: Vec<String>,
5243 }
5244
5245 let mut intermediate_rep = IntermediateRep::default();
5246
5247 let mut string_iter = s.split(',');
5249 let mut key_result = string_iter.next();
5250
5251 while key_result.is_some() {
5252 let val = match string_iter.next() {
5253 Some(x) => x,
5254 None => return std::result::Result::Err("Missing value while parsing ConnectionMetadata".to_string())
5255 };
5256
5257 if let Some(key) = key_result {
5258 #[allow(clippy::match_single_binding)]
5259 match key {
5260 #[allow(clippy::redundant_clone)]
5261 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5262 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionMetadata".to_string()),
5263 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionMetadata".to_string()),
5264 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in ConnectionMetadata".to_string()),
5265 #[allow(clippy::redundant_clone)]
5266 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5267 _ => return std::result::Result::Err("Unexpected key while parsing ConnectionMetadata".to_string())
5268 }
5269 }
5270
5271 key_result = string_iter.next();
5273 }
5274
5275 std::result::Result::Ok(ConnectionMetadata {
5277 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in ConnectionMetadata".to_string())?,
5278 environment: intermediate_rep.environment.into_iter().next(),
5279 files: intermediate_rep.files.into_iter().next(),
5280 metadata: intermediate_rep.metadata.into_iter().next(),
5281 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in ConnectionMetadata".to_string())?,
5282 })
5283 }
5284}
5285
5286#[cfg(feature = "server")]
5289impl std::convert::TryFrom<header::IntoHeaderValue<ConnectionMetadata>> for HeaderValue {
5290 type Error = String;
5291
5292 fn try_from(hdr_value: header::IntoHeaderValue<ConnectionMetadata>) -> std::result::Result<Self, Self::Error> {
5293 let hdr_value = hdr_value.to_string();
5294 match HeaderValue::from_str(&hdr_value) {
5295 std::result::Result::Ok(value) => std::result::Result::Ok(value),
5296 std::result::Result::Err(e) => std::result::Result::Err(
5297 format!("Invalid header value for ConnectionMetadata - value: {} is invalid {}",
5298 hdr_value, e))
5299 }
5300 }
5301}
5302
5303#[cfg(feature = "server")]
5304impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ConnectionMetadata> {
5305 type Error = String;
5306
5307 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
5308 match hdr_value.to_str() {
5309 std::result::Result::Ok(value) => {
5310 match <ConnectionMetadata as std::str::FromStr>::from_str(value) {
5311 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
5312 std::result::Result::Err(err) => std::result::Result::Err(
5313 format!("Unable to convert header value '{}' into ConnectionMetadata - {}",
5314 value, err))
5315 }
5316 },
5317 std::result::Result::Err(e) => std::result::Result::Err(
5318 format!("Unable to convert header: {:?} to string: {}",
5319 hdr_value, e))
5320 }
5321 }
5322}
5323
5324
5325
5326
5327#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
5328#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
5329pub struct Consistency(String);
5330
5331impl validator::Validate for Consistency {
5332 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
5333 std::result::Result::Ok(())
5334 }
5335}
5336
5337impl std::convert::From<String> for Consistency {
5338 fn from(x: String) -> Self {
5339 Consistency(x)
5340 }
5341}
5342
5343impl std::string::ToString for Consistency {
5344 fn to_string(&self) -> String {
5345 self.0.to_string()
5346 }
5347}
5348
5349impl std::str::FromStr for Consistency {
5350 type Err = std::string::ParseError;
5351 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
5352 std::result::Result::Ok(Consistency(x.to_string()))
5353 }
5354}
5355
5356impl std::convert::From<Consistency> for String {
5357 fn from(x: Consistency) -> Self {
5358 x.0
5359 }
5360}
5361
5362impl std::ops::Deref for Consistency {
5363 type Target = String;
5364 fn deref(&self) -> &String {
5365 &self.0
5366 }
5367}
5368
5369impl std::ops::DerefMut for Consistency {
5370 fn deref_mut(&mut self) -> &mut String {
5371 &mut self.0
5372 }
5373}
5374
5375
5376
5377
5378
5379
5380#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
5381#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
5382pub struct Container {
5383#[serde(rename = "args")]
5385 #[serde(skip_serializing_if="Option::is_none")]
5386 pub args: Option<Vec<String>>,
5387
5388#[serde(rename = "command")]
5390 #[serde(skip_serializing_if="Option::is_none")]
5391 pub command: Option<Vec<String>>,
5392
5393#[serde(rename = "env")]
5395 #[serde(skip_serializing_if="Option::is_none")]
5396 pub env: Option<Vec<models::EnvVar>>,
5397
5398#[serde(rename = "envFrom")]
5400 #[serde(skip_serializing_if="Option::is_none")]
5401 pub env_from: Option<Vec<models::EnvFromSource>>,
5402
5403#[serde(rename = "image")]
5405 #[serde(skip_serializing_if="Option::is_none")]
5406 pub image: Option<String>,
5407
5408#[serde(rename = "imagePullPolicy")]
5410 #[serde(skip_serializing_if="Option::is_none")]
5411 pub image_pull_policy: Option<String>,
5412
5413 #[serde(rename = "lifecycle")]
5414 #[serde(skip_serializing_if="Option::is_none")]
5415 pub lifecycle: Option<models::Lifecycle>,
5416
5417 #[serde(rename = "livenessProbe")]
5418 #[serde(skip_serializing_if="Option::is_none")]
5419 pub liveness_probe: Option<models::Probe>,
5420
5421#[serde(rename = "name")]
5423 #[serde(skip_serializing_if="Option::is_none")]
5424 pub name: Option<String>,
5425
5426#[serde(rename = "ports")]
5428 #[serde(skip_serializing_if="Option::is_none")]
5429 pub ports: Option<Vec<models::ContainerPort>>,
5430
5431 #[serde(rename = "readinessProbe")]
5432 #[serde(skip_serializing_if="Option::is_none")]
5433 pub readiness_probe: Option<models::Probe>,
5434
5435 #[serde(rename = "resources")]
5436 #[serde(skip_serializing_if="Option::is_none")]
5437 pub resources: Option<models::ResourceRequirements>,
5438
5439 #[serde(rename = "securityContext")]
5440 #[serde(skip_serializing_if="Option::is_none")]
5441 pub security_context: Option<models::SecurityContext>,
5442
5443 #[serde(rename = "startupProbe")]
5444 #[serde(skip_serializing_if="Option::is_none")]
5445 pub startup_probe: Option<models::Probe>,
5446
5447#[serde(rename = "stdin")]
5449 #[serde(skip_serializing_if="Option::is_none")]
5450 pub stdin: Option<bool>,
5451
5452#[serde(rename = "stdinOnce")]
5454 #[serde(skip_serializing_if="Option::is_none")]
5455 pub stdin_once: Option<bool>,
5456
5457#[serde(rename = "terminationMessagePath")]
5459 #[serde(skip_serializing_if="Option::is_none")]
5460 pub termination_message_path: Option<String>,
5461
5462#[serde(rename = "terminationMessagePolicy")]
5464 #[serde(skip_serializing_if="Option::is_none")]
5465 pub termination_message_policy: Option<String>,
5466
5467#[serde(rename = "tty")]
5469 #[serde(skip_serializing_if="Option::is_none")]
5470 pub tty: Option<bool>,
5471
5472#[serde(rename = "volumeDevices")]
5474 #[serde(skip_serializing_if="Option::is_none")]
5475 pub volume_devices: Option<Vec<models::VolumeDevice>>,
5476
5477#[serde(rename = "volumeMounts")]
5479 #[serde(skip_serializing_if="Option::is_none")]
5480 pub volume_mounts: Option<Vec<models::VolumeMount>>,
5481
5482#[serde(rename = "workingDir")]
5484 #[serde(skip_serializing_if="Option::is_none")]
5485 pub working_dir: Option<String>,
5486
5487}
5488
5489
5490impl Container {
5491 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
5492 pub fn new() -> Container {
5493 Container {
5494 args: None,
5495 command: None,
5496 env: None,
5497 env_from: None,
5498 image: None,
5499 image_pull_policy: None,
5500 lifecycle: None,
5501 liveness_probe: None,
5502 name: None,
5503 ports: None,
5504 readiness_probe: None,
5505 resources: None,
5506 security_context: None,
5507 startup_probe: None,
5508 stdin: None,
5509 stdin_once: None,
5510 termination_message_path: None,
5511 termination_message_policy: None,
5512 tty: None,
5513 volume_devices: None,
5514 volume_mounts: None,
5515 working_dir: None,
5516 }
5517 }
5518}
5519
5520impl std::string::ToString for Container {
5524 fn to_string(&self) -> String {
5525 let params: Vec<Option<String>> = vec![
5526
5527 self.args.as_ref().map(|args| {
5528 [
5529 "args".to_string(),
5530 args.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
5531 ].join(",")
5532 }),
5533
5534
5535 self.command.as_ref().map(|command| {
5536 [
5537 "command".to_string(),
5538 command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
5539 ].join(",")
5540 }),
5541
5542 self.image.as_ref().map(|image| {
5548 [
5549 "image".to_string(),
5550 image.to_string(),
5551 ].join(",")
5552 }),
5553
5554
5555 self.image_pull_policy.as_ref().map(|image_pull_policy| {
5556 [
5557 "imagePullPolicy".to_string(),
5558 image_pull_policy.to_string(),
5559 ].join(",")
5560 }),
5561
5562 self.name.as_ref().map(|name| {
5568 [
5569 "name".to_string(),
5570 name.to_string(),
5571 ].join(",")
5572 }),
5573
5574 self.stdin.as_ref().map(|stdin| {
5586 [
5587 "stdin".to_string(),
5588 stdin.to_string(),
5589 ].join(",")
5590 }),
5591
5592
5593 self.stdin_once.as_ref().map(|stdin_once| {
5594 [
5595 "stdinOnce".to_string(),
5596 stdin_once.to_string(),
5597 ].join(",")
5598 }),
5599
5600
5601 self.termination_message_path.as_ref().map(|termination_message_path| {
5602 [
5603 "terminationMessagePath".to_string(),
5604 termination_message_path.to_string(),
5605 ].join(",")
5606 }),
5607
5608
5609 self.termination_message_policy.as_ref().map(|termination_message_policy| {
5610 [
5611 "terminationMessagePolicy".to_string(),
5612 termination_message_policy.to_string(),
5613 ].join(",")
5614 }),
5615
5616
5617 self.tty.as_ref().map(|tty| {
5618 [
5619 "tty".to_string(),
5620 tty.to_string(),
5621 ].join(",")
5622 }),
5623
5624 self.working_dir.as_ref().map(|working_dir| {
5630 [
5631 "workingDir".to_string(),
5632 working_dir.to_string(),
5633 ].join(",")
5634 }),
5635
5636 ];
5637
5638 params.into_iter().flatten().collect::<Vec<_>>().join(",")
5639 }
5640}
5641
5642impl std::str::FromStr for Container {
5646 type Err = String;
5647
5648 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
5649 #[derive(Default)]
5651 #[allow(dead_code)]
5652 struct IntermediateRep {
5653 pub args: Vec<Vec<String>>,
5654 pub command: Vec<Vec<String>>,
5655 pub env: Vec<Vec<models::EnvVar>>,
5656 pub env_from: Vec<Vec<models::EnvFromSource>>,
5657 pub image: Vec<String>,
5658 pub image_pull_policy: Vec<String>,
5659 pub lifecycle: Vec<models::Lifecycle>,
5660 pub liveness_probe: Vec<models::Probe>,
5661 pub name: Vec<String>,
5662 pub ports: Vec<Vec<models::ContainerPort>>,
5663 pub readiness_probe: Vec<models::Probe>,
5664 pub resources: Vec<models::ResourceRequirements>,
5665 pub security_context: Vec<models::SecurityContext>,
5666 pub startup_probe: Vec<models::Probe>,
5667 pub stdin: Vec<bool>,
5668 pub stdin_once: Vec<bool>,
5669 pub termination_message_path: Vec<String>,
5670 pub termination_message_policy: Vec<String>,
5671 pub tty: Vec<bool>,
5672 pub volume_devices: Vec<Vec<models::VolumeDevice>>,
5673 pub volume_mounts: Vec<Vec<models::VolumeMount>>,
5674 pub working_dir: Vec<String>,
5675 }
5676
5677 let mut intermediate_rep = IntermediateRep::default();
5678
5679 let mut string_iter = s.split(',');
5681 let mut key_result = string_iter.next();
5682
5683 while key_result.is_some() {
5684 let val = match string_iter.next() {
5685 Some(x) => x,
5686 None => return std::result::Result::Err("Missing value while parsing Container".to_string())
5687 };
5688
5689 if let Some(key) = key_result {
5690 #[allow(clippy::match_single_binding)]
5691 match key {
5692 "args" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5693 "command" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5694 "env" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5695 "envFrom" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5696 #[allow(clippy::redundant_clone)]
5697 "image" => intermediate_rep.image.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5698 #[allow(clippy::redundant_clone)]
5699 "imagePullPolicy" => intermediate_rep.image_pull_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5700 #[allow(clippy::redundant_clone)]
5701 "lifecycle" => intermediate_rep.lifecycle.push(<models::Lifecycle as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5702 #[allow(clippy::redundant_clone)]
5703 "livenessProbe" => intermediate_rep.liveness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5704 #[allow(clippy::redundant_clone)]
5705 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5706 "ports" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5707 #[allow(clippy::redundant_clone)]
5708 "readinessProbe" => intermediate_rep.readiness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5709 #[allow(clippy::redundant_clone)]
5710 "resources" => intermediate_rep.resources.push(<models::ResourceRequirements as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5711 #[allow(clippy::redundant_clone)]
5712 "securityContext" => intermediate_rep.security_context.push(<models::SecurityContext as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5713 #[allow(clippy::redundant_clone)]
5714 "startupProbe" => intermediate_rep.startup_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5715 #[allow(clippy::redundant_clone)]
5716 "stdin" => intermediate_rep.stdin.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5717 #[allow(clippy::redundant_clone)]
5718 "stdinOnce" => intermediate_rep.stdin_once.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5719 #[allow(clippy::redundant_clone)]
5720 "terminationMessagePath" => intermediate_rep.termination_message_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5721 #[allow(clippy::redundant_clone)]
5722 "terminationMessagePolicy" => intermediate_rep.termination_message_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5723 #[allow(clippy::redundant_clone)]
5724 "tty" => intermediate_rep.tty.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5725 "volumeDevices" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5726 "volumeMounts" => return std::result::Result::Err("Parsing a container in this style is not supported in Container".to_string()),
5727 #[allow(clippy::redundant_clone)]
5728 "workingDir" => intermediate_rep.working_dir.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5729 _ => return std::result::Result::Err("Unexpected key while parsing Container".to_string())
5730 }
5731 }
5732
5733 key_result = string_iter.next();
5735 }
5736
5737 std::result::Result::Ok(Container {
5739 args: intermediate_rep.args.into_iter().next(),
5740 command: intermediate_rep.command.into_iter().next(),
5741 env: intermediate_rep.env.into_iter().next(),
5742 env_from: intermediate_rep.env_from.into_iter().next(),
5743 image: intermediate_rep.image.into_iter().next(),
5744 image_pull_policy: intermediate_rep.image_pull_policy.into_iter().next(),
5745 lifecycle: intermediate_rep.lifecycle.into_iter().next(),
5746 liveness_probe: intermediate_rep.liveness_probe.into_iter().next(),
5747 name: intermediate_rep.name.into_iter().next(),
5748 ports: intermediate_rep.ports.into_iter().next(),
5749 readiness_probe: intermediate_rep.readiness_probe.into_iter().next(),
5750 resources: intermediate_rep.resources.into_iter().next(),
5751 security_context: intermediate_rep.security_context.into_iter().next(),
5752 startup_probe: intermediate_rep.startup_probe.into_iter().next(),
5753 stdin: intermediate_rep.stdin.into_iter().next(),
5754 stdin_once: intermediate_rep.stdin_once.into_iter().next(),
5755 termination_message_path: intermediate_rep.termination_message_path.into_iter().next(),
5756 termination_message_policy: intermediate_rep.termination_message_policy.into_iter().next(),
5757 tty: intermediate_rep.tty.into_iter().next(),
5758 volume_devices: intermediate_rep.volume_devices.into_iter().next(),
5759 volume_mounts: intermediate_rep.volume_mounts.into_iter().next(),
5760 working_dir: intermediate_rep.working_dir.into_iter().next(),
5761 })
5762 }
5763}
5764
5765#[cfg(feature = "server")]
5768impl std::convert::TryFrom<header::IntoHeaderValue<Container>> for HeaderValue {
5769 type Error = String;
5770
5771 fn try_from(hdr_value: header::IntoHeaderValue<Container>) -> std::result::Result<Self, Self::Error> {
5772 let hdr_value = hdr_value.to_string();
5773 match HeaderValue::from_str(&hdr_value) {
5774 std::result::Result::Ok(value) => std::result::Result::Ok(value),
5775 std::result::Result::Err(e) => std::result::Result::Err(
5776 format!("Invalid header value for Container - value: {} is invalid {}",
5777 hdr_value, e))
5778 }
5779 }
5780}
5781
5782#[cfg(feature = "server")]
5783impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Container> {
5784 type Error = String;
5785
5786 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
5787 match hdr_value.to_str() {
5788 std::result::Result::Ok(value) => {
5789 match <Container as std::str::FromStr>::from_str(value) {
5790 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
5791 std::result::Result::Err(err) => std::result::Result::Err(
5792 format!("Unable to convert header value '{}' into Container - {}",
5793 value, err))
5794 }
5795 },
5796 std::result::Result::Err(e) => std::result::Result::Err(
5797 format!("Unable to convert header: {:?} to string: {}",
5798 hdr_value, e))
5799 }
5800 }
5801}
5802
5803
5804
5805
5806#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
5811#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
5812pub struct ContainerChangeResponseItem {
5813#[serde(rename = "Kind")]
5815 pub kind: i32,
5816
5817#[serde(rename = "Path")]
5819 pub path: String,
5820
5821}
5822
5823
5824impl ContainerChangeResponseItem {
5825 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
5826 pub fn new(kind: i32, path: String, ) -> ContainerChangeResponseItem {
5827 ContainerChangeResponseItem {
5828 kind,
5829 path,
5830 }
5831 }
5832}
5833
5834impl std::string::ToString for ContainerChangeResponseItem {
5838 fn to_string(&self) -> String {
5839 let params: Vec<Option<String>> = vec![
5840
5841 Some("Kind".to_string()),
5842 Some(self.kind.to_string()),
5843
5844
5845 Some("Path".to_string()),
5846 Some(self.path.to_string()),
5847
5848 ];
5849
5850 params.into_iter().flatten().collect::<Vec<_>>().join(",")
5851 }
5852}
5853
5854impl std::str::FromStr for ContainerChangeResponseItem {
5858 type Err = String;
5859
5860 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
5861 #[derive(Default)]
5863 #[allow(dead_code)]
5864 struct IntermediateRep {
5865 pub kind: Vec<i32>,
5866 pub path: Vec<String>,
5867 }
5868
5869 let mut intermediate_rep = IntermediateRep::default();
5870
5871 let mut string_iter = s.split(',');
5873 let mut key_result = string_iter.next();
5874
5875 while key_result.is_some() {
5876 let val = match string_iter.next() {
5877 Some(x) => x,
5878 None => return std::result::Result::Err("Missing value while parsing ContainerChangeResponseItem".to_string())
5879 };
5880
5881 if let Some(key) = key_result {
5882 #[allow(clippy::match_single_binding)]
5883 match key {
5884 #[allow(clippy::redundant_clone)]
5885 "Kind" => intermediate_rep.kind.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5886 #[allow(clippy::redundant_clone)]
5887 "Path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
5888 _ => return std::result::Result::Err("Unexpected key while parsing ContainerChangeResponseItem".to_string())
5889 }
5890 }
5891
5892 key_result = string_iter.next();
5894 }
5895
5896 std::result::Result::Ok(ContainerChangeResponseItem {
5898 kind: intermediate_rep.kind.into_iter().next().ok_or_else(|| "Kind missing in ContainerChangeResponseItem".to_string())?,
5899 path: intermediate_rep.path.into_iter().next().ok_or_else(|| "Path missing in ContainerChangeResponseItem".to_string())?,
5900 })
5901 }
5902}
5903
5904#[cfg(feature = "server")]
5907impl std::convert::TryFrom<header::IntoHeaderValue<ContainerChangeResponseItem>> for HeaderValue {
5908 type Error = String;
5909
5910 fn try_from(hdr_value: header::IntoHeaderValue<ContainerChangeResponseItem>) -> std::result::Result<Self, Self::Error> {
5911 let hdr_value = hdr_value.to_string();
5912 match HeaderValue::from_str(&hdr_value) {
5913 std::result::Result::Ok(value) => std::result::Result::Ok(value),
5914 std::result::Result::Err(e) => std::result::Result::Err(
5915 format!("Invalid header value for ContainerChangeResponseItem - value: {} is invalid {}",
5916 hdr_value, e))
5917 }
5918 }
5919}
5920
5921#[cfg(feature = "server")]
5922impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerChangeResponseItem> {
5923 type Error = String;
5924
5925 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
5926 match hdr_value.to_str() {
5927 std::result::Result::Ok(value) => {
5928 match <ContainerChangeResponseItem as std::str::FromStr>::from_str(value) {
5929 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
5930 std::result::Result::Err(err) => std::result::Result::Err(
5931 format!("Unable to convert header value '{}' into ContainerChangeResponseItem - {}",
5932 value, err))
5933 }
5934 },
5935 std::result::Result::Err(e) => std::result::Result::Err(
5936 format!("Unable to convert header: {:?} to string: {}",
5937 hdr_value, e))
5938 }
5939 }
5940}
5941
5942
5943
5944
5945#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
5950#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
5951pub struct ContainerCreateCreatedBody {
5952#[serde(rename = "Id")]
5954 pub id: String,
5955
5956#[serde(rename = "Warnings")]
5958 pub warnings: Vec<String>,
5959
5960}
5961
5962
5963impl ContainerCreateCreatedBody {
5964 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
5965 pub fn new(id: String, warnings: Vec<String>, ) -> ContainerCreateCreatedBody {
5966 ContainerCreateCreatedBody {
5967 id,
5968 warnings,
5969 }
5970 }
5971}
5972
5973impl std::string::ToString for ContainerCreateCreatedBody {
5977 fn to_string(&self) -> String {
5978 let params: Vec<Option<String>> = vec![
5979
5980 Some("Id".to_string()),
5981 Some(self.id.to_string()),
5982
5983
5984 Some("Warnings".to_string()),
5985 Some(self.warnings.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
5986
5987 ];
5988
5989 params.into_iter().flatten().collect::<Vec<_>>().join(",")
5990 }
5991}
5992
5993impl std::str::FromStr for ContainerCreateCreatedBody {
5997 type Err = String;
5998
5999 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6000 #[derive(Default)]
6002 #[allow(dead_code)]
6003 struct IntermediateRep {
6004 pub id: Vec<String>,
6005 pub warnings: Vec<Vec<String>>,
6006 }
6007
6008 let mut intermediate_rep = IntermediateRep::default();
6009
6010 let mut string_iter = s.split(',');
6012 let mut key_result = string_iter.next();
6013
6014 while key_result.is_some() {
6015 let val = match string_iter.next() {
6016 Some(x) => x,
6017 None => return std::result::Result::Err("Missing value while parsing ContainerCreateCreatedBody".to_string())
6018 };
6019
6020 if let Some(key) = key_result {
6021 #[allow(clippy::match_single_binding)]
6022 match key {
6023 #[allow(clippy::redundant_clone)]
6024 "Id" => intermediate_rep.id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6025 "Warnings" => return std::result::Result::Err("Parsing a container in this style is not supported in ContainerCreateCreatedBody".to_string()),
6026 _ => return std::result::Result::Err("Unexpected key while parsing ContainerCreateCreatedBody".to_string())
6027 }
6028 }
6029
6030 key_result = string_iter.next();
6032 }
6033
6034 std::result::Result::Ok(ContainerCreateCreatedBody {
6036 id: intermediate_rep.id.into_iter().next().ok_or_else(|| "Id missing in ContainerCreateCreatedBody".to_string())?,
6037 warnings: intermediate_rep.warnings.into_iter().next().ok_or_else(|| "Warnings missing in ContainerCreateCreatedBody".to_string())?,
6038 })
6039 }
6040}
6041
6042#[cfg(feature = "server")]
6045impl std::convert::TryFrom<header::IntoHeaderValue<ContainerCreateCreatedBody>> for HeaderValue {
6046 type Error = String;
6047
6048 fn try_from(hdr_value: header::IntoHeaderValue<ContainerCreateCreatedBody>) -> std::result::Result<Self, Self::Error> {
6049 let hdr_value = hdr_value.to_string();
6050 match HeaderValue::from_str(&hdr_value) {
6051 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6052 std::result::Result::Err(e) => std::result::Result::Err(
6053 format!("Invalid header value for ContainerCreateCreatedBody - value: {} is invalid {}",
6054 hdr_value, e))
6055 }
6056 }
6057}
6058
6059#[cfg(feature = "server")]
6060impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerCreateCreatedBody> {
6061 type Error = String;
6062
6063 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6064 match hdr_value.to_str() {
6065 std::result::Result::Ok(value) => {
6066 match <ContainerCreateCreatedBody as std::str::FromStr>::from_str(value) {
6067 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6068 std::result::Result::Err(err) => std::result::Result::Err(
6069 format!("Unable to convert header value '{}' into ContainerCreateCreatedBody - {}",
6070 value, err))
6071 }
6072 },
6073 std::result::Result::Err(e) => std::result::Result::Err(
6074 format!("Unable to convert header: {:?} to string: {}",
6075 hdr_value, e))
6076 }
6077 }
6078}
6079
6080
6081
6082
6083
6084
6085
6086#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6087#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6088pub struct ContainerPort {
6089#[serde(rename = "containerPort")]
6091 #[serde(skip_serializing_if="Option::is_none")]
6092 pub container_port: Option<i32>,
6093
6094#[serde(rename = "hostIP")]
6096 #[serde(skip_serializing_if="Option::is_none")]
6097 pub host_ip: Option<String>,
6098
6099#[serde(rename = "hostPort")]
6101 #[serde(skip_serializing_if="Option::is_none")]
6102 pub host_port: Option<i32>,
6103
6104#[serde(rename = "name")]
6106 #[serde(skip_serializing_if="Option::is_none")]
6107 pub name: Option<String>,
6108
6109#[serde(rename = "protocol")]
6111 #[serde(skip_serializing_if="Option::is_none")]
6112 pub protocol: Option<String>,
6113
6114}
6115
6116
6117impl ContainerPort {
6118 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6119 pub fn new() -> ContainerPort {
6120 ContainerPort {
6121 container_port: None,
6122 host_ip: None,
6123 host_port: None,
6124 name: None,
6125 protocol: None,
6126 }
6127 }
6128}
6129
6130impl std::string::ToString for ContainerPort {
6134 fn to_string(&self) -> String {
6135 let params: Vec<Option<String>> = vec![
6136
6137 self.container_port.as_ref().map(|container_port| {
6138 [
6139 "containerPort".to_string(),
6140 container_port.to_string(),
6141 ].join(",")
6142 }),
6143
6144
6145 self.host_ip.as_ref().map(|host_ip| {
6146 [
6147 "hostIP".to_string(),
6148 host_ip.to_string(),
6149 ].join(",")
6150 }),
6151
6152
6153 self.host_port.as_ref().map(|host_port| {
6154 [
6155 "hostPort".to_string(),
6156 host_port.to_string(),
6157 ].join(",")
6158 }),
6159
6160
6161 self.name.as_ref().map(|name| {
6162 [
6163 "name".to_string(),
6164 name.to_string(),
6165 ].join(",")
6166 }),
6167
6168
6169 self.protocol.as_ref().map(|protocol| {
6170 [
6171 "protocol".to_string(),
6172 protocol.to_string(),
6173 ].join(",")
6174 }),
6175
6176 ];
6177
6178 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6179 }
6180}
6181
6182impl std::str::FromStr for ContainerPort {
6186 type Err = String;
6187
6188 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6189 #[derive(Default)]
6191 #[allow(dead_code)]
6192 struct IntermediateRep {
6193 pub container_port: Vec<i32>,
6194 pub host_ip: Vec<String>,
6195 pub host_port: Vec<i32>,
6196 pub name: Vec<String>,
6197 pub protocol: Vec<String>,
6198 }
6199
6200 let mut intermediate_rep = IntermediateRep::default();
6201
6202 let mut string_iter = s.split(',');
6204 let mut key_result = string_iter.next();
6205
6206 while key_result.is_some() {
6207 let val = match string_iter.next() {
6208 Some(x) => x,
6209 None => return std::result::Result::Err("Missing value while parsing ContainerPort".to_string())
6210 };
6211
6212 if let Some(key) = key_result {
6213 #[allow(clippy::match_single_binding)]
6214 match key {
6215 #[allow(clippy::redundant_clone)]
6216 "containerPort" => intermediate_rep.container_port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6217 #[allow(clippy::redundant_clone)]
6218 "hostIP" => intermediate_rep.host_ip.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6219 #[allow(clippy::redundant_clone)]
6220 "hostPort" => intermediate_rep.host_port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6221 #[allow(clippy::redundant_clone)]
6222 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6223 #[allow(clippy::redundant_clone)]
6224 "protocol" => intermediate_rep.protocol.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6225 _ => return std::result::Result::Err("Unexpected key while parsing ContainerPort".to_string())
6226 }
6227 }
6228
6229 key_result = string_iter.next();
6231 }
6232
6233 std::result::Result::Ok(ContainerPort {
6235 container_port: intermediate_rep.container_port.into_iter().next(),
6236 host_ip: intermediate_rep.host_ip.into_iter().next(),
6237 host_port: intermediate_rep.host_port.into_iter().next(),
6238 name: intermediate_rep.name.into_iter().next(),
6239 protocol: intermediate_rep.protocol.into_iter().next(),
6240 })
6241 }
6242}
6243
6244#[cfg(feature = "server")]
6247impl std::convert::TryFrom<header::IntoHeaderValue<ContainerPort>> for HeaderValue {
6248 type Error = String;
6249
6250 fn try_from(hdr_value: header::IntoHeaderValue<ContainerPort>) -> std::result::Result<Self, Self::Error> {
6251 let hdr_value = hdr_value.to_string();
6252 match HeaderValue::from_str(&hdr_value) {
6253 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6254 std::result::Result::Err(e) => std::result::Result::Err(
6255 format!("Invalid header value for ContainerPort - value: {} is invalid {}",
6256 hdr_value, e))
6257 }
6258 }
6259}
6260
6261#[cfg(feature = "server")]
6262impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerPort> {
6263 type Error = String;
6264
6265 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6266 match hdr_value.to_str() {
6267 std::result::Result::Ok(value) => {
6268 match <ContainerPort as std::str::FromStr>::from_str(value) {
6269 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6270 std::result::Result::Err(err) => std::result::Result::Err(
6271 format!("Unable to convert header value '{}' into ContainerPort - {}",
6272 value, err))
6273 }
6274 },
6275 std::result::Result::Err(e) => std::result::Result::Err(
6276 format!("Unable to convert header: {:?} to string: {}",
6277 hdr_value, e))
6278 }
6279 }
6280}
6281
6282
6283
6284
6285#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6290#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6291pub struct ContainerTopOkBody {
6292#[serde(rename = "Processes")]
6294 pub processes: Vec<Vec<String>>,
6295
6296#[serde(rename = "Titles")]
6298 pub titles: Vec<String>,
6299
6300}
6301
6302
6303impl ContainerTopOkBody {
6304 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6305 pub fn new(processes: Vec<Vec<String>>, titles: Vec<String>, ) -> ContainerTopOkBody {
6306 ContainerTopOkBody {
6307 processes,
6308 titles,
6309 }
6310 }
6311}
6312
6313impl std::string::ToString for ContainerTopOkBody {
6317 fn to_string(&self) -> String {
6318 let params: Vec<Option<String>> = vec![
6319 Some("Titles".to_string()),
6323 Some(self.titles.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
6324
6325 ];
6326
6327 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6328 }
6329}
6330
6331impl std::str::FromStr for ContainerTopOkBody {
6335 type Err = String;
6336
6337 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6338 #[derive(Default)]
6340 #[allow(dead_code)]
6341 struct IntermediateRep {
6342 pub processes: Vec<Vec<Vec<String>>>,
6343 pub titles: Vec<Vec<String>>,
6344 }
6345
6346 let mut intermediate_rep = IntermediateRep::default();
6347
6348 let mut string_iter = s.split(',');
6350 let mut key_result = string_iter.next();
6351
6352 while key_result.is_some() {
6353 let val = match string_iter.next() {
6354 Some(x) => x,
6355 None => return std::result::Result::Err("Missing value while parsing ContainerTopOkBody".to_string())
6356 };
6357
6358 if let Some(key) = key_result {
6359 #[allow(clippy::match_single_binding)]
6360 match key {
6361 "Processes" => return std::result::Result::Err("Parsing a container in this style is not supported in ContainerTopOkBody".to_string()),
6362 "Titles" => return std::result::Result::Err("Parsing a container in this style is not supported in ContainerTopOkBody".to_string()),
6363 _ => return std::result::Result::Err("Unexpected key while parsing ContainerTopOkBody".to_string())
6364 }
6365 }
6366
6367 key_result = string_iter.next();
6369 }
6370
6371 std::result::Result::Ok(ContainerTopOkBody {
6373 processes: intermediate_rep.processes.into_iter().next().ok_or_else(|| "Processes missing in ContainerTopOkBody".to_string())?,
6374 titles: intermediate_rep.titles.into_iter().next().ok_or_else(|| "Titles missing in ContainerTopOkBody".to_string())?,
6375 })
6376 }
6377}
6378
6379#[cfg(feature = "server")]
6382impl std::convert::TryFrom<header::IntoHeaderValue<ContainerTopOkBody>> for HeaderValue {
6383 type Error = String;
6384
6385 fn try_from(hdr_value: header::IntoHeaderValue<ContainerTopOkBody>) -> std::result::Result<Self, Self::Error> {
6386 let hdr_value = hdr_value.to_string();
6387 match HeaderValue::from_str(&hdr_value) {
6388 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6389 std::result::Result::Err(e) => std::result::Result::Err(
6390 format!("Invalid header value for ContainerTopOkBody - value: {} is invalid {}",
6391 hdr_value, e))
6392 }
6393 }
6394}
6395
6396#[cfg(feature = "server")]
6397impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerTopOkBody> {
6398 type Error = String;
6399
6400 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6401 match hdr_value.to_str() {
6402 std::result::Result::Ok(value) => {
6403 match <ContainerTopOkBody as std::str::FromStr>::from_str(value) {
6404 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6405 std::result::Result::Err(err) => std::result::Result::Err(
6406 format!("Unable to convert header value '{}' into ContainerTopOkBody - {}",
6407 value, err))
6408 }
6409 },
6410 std::result::Result::Err(e) => std::result::Result::Err(
6411 format!("Unable to convert header: {:?} to string: {}",
6412 hdr_value, e))
6413 }
6414 }
6415}
6416
6417
6418
6419
6420#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6425#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6426pub struct ContainerUpdateOkBody {
6427#[serde(rename = "Warnings")]
6429 pub warnings: Vec<String>,
6430
6431}
6432
6433
6434impl ContainerUpdateOkBody {
6435 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6436 pub fn new(warnings: Vec<String>, ) -> ContainerUpdateOkBody {
6437 ContainerUpdateOkBody {
6438 warnings,
6439 }
6440 }
6441}
6442
6443impl std::string::ToString for ContainerUpdateOkBody {
6447 fn to_string(&self) -> String {
6448 let params: Vec<Option<String>> = vec![
6449
6450 Some("Warnings".to_string()),
6451 Some(self.warnings.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
6452
6453 ];
6454
6455 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6456 }
6457}
6458
6459impl std::str::FromStr for ContainerUpdateOkBody {
6463 type Err = String;
6464
6465 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6466 #[derive(Default)]
6468 #[allow(dead_code)]
6469 struct IntermediateRep {
6470 pub warnings: Vec<Vec<String>>,
6471 }
6472
6473 let mut intermediate_rep = IntermediateRep::default();
6474
6475 let mut string_iter = s.split(',');
6477 let mut key_result = string_iter.next();
6478
6479 while key_result.is_some() {
6480 let val = match string_iter.next() {
6481 Some(x) => x,
6482 None => return std::result::Result::Err("Missing value while parsing ContainerUpdateOkBody".to_string())
6483 };
6484
6485 if let Some(key) = key_result {
6486 #[allow(clippy::match_single_binding)]
6487 match key {
6488 "Warnings" => return std::result::Result::Err("Parsing a container in this style is not supported in ContainerUpdateOkBody".to_string()),
6489 _ => return std::result::Result::Err("Unexpected key while parsing ContainerUpdateOkBody".to_string())
6490 }
6491 }
6492
6493 key_result = string_iter.next();
6495 }
6496
6497 std::result::Result::Ok(ContainerUpdateOkBody {
6499 warnings: intermediate_rep.warnings.into_iter().next().ok_or_else(|| "Warnings missing in ContainerUpdateOkBody".to_string())?,
6500 })
6501 }
6502}
6503
6504#[cfg(feature = "server")]
6507impl std::convert::TryFrom<header::IntoHeaderValue<ContainerUpdateOkBody>> for HeaderValue {
6508 type Error = String;
6509
6510 fn try_from(hdr_value: header::IntoHeaderValue<ContainerUpdateOkBody>) -> std::result::Result<Self, Self::Error> {
6511 let hdr_value = hdr_value.to_string();
6512 match HeaderValue::from_str(&hdr_value) {
6513 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6514 std::result::Result::Err(e) => std::result::Result::Err(
6515 format!("Invalid header value for ContainerUpdateOkBody - value: {} is invalid {}",
6516 hdr_value, e))
6517 }
6518 }
6519}
6520
6521#[cfg(feature = "server")]
6522impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerUpdateOkBody> {
6523 type Error = String;
6524
6525 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6526 match hdr_value.to_str() {
6527 std::result::Result::Ok(value) => {
6528 match <ContainerUpdateOkBody as std::str::FromStr>::from_str(value) {
6529 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6530 std::result::Result::Err(err) => std::result::Result::Err(
6531 format!("Unable to convert header value '{}' into ContainerUpdateOkBody - {}",
6532 value, err))
6533 }
6534 },
6535 std::result::Result::Err(e) => std::result::Result::Err(
6536 format!("Unable to convert header: {:?} to string: {}",
6537 hdr_value, e))
6538 }
6539 }
6540}
6541
6542
6543
6544
6545#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6550#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6551pub struct ContainerWaitOkBody {
6552 #[serde(rename = "Error")]
6553 pub error: models::ContainerWaitOkBodyError,
6554
6555#[serde(rename = "StatusCode")]
6557 pub status_code: i64,
6558
6559}
6560
6561
6562impl ContainerWaitOkBody {
6563 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6564 pub fn new(error: models::ContainerWaitOkBodyError, status_code: i64, ) -> ContainerWaitOkBody {
6565 ContainerWaitOkBody {
6566 error,
6567 status_code,
6568 }
6569 }
6570}
6571
6572impl std::string::ToString for ContainerWaitOkBody {
6576 fn to_string(&self) -> String {
6577 let params: Vec<Option<String>> = vec![
6578 Some("StatusCode".to_string()),
6582 Some(self.status_code.to_string()),
6583
6584 ];
6585
6586 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6587 }
6588}
6589
6590impl std::str::FromStr for ContainerWaitOkBody {
6594 type Err = String;
6595
6596 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6597 #[derive(Default)]
6599 #[allow(dead_code)]
6600 struct IntermediateRep {
6601 pub error: Vec<models::ContainerWaitOkBodyError>,
6602 pub status_code: Vec<i64>,
6603 }
6604
6605 let mut intermediate_rep = IntermediateRep::default();
6606
6607 let mut string_iter = s.split(',');
6609 let mut key_result = string_iter.next();
6610
6611 while key_result.is_some() {
6612 let val = match string_iter.next() {
6613 Some(x) => x,
6614 None => return std::result::Result::Err("Missing value while parsing ContainerWaitOkBody".to_string())
6615 };
6616
6617 if let Some(key) = key_result {
6618 #[allow(clippy::match_single_binding)]
6619 match key {
6620 #[allow(clippy::redundant_clone)]
6621 "Error" => intermediate_rep.error.push(<models::ContainerWaitOkBodyError as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6622 #[allow(clippy::redundant_clone)]
6623 "StatusCode" => intermediate_rep.status_code.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6624 _ => return std::result::Result::Err("Unexpected key while parsing ContainerWaitOkBody".to_string())
6625 }
6626 }
6627
6628 key_result = string_iter.next();
6630 }
6631
6632 std::result::Result::Ok(ContainerWaitOkBody {
6634 error: intermediate_rep.error.into_iter().next().ok_or_else(|| "Error missing in ContainerWaitOkBody".to_string())?,
6635 status_code: intermediate_rep.status_code.into_iter().next().ok_or_else(|| "StatusCode missing in ContainerWaitOkBody".to_string())?,
6636 })
6637 }
6638}
6639
6640#[cfg(feature = "server")]
6643impl std::convert::TryFrom<header::IntoHeaderValue<ContainerWaitOkBody>> for HeaderValue {
6644 type Error = String;
6645
6646 fn try_from(hdr_value: header::IntoHeaderValue<ContainerWaitOkBody>) -> std::result::Result<Self, Self::Error> {
6647 let hdr_value = hdr_value.to_string();
6648 match HeaderValue::from_str(&hdr_value) {
6649 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6650 std::result::Result::Err(e) => std::result::Result::Err(
6651 format!("Invalid header value for ContainerWaitOkBody - value: {} is invalid {}",
6652 hdr_value, e))
6653 }
6654 }
6655}
6656
6657#[cfg(feature = "server")]
6658impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerWaitOkBody> {
6659 type Error = String;
6660
6661 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6662 match hdr_value.to_str() {
6663 std::result::Result::Ok(value) => {
6664 match <ContainerWaitOkBody as std::str::FromStr>::from_str(value) {
6665 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6666 std::result::Result::Err(err) => std::result::Result::Err(
6667 format!("Unable to convert header value '{}' into ContainerWaitOkBody - {}",
6668 value, err))
6669 }
6670 },
6671 std::result::Result::Err(e) => std::result::Result::Err(
6672 format!("Unable to convert header: {:?} to string: {}",
6673 hdr_value, e))
6674 }
6675 }
6676}
6677
6678
6679
6680
6681#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6686#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6687pub struct ContainerWaitOkBodyError {
6688#[serde(rename = "Message")]
6690 #[serde(skip_serializing_if="Option::is_none")]
6691 pub message: Option<String>,
6692
6693}
6694
6695
6696impl ContainerWaitOkBodyError {
6697 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6698 pub fn new() -> ContainerWaitOkBodyError {
6699 ContainerWaitOkBodyError {
6700 message: None,
6701 }
6702 }
6703}
6704
6705impl std::string::ToString for ContainerWaitOkBodyError {
6709 fn to_string(&self) -> String {
6710 let params: Vec<Option<String>> = vec![
6711
6712 self.message.as_ref().map(|message| {
6713 [
6714 "Message".to_string(),
6715 message.to_string(),
6716 ].join(",")
6717 }),
6718
6719 ];
6720
6721 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6722 }
6723}
6724
6725impl std::str::FromStr for ContainerWaitOkBodyError {
6729 type Err = String;
6730
6731 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6732 #[derive(Default)]
6734 #[allow(dead_code)]
6735 struct IntermediateRep {
6736 pub message: Vec<String>,
6737 }
6738
6739 let mut intermediate_rep = IntermediateRep::default();
6740
6741 let mut string_iter = s.split(',');
6743 let mut key_result = string_iter.next();
6744
6745 while key_result.is_some() {
6746 let val = match string_iter.next() {
6747 Some(x) => x,
6748 None => return std::result::Result::Err("Missing value while parsing ContainerWaitOkBodyError".to_string())
6749 };
6750
6751 if let Some(key) = key_result {
6752 #[allow(clippy::match_single_binding)]
6753 match key {
6754 #[allow(clippy::redundant_clone)]
6755 "Message" => intermediate_rep.message.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6756 _ => return std::result::Result::Err("Unexpected key while parsing ContainerWaitOkBodyError".to_string())
6757 }
6758 }
6759
6760 key_result = string_iter.next();
6762 }
6763
6764 std::result::Result::Ok(ContainerWaitOkBodyError {
6766 message: intermediate_rep.message.into_iter().next(),
6767 })
6768 }
6769}
6770
6771#[cfg(feature = "server")]
6774impl std::convert::TryFrom<header::IntoHeaderValue<ContainerWaitOkBodyError>> for HeaderValue {
6775 type Error = String;
6776
6777 fn try_from(hdr_value: header::IntoHeaderValue<ContainerWaitOkBodyError>) -> std::result::Result<Self, Self::Error> {
6778 let hdr_value = hdr_value.to_string();
6779 match HeaderValue::from_str(&hdr_value) {
6780 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6781 std::result::Result::Err(e) => std::result::Result::Err(
6782 format!("Invalid header value for ContainerWaitOkBodyError - value: {} is invalid {}",
6783 hdr_value, e))
6784 }
6785 }
6786}
6787
6788#[cfg(feature = "server")]
6789impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ContainerWaitOkBodyError> {
6790 type Error = String;
6791
6792 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6793 match hdr_value.to_str() {
6794 std::result::Result::Ok(value) => {
6795 match <ContainerWaitOkBodyError as std::str::FromStr>::from_str(value) {
6796 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6797 std::result::Result::Err(err) => std::result::Result::Err(
6798 format!("Unable to convert header value '{}' into ContainerWaitOkBodyError - {}",
6799 value, err))
6800 }
6801 },
6802 std::result::Result::Err(e) => std::result::Result::Err(
6803 format!("Unable to convert header: {:?} to string: {}",
6804 hdr_value, e))
6805 }
6806 }
6807}
6808
6809
6810
6811
6812#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
6817#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
6818pub struct CsiVolumeSource {
6819#[serde(rename = "driver")]
6821 #[serde(skip_serializing_if="Option::is_none")]
6822 pub driver: Option<String>,
6823
6824#[serde(rename = "fsType")]
6826 #[serde(skip_serializing_if="Option::is_none")]
6827 pub fs_type: Option<String>,
6828
6829 #[serde(rename = "nodePublishSecretRef")]
6830 #[serde(skip_serializing_if="Option::is_none")]
6831 pub node_publish_secret_ref: Option<models::LocalObjectReference>,
6832
6833#[serde(rename = "readOnly")]
6835 #[serde(skip_serializing_if="Option::is_none")]
6836 pub read_only: Option<bool>,
6837
6838#[serde(rename = "volumeAttributes")]
6840 #[serde(skip_serializing_if="Option::is_none")]
6841 pub volume_attributes: Option<std::collections::HashMap<String, String>>,
6842
6843}
6844
6845
6846impl CsiVolumeSource {
6847 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
6848 pub fn new() -> CsiVolumeSource {
6849 CsiVolumeSource {
6850 driver: None,
6851 fs_type: None,
6852 node_publish_secret_ref: None,
6853 read_only: None,
6854 volume_attributes: None,
6855 }
6856 }
6857}
6858
6859impl std::string::ToString for CsiVolumeSource {
6863 fn to_string(&self) -> String {
6864 let params: Vec<Option<String>> = vec![
6865
6866 self.driver.as_ref().map(|driver| {
6867 [
6868 "driver".to_string(),
6869 driver.to_string(),
6870 ].join(",")
6871 }),
6872
6873
6874 self.fs_type.as_ref().map(|fs_type| {
6875 [
6876 "fsType".to_string(),
6877 fs_type.to_string(),
6878 ].join(",")
6879 }),
6880
6881 self.read_only.as_ref().map(|read_only| {
6885 [
6886 "readOnly".to_string(),
6887 read_only.to_string(),
6888 ].join(",")
6889 }),
6890
6891 ];
6894
6895 params.into_iter().flatten().collect::<Vec<_>>().join(",")
6896 }
6897}
6898
6899impl std::str::FromStr for CsiVolumeSource {
6903 type Err = String;
6904
6905 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
6906 #[derive(Default)]
6908 #[allow(dead_code)]
6909 struct IntermediateRep {
6910 pub driver: Vec<String>,
6911 pub fs_type: Vec<String>,
6912 pub node_publish_secret_ref: Vec<models::LocalObjectReference>,
6913 pub read_only: Vec<bool>,
6914 pub volume_attributes: Vec<std::collections::HashMap<String, String>>,
6915 }
6916
6917 let mut intermediate_rep = IntermediateRep::default();
6918
6919 let mut string_iter = s.split(',');
6921 let mut key_result = string_iter.next();
6922
6923 while key_result.is_some() {
6924 let val = match string_iter.next() {
6925 Some(x) => x,
6926 None => return std::result::Result::Err("Missing value while parsing CsiVolumeSource".to_string())
6927 };
6928
6929 if let Some(key) = key_result {
6930 #[allow(clippy::match_single_binding)]
6931 match key {
6932 #[allow(clippy::redundant_clone)]
6933 "driver" => intermediate_rep.driver.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6934 #[allow(clippy::redundant_clone)]
6935 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6936 #[allow(clippy::redundant_clone)]
6937 "nodePublishSecretRef" => intermediate_rep.node_publish_secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6938 #[allow(clippy::redundant_clone)]
6939 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
6940 "volumeAttributes" => return std::result::Result::Err("Parsing a container in this style is not supported in CsiVolumeSource".to_string()),
6941 _ => return std::result::Result::Err("Unexpected key while parsing CsiVolumeSource".to_string())
6942 }
6943 }
6944
6945 key_result = string_iter.next();
6947 }
6948
6949 std::result::Result::Ok(CsiVolumeSource {
6951 driver: intermediate_rep.driver.into_iter().next(),
6952 fs_type: intermediate_rep.fs_type.into_iter().next(),
6953 node_publish_secret_ref: intermediate_rep.node_publish_secret_ref.into_iter().next(),
6954 read_only: intermediate_rep.read_only.into_iter().next(),
6955 volume_attributes: intermediate_rep.volume_attributes.into_iter().next(),
6956 })
6957 }
6958}
6959
6960#[cfg(feature = "server")]
6963impl std::convert::TryFrom<header::IntoHeaderValue<CsiVolumeSource>> for HeaderValue {
6964 type Error = String;
6965
6966 fn try_from(hdr_value: header::IntoHeaderValue<CsiVolumeSource>) -> std::result::Result<Self, Self::Error> {
6967 let hdr_value = hdr_value.to_string();
6968 match HeaderValue::from_str(&hdr_value) {
6969 std::result::Result::Ok(value) => std::result::Result::Ok(value),
6970 std::result::Result::Err(e) => std::result::Result::Err(
6971 format!("Invalid header value for CsiVolumeSource - value: {} is invalid {}",
6972 hdr_value, e))
6973 }
6974 }
6975}
6976
6977#[cfg(feature = "server")]
6978impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<CsiVolumeSource> {
6979 type Error = String;
6980
6981 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
6982 match hdr_value.to_str() {
6983 std::result::Result::Ok(value) => {
6984 match <CsiVolumeSource as std::str::FromStr>::from_str(value) {
6985 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
6986 std::result::Result::Err(err) => std::result::Result::Err(
6987 format!("Unable to convert header value '{}' into CsiVolumeSource - {}",
6988 value, err))
6989 }
6990 },
6991 std::result::Result::Err(e) => std::result::Result::Err(
6992 format!("Unable to convert header: {:?} to string: {}",
6993 hdr_value, e))
6994 }
6995 }
6996}
6997
6998
6999
7000
7001
7002
7003
7004#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
7005#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7006pub struct DeviceMapping {
7007 #[serde(rename = "CgroupPermissions")]
7008 #[serde(skip_serializing_if="Option::is_none")]
7009 pub cgroup_permissions: Option<String>,
7010
7011 #[serde(rename = "PathInContainer")]
7012 #[serde(skip_serializing_if="Option::is_none")]
7013 pub path_in_container: Option<String>,
7014
7015 #[serde(rename = "PathOnHost")]
7016 #[serde(skip_serializing_if="Option::is_none")]
7017 pub path_on_host: Option<String>,
7018
7019}
7020
7021
7022impl DeviceMapping {
7023 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
7024 pub fn new() -> DeviceMapping {
7025 DeviceMapping {
7026 cgroup_permissions: None,
7027 path_in_container: None,
7028 path_on_host: None,
7029 }
7030 }
7031}
7032
7033impl std::string::ToString for DeviceMapping {
7037 fn to_string(&self) -> String {
7038 let params: Vec<Option<String>> = vec![
7039
7040 self.cgroup_permissions.as_ref().map(|cgroup_permissions| {
7041 [
7042 "CgroupPermissions".to_string(),
7043 cgroup_permissions.to_string(),
7044 ].join(",")
7045 }),
7046
7047
7048 self.path_in_container.as_ref().map(|path_in_container| {
7049 [
7050 "PathInContainer".to_string(),
7051 path_in_container.to_string(),
7052 ].join(",")
7053 }),
7054
7055
7056 self.path_on_host.as_ref().map(|path_on_host| {
7057 [
7058 "PathOnHost".to_string(),
7059 path_on_host.to_string(),
7060 ].join(",")
7061 }),
7062
7063 ];
7064
7065 params.into_iter().flatten().collect::<Vec<_>>().join(",")
7066 }
7067}
7068
7069impl std::str::FromStr for DeviceMapping {
7073 type Err = String;
7074
7075 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
7076 #[derive(Default)]
7078 #[allow(dead_code)]
7079 struct IntermediateRep {
7080 pub cgroup_permissions: Vec<String>,
7081 pub path_in_container: Vec<String>,
7082 pub path_on_host: Vec<String>,
7083 }
7084
7085 let mut intermediate_rep = IntermediateRep::default();
7086
7087 let mut string_iter = s.split(',');
7089 let mut key_result = string_iter.next();
7090
7091 while key_result.is_some() {
7092 let val = match string_iter.next() {
7093 Some(x) => x,
7094 None => return std::result::Result::Err("Missing value while parsing DeviceMapping".to_string())
7095 };
7096
7097 if let Some(key) = key_result {
7098 #[allow(clippy::match_single_binding)]
7099 match key {
7100 #[allow(clippy::redundant_clone)]
7101 "CgroupPermissions" => intermediate_rep.cgroup_permissions.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7102 #[allow(clippy::redundant_clone)]
7103 "PathInContainer" => intermediate_rep.path_in_container.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7104 #[allow(clippy::redundant_clone)]
7105 "PathOnHost" => intermediate_rep.path_on_host.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7106 _ => return std::result::Result::Err("Unexpected key while parsing DeviceMapping".to_string())
7107 }
7108 }
7109
7110 key_result = string_iter.next();
7112 }
7113
7114 std::result::Result::Ok(DeviceMapping {
7116 cgroup_permissions: intermediate_rep.cgroup_permissions.into_iter().next(),
7117 path_in_container: intermediate_rep.path_in_container.into_iter().next(),
7118 path_on_host: intermediate_rep.path_on_host.into_iter().next(),
7119 })
7120 }
7121}
7122
7123#[cfg(feature = "server")]
7126impl std::convert::TryFrom<header::IntoHeaderValue<DeviceMapping>> for HeaderValue {
7127 type Error = String;
7128
7129 fn try_from(hdr_value: header::IntoHeaderValue<DeviceMapping>) -> std::result::Result<Self, Self::Error> {
7130 let hdr_value = hdr_value.to_string();
7131 match HeaderValue::from_str(&hdr_value) {
7132 std::result::Result::Ok(value) => std::result::Result::Ok(value),
7133 std::result::Result::Err(e) => std::result::Result::Err(
7134 format!("Invalid header value for DeviceMapping - value: {} is invalid {}",
7135 hdr_value, e))
7136 }
7137 }
7138}
7139
7140#[cfg(feature = "server")]
7141impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DeviceMapping> {
7142 type Error = String;
7143
7144 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
7145 match hdr_value.to_str() {
7146 std::result::Result::Ok(value) => {
7147 match <DeviceMapping as std::str::FromStr>::from_str(value) {
7148 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
7149 std::result::Result::Err(err) => std::result::Result::Err(
7150 format!("Unable to convert header value '{}' into DeviceMapping - {}",
7151 value, err))
7152 }
7153 },
7154 std::result::Result::Err(e) => std::result::Result::Err(
7155 format!("Unable to convert header: {:?} to string: {}",
7156 hdr_value, e))
7157 }
7158 }
7159}
7160
7161
7162
7163
7164#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
7169#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7170pub struct DeviceRequest {
7171 #[serde(rename = "Capabilities")]
7172 #[serde(skip_serializing_if="Option::is_none")]
7173 pub capabilities: Option<Vec<Vec<String>>>,
7174
7175 #[serde(rename = "Count")]
7176 #[serde(skip_serializing_if="Option::is_none")]
7177 pub count: Option<i64>,
7178
7179 #[serde(rename = "DeviceIDs")]
7180 #[serde(skip_serializing_if="Option::is_none")]
7181 pub device_ids: Option<Vec<String>>,
7182
7183 #[serde(rename = "Driver")]
7184 #[serde(skip_serializing_if="Option::is_none")]
7185 pub driver: Option<String>,
7186
7187 #[serde(rename = "Options")]
7188 #[serde(skip_serializing_if="Option::is_none")]
7189 pub options: Option<std::collections::HashMap<String, String>>,
7190
7191}
7192
7193
7194impl DeviceRequest {
7195 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
7196 pub fn new() -> DeviceRequest {
7197 DeviceRequest {
7198 capabilities: None,
7199 count: None,
7200 device_ids: None,
7201 driver: None,
7202 options: None,
7203 }
7204 }
7205}
7206
7207impl std::string::ToString for DeviceRequest {
7211 fn to_string(&self) -> String {
7212 let params: Vec<Option<String>> = vec![
7213 self.count.as_ref().map(|count| {
7217 [
7218 "Count".to_string(),
7219 count.to_string(),
7220 ].join(",")
7221 }),
7222
7223
7224 self.device_ids.as_ref().map(|device_ids| {
7225 [
7226 "DeviceIDs".to_string(),
7227 device_ids.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
7228 ].join(",")
7229 }),
7230
7231
7232 self.driver.as_ref().map(|driver| {
7233 [
7234 "Driver".to_string(),
7235 driver.to_string(),
7236 ].join(",")
7237 }),
7238
7239 ];
7242
7243 params.into_iter().flatten().collect::<Vec<_>>().join(",")
7244 }
7245}
7246
7247impl std::str::FromStr for DeviceRequest {
7251 type Err = String;
7252
7253 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
7254 #[derive(Default)]
7256 #[allow(dead_code)]
7257 struct IntermediateRep {
7258 pub capabilities: Vec<Vec<Vec<String>>>,
7259 pub count: Vec<i64>,
7260 pub device_ids: Vec<Vec<String>>,
7261 pub driver: Vec<String>,
7262 pub options: Vec<std::collections::HashMap<String, String>>,
7263 }
7264
7265 let mut intermediate_rep = IntermediateRep::default();
7266
7267 let mut string_iter = s.split(',');
7269 let mut key_result = string_iter.next();
7270
7271 while key_result.is_some() {
7272 let val = match string_iter.next() {
7273 Some(x) => x,
7274 None => return std::result::Result::Err("Missing value while parsing DeviceRequest".to_string())
7275 };
7276
7277 if let Some(key) = key_result {
7278 #[allow(clippy::match_single_binding)]
7279 match key {
7280 "Capabilities" => return std::result::Result::Err("Parsing a container in this style is not supported in DeviceRequest".to_string()),
7281 #[allow(clippy::redundant_clone)]
7282 "Count" => intermediate_rep.count.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7283 "DeviceIDs" => return std::result::Result::Err("Parsing a container in this style is not supported in DeviceRequest".to_string()),
7284 #[allow(clippy::redundant_clone)]
7285 "Driver" => intermediate_rep.driver.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7286 "Options" => return std::result::Result::Err("Parsing a container in this style is not supported in DeviceRequest".to_string()),
7287 _ => return std::result::Result::Err("Unexpected key while parsing DeviceRequest".to_string())
7288 }
7289 }
7290
7291 key_result = string_iter.next();
7293 }
7294
7295 std::result::Result::Ok(DeviceRequest {
7297 capabilities: intermediate_rep.capabilities.into_iter().next(),
7298 count: intermediate_rep.count.into_iter().next(),
7299 device_ids: intermediate_rep.device_ids.into_iter().next(),
7300 driver: intermediate_rep.driver.into_iter().next(),
7301 options: intermediate_rep.options.into_iter().next(),
7302 })
7303 }
7304}
7305
7306#[cfg(feature = "server")]
7309impl std::convert::TryFrom<header::IntoHeaderValue<DeviceRequest>> for HeaderValue {
7310 type Error = String;
7311
7312 fn try_from(hdr_value: header::IntoHeaderValue<DeviceRequest>) -> std::result::Result<Self, Self::Error> {
7313 let hdr_value = hdr_value.to_string();
7314 match HeaderValue::from_str(&hdr_value) {
7315 std::result::Result::Ok(value) => std::result::Result::Ok(value),
7316 std::result::Result::Err(e) => std::result::Result::Err(
7317 format!("Invalid header value for DeviceRequest - value: {} is invalid {}",
7318 hdr_value, e))
7319 }
7320 }
7321}
7322
7323#[cfg(feature = "server")]
7324impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DeviceRequest> {
7325 type Error = String;
7326
7327 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
7328 match hdr_value.to_str() {
7329 std::result::Result::Ok(value) => {
7330 match <DeviceRequest as std::str::FromStr>::from_str(value) {
7331 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
7332 std::result::Result::Err(err) => std::result::Result::Err(
7333 format!("Unable to convert header value '{}' into DeviceRequest - {}",
7334 value, err))
7335 }
7336 },
7337 std::result::Result::Err(e) => std::result::Result::Err(
7338 format!("Unable to convert header: {:?} to string: {}",
7339 hdr_value, e))
7340 }
7341 }
7342}
7343
7344
7345
7346
7347#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
7349#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7350pub struct DnsPolicy(String);
7351
7352impl validator::Validate for DnsPolicy {
7353 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
7354 std::result::Result::Ok(())
7355 }
7356}
7357
7358impl std::convert::From<String> for DnsPolicy {
7359 fn from(x: String) -> Self {
7360 DnsPolicy(x)
7361 }
7362}
7363
7364impl std::string::ToString for DnsPolicy {
7365 fn to_string(&self) -> String {
7366 self.0.to_string()
7367 }
7368}
7369
7370impl std::str::FromStr for DnsPolicy {
7371 type Err = std::string::ParseError;
7372 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
7373 std::result::Result::Ok(DnsPolicy(x.to_string()))
7374 }
7375}
7376
7377impl std::convert::From<DnsPolicy> for String {
7378 fn from(x: DnsPolicy) -> Self {
7379 x.0
7380 }
7381}
7382
7383impl std::ops::Deref for DnsPolicy {
7384 type Target = String;
7385 fn deref(&self) -> &String {
7386 &self.0
7387 }
7388}
7389
7390impl std::ops::DerefMut for DnsPolicy {
7391 fn deref_mut(&mut self) -> &mut String {
7392 &mut self.0
7393 }
7394}
7395
7396
7397
7398
7399
7400
7401#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
7402#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7403pub struct DockerConfig {
7404 #[serde(rename = "connection")]
7405 #[serde(skip_serializing_if="Option::is_none")]
7406 pub connection: Option<models::DockerConnectionConfig>,
7407
7408 #[serde(rename = "execution")]
7409 #[serde(skip_serializing_if="Option::is_none")]
7410 pub execution: Option<models::DockerExecutionConfig>,
7411
7412 #[serde(rename = "timeouts")]
7413 #[serde(skip_serializing_if="Option::is_none")]
7414 pub timeouts: Option<models::DockerTimeoutConfig>,
7415
7416}
7417
7418
7419impl DockerConfig {
7420 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
7421 pub fn new() -> DockerConfig {
7422 DockerConfig {
7423 connection: None,
7424 execution: None,
7425 timeouts: None,
7426 }
7427 }
7428}
7429
7430impl std::string::ToString for DockerConfig {
7434 fn to_string(&self) -> String {
7435 let params: Vec<Option<String>> = vec![
7436 ];
7443
7444 params.into_iter().flatten().collect::<Vec<_>>().join(",")
7445 }
7446}
7447
7448impl std::str::FromStr for DockerConfig {
7452 type Err = String;
7453
7454 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
7455 #[derive(Default)]
7457 #[allow(dead_code)]
7458 struct IntermediateRep {
7459 pub connection: Vec<models::DockerConnectionConfig>,
7460 pub execution: Vec<models::DockerExecutionConfig>,
7461 pub timeouts: Vec<models::DockerTimeoutConfig>,
7462 }
7463
7464 let mut intermediate_rep = IntermediateRep::default();
7465
7466 let mut string_iter = s.split(',');
7468 let mut key_result = string_iter.next();
7469
7470 while key_result.is_some() {
7471 let val = match string_iter.next() {
7472 Some(x) => x,
7473 None => return std::result::Result::Err("Missing value while parsing DockerConfig".to_string())
7474 };
7475
7476 if let Some(key) = key_result {
7477 #[allow(clippy::match_single_binding)]
7478 match key {
7479 #[allow(clippy::redundant_clone)]
7480 "connection" => intermediate_rep.connection.push(<models::DockerConnectionConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7481 #[allow(clippy::redundant_clone)]
7482 "execution" => intermediate_rep.execution.push(<models::DockerExecutionConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7483 #[allow(clippy::redundant_clone)]
7484 "timeouts" => intermediate_rep.timeouts.push(<models::DockerTimeoutConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7485 _ => return std::result::Result::Err("Unexpected key while parsing DockerConfig".to_string())
7486 }
7487 }
7488
7489 key_result = string_iter.next();
7491 }
7492
7493 std::result::Result::Ok(DockerConfig {
7495 connection: intermediate_rep.connection.into_iter().next(),
7496 execution: intermediate_rep.execution.into_iter().next(),
7497 timeouts: intermediate_rep.timeouts.into_iter().next(),
7498 })
7499 }
7500}
7501
7502#[cfg(feature = "server")]
7505impl std::convert::TryFrom<header::IntoHeaderValue<DockerConfig>> for HeaderValue {
7506 type Error = String;
7507
7508 fn try_from(hdr_value: header::IntoHeaderValue<DockerConfig>) -> std::result::Result<Self, Self::Error> {
7509 let hdr_value = hdr_value.to_string();
7510 match HeaderValue::from_str(&hdr_value) {
7511 std::result::Result::Ok(value) => std::result::Result::Ok(value),
7512 std::result::Result::Err(e) => std::result::Result::Err(
7513 format!("Invalid header value for DockerConfig - value: {} is invalid {}",
7514 hdr_value, e))
7515 }
7516 }
7517}
7518
7519#[cfg(feature = "server")]
7520impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DockerConfig> {
7521 type Error = String;
7522
7523 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
7524 match hdr_value.to_str() {
7525 std::result::Result::Ok(value) => {
7526 match <DockerConfig as std::str::FromStr>::from_str(value) {
7527 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
7528 std::result::Result::Err(err) => std::result::Result::Err(
7529 format!("Unable to convert header value '{}' into DockerConfig - {}",
7530 value, err))
7531 }
7532 },
7533 std::result::Result::Err(e) => std::result::Result::Err(
7534 format!("Unable to convert header: {:?} to string: {}",
7535 hdr_value, e))
7536 }
7537 }
7538}
7539
7540
7541
7542
7543
7544
7545
7546#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
7547#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7548pub struct DockerConnectionConfig {
7549#[serde(rename = "cacert")]
7551 #[serde(skip_serializing_if="Option::is_none")]
7552 pub cacert: Option<String>,
7553
7554#[serde(rename = "cert")]
7556 #[serde(skip_serializing_if="Option::is_none")]
7557 pub cert: Option<String>,
7558
7559#[serde(rename = "host")]
7561 #[serde(skip_serializing_if="Option::is_none")]
7562 pub host: Option<String>,
7563
7564#[serde(rename = "key")]
7566 #[serde(skip_serializing_if="Option::is_none")]
7567 pub key: Option<String>,
7568
7569}
7570
7571
7572impl DockerConnectionConfig {
7573 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
7574 pub fn new() -> DockerConnectionConfig {
7575 DockerConnectionConfig {
7576 cacert: None,
7577 cert: None,
7578 host: None,
7579 key: None,
7580 }
7581 }
7582}
7583
7584impl std::string::ToString for DockerConnectionConfig {
7588 fn to_string(&self) -> String {
7589 let params: Vec<Option<String>> = vec![
7590
7591 self.cacert.as_ref().map(|cacert| {
7592 [
7593 "cacert".to_string(),
7594 cacert.to_string(),
7595 ].join(",")
7596 }),
7597
7598
7599 self.cert.as_ref().map(|cert| {
7600 [
7601 "cert".to_string(),
7602 cert.to_string(),
7603 ].join(",")
7604 }),
7605
7606
7607 self.host.as_ref().map(|host| {
7608 [
7609 "host".to_string(),
7610 host.to_string(),
7611 ].join(",")
7612 }),
7613
7614
7615 self.key.as_ref().map(|key| {
7616 [
7617 "key".to_string(),
7618 key.to_string(),
7619 ].join(",")
7620 }),
7621
7622 ];
7623
7624 params.into_iter().flatten().collect::<Vec<_>>().join(",")
7625 }
7626}
7627
7628impl std::str::FromStr for DockerConnectionConfig {
7632 type Err = String;
7633
7634 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
7635 #[derive(Default)]
7637 #[allow(dead_code)]
7638 struct IntermediateRep {
7639 pub cacert: Vec<String>,
7640 pub cert: Vec<String>,
7641 pub host: Vec<String>,
7642 pub key: Vec<String>,
7643 }
7644
7645 let mut intermediate_rep = IntermediateRep::default();
7646
7647 let mut string_iter = s.split(',');
7649 let mut key_result = string_iter.next();
7650
7651 while key_result.is_some() {
7652 let val = match string_iter.next() {
7653 Some(x) => x,
7654 None => return std::result::Result::Err("Missing value while parsing DockerConnectionConfig".to_string())
7655 };
7656
7657 if let Some(key) = key_result {
7658 #[allow(clippy::match_single_binding)]
7659 match key {
7660 #[allow(clippy::redundant_clone)]
7661 "cacert" => intermediate_rep.cacert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7662 #[allow(clippy::redundant_clone)]
7663 "cert" => intermediate_rep.cert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7664 #[allow(clippy::redundant_clone)]
7665 "host" => intermediate_rep.host.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7666 #[allow(clippy::redundant_clone)]
7667 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7668 _ => return std::result::Result::Err("Unexpected key while parsing DockerConnectionConfig".to_string())
7669 }
7670 }
7671
7672 key_result = string_iter.next();
7674 }
7675
7676 std::result::Result::Ok(DockerConnectionConfig {
7678 cacert: intermediate_rep.cacert.into_iter().next(),
7679 cert: intermediate_rep.cert.into_iter().next(),
7680 host: intermediate_rep.host.into_iter().next(),
7681 key: intermediate_rep.key.into_iter().next(),
7682 })
7683 }
7684}
7685
7686#[cfg(feature = "server")]
7689impl std::convert::TryFrom<header::IntoHeaderValue<DockerConnectionConfig>> for HeaderValue {
7690 type Error = String;
7691
7692 fn try_from(hdr_value: header::IntoHeaderValue<DockerConnectionConfig>) -> std::result::Result<Self, Self::Error> {
7693 let hdr_value = hdr_value.to_string();
7694 match HeaderValue::from_str(&hdr_value) {
7695 std::result::Result::Ok(value) => std::result::Result::Ok(value),
7696 std::result::Result::Err(e) => std::result::Result::Err(
7697 format!("Invalid header value for DockerConnectionConfig - value: {} is invalid {}",
7698 hdr_value, e))
7699 }
7700 }
7701}
7702
7703#[cfg(feature = "server")]
7704impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DockerConnectionConfig> {
7705 type Error = String;
7706
7707 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
7708 match hdr_value.to_str() {
7709 std::result::Result::Ok(value) => {
7710 match <DockerConnectionConfig as std::str::FromStr>::from_str(value) {
7711 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
7712 std::result::Result::Err(err) => std::result::Result::Err(
7713 format!("Unable to convert header value '{}' into DockerConnectionConfig - {}",
7714 value, err))
7715 }
7716 },
7717 std::result::Result::Err(e) => std::result::Result::Err(
7718 format!("Unable to convert header: {:?} to string: {}",
7719 hdr_value, e))
7720 }
7721 }
7722}
7723
7724
7725
7726
7727#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
7732#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
7733pub struct DockerExecutionConfig {
7734#[serde(rename = "agentPath")]
7736 #[serde(skip_serializing_if="Option::is_none")]
7737 pub agent_path: Option<String>,
7738
7739 #[serde(rename = "auth")]
7740 #[serde(skip_serializing_if="Option::is_none")]
7741 pub auth: Option<models::AuthConfig>,
7742
7743 #[serde(rename = "container")]
7744 #[serde(skip_serializing_if="Option::is_none")]
7745 pub container: Option<models::Config>,
7746
7747#[serde(rename = "containername")]
7749 #[serde(skip_serializing_if="Option::is_none")]
7750 pub containername: Option<String>,
7751
7752#[serde(rename = "disableAgent")]
7754 #[serde(skip_serializing_if="Option::is_none")]
7755 pub disable_agent: Option<bool>,
7756
7757#[serde(rename = "exposeAuthMetadataAsEnv")]
7759 #[serde(skip_serializing_if="Option::is_none")]
7760 pub expose_auth_metadata_as_env: Option<bool>,
7761
7762 #[serde(rename = "host")]
7763 #[serde(skip_serializing_if="Option::is_none")]
7764 pub host: Option<models::HostConfig>,
7765
7766#[serde(rename = "idleCommand")]
7768 #[serde(skip_serializing_if="Option::is_none")]
7769 pub idle_command: Option<Vec<String>>,
7770
7771#[serde(rename = "imagePullPolicy")]
7773 #[serde(skip_serializing_if="Option::is_none")]
7774 pub image_pull_policy: Option<String>,
7775
7776#[serde(rename = "mode")]
7778 #[serde(skip_serializing_if="Option::is_none")]
7779 pub mode: Option<String>,
7780
7781 #[serde(rename = "network")]
7782 #[serde(skip_serializing_if="Option::is_none")]
7783 pub network: Option<models::NetworkingConfig>,
7784
7785 #[serde(rename = "platform")]
7786 #[serde(skip_serializing_if="Option::is_none")]
7787 pub platform: Option<models::Platform>,
7788
7789#[serde(rename = "shellCommand")]
7791 #[serde(skip_serializing_if="Option::is_none")]
7792 pub shell_command: Option<Vec<String>>,
7793
7794#[serde(rename = "subsystems")]
7796 #[serde(skip_serializing_if="Option::is_none")]
7797 pub subsystems: Option<std::collections::HashMap<String, String>>,
7798
7799}
7800
7801
7802impl DockerExecutionConfig {
7803 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
7804 pub fn new() -> DockerExecutionConfig {
7805 DockerExecutionConfig {
7806 agent_path: None,
7807 auth: None,
7808 container: None,
7809 containername: None,
7810 disable_agent: None,
7811 expose_auth_metadata_as_env: None,
7812 host: None,
7813 idle_command: None,
7814 image_pull_policy: None,
7815 mode: None,
7816 network: None,
7817 platform: None,
7818 shell_command: None,
7819 subsystems: None,
7820 }
7821 }
7822}
7823
7824impl std::string::ToString for DockerExecutionConfig {
7828 fn to_string(&self) -> String {
7829 let params: Vec<Option<String>> = vec![
7830
7831 self.agent_path.as_ref().map(|agent_path| {
7832 [
7833 "agentPath".to_string(),
7834 agent_path.to_string(),
7835 ].join(",")
7836 }),
7837
7838 self.containername.as_ref().map(|containername| {
7844 [
7845 "containername".to_string(),
7846 containername.to_string(),
7847 ].join(",")
7848 }),
7849
7850
7851 self.disable_agent.as_ref().map(|disable_agent| {
7852 [
7853 "disableAgent".to_string(),
7854 disable_agent.to_string(),
7855 ].join(",")
7856 }),
7857
7858
7859 self.expose_auth_metadata_as_env.as_ref().map(|expose_auth_metadata_as_env| {
7860 [
7861 "exposeAuthMetadataAsEnv".to_string(),
7862 expose_auth_metadata_as_env.to_string(),
7863 ].join(",")
7864 }),
7865
7866 self.idle_command.as_ref().map(|idle_command| {
7870 [
7871 "idleCommand".to_string(),
7872 idle_command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
7873 ].join(",")
7874 }),
7875
7876
7877 self.image_pull_policy.as_ref().map(|image_pull_policy| {
7878 [
7879 "imagePullPolicy".to_string(),
7880 image_pull_policy.to_string(),
7881 ].join(",")
7882 }),
7883
7884
7885 self.mode.as_ref().map(|mode| {
7886 [
7887 "mode".to_string(),
7888 mode.to_string(),
7889 ].join(",")
7890 }),
7891
7892 self.shell_command.as_ref().map(|shell_command| {
7898 [
7899 "shellCommand".to_string(),
7900 shell_command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
7901 ].join(",")
7902 }),
7903
7904 ];
7907
7908 params.into_iter().flatten().collect::<Vec<_>>().join(",")
7909 }
7910}
7911
7912impl std::str::FromStr for DockerExecutionConfig {
7916 type Err = String;
7917
7918 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
7919 #[derive(Default)]
7921 #[allow(dead_code)]
7922 struct IntermediateRep {
7923 pub agent_path: Vec<String>,
7924 pub auth: Vec<models::AuthConfig>,
7925 pub container: Vec<models::Config>,
7926 pub containername: Vec<String>,
7927 pub disable_agent: Vec<bool>,
7928 pub expose_auth_metadata_as_env: Vec<bool>,
7929 pub host: Vec<models::HostConfig>,
7930 pub idle_command: Vec<Vec<String>>,
7931 pub image_pull_policy: Vec<String>,
7932 pub mode: Vec<String>,
7933 pub network: Vec<models::NetworkingConfig>,
7934 pub platform: Vec<models::Platform>,
7935 pub shell_command: Vec<Vec<String>>,
7936 pub subsystems: Vec<std::collections::HashMap<String, String>>,
7937 }
7938
7939 let mut intermediate_rep = IntermediateRep::default();
7940
7941 let mut string_iter = s.split(',');
7943 let mut key_result = string_iter.next();
7944
7945 while key_result.is_some() {
7946 let val = match string_iter.next() {
7947 Some(x) => x,
7948 None => return std::result::Result::Err("Missing value while parsing DockerExecutionConfig".to_string())
7949 };
7950
7951 if let Some(key) = key_result {
7952 #[allow(clippy::match_single_binding)]
7953 match key {
7954 #[allow(clippy::redundant_clone)]
7955 "agentPath" => intermediate_rep.agent_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7956 #[allow(clippy::redundant_clone)]
7957 "auth" => intermediate_rep.auth.push(<models::AuthConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7958 #[allow(clippy::redundant_clone)]
7959 "container" => intermediate_rep.container.push(<models::Config as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7960 #[allow(clippy::redundant_clone)]
7961 "containername" => intermediate_rep.containername.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7962 #[allow(clippy::redundant_clone)]
7963 "disableAgent" => intermediate_rep.disable_agent.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7964 #[allow(clippy::redundant_clone)]
7965 "exposeAuthMetadataAsEnv" => intermediate_rep.expose_auth_metadata_as_env.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7966 #[allow(clippy::redundant_clone)]
7967 "host" => intermediate_rep.host.push(<models::HostConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7968 "idleCommand" => return std::result::Result::Err("Parsing a container in this style is not supported in DockerExecutionConfig".to_string()),
7969 #[allow(clippy::redundant_clone)]
7970 "imagePullPolicy" => intermediate_rep.image_pull_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7971 #[allow(clippy::redundant_clone)]
7972 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7973 #[allow(clippy::redundant_clone)]
7974 "network" => intermediate_rep.network.push(<models::NetworkingConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7975 #[allow(clippy::redundant_clone)]
7976 "platform" => intermediate_rep.platform.push(<models::Platform as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
7977 "shellCommand" => return std::result::Result::Err("Parsing a container in this style is not supported in DockerExecutionConfig".to_string()),
7978 "subsystems" => return std::result::Result::Err("Parsing a container in this style is not supported in DockerExecutionConfig".to_string()),
7979 _ => return std::result::Result::Err("Unexpected key while parsing DockerExecutionConfig".to_string())
7980 }
7981 }
7982
7983 key_result = string_iter.next();
7985 }
7986
7987 std::result::Result::Ok(DockerExecutionConfig {
7989 agent_path: intermediate_rep.agent_path.into_iter().next(),
7990 auth: intermediate_rep.auth.into_iter().next(),
7991 container: intermediate_rep.container.into_iter().next(),
7992 containername: intermediate_rep.containername.into_iter().next(),
7993 disable_agent: intermediate_rep.disable_agent.into_iter().next(),
7994 expose_auth_metadata_as_env: intermediate_rep.expose_auth_metadata_as_env.into_iter().next(),
7995 host: intermediate_rep.host.into_iter().next(),
7996 idle_command: intermediate_rep.idle_command.into_iter().next(),
7997 image_pull_policy: intermediate_rep.image_pull_policy.into_iter().next(),
7998 mode: intermediate_rep.mode.into_iter().next(),
7999 network: intermediate_rep.network.into_iter().next(),
8000 platform: intermediate_rep.platform.into_iter().next(),
8001 shell_command: intermediate_rep.shell_command.into_iter().next(),
8002 subsystems: intermediate_rep.subsystems.into_iter().next(),
8003 })
8004 }
8005}
8006
8007#[cfg(feature = "server")]
8010impl std::convert::TryFrom<header::IntoHeaderValue<DockerExecutionConfig>> for HeaderValue {
8011 type Error = String;
8012
8013 fn try_from(hdr_value: header::IntoHeaderValue<DockerExecutionConfig>) -> std::result::Result<Self, Self::Error> {
8014 let hdr_value = hdr_value.to_string();
8015 match HeaderValue::from_str(&hdr_value) {
8016 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8017 std::result::Result::Err(e) => std::result::Result::Err(
8018 format!("Invalid header value for DockerExecutionConfig - value: {} is invalid {}",
8019 hdr_value, e))
8020 }
8021 }
8022}
8023
8024#[cfg(feature = "server")]
8025impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DockerExecutionConfig> {
8026 type Error = String;
8027
8028 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8029 match hdr_value.to_str() {
8030 std::result::Result::Ok(value) => {
8031 match <DockerExecutionConfig as std::str::FromStr>::from_str(value) {
8032 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8033 std::result::Result::Err(err) => std::result::Result::Err(
8034 format!("Unable to convert header value '{}' into DockerExecutionConfig - {}",
8035 value, err))
8036 }
8037 },
8038 std::result::Result::Err(e) => std::result::Result::Err(
8039 format!("Unable to convert header: {:?} to string: {}",
8040 hdr_value, e))
8041 }
8042 }
8043}
8044
8045
8046
8047
8048#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
8050#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8051pub struct DockerExecutionMode(String);
8052
8053impl validator::Validate for DockerExecutionMode {
8054 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
8055 std::result::Result::Ok(())
8056 }
8057}
8058
8059impl std::convert::From<String> for DockerExecutionMode {
8060 fn from(x: String) -> Self {
8061 DockerExecutionMode(x)
8062 }
8063}
8064
8065impl std::string::ToString for DockerExecutionMode {
8066 fn to_string(&self) -> String {
8067 self.0.to_string()
8068 }
8069}
8070
8071impl std::str::FromStr for DockerExecutionMode {
8072 type Err = std::string::ParseError;
8073 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
8074 std::result::Result::Ok(DockerExecutionMode(x.to_string()))
8075 }
8076}
8077
8078impl std::convert::From<DockerExecutionMode> for String {
8079 fn from(x: DockerExecutionMode) -> Self {
8080 x.0
8081 }
8082}
8083
8084impl std::ops::Deref for DockerExecutionMode {
8085 type Target = String;
8086 fn deref(&self) -> &String {
8087 &self.0
8088 }
8089}
8090
8091impl std::ops::DerefMut for DockerExecutionMode {
8092 fn deref_mut(&mut self) -> &mut String {
8093 &mut self.0
8094 }
8095}
8096
8097
8098
8099#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
8101#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8102pub struct DockerImagePullPolicy(String);
8103
8104impl validator::Validate for DockerImagePullPolicy {
8105 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
8106 std::result::Result::Ok(())
8107 }
8108}
8109
8110impl std::convert::From<String> for DockerImagePullPolicy {
8111 fn from(x: String) -> Self {
8112 DockerImagePullPolicy(x)
8113 }
8114}
8115
8116impl std::string::ToString for DockerImagePullPolicy {
8117 fn to_string(&self) -> String {
8118 self.0.to_string()
8119 }
8120}
8121
8122impl std::str::FromStr for DockerImagePullPolicy {
8123 type Err = std::string::ParseError;
8124 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
8125 std::result::Result::Ok(DockerImagePullPolicy(x.to_string()))
8126 }
8127}
8128
8129impl std::convert::From<DockerImagePullPolicy> for String {
8130 fn from(x: DockerImagePullPolicy) -> Self {
8131 x.0
8132 }
8133}
8134
8135impl std::ops::Deref for DockerImagePullPolicy {
8136 type Target = String;
8137 fn deref(&self) -> &String {
8138 &self.0
8139 }
8140}
8141
8142impl std::ops::DerefMut for DockerImagePullPolicy {
8143 fn deref_mut(&mut self) -> &mut String {
8144 &mut self.0
8145 }
8146}
8147
8148
8149
8150
8151
8152
8153#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8154#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8155pub struct DockerLaunchConfig {
8156 #[serde(rename = "container")]
8157 #[serde(skip_serializing_if="Option::is_none")]
8158 pub container: Option<models::Config>,
8159
8160#[serde(rename = "containername")]
8162 #[serde(skip_serializing_if="Option::is_none")]
8163 pub containername: Option<String>,
8164
8165 #[serde(rename = "host")]
8166 #[serde(skip_serializing_if="Option::is_none")]
8167 pub host: Option<models::HostConfig>,
8168
8169 #[serde(rename = "network")]
8170 #[serde(skip_serializing_if="Option::is_none")]
8171 pub network: Option<models::NetworkingConfig>,
8172
8173 #[serde(rename = "platform")]
8174 #[serde(skip_serializing_if="Option::is_none")]
8175 pub platform: Option<models::Platform>,
8176
8177}
8178
8179
8180impl DockerLaunchConfig {
8181 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
8182 pub fn new() -> DockerLaunchConfig {
8183 DockerLaunchConfig {
8184 container: None,
8185 containername: None,
8186 host: None,
8187 network: None,
8188 platform: None,
8189 }
8190 }
8191}
8192
8193impl std::string::ToString for DockerLaunchConfig {
8197 fn to_string(&self) -> String {
8198 let params: Vec<Option<String>> = vec![
8199 self.containername.as_ref().map(|containername| {
8203 [
8204 "containername".to_string(),
8205 containername.to_string(),
8206 ].join(",")
8207 }),
8208
8209 ];
8216
8217 params.into_iter().flatten().collect::<Vec<_>>().join(",")
8218 }
8219}
8220
8221impl std::str::FromStr for DockerLaunchConfig {
8225 type Err = String;
8226
8227 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
8228 #[derive(Default)]
8230 #[allow(dead_code)]
8231 struct IntermediateRep {
8232 pub container: Vec<models::Config>,
8233 pub containername: Vec<String>,
8234 pub host: Vec<models::HostConfig>,
8235 pub network: Vec<models::NetworkingConfig>,
8236 pub platform: Vec<models::Platform>,
8237 }
8238
8239 let mut intermediate_rep = IntermediateRep::default();
8240
8241 let mut string_iter = s.split(',');
8243 let mut key_result = string_iter.next();
8244
8245 while key_result.is_some() {
8246 let val = match string_iter.next() {
8247 Some(x) => x,
8248 None => return std::result::Result::Err("Missing value while parsing DockerLaunchConfig".to_string())
8249 };
8250
8251 if let Some(key) = key_result {
8252 #[allow(clippy::match_single_binding)]
8253 match key {
8254 #[allow(clippy::redundant_clone)]
8255 "container" => intermediate_rep.container.push(<models::Config as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8256 #[allow(clippy::redundant_clone)]
8257 "containername" => intermediate_rep.containername.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8258 #[allow(clippy::redundant_clone)]
8259 "host" => intermediate_rep.host.push(<models::HostConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8260 #[allow(clippy::redundant_clone)]
8261 "network" => intermediate_rep.network.push(<models::NetworkingConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8262 #[allow(clippy::redundant_clone)]
8263 "platform" => intermediate_rep.platform.push(<models::Platform as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8264 _ => return std::result::Result::Err("Unexpected key while parsing DockerLaunchConfig".to_string())
8265 }
8266 }
8267
8268 key_result = string_iter.next();
8270 }
8271
8272 std::result::Result::Ok(DockerLaunchConfig {
8274 container: intermediate_rep.container.into_iter().next(),
8275 containername: intermediate_rep.containername.into_iter().next(),
8276 host: intermediate_rep.host.into_iter().next(),
8277 network: intermediate_rep.network.into_iter().next(),
8278 platform: intermediate_rep.platform.into_iter().next(),
8279 })
8280 }
8281}
8282
8283#[cfg(feature = "server")]
8286impl std::convert::TryFrom<header::IntoHeaderValue<DockerLaunchConfig>> for HeaderValue {
8287 type Error = String;
8288
8289 fn try_from(hdr_value: header::IntoHeaderValue<DockerLaunchConfig>) -> std::result::Result<Self, Self::Error> {
8290 let hdr_value = hdr_value.to_string();
8291 match HeaderValue::from_str(&hdr_value) {
8292 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8293 std::result::Result::Err(e) => std::result::Result::Err(
8294 format!("Invalid header value for DockerLaunchConfig - value: {} is invalid {}",
8295 hdr_value, e))
8296 }
8297 }
8298}
8299
8300#[cfg(feature = "server")]
8301impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DockerLaunchConfig> {
8302 type Error = String;
8303
8304 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8305 match hdr_value.to_str() {
8306 std::result::Result::Ok(value) => {
8307 match <DockerLaunchConfig as std::str::FromStr>::from_str(value) {
8308 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8309 std::result::Result::Err(err) => std::result::Result::Err(
8310 format!("Unable to convert header value '{}' into DockerLaunchConfig - {}",
8311 value, err))
8312 }
8313 },
8314 std::result::Result::Err(e) => std::result::Result::Err(
8315 format!("Unable to convert header: {:?} to string: {}",
8316 hdr_value, e))
8317 }
8318 }
8319}
8320
8321
8322
8323
8324
8325
8326
8327#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8328#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8329pub struct DockerTimeoutConfig {
8330#[serde(rename = "commandStart")]
8332 #[serde(skip_serializing_if="Option::is_none")]
8333 pub command_start: Option<i64>,
8334
8335#[serde(rename = "containerStart")]
8337 #[serde(skip_serializing_if="Option::is_none")]
8338 pub container_start: Option<i64>,
8339
8340#[serde(rename = "containerStop")]
8342 #[serde(skip_serializing_if="Option::is_none")]
8343 pub container_stop: Option<i64>,
8344
8345#[serde(rename = "http")]
8347 #[serde(skip_serializing_if="Option::is_none")]
8348 pub http: Option<i64>,
8349
8350#[serde(rename = "signal")]
8352 #[serde(skip_serializing_if="Option::is_none")]
8353 pub signal: Option<i64>,
8354
8355#[serde(rename = "window")]
8357 #[serde(skip_serializing_if="Option::is_none")]
8358 pub window: Option<i64>,
8359
8360}
8361
8362
8363impl DockerTimeoutConfig {
8364 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
8365 pub fn new() -> DockerTimeoutConfig {
8366 DockerTimeoutConfig {
8367 command_start: None,
8368 container_start: None,
8369 container_stop: None,
8370 http: None,
8371 signal: None,
8372 window: None,
8373 }
8374 }
8375}
8376
8377impl std::string::ToString for DockerTimeoutConfig {
8381 fn to_string(&self) -> String {
8382 let params: Vec<Option<String>> = vec![
8383
8384 self.command_start.as_ref().map(|command_start| {
8385 [
8386 "commandStart".to_string(),
8387 command_start.to_string(),
8388 ].join(",")
8389 }),
8390
8391
8392 self.container_start.as_ref().map(|container_start| {
8393 [
8394 "containerStart".to_string(),
8395 container_start.to_string(),
8396 ].join(",")
8397 }),
8398
8399
8400 self.container_stop.as_ref().map(|container_stop| {
8401 [
8402 "containerStop".to_string(),
8403 container_stop.to_string(),
8404 ].join(",")
8405 }),
8406
8407
8408 self.http.as_ref().map(|http| {
8409 [
8410 "http".to_string(),
8411 http.to_string(),
8412 ].join(",")
8413 }),
8414
8415
8416 self.signal.as_ref().map(|signal| {
8417 [
8418 "signal".to_string(),
8419 signal.to_string(),
8420 ].join(",")
8421 }),
8422
8423
8424 self.window.as_ref().map(|window| {
8425 [
8426 "window".to_string(),
8427 window.to_string(),
8428 ].join(",")
8429 }),
8430
8431 ];
8432
8433 params.into_iter().flatten().collect::<Vec<_>>().join(",")
8434 }
8435}
8436
8437impl std::str::FromStr for DockerTimeoutConfig {
8441 type Err = String;
8442
8443 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
8444 #[derive(Default)]
8446 #[allow(dead_code)]
8447 struct IntermediateRep {
8448 pub command_start: Vec<i64>,
8449 pub container_start: Vec<i64>,
8450 pub container_stop: Vec<i64>,
8451 pub http: Vec<i64>,
8452 pub signal: Vec<i64>,
8453 pub window: Vec<i64>,
8454 }
8455
8456 let mut intermediate_rep = IntermediateRep::default();
8457
8458 let mut string_iter = s.split(',');
8460 let mut key_result = string_iter.next();
8461
8462 while key_result.is_some() {
8463 let val = match string_iter.next() {
8464 Some(x) => x,
8465 None => return std::result::Result::Err("Missing value while parsing DockerTimeoutConfig".to_string())
8466 };
8467
8468 if let Some(key) = key_result {
8469 #[allow(clippy::match_single_binding)]
8470 match key {
8471 #[allow(clippy::redundant_clone)]
8472 "commandStart" => intermediate_rep.command_start.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8473 #[allow(clippy::redundant_clone)]
8474 "containerStart" => intermediate_rep.container_start.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8475 #[allow(clippy::redundant_clone)]
8476 "containerStop" => intermediate_rep.container_stop.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8477 #[allow(clippy::redundant_clone)]
8478 "http" => intermediate_rep.http.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8479 #[allow(clippy::redundant_clone)]
8480 "signal" => intermediate_rep.signal.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8481 #[allow(clippy::redundant_clone)]
8482 "window" => intermediate_rep.window.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8483 _ => return std::result::Result::Err("Unexpected key while parsing DockerTimeoutConfig".to_string())
8484 }
8485 }
8486
8487 key_result = string_iter.next();
8489 }
8490
8491 std::result::Result::Ok(DockerTimeoutConfig {
8493 command_start: intermediate_rep.command_start.into_iter().next(),
8494 container_start: intermediate_rep.container_start.into_iter().next(),
8495 container_stop: intermediate_rep.container_stop.into_iter().next(),
8496 http: intermediate_rep.http.into_iter().next(),
8497 signal: intermediate_rep.signal.into_iter().next(),
8498 window: intermediate_rep.window.into_iter().next(),
8499 })
8500 }
8501}
8502
8503#[cfg(feature = "server")]
8506impl std::convert::TryFrom<header::IntoHeaderValue<DockerTimeoutConfig>> for HeaderValue {
8507 type Error = String;
8508
8509 fn try_from(hdr_value: header::IntoHeaderValue<DockerTimeoutConfig>) -> std::result::Result<Self, Self::Error> {
8510 let hdr_value = hdr_value.to_string();
8511 match HeaderValue::from_str(&hdr_value) {
8512 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8513 std::result::Result::Err(e) => std::result::Result::Err(
8514 format!("Invalid header value for DockerTimeoutConfig - value: {} is invalid {}",
8515 hdr_value, e))
8516 }
8517 }
8518}
8519
8520#[cfg(feature = "server")]
8521impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DockerTimeoutConfig> {
8522 type Error = String;
8523
8524 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8525 match hdr_value.to_str() {
8526 std::result::Result::Ok(value) => {
8527 match <DockerTimeoutConfig as std::str::FromStr>::from_str(value) {
8528 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8529 std::result::Result::Err(err) => std::result::Result::Err(
8530 format!("Unable to convert header value '{}' into DockerTimeoutConfig - {}",
8531 value, err))
8532 }
8533 },
8534 std::result::Result::Err(e) => std::result::Result::Err(
8535 format!("Unable to convert header: {:?} to string: {}",
8536 hdr_value, e))
8537 }
8538 }
8539}
8540
8541
8542
8543
8544#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8549#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8550pub struct DownwardApiProjection {
8551#[serde(rename = "items")]
8553 #[serde(skip_serializing_if="Option::is_none")]
8554 pub items: Option<Vec<models::DownwardApiVolumeFile>>,
8555
8556}
8557
8558
8559impl DownwardApiProjection {
8560 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
8561 pub fn new() -> DownwardApiProjection {
8562 DownwardApiProjection {
8563 items: None,
8564 }
8565 }
8566}
8567
8568impl std::string::ToString for DownwardApiProjection {
8572 fn to_string(&self) -> String {
8573 let params: Vec<Option<String>> = vec![
8574 ];
8577
8578 params.into_iter().flatten().collect::<Vec<_>>().join(",")
8579 }
8580}
8581
8582impl std::str::FromStr for DownwardApiProjection {
8586 type Err = String;
8587
8588 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
8589 #[derive(Default)]
8591 #[allow(dead_code)]
8592 struct IntermediateRep {
8593 pub items: Vec<Vec<models::DownwardApiVolumeFile>>,
8594 }
8595
8596 let mut intermediate_rep = IntermediateRep::default();
8597
8598 let mut string_iter = s.split(',');
8600 let mut key_result = string_iter.next();
8601
8602 while key_result.is_some() {
8603 let val = match string_iter.next() {
8604 Some(x) => x,
8605 None => return std::result::Result::Err("Missing value while parsing DownwardApiProjection".to_string())
8606 };
8607
8608 if let Some(key) = key_result {
8609 #[allow(clippy::match_single_binding)]
8610 match key {
8611 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in DownwardApiProjection".to_string()),
8612 _ => return std::result::Result::Err("Unexpected key while parsing DownwardApiProjection".to_string())
8613 }
8614 }
8615
8616 key_result = string_iter.next();
8618 }
8619
8620 std::result::Result::Ok(DownwardApiProjection {
8622 items: intermediate_rep.items.into_iter().next(),
8623 })
8624 }
8625}
8626
8627#[cfg(feature = "server")]
8630impl std::convert::TryFrom<header::IntoHeaderValue<DownwardApiProjection>> for HeaderValue {
8631 type Error = String;
8632
8633 fn try_from(hdr_value: header::IntoHeaderValue<DownwardApiProjection>) -> std::result::Result<Self, Self::Error> {
8634 let hdr_value = hdr_value.to_string();
8635 match HeaderValue::from_str(&hdr_value) {
8636 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8637 std::result::Result::Err(e) => std::result::Result::Err(
8638 format!("Invalid header value for DownwardApiProjection - value: {} is invalid {}",
8639 hdr_value, e))
8640 }
8641 }
8642}
8643
8644#[cfg(feature = "server")]
8645impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DownwardApiProjection> {
8646 type Error = String;
8647
8648 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8649 match hdr_value.to_str() {
8650 std::result::Result::Ok(value) => {
8651 match <DownwardApiProjection as std::str::FromStr>::from_str(value) {
8652 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8653 std::result::Result::Err(err) => std::result::Result::Err(
8654 format!("Unable to convert header value '{}' into DownwardApiProjection - {}",
8655 value, err))
8656 }
8657 },
8658 std::result::Result::Err(e) => std::result::Result::Err(
8659 format!("Unable to convert header: {:?} to string: {}",
8660 hdr_value, e))
8661 }
8662 }
8663}
8664
8665
8666
8667
8668#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8673#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8674pub struct DownwardApiVolumeFile {
8675 #[serde(rename = "fieldRef")]
8676 #[serde(skip_serializing_if="Option::is_none")]
8677 pub field_ref: Option<models::ObjectFieldSelector>,
8678
8679#[serde(rename = "mode")]
8681 #[serde(skip_serializing_if="Option::is_none")]
8682 pub mode: Option<i32>,
8683
8684#[serde(rename = "path")]
8686 #[serde(skip_serializing_if="Option::is_none")]
8687 pub path: Option<String>,
8688
8689 #[serde(rename = "resourceFieldRef")]
8690 #[serde(skip_serializing_if="Option::is_none")]
8691 pub resource_field_ref: Option<models::ResourceFieldSelector>,
8692
8693}
8694
8695
8696impl DownwardApiVolumeFile {
8697 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
8698 pub fn new() -> DownwardApiVolumeFile {
8699 DownwardApiVolumeFile {
8700 field_ref: None,
8701 mode: None,
8702 path: None,
8703 resource_field_ref: None,
8704 }
8705 }
8706}
8707
8708impl std::string::ToString for DownwardApiVolumeFile {
8712 fn to_string(&self) -> String {
8713 let params: Vec<Option<String>> = vec![
8714 self.mode.as_ref().map(|mode| {
8718 [
8719 "mode".to_string(),
8720 mode.to_string(),
8721 ].join(",")
8722 }),
8723
8724
8725 self.path.as_ref().map(|path| {
8726 [
8727 "path".to_string(),
8728 path.to_string(),
8729 ].join(",")
8730 }),
8731
8732 ];
8735
8736 params.into_iter().flatten().collect::<Vec<_>>().join(",")
8737 }
8738}
8739
8740impl std::str::FromStr for DownwardApiVolumeFile {
8744 type Err = String;
8745
8746 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
8747 #[derive(Default)]
8749 #[allow(dead_code)]
8750 struct IntermediateRep {
8751 pub field_ref: Vec<models::ObjectFieldSelector>,
8752 pub mode: Vec<i32>,
8753 pub path: Vec<String>,
8754 pub resource_field_ref: Vec<models::ResourceFieldSelector>,
8755 }
8756
8757 let mut intermediate_rep = IntermediateRep::default();
8758
8759 let mut string_iter = s.split(',');
8761 let mut key_result = string_iter.next();
8762
8763 while key_result.is_some() {
8764 let val = match string_iter.next() {
8765 Some(x) => x,
8766 None => return std::result::Result::Err("Missing value while parsing DownwardApiVolumeFile".to_string())
8767 };
8768
8769 if let Some(key) = key_result {
8770 #[allow(clippy::match_single_binding)]
8771 match key {
8772 #[allow(clippy::redundant_clone)]
8773 "fieldRef" => intermediate_rep.field_ref.push(<models::ObjectFieldSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8774 #[allow(clippy::redundant_clone)]
8775 "mode" => intermediate_rep.mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8776 #[allow(clippy::redundant_clone)]
8777 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8778 #[allow(clippy::redundant_clone)]
8779 "resourceFieldRef" => intermediate_rep.resource_field_ref.push(<models::ResourceFieldSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8780 _ => return std::result::Result::Err("Unexpected key while parsing DownwardApiVolumeFile".to_string())
8781 }
8782 }
8783
8784 key_result = string_iter.next();
8786 }
8787
8788 std::result::Result::Ok(DownwardApiVolumeFile {
8790 field_ref: intermediate_rep.field_ref.into_iter().next(),
8791 mode: intermediate_rep.mode.into_iter().next(),
8792 path: intermediate_rep.path.into_iter().next(),
8793 resource_field_ref: intermediate_rep.resource_field_ref.into_iter().next(),
8794 })
8795 }
8796}
8797
8798#[cfg(feature = "server")]
8801impl std::convert::TryFrom<header::IntoHeaderValue<DownwardApiVolumeFile>> for HeaderValue {
8802 type Error = String;
8803
8804 fn try_from(hdr_value: header::IntoHeaderValue<DownwardApiVolumeFile>) -> std::result::Result<Self, Self::Error> {
8805 let hdr_value = hdr_value.to_string();
8806 match HeaderValue::from_str(&hdr_value) {
8807 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8808 std::result::Result::Err(e) => std::result::Result::Err(
8809 format!("Invalid header value for DownwardApiVolumeFile - value: {} is invalid {}",
8810 hdr_value, e))
8811 }
8812 }
8813}
8814
8815#[cfg(feature = "server")]
8816impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DownwardApiVolumeFile> {
8817 type Error = String;
8818
8819 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8820 match hdr_value.to_str() {
8821 std::result::Result::Ok(value) => {
8822 match <DownwardApiVolumeFile as std::str::FromStr>::from_str(value) {
8823 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8824 std::result::Result::Err(err) => std::result::Result::Err(
8825 format!("Unable to convert header value '{}' into DownwardApiVolumeFile - {}",
8826 value, err))
8827 }
8828 },
8829 std::result::Result::Err(e) => std::result::Result::Err(
8830 format!("Unable to convert header: {:?} to string: {}",
8831 hdr_value, e))
8832 }
8833 }
8834}
8835
8836
8837
8838
8839#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8844#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8845pub struct DownwardApiVolumeSource {
8846#[serde(rename = "defaultMode")]
8848 #[serde(skip_serializing_if="Option::is_none")]
8849 pub default_mode: Option<i32>,
8850
8851#[serde(rename = "items")]
8853 #[serde(skip_serializing_if="Option::is_none")]
8854 pub items: Option<Vec<models::DownwardApiVolumeFile>>,
8855
8856}
8857
8858
8859impl DownwardApiVolumeSource {
8860 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
8861 pub fn new() -> DownwardApiVolumeSource {
8862 DownwardApiVolumeSource {
8863 default_mode: None,
8864 items: None,
8865 }
8866 }
8867}
8868
8869impl std::string::ToString for DownwardApiVolumeSource {
8873 fn to_string(&self) -> String {
8874 let params: Vec<Option<String>> = vec![
8875
8876 self.default_mode.as_ref().map(|default_mode| {
8877 [
8878 "defaultMode".to_string(),
8879 default_mode.to_string(),
8880 ].join(",")
8881 }),
8882
8883 ];
8886
8887 params.into_iter().flatten().collect::<Vec<_>>().join(",")
8888 }
8889}
8890
8891impl std::str::FromStr for DownwardApiVolumeSource {
8895 type Err = String;
8896
8897 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
8898 #[derive(Default)]
8900 #[allow(dead_code)]
8901 struct IntermediateRep {
8902 pub default_mode: Vec<i32>,
8903 pub items: Vec<Vec<models::DownwardApiVolumeFile>>,
8904 }
8905
8906 let mut intermediate_rep = IntermediateRep::default();
8907
8908 let mut string_iter = s.split(',');
8910 let mut key_result = string_iter.next();
8911
8912 while key_result.is_some() {
8913 let val = match string_iter.next() {
8914 Some(x) => x,
8915 None => return std::result::Result::Err("Missing value while parsing DownwardApiVolumeSource".to_string())
8916 };
8917
8918 if let Some(key) = key_result {
8919 #[allow(clippy::match_single_binding)]
8920 match key {
8921 #[allow(clippy::redundant_clone)]
8922 "defaultMode" => intermediate_rep.default_mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
8923 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in DownwardApiVolumeSource".to_string()),
8924 _ => return std::result::Result::Err("Unexpected key while parsing DownwardApiVolumeSource".to_string())
8925 }
8926 }
8927
8928 key_result = string_iter.next();
8930 }
8931
8932 std::result::Result::Ok(DownwardApiVolumeSource {
8934 default_mode: intermediate_rep.default_mode.into_iter().next(),
8935 items: intermediate_rep.items.into_iter().next(),
8936 })
8937 }
8938}
8939
8940#[cfg(feature = "server")]
8943impl std::convert::TryFrom<header::IntoHeaderValue<DownwardApiVolumeSource>> for HeaderValue {
8944 type Error = String;
8945
8946 fn try_from(hdr_value: header::IntoHeaderValue<DownwardApiVolumeSource>) -> std::result::Result<Self, Self::Error> {
8947 let hdr_value = hdr_value.to_string();
8948 match HeaderValue::from_str(&hdr_value) {
8949 std::result::Result::Ok(value) => std::result::Result::Ok(value),
8950 std::result::Result::Err(e) => std::result::Result::Err(
8951 format!("Invalid header value for DownwardApiVolumeSource - value: {} is invalid {}",
8952 hdr_value, e))
8953 }
8954 }
8955}
8956
8957#[cfg(feature = "server")]
8958impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<DownwardApiVolumeSource> {
8959 type Error = String;
8960
8961 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
8962 match hdr_value.to_str() {
8963 std::result::Result::Ok(value) => {
8964 match <DownwardApiVolumeSource as std::str::FromStr>::from_str(value) {
8965 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
8966 std::result::Result::Err(err) => std::result::Result::Err(
8967 format!("Unable to convert header value '{}' into DownwardApiVolumeSource - {}",
8968 value, err))
8969 }
8970 },
8971 std::result::Result::Err(e) => std::result::Result::Err(
8972 format!("Unable to convert header: {:?} to string: {}",
8973 hdr_value, e))
8974 }
8975 }
8976}
8977
8978
8979
8980
8981
8982
8983
8984#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
8985#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
8986pub struct Driver {
8987 #[serde(rename = "Name")]
8988 #[serde(skip_serializing_if="Option::is_none")]
8989 pub name: Option<String>,
8990
8991 #[serde(rename = "Options")]
8992 #[serde(skip_serializing_if="Option::is_none")]
8993 pub options: Option<std::collections::HashMap<String, String>>,
8994
8995}
8996
8997
8998impl Driver {
8999 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
9000 pub fn new() -> Driver {
9001 Driver {
9002 name: None,
9003 options: None,
9004 }
9005 }
9006}
9007
9008impl std::string::ToString for Driver {
9012 fn to_string(&self) -> String {
9013 let params: Vec<Option<String>> = vec![
9014
9015 self.name.as_ref().map(|name| {
9016 [
9017 "Name".to_string(),
9018 name.to_string(),
9019 ].join(",")
9020 }),
9021
9022 ];
9025
9026 params.into_iter().flatten().collect::<Vec<_>>().join(",")
9027 }
9028}
9029
9030impl std::str::FromStr for Driver {
9034 type Err = String;
9035
9036 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
9037 #[derive(Default)]
9039 #[allow(dead_code)]
9040 struct IntermediateRep {
9041 pub name: Vec<String>,
9042 pub options: Vec<std::collections::HashMap<String, String>>,
9043 }
9044
9045 let mut intermediate_rep = IntermediateRep::default();
9046
9047 let mut string_iter = s.split(',');
9049 let mut key_result = string_iter.next();
9050
9051 while key_result.is_some() {
9052 let val = match string_iter.next() {
9053 Some(x) => x,
9054 None => return std::result::Result::Err("Missing value while parsing Driver".to_string())
9055 };
9056
9057 if let Some(key) = key_result {
9058 #[allow(clippy::match_single_binding)]
9059 match key {
9060 #[allow(clippy::redundant_clone)]
9061 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9062 "Options" => return std::result::Result::Err("Parsing a container in this style is not supported in Driver".to_string()),
9063 _ => return std::result::Result::Err("Unexpected key while parsing Driver".to_string())
9064 }
9065 }
9066
9067 key_result = string_iter.next();
9069 }
9070
9071 std::result::Result::Ok(Driver {
9073 name: intermediate_rep.name.into_iter().next(),
9074 options: intermediate_rep.options.into_iter().next(),
9075 })
9076 }
9077}
9078
9079#[cfg(feature = "server")]
9082impl std::convert::TryFrom<header::IntoHeaderValue<Driver>> for HeaderValue {
9083 type Error = String;
9084
9085 fn try_from(hdr_value: header::IntoHeaderValue<Driver>) -> std::result::Result<Self, Self::Error> {
9086 let hdr_value = hdr_value.to_string();
9087 match HeaderValue::from_str(&hdr_value) {
9088 std::result::Result::Ok(value) => std::result::Result::Ok(value),
9089 std::result::Result::Err(e) => std::result::Result::Err(
9090 format!("Invalid header value for Driver - value: {} is invalid {}",
9091 hdr_value, e))
9092 }
9093 }
9094}
9095
9096#[cfg(feature = "server")]
9097impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Driver> {
9098 type Error = String;
9099
9100 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
9101 match hdr_value.to_str() {
9102 std::result::Result::Ok(value) => {
9103 match <Driver as std::str::FromStr>::from_str(value) {
9104 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
9105 std::result::Result::Err(err) => std::result::Result::Err(
9106 format!("Unable to convert header value '{}' into Driver - {}",
9107 value, err))
9108 }
9109 },
9110 std::result::Result::Err(e) => std::result::Result::Err(
9111 format!("Unable to convert header: {:?} to string: {}",
9112 hdr_value, e))
9113 }
9114 }
9115}
9116
9117
9118
9119
9120#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
9122#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9123pub struct Duration(i64);
9124
9125impl validator::Validate for Duration {
9126 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
9127 std::result::Result::Ok(())
9128 }
9129}
9130
9131impl std::convert::From<i64> for Duration {
9132 fn from(x: i64) -> Self {
9133 Duration(x)
9134 }
9135}
9136
9137impl std::convert::From<Duration> for i64 {
9138 fn from(x: Duration) -> Self {
9139 x.0
9140 }
9141}
9142
9143impl std::ops::Deref for Duration {
9144 type Target = i64;
9145 fn deref(&self) -> &i64 {
9146 &self.0
9147 }
9148}
9149
9150impl std::ops::DerefMut for Duration {
9151 fn deref_mut(&mut self) -> &mut i64 {
9152 &mut self.0
9153 }
9154}
9155
9156
9157
9158#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
9159#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9160pub struct EcdhCurve(String);
9161
9162impl validator::Validate for EcdhCurve {
9163 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
9164 std::result::Result::Ok(())
9165 }
9166}
9167
9168impl std::convert::From<String> for EcdhCurve {
9169 fn from(x: String) -> Self {
9170 EcdhCurve(x)
9171 }
9172}
9173
9174impl std::string::ToString for EcdhCurve {
9175 fn to_string(&self) -> String {
9176 self.0.to_string()
9177 }
9178}
9179
9180impl std::str::FromStr for EcdhCurve {
9181 type Err = std::string::ParseError;
9182 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
9183 std::result::Result::Ok(EcdhCurve(x.to_string()))
9184 }
9185}
9186
9187impl std::convert::From<EcdhCurve> for String {
9188 fn from(x: EcdhCurve) -> Self {
9189 x.0
9190 }
9191}
9192
9193impl std::ops::Deref for EcdhCurve {
9194 type Target = String;
9195 fn deref(&self) -> &String {
9196 &self.0
9197 }
9198}
9199
9200impl std::ops::DerefMut for EcdhCurve {
9201 fn deref_mut(&mut self) -> &mut String {
9202 &mut self.0
9203 }
9204}
9205
9206
9207
9208#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
9213#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9214pub struct EmptyDirVolumeSource {
9215 #[serde(rename = "medium")]
9216 #[serde(skip_serializing_if="Option::is_none")]
9217 pub medium: Option<String>,
9218
9219#[serde(rename = "sizeLimit")]
9221 #[serde(skip_serializing_if="Option::is_none")]
9222 pub size_limit: Option<crate::types::Object>,
9223
9224}
9225
9226
9227impl EmptyDirVolumeSource {
9228 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
9229 pub fn new() -> EmptyDirVolumeSource {
9230 EmptyDirVolumeSource {
9231 medium: None,
9232 size_limit: None,
9233 }
9234 }
9235}
9236
9237impl std::string::ToString for EmptyDirVolumeSource {
9241 fn to_string(&self) -> String {
9242 let params: Vec<Option<String>> = vec![
9243
9244 self.medium.as_ref().map(|medium| {
9245 [
9246 "medium".to_string(),
9247 medium.to_string(),
9248 ].join(",")
9249 }),
9250
9251 ];
9254
9255 params.into_iter().flatten().collect::<Vec<_>>().join(",")
9256 }
9257}
9258
9259impl std::str::FromStr for EmptyDirVolumeSource {
9263 type Err = String;
9264
9265 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
9266 #[derive(Default)]
9268 #[allow(dead_code)]
9269 struct IntermediateRep {
9270 pub medium: Vec<String>,
9271 pub size_limit: Vec<crate::types::Object>,
9272 }
9273
9274 let mut intermediate_rep = IntermediateRep::default();
9275
9276 let mut string_iter = s.split(',');
9278 let mut key_result = string_iter.next();
9279
9280 while key_result.is_some() {
9281 let val = match string_iter.next() {
9282 Some(x) => x,
9283 None => return std::result::Result::Err("Missing value while parsing EmptyDirVolumeSource".to_string())
9284 };
9285
9286 if let Some(key) = key_result {
9287 #[allow(clippy::match_single_binding)]
9288 match key {
9289 #[allow(clippy::redundant_clone)]
9290 "medium" => intermediate_rep.medium.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9291 #[allow(clippy::redundant_clone)]
9292 "sizeLimit" => intermediate_rep.size_limit.push(<crate::types::Object as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9293 _ => return std::result::Result::Err("Unexpected key while parsing EmptyDirVolumeSource".to_string())
9294 }
9295 }
9296
9297 key_result = string_iter.next();
9299 }
9300
9301 std::result::Result::Ok(EmptyDirVolumeSource {
9303 medium: intermediate_rep.medium.into_iter().next(),
9304 size_limit: intermediate_rep.size_limit.into_iter().next(),
9305 })
9306 }
9307}
9308
9309#[cfg(feature = "server")]
9312impl std::convert::TryFrom<header::IntoHeaderValue<EmptyDirVolumeSource>> for HeaderValue {
9313 type Error = String;
9314
9315 fn try_from(hdr_value: header::IntoHeaderValue<EmptyDirVolumeSource>) -> std::result::Result<Self, Self::Error> {
9316 let hdr_value = hdr_value.to_string();
9317 match HeaderValue::from_str(&hdr_value) {
9318 std::result::Result::Ok(value) => std::result::Result::Ok(value),
9319 std::result::Result::Err(e) => std::result::Result::Err(
9320 format!("Invalid header value for EmptyDirVolumeSource - value: {} is invalid {}",
9321 hdr_value, e))
9322 }
9323 }
9324}
9325
9326#[cfg(feature = "server")]
9327impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EmptyDirVolumeSource> {
9328 type Error = String;
9329
9330 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
9331 match hdr_value.to_str() {
9332 std::result::Result::Ok(value) => {
9333 match <EmptyDirVolumeSource as std::str::FromStr>::from_str(value) {
9334 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
9335 std::result::Result::Err(err) => std::result::Result::Err(
9336 format!("Unable to convert header value '{}' into EmptyDirVolumeSource - {}",
9337 value, err))
9338 }
9339 },
9340 std::result::Result::Err(e) => std::result::Result::Err(
9341 format!("Unable to convert header: {:?} to string: {}",
9342 hdr_value, e))
9343 }
9344 }
9345}
9346
9347
9348
9349
9350#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
9355#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9356pub struct EndpointIpamConfig {
9357 #[serde(rename = "IPv4Address")]
9358 #[serde(skip_serializing_if="Option::is_none")]
9359 pub ipv4_address: Option<String>,
9360
9361 #[serde(rename = "IPv6Address")]
9362 #[serde(skip_serializing_if="Option::is_none")]
9363 pub ipv6_address: Option<String>,
9364
9365 #[serde(rename = "LinkLocalIPs")]
9366 #[serde(skip_serializing_if="Option::is_none")]
9367 pub link_local_ips: Option<Vec<String>>,
9368
9369}
9370
9371
9372impl EndpointIpamConfig {
9373 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
9374 pub fn new() -> EndpointIpamConfig {
9375 EndpointIpamConfig {
9376 ipv4_address: None,
9377 ipv6_address: None,
9378 link_local_ips: None,
9379 }
9380 }
9381}
9382
9383impl std::string::ToString for EndpointIpamConfig {
9387 fn to_string(&self) -> String {
9388 let params: Vec<Option<String>> = vec![
9389
9390 self.ipv4_address.as_ref().map(|ipv4_address| {
9391 [
9392 "IPv4Address".to_string(),
9393 ipv4_address.to_string(),
9394 ].join(",")
9395 }),
9396
9397
9398 self.ipv6_address.as_ref().map(|ipv6_address| {
9399 [
9400 "IPv6Address".to_string(),
9401 ipv6_address.to_string(),
9402 ].join(",")
9403 }),
9404
9405
9406 self.link_local_ips.as_ref().map(|link_local_ips| {
9407 [
9408 "LinkLocalIPs".to_string(),
9409 link_local_ips.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
9410 ].join(",")
9411 }),
9412
9413 ];
9414
9415 params.into_iter().flatten().collect::<Vec<_>>().join(",")
9416 }
9417}
9418
9419impl std::str::FromStr for EndpointIpamConfig {
9423 type Err = String;
9424
9425 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
9426 #[derive(Default)]
9428 #[allow(dead_code)]
9429 struct IntermediateRep {
9430 pub ipv4_address: Vec<String>,
9431 pub ipv6_address: Vec<String>,
9432 pub link_local_ips: Vec<Vec<String>>,
9433 }
9434
9435 let mut intermediate_rep = IntermediateRep::default();
9436
9437 let mut string_iter = s.split(',');
9439 let mut key_result = string_iter.next();
9440
9441 while key_result.is_some() {
9442 let val = match string_iter.next() {
9443 Some(x) => x,
9444 None => return std::result::Result::Err("Missing value while parsing EndpointIpamConfig".to_string())
9445 };
9446
9447 if let Some(key) = key_result {
9448 #[allow(clippy::match_single_binding)]
9449 match key {
9450 #[allow(clippy::redundant_clone)]
9451 "IPv4Address" => intermediate_rep.ipv4_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9452 #[allow(clippy::redundant_clone)]
9453 "IPv6Address" => intermediate_rep.ipv6_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9454 "LinkLocalIPs" => return std::result::Result::Err("Parsing a container in this style is not supported in EndpointIpamConfig".to_string()),
9455 _ => return std::result::Result::Err("Unexpected key while parsing EndpointIpamConfig".to_string())
9456 }
9457 }
9458
9459 key_result = string_iter.next();
9461 }
9462
9463 std::result::Result::Ok(EndpointIpamConfig {
9465 ipv4_address: intermediate_rep.ipv4_address.into_iter().next(),
9466 ipv6_address: intermediate_rep.ipv6_address.into_iter().next(),
9467 link_local_ips: intermediate_rep.link_local_ips.into_iter().next(),
9468 })
9469 }
9470}
9471
9472#[cfg(feature = "server")]
9475impl std::convert::TryFrom<header::IntoHeaderValue<EndpointIpamConfig>> for HeaderValue {
9476 type Error = String;
9477
9478 fn try_from(hdr_value: header::IntoHeaderValue<EndpointIpamConfig>) -> std::result::Result<Self, Self::Error> {
9479 let hdr_value = hdr_value.to_string();
9480 match HeaderValue::from_str(&hdr_value) {
9481 std::result::Result::Ok(value) => std::result::Result::Ok(value),
9482 std::result::Result::Err(e) => std::result::Result::Err(
9483 format!("Invalid header value for EndpointIpamConfig - value: {} is invalid {}",
9484 hdr_value, e))
9485 }
9486 }
9487}
9488
9489#[cfg(feature = "server")]
9490impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EndpointIpamConfig> {
9491 type Error = String;
9492
9493 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
9494 match hdr_value.to_str() {
9495 std::result::Result::Ok(value) => {
9496 match <EndpointIpamConfig as std::str::FromStr>::from_str(value) {
9497 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
9498 std::result::Result::Err(err) => std::result::Result::Err(
9499 format!("Unable to convert header value '{}' into EndpointIpamConfig - {}",
9500 value, err))
9501 }
9502 },
9503 std::result::Result::Err(e) => std::result::Result::Err(
9504 format!("Unable to convert header: {:?} to string: {}",
9505 hdr_value, e))
9506 }
9507 }
9508}
9509
9510
9511
9512
9513#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
9518#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9519pub struct EndpointSettings {
9520 #[serde(rename = "Aliases")]
9521 #[serde(skip_serializing_if="Option::is_none")]
9522 pub aliases: Option<Vec<String>>,
9523
9524 #[serde(rename = "DriverOpts")]
9525 #[serde(skip_serializing_if="Option::is_none")]
9526 pub driver_opts: Option<std::collections::HashMap<String, String>>,
9527
9528 #[serde(rename = "EndpointID")]
9529 #[serde(skip_serializing_if="Option::is_none")]
9530 pub endpoint_id: Option<String>,
9531
9532 #[serde(rename = "Gateway")]
9533 #[serde(skip_serializing_if="Option::is_none")]
9534 pub gateway: Option<String>,
9535
9536 #[serde(rename = "GlobalIPv6Address")]
9537 #[serde(skip_serializing_if="Option::is_none")]
9538 pub global_ipv6_address: Option<String>,
9539
9540 #[serde(rename = "GlobalIPv6PrefixLen")]
9541 #[serde(skip_serializing_if="Option::is_none")]
9542 pub global_ipv6_prefix_len: Option<i64>,
9543
9544 #[serde(rename = "IPAMConfig")]
9545 #[serde(skip_serializing_if="Option::is_none")]
9546 pub ipam_config: Option<models::EndpointIpamConfig>,
9547
9548 #[serde(rename = "IPAddress")]
9549 #[serde(skip_serializing_if="Option::is_none")]
9550 pub ip_address: Option<String>,
9551
9552 #[serde(rename = "IPPrefixLen")]
9553 #[serde(skip_serializing_if="Option::is_none")]
9554 pub ip_prefix_len: Option<i64>,
9555
9556 #[serde(rename = "IPv6Gateway")]
9557 #[serde(skip_serializing_if="Option::is_none")]
9558 pub ipv6_gateway: Option<String>,
9559
9560 #[serde(rename = "Links")]
9561 #[serde(skip_serializing_if="Option::is_none")]
9562 pub links: Option<Vec<String>>,
9563
9564 #[serde(rename = "MacAddress")]
9565 #[serde(skip_serializing_if="Option::is_none")]
9566 pub mac_address: Option<String>,
9567
9568#[serde(rename = "NetworkID")]
9570 #[serde(skip_serializing_if="Option::is_none")]
9571 pub network_id: Option<String>,
9572
9573}
9574
9575
9576impl EndpointSettings {
9577 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
9578 pub fn new() -> EndpointSettings {
9579 EndpointSettings {
9580 aliases: None,
9581 driver_opts: None,
9582 endpoint_id: None,
9583 gateway: None,
9584 global_ipv6_address: None,
9585 global_ipv6_prefix_len: None,
9586 ipam_config: None,
9587 ip_address: None,
9588 ip_prefix_len: None,
9589 ipv6_gateway: None,
9590 links: None,
9591 mac_address: None,
9592 network_id: None,
9593 }
9594 }
9595}
9596
9597impl std::string::ToString for EndpointSettings {
9601 fn to_string(&self) -> String {
9602 let params: Vec<Option<String>> = vec![
9603
9604 self.aliases.as_ref().map(|aliases| {
9605 [
9606 "Aliases".to_string(),
9607 aliases.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
9608 ].join(",")
9609 }),
9610
9611 self.endpoint_id.as_ref().map(|endpoint_id| {
9615 [
9616 "EndpointID".to_string(),
9617 endpoint_id.to_string(),
9618 ].join(",")
9619 }),
9620
9621
9622 self.gateway.as_ref().map(|gateway| {
9623 [
9624 "Gateway".to_string(),
9625 gateway.to_string(),
9626 ].join(",")
9627 }),
9628
9629
9630 self.global_ipv6_address.as_ref().map(|global_ipv6_address| {
9631 [
9632 "GlobalIPv6Address".to_string(),
9633 global_ipv6_address.to_string(),
9634 ].join(",")
9635 }),
9636
9637
9638 self.global_ipv6_prefix_len.as_ref().map(|global_ipv6_prefix_len| {
9639 [
9640 "GlobalIPv6PrefixLen".to_string(),
9641 global_ipv6_prefix_len.to_string(),
9642 ].join(",")
9643 }),
9644
9645 self.ip_address.as_ref().map(|ip_address| {
9649 [
9650 "IPAddress".to_string(),
9651 ip_address.to_string(),
9652 ].join(",")
9653 }),
9654
9655
9656 self.ip_prefix_len.as_ref().map(|ip_prefix_len| {
9657 [
9658 "IPPrefixLen".to_string(),
9659 ip_prefix_len.to_string(),
9660 ].join(",")
9661 }),
9662
9663
9664 self.ipv6_gateway.as_ref().map(|ipv6_gateway| {
9665 [
9666 "IPv6Gateway".to_string(),
9667 ipv6_gateway.to_string(),
9668 ].join(",")
9669 }),
9670
9671
9672 self.links.as_ref().map(|links| {
9673 [
9674 "Links".to_string(),
9675 links.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
9676 ].join(",")
9677 }),
9678
9679
9680 self.mac_address.as_ref().map(|mac_address| {
9681 [
9682 "MacAddress".to_string(),
9683 mac_address.to_string(),
9684 ].join(",")
9685 }),
9686
9687
9688 self.network_id.as_ref().map(|network_id| {
9689 [
9690 "NetworkID".to_string(),
9691 network_id.to_string(),
9692 ].join(",")
9693 }),
9694
9695 ];
9696
9697 params.into_iter().flatten().collect::<Vec<_>>().join(",")
9698 }
9699}
9700
9701impl std::str::FromStr for EndpointSettings {
9705 type Err = String;
9706
9707 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
9708 #[derive(Default)]
9710 #[allow(dead_code)]
9711 struct IntermediateRep {
9712 pub aliases: Vec<Vec<String>>,
9713 pub driver_opts: Vec<std::collections::HashMap<String, String>>,
9714 pub endpoint_id: Vec<String>,
9715 pub gateway: Vec<String>,
9716 pub global_ipv6_address: Vec<String>,
9717 pub global_ipv6_prefix_len: Vec<i64>,
9718 pub ipam_config: Vec<models::EndpointIpamConfig>,
9719 pub ip_address: Vec<String>,
9720 pub ip_prefix_len: Vec<i64>,
9721 pub ipv6_gateway: Vec<String>,
9722 pub links: Vec<Vec<String>>,
9723 pub mac_address: Vec<String>,
9724 pub network_id: Vec<String>,
9725 }
9726
9727 let mut intermediate_rep = IntermediateRep::default();
9728
9729 let mut string_iter = s.split(',');
9731 let mut key_result = string_iter.next();
9732
9733 while key_result.is_some() {
9734 let val = match string_iter.next() {
9735 Some(x) => x,
9736 None => return std::result::Result::Err("Missing value while parsing EndpointSettings".to_string())
9737 };
9738
9739 if let Some(key) = key_result {
9740 #[allow(clippy::match_single_binding)]
9741 match key {
9742 "Aliases" => return std::result::Result::Err("Parsing a container in this style is not supported in EndpointSettings".to_string()),
9743 "DriverOpts" => return std::result::Result::Err("Parsing a container in this style is not supported in EndpointSettings".to_string()),
9744 #[allow(clippy::redundant_clone)]
9745 "EndpointID" => intermediate_rep.endpoint_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9746 #[allow(clippy::redundant_clone)]
9747 "Gateway" => intermediate_rep.gateway.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9748 #[allow(clippy::redundant_clone)]
9749 "GlobalIPv6Address" => intermediate_rep.global_ipv6_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9750 #[allow(clippy::redundant_clone)]
9751 "GlobalIPv6PrefixLen" => intermediate_rep.global_ipv6_prefix_len.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9752 #[allow(clippy::redundant_clone)]
9753 "IPAMConfig" => intermediate_rep.ipam_config.push(<models::EndpointIpamConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9754 #[allow(clippy::redundant_clone)]
9755 "IPAddress" => intermediate_rep.ip_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9756 #[allow(clippy::redundant_clone)]
9757 "IPPrefixLen" => intermediate_rep.ip_prefix_len.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9758 #[allow(clippy::redundant_clone)]
9759 "IPv6Gateway" => intermediate_rep.ipv6_gateway.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9760 "Links" => return std::result::Result::Err("Parsing a container in this style is not supported in EndpointSettings".to_string()),
9761 #[allow(clippy::redundant_clone)]
9762 "MacAddress" => intermediate_rep.mac_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9763 #[allow(clippy::redundant_clone)]
9764 "NetworkID" => intermediate_rep.network_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9765 _ => return std::result::Result::Err("Unexpected key while parsing EndpointSettings".to_string())
9766 }
9767 }
9768
9769 key_result = string_iter.next();
9771 }
9772
9773 std::result::Result::Ok(EndpointSettings {
9775 aliases: intermediate_rep.aliases.into_iter().next(),
9776 driver_opts: intermediate_rep.driver_opts.into_iter().next(),
9777 endpoint_id: intermediate_rep.endpoint_id.into_iter().next(),
9778 gateway: intermediate_rep.gateway.into_iter().next(),
9779 global_ipv6_address: intermediate_rep.global_ipv6_address.into_iter().next(),
9780 global_ipv6_prefix_len: intermediate_rep.global_ipv6_prefix_len.into_iter().next(),
9781 ipam_config: intermediate_rep.ipam_config.into_iter().next(),
9782 ip_address: intermediate_rep.ip_address.into_iter().next(),
9783 ip_prefix_len: intermediate_rep.ip_prefix_len.into_iter().next(),
9784 ipv6_gateway: intermediate_rep.ipv6_gateway.into_iter().next(),
9785 links: intermediate_rep.links.into_iter().next(),
9786 mac_address: intermediate_rep.mac_address.into_iter().next(),
9787 network_id: intermediate_rep.network_id.into_iter().next(),
9788 })
9789 }
9790}
9791
9792#[cfg(feature = "server")]
9795impl std::convert::TryFrom<header::IntoHeaderValue<EndpointSettings>> for HeaderValue {
9796 type Error = String;
9797
9798 fn try_from(hdr_value: header::IntoHeaderValue<EndpointSettings>) -> std::result::Result<Self, Self::Error> {
9799 let hdr_value = hdr_value.to_string();
9800 match HeaderValue::from_str(&hdr_value) {
9801 std::result::Result::Ok(value) => std::result::Result::Ok(value),
9802 std::result::Result::Err(e) => std::result::Result::Err(
9803 format!("Invalid header value for EndpointSettings - value: {} is invalid {}",
9804 hdr_value, e))
9805 }
9806 }
9807}
9808
9809#[cfg(feature = "server")]
9810impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EndpointSettings> {
9811 type Error = String;
9812
9813 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
9814 match hdr_value.to_str() {
9815 std::result::Result::Ok(value) => {
9816 match <EndpointSettings as std::str::FromStr>::from_str(value) {
9817 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
9818 std::result::Result::Err(err) => std::result::Result::Err(
9819 format!("Unable to convert header value '{}' into EndpointSettings - {}",
9820 value, err))
9821 }
9822 },
9823 std::result::Result::Err(e) => std::result::Result::Err(
9824 format!("Unable to convert header: {:?} to string: {}",
9825 hdr_value, e))
9826 }
9827 }
9828}
9829
9830
9831
9832
9833#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
9838#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9839pub struct EnvFromSource {
9840 #[serde(rename = "configMapRef")]
9841 #[serde(skip_serializing_if="Option::is_none")]
9842 pub config_map_ref: Option<models::ConfigMapEnvSource>,
9843
9844#[serde(rename = "prefix")]
9846 #[serde(skip_serializing_if="Option::is_none")]
9847 pub prefix: Option<String>,
9848
9849 #[serde(rename = "secretRef")]
9850 #[serde(skip_serializing_if="Option::is_none")]
9851 pub secret_ref: Option<models::SecretEnvSource>,
9852
9853}
9854
9855
9856impl EnvFromSource {
9857 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
9858 pub fn new() -> EnvFromSource {
9859 EnvFromSource {
9860 config_map_ref: None,
9861 prefix: None,
9862 secret_ref: None,
9863 }
9864 }
9865}
9866
9867impl std::string::ToString for EnvFromSource {
9871 fn to_string(&self) -> String {
9872 let params: Vec<Option<String>> = vec![
9873 self.prefix.as_ref().map(|prefix| {
9877 [
9878 "prefix".to_string(),
9879 prefix.to_string(),
9880 ].join(",")
9881 }),
9882
9883 ];
9886
9887 params.into_iter().flatten().collect::<Vec<_>>().join(",")
9888 }
9889}
9890
9891impl std::str::FromStr for EnvFromSource {
9895 type Err = String;
9896
9897 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
9898 #[derive(Default)]
9900 #[allow(dead_code)]
9901 struct IntermediateRep {
9902 pub config_map_ref: Vec<models::ConfigMapEnvSource>,
9903 pub prefix: Vec<String>,
9904 pub secret_ref: Vec<models::SecretEnvSource>,
9905 }
9906
9907 let mut intermediate_rep = IntermediateRep::default();
9908
9909 let mut string_iter = s.split(',');
9911 let mut key_result = string_iter.next();
9912
9913 while key_result.is_some() {
9914 let val = match string_iter.next() {
9915 Some(x) => x,
9916 None => return std::result::Result::Err("Missing value while parsing EnvFromSource".to_string())
9917 };
9918
9919 if let Some(key) = key_result {
9920 #[allow(clippy::match_single_binding)]
9921 match key {
9922 #[allow(clippy::redundant_clone)]
9923 "configMapRef" => intermediate_rep.config_map_ref.push(<models::ConfigMapEnvSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9924 #[allow(clippy::redundant_clone)]
9925 "prefix" => intermediate_rep.prefix.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9926 #[allow(clippy::redundant_clone)]
9927 "secretRef" => intermediate_rep.secret_ref.push(<models::SecretEnvSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
9928 _ => return std::result::Result::Err("Unexpected key while parsing EnvFromSource".to_string())
9929 }
9930 }
9931
9932 key_result = string_iter.next();
9934 }
9935
9936 std::result::Result::Ok(EnvFromSource {
9938 config_map_ref: intermediate_rep.config_map_ref.into_iter().next(),
9939 prefix: intermediate_rep.prefix.into_iter().next(),
9940 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
9941 })
9942 }
9943}
9944
9945#[cfg(feature = "server")]
9948impl std::convert::TryFrom<header::IntoHeaderValue<EnvFromSource>> for HeaderValue {
9949 type Error = String;
9950
9951 fn try_from(hdr_value: header::IntoHeaderValue<EnvFromSource>) -> std::result::Result<Self, Self::Error> {
9952 let hdr_value = hdr_value.to_string();
9953 match HeaderValue::from_str(&hdr_value) {
9954 std::result::Result::Ok(value) => std::result::Result::Ok(value),
9955 std::result::Result::Err(e) => std::result::Result::Err(
9956 format!("Invalid header value for EnvFromSource - value: {} is invalid {}",
9957 hdr_value, e))
9958 }
9959 }
9960}
9961
9962#[cfg(feature = "server")]
9963impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EnvFromSource> {
9964 type Error = String;
9965
9966 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
9967 match hdr_value.to_str() {
9968 std::result::Result::Ok(value) => {
9969 match <EnvFromSource as std::str::FromStr>::from_str(value) {
9970 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
9971 std::result::Result::Err(err) => std::result::Result::Err(
9972 format!("Unable to convert header value '{}' into EnvFromSource - {}",
9973 value, err))
9974 }
9975 },
9976 std::result::Result::Err(e) => std::result::Result::Err(
9977 format!("Unable to convert header: {:?} to string: {}",
9978 hdr_value, e))
9979 }
9980 }
9981}
9982
9983
9984
9985
9986
9987
9988
9989#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
9990#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
9991pub struct EnvVar {
9992#[serde(rename = "name")]
9994 #[serde(skip_serializing_if="Option::is_none")]
9995 pub name: Option<String>,
9996
9997#[serde(rename = "value")]
9999 #[serde(skip_serializing_if="Option::is_none")]
10000 pub value: Option<String>,
10001
10002 #[serde(rename = "valueFrom")]
10003 #[serde(skip_serializing_if="Option::is_none")]
10004 pub value_from: Option<models::EnvVarSource>,
10005
10006}
10007
10008
10009impl EnvVar {
10010 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
10011 pub fn new() -> EnvVar {
10012 EnvVar {
10013 name: None,
10014 value: None,
10015 value_from: None,
10016 }
10017 }
10018}
10019
10020impl std::string::ToString for EnvVar {
10024 fn to_string(&self) -> String {
10025 let params: Vec<Option<String>> = vec![
10026
10027 self.name.as_ref().map(|name| {
10028 [
10029 "name".to_string(),
10030 name.to_string(),
10031 ].join(",")
10032 }),
10033
10034
10035 self.value.as_ref().map(|value| {
10036 [
10037 "value".to_string(),
10038 value.to_string(),
10039 ].join(",")
10040 }),
10041
10042 ];
10045
10046 params.into_iter().flatten().collect::<Vec<_>>().join(",")
10047 }
10048}
10049
10050impl std::str::FromStr for EnvVar {
10054 type Err = String;
10055
10056 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
10057 #[derive(Default)]
10059 #[allow(dead_code)]
10060 struct IntermediateRep {
10061 pub name: Vec<String>,
10062 pub value: Vec<String>,
10063 pub value_from: Vec<models::EnvVarSource>,
10064 }
10065
10066 let mut intermediate_rep = IntermediateRep::default();
10067
10068 let mut string_iter = s.split(',');
10070 let mut key_result = string_iter.next();
10071
10072 while key_result.is_some() {
10073 let val = match string_iter.next() {
10074 Some(x) => x,
10075 None => return std::result::Result::Err("Missing value while parsing EnvVar".to_string())
10076 };
10077
10078 if let Some(key) = key_result {
10079 #[allow(clippy::match_single_binding)]
10080 match key {
10081 #[allow(clippy::redundant_clone)]
10082 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10083 #[allow(clippy::redundant_clone)]
10084 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10085 #[allow(clippy::redundant_clone)]
10086 "valueFrom" => intermediate_rep.value_from.push(<models::EnvVarSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10087 _ => return std::result::Result::Err("Unexpected key while parsing EnvVar".to_string())
10088 }
10089 }
10090
10091 key_result = string_iter.next();
10093 }
10094
10095 std::result::Result::Ok(EnvVar {
10097 name: intermediate_rep.name.into_iter().next(),
10098 value: intermediate_rep.value.into_iter().next(),
10099 value_from: intermediate_rep.value_from.into_iter().next(),
10100 })
10101 }
10102}
10103
10104#[cfg(feature = "server")]
10107impl std::convert::TryFrom<header::IntoHeaderValue<EnvVar>> for HeaderValue {
10108 type Error = String;
10109
10110 fn try_from(hdr_value: header::IntoHeaderValue<EnvVar>) -> std::result::Result<Self, Self::Error> {
10111 let hdr_value = hdr_value.to_string();
10112 match HeaderValue::from_str(&hdr_value) {
10113 std::result::Result::Ok(value) => std::result::Result::Ok(value),
10114 std::result::Result::Err(e) => std::result::Result::Err(
10115 format!("Invalid header value for EnvVar - value: {} is invalid {}",
10116 hdr_value, e))
10117 }
10118 }
10119}
10120
10121#[cfg(feature = "server")]
10122impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EnvVar> {
10123 type Error = String;
10124
10125 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
10126 match hdr_value.to_str() {
10127 std::result::Result::Ok(value) => {
10128 match <EnvVar as std::str::FromStr>::from_str(value) {
10129 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
10130 std::result::Result::Err(err) => std::result::Result::Err(
10131 format!("Unable to convert header value '{}' into EnvVar - {}",
10132 value, err))
10133 }
10134 },
10135 std::result::Result::Err(e) => std::result::Result::Err(
10136 format!("Unable to convert header: {:?} to string: {}",
10137 hdr_value, e))
10138 }
10139 }
10140}
10141
10142
10143
10144
10145
10146
10147
10148#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
10149#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
10150pub struct EnvVarSource {
10151 #[serde(rename = "configMapKeyRef")]
10152 #[serde(skip_serializing_if="Option::is_none")]
10153 pub config_map_key_ref: Option<models::ConfigMapKeySelector>,
10154
10155 #[serde(rename = "fieldRef")]
10156 #[serde(skip_serializing_if="Option::is_none")]
10157 pub field_ref: Option<models::ObjectFieldSelector>,
10158
10159 #[serde(rename = "resourceFieldRef")]
10160 #[serde(skip_serializing_if="Option::is_none")]
10161 pub resource_field_ref: Option<models::ResourceFieldSelector>,
10162
10163 #[serde(rename = "secretKeyRef")]
10164 #[serde(skip_serializing_if="Option::is_none")]
10165 pub secret_key_ref: Option<models::SecretKeySelector>,
10166
10167}
10168
10169
10170impl EnvVarSource {
10171 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
10172 pub fn new() -> EnvVarSource {
10173 EnvVarSource {
10174 config_map_key_ref: None,
10175 field_ref: None,
10176 resource_field_ref: None,
10177 secret_key_ref: None,
10178 }
10179 }
10180}
10181
10182impl std::string::ToString for EnvVarSource {
10186 fn to_string(&self) -> String {
10187 let params: Vec<Option<String>> = vec![
10188 ];
10197
10198 params.into_iter().flatten().collect::<Vec<_>>().join(",")
10199 }
10200}
10201
10202impl std::str::FromStr for EnvVarSource {
10206 type Err = String;
10207
10208 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
10209 #[derive(Default)]
10211 #[allow(dead_code)]
10212 struct IntermediateRep {
10213 pub config_map_key_ref: Vec<models::ConfigMapKeySelector>,
10214 pub field_ref: Vec<models::ObjectFieldSelector>,
10215 pub resource_field_ref: Vec<models::ResourceFieldSelector>,
10216 pub secret_key_ref: Vec<models::SecretKeySelector>,
10217 }
10218
10219 let mut intermediate_rep = IntermediateRep::default();
10220
10221 let mut string_iter = s.split(',');
10223 let mut key_result = string_iter.next();
10224
10225 while key_result.is_some() {
10226 let val = match string_iter.next() {
10227 Some(x) => x,
10228 None => return std::result::Result::Err("Missing value while parsing EnvVarSource".to_string())
10229 };
10230
10231 if let Some(key) = key_result {
10232 #[allow(clippy::match_single_binding)]
10233 match key {
10234 #[allow(clippy::redundant_clone)]
10235 "configMapKeyRef" => intermediate_rep.config_map_key_ref.push(<models::ConfigMapKeySelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10236 #[allow(clippy::redundant_clone)]
10237 "fieldRef" => intermediate_rep.field_ref.push(<models::ObjectFieldSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10238 #[allow(clippy::redundant_clone)]
10239 "resourceFieldRef" => intermediate_rep.resource_field_ref.push(<models::ResourceFieldSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10240 #[allow(clippy::redundant_clone)]
10241 "secretKeyRef" => intermediate_rep.secret_key_ref.push(<models::SecretKeySelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10242 _ => return std::result::Result::Err("Unexpected key while parsing EnvVarSource".to_string())
10243 }
10244 }
10245
10246 key_result = string_iter.next();
10248 }
10249
10250 std::result::Result::Ok(EnvVarSource {
10252 config_map_key_ref: intermediate_rep.config_map_key_ref.into_iter().next(),
10253 field_ref: intermediate_rep.field_ref.into_iter().next(),
10254 resource_field_ref: intermediate_rep.resource_field_ref.into_iter().next(),
10255 secret_key_ref: intermediate_rep.secret_key_ref.into_iter().next(),
10256 })
10257 }
10258}
10259
10260#[cfg(feature = "server")]
10263impl std::convert::TryFrom<header::IntoHeaderValue<EnvVarSource>> for HeaderValue {
10264 type Error = String;
10265
10266 fn try_from(hdr_value: header::IntoHeaderValue<EnvVarSource>) -> std::result::Result<Self, Self::Error> {
10267 let hdr_value = hdr_value.to_string();
10268 match HeaderValue::from_str(&hdr_value) {
10269 std::result::Result::Ok(value) => std::result::Result::Ok(value),
10270 std::result::Result::Err(e) => std::result::Result::Err(
10271 format!("Invalid header value for EnvVarSource - value: {} is invalid {}",
10272 hdr_value, e))
10273 }
10274 }
10275}
10276
10277#[cfg(feature = "server")]
10278impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EnvVarSource> {
10279 type Error = String;
10280
10281 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
10282 match hdr_value.to_str() {
10283 std::result::Result::Ok(value) => {
10284 match <EnvVarSource as std::str::FromStr>::from_str(value) {
10285 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
10286 std::result::Result::Err(err) => std::result::Result::Err(
10287 format!("Unable to convert header value '{}' into EnvVarSource - {}",
10288 value, err))
10289 }
10290 },
10291 std::result::Result::Err(e) => std::result::Result::Err(
10292 format!("Unable to convert header: {:?} to string: {}",
10293 hdr_value, e))
10294 }
10295 }
10296}
10297
10298
10299
10300
10301#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
10306#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
10307pub struct EphemeralContainer {
10308#[serde(rename = "args")]
10310 #[serde(skip_serializing_if="Option::is_none")]
10311 pub args: Option<Vec<String>>,
10312
10313#[serde(rename = "command")]
10315 #[serde(skip_serializing_if="Option::is_none")]
10316 pub command: Option<Vec<String>>,
10317
10318#[serde(rename = "env")]
10320 #[serde(skip_serializing_if="Option::is_none")]
10321 pub env: Option<Vec<models::EnvVar>>,
10322
10323#[serde(rename = "envFrom")]
10325 #[serde(skip_serializing_if="Option::is_none")]
10326 pub env_from: Option<Vec<models::EnvFromSource>>,
10327
10328#[serde(rename = "image")]
10330 #[serde(skip_serializing_if="Option::is_none")]
10331 pub image: Option<String>,
10332
10333#[serde(rename = "imagePullPolicy")]
10335 #[serde(skip_serializing_if="Option::is_none")]
10336 pub image_pull_policy: Option<String>,
10337
10338 #[serde(rename = "lifecycle")]
10339 #[serde(skip_serializing_if="Option::is_none")]
10340 pub lifecycle: Option<models::Lifecycle>,
10341
10342 #[serde(rename = "livenessProbe")]
10343 #[serde(skip_serializing_if="Option::is_none")]
10344 pub liveness_probe: Option<models::Probe>,
10345
10346#[serde(rename = "name")]
10348 #[serde(skip_serializing_if="Option::is_none")]
10349 pub name: Option<String>,
10350
10351#[serde(rename = "ports")]
10353 #[serde(skip_serializing_if="Option::is_none")]
10354 pub ports: Option<Vec<models::ContainerPort>>,
10355
10356 #[serde(rename = "readinessProbe")]
10357 #[serde(skip_serializing_if="Option::is_none")]
10358 pub readiness_probe: Option<models::Probe>,
10359
10360 #[serde(rename = "resources")]
10361 #[serde(skip_serializing_if="Option::is_none")]
10362 pub resources: Option<models::ResourceRequirements>,
10363
10364 #[serde(rename = "securityContext")]
10365 #[serde(skip_serializing_if="Option::is_none")]
10366 pub security_context: Option<models::SecurityContext>,
10367
10368 #[serde(rename = "startupProbe")]
10369 #[serde(skip_serializing_if="Option::is_none")]
10370 pub startup_probe: Option<models::Probe>,
10371
10372#[serde(rename = "stdin")]
10374 #[serde(skip_serializing_if="Option::is_none")]
10375 pub stdin: Option<bool>,
10376
10377#[serde(rename = "stdinOnce")]
10379 #[serde(skip_serializing_if="Option::is_none")]
10380 pub stdin_once: Option<bool>,
10381
10382#[serde(rename = "targetContainerName")]
10384 #[serde(skip_serializing_if="Option::is_none")]
10385 pub target_container_name: Option<String>,
10386
10387#[serde(rename = "terminationMessagePath")]
10389 #[serde(skip_serializing_if="Option::is_none")]
10390 pub termination_message_path: Option<String>,
10391
10392#[serde(rename = "terminationMessagePolicy")]
10394 #[serde(skip_serializing_if="Option::is_none")]
10395 pub termination_message_policy: Option<String>,
10396
10397#[serde(rename = "tty")]
10399 #[serde(skip_serializing_if="Option::is_none")]
10400 pub tty: Option<bool>,
10401
10402#[serde(rename = "volumeDevices")]
10404 #[serde(skip_serializing_if="Option::is_none")]
10405 pub volume_devices: Option<Vec<models::VolumeDevice>>,
10406
10407#[serde(rename = "volumeMounts")]
10409 #[serde(skip_serializing_if="Option::is_none")]
10410 pub volume_mounts: Option<Vec<models::VolumeMount>>,
10411
10412#[serde(rename = "workingDir")]
10414 #[serde(skip_serializing_if="Option::is_none")]
10415 pub working_dir: Option<String>,
10416
10417}
10418
10419
10420impl EphemeralContainer {
10421 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
10422 pub fn new() -> EphemeralContainer {
10423 EphemeralContainer {
10424 args: None,
10425 command: None,
10426 env: None,
10427 env_from: None,
10428 image: None,
10429 image_pull_policy: None,
10430 lifecycle: None,
10431 liveness_probe: None,
10432 name: None,
10433 ports: None,
10434 readiness_probe: None,
10435 resources: None,
10436 security_context: None,
10437 startup_probe: None,
10438 stdin: None,
10439 stdin_once: None,
10440 target_container_name: None,
10441 termination_message_path: None,
10442 termination_message_policy: None,
10443 tty: None,
10444 volume_devices: None,
10445 volume_mounts: None,
10446 working_dir: None,
10447 }
10448 }
10449}
10450
10451impl std::string::ToString for EphemeralContainer {
10455 fn to_string(&self) -> String {
10456 let params: Vec<Option<String>> = vec![
10457
10458 self.args.as_ref().map(|args| {
10459 [
10460 "args".to_string(),
10461 args.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
10462 ].join(",")
10463 }),
10464
10465
10466 self.command.as_ref().map(|command| {
10467 [
10468 "command".to_string(),
10469 command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
10470 ].join(",")
10471 }),
10472
10473 self.image.as_ref().map(|image| {
10479 [
10480 "image".to_string(),
10481 image.to_string(),
10482 ].join(",")
10483 }),
10484
10485
10486 self.image_pull_policy.as_ref().map(|image_pull_policy| {
10487 [
10488 "imagePullPolicy".to_string(),
10489 image_pull_policy.to_string(),
10490 ].join(",")
10491 }),
10492
10493 self.name.as_ref().map(|name| {
10499 [
10500 "name".to_string(),
10501 name.to_string(),
10502 ].join(",")
10503 }),
10504
10505 self.stdin.as_ref().map(|stdin| {
10517 [
10518 "stdin".to_string(),
10519 stdin.to_string(),
10520 ].join(",")
10521 }),
10522
10523
10524 self.stdin_once.as_ref().map(|stdin_once| {
10525 [
10526 "stdinOnce".to_string(),
10527 stdin_once.to_string(),
10528 ].join(",")
10529 }),
10530
10531
10532 self.target_container_name.as_ref().map(|target_container_name| {
10533 [
10534 "targetContainerName".to_string(),
10535 target_container_name.to_string(),
10536 ].join(",")
10537 }),
10538
10539
10540 self.termination_message_path.as_ref().map(|termination_message_path| {
10541 [
10542 "terminationMessagePath".to_string(),
10543 termination_message_path.to_string(),
10544 ].join(",")
10545 }),
10546
10547
10548 self.termination_message_policy.as_ref().map(|termination_message_policy| {
10549 [
10550 "terminationMessagePolicy".to_string(),
10551 termination_message_policy.to_string(),
10552 ].join(",")
10553 }),
10554
10555
10556 self.tty.as_ref().map(|tty| {
10557 [
10558 "tty".to_string(),
10559 tty.to_string(),
10560 ].join(",")
10561 }),
10562
10563 self.working_dir.as_ref().map(|working_dir| {
10569 [
10570 "workingDir".to_string(),
10571 working_dir.to_string(),
10572 ].join(",")
10573 }),
10574
10575 ];
10576
10577 params.into_iter().flatten().collect::<Vec<_>>().join(",")
10578 }
10579}
10580
10581impl std::str::FromStr for EphemeralContainer {
10585 type Err = String;
10586
10587 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
10588 #[derive(Default)]
10590 #[allow(dead_code)]
10591 struct IntermediateRep {
10592 pub args: Vec<Vec<String>>,
10593 pub command: Vec<Vec<String>>,
10594 pub env: Vec<Vec<models::EnvVar>>,
10595 pub env_from: Vec<Vec<models::EnvFromSource>>,
10596 pub image: Vec<String>,
10597 pub image_pull_policy: Vec<String>,
10598 pub lifecycle: Vec<models::Lifecycle>,
10599 pub liveness_probe: Vec<models::Probe>,
10600 pub name: Vec<String>,
10601 pub ports: Vec<Vec<models::ContainerPort>>,
10602 pub readiness_probe: Vec<models::Probe>,
10603 pub resources: Vec<models::ResourceRequirements>,
10604 pub security_context: Vec<models::SecurityContext>,
10605 pub startup_probe: Vec<models::Probe>,
10606 pub stdin: Vec<bool>,
10607 pub stdin_once: Vec<bool>,
10608 pub target_container_name: Vec<String>,
10609 pub termination_message_path: Vec<String>,
10610 pub termination_message_policy: Vec<String>,
10611 pub tty: Vec<bool>,
10612 pub volume_devices: Vec<Vec<models::VolumeDevice>>,
10613 pub volume_mounts: Vec<Vec<models::VolumeMount>>,
10614 pub working_dir: Vec<String>,
10615 }
10616
10617 let mut intermediate_rep = IntermediateRep::default();
10618
10619 let mut string_iter = s.split(',');
10621 let mut key_result = string_iter.next();
10622
10623 while key_result.is_some() {
10624 let val = match string_iter.next() {
10625 Some(x) => x,
10626 None => return std::result::Result::Err("Missing value while parsing EphemeralContainer".to_string())
10627 };
10628
10629 if let Some(key) = key_result {
10630 #[allow(clippy::match_single_binding)]
10631 match key {
10632 "args" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10633 "command" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10634 "env" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10635 "envFrom" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10636 #[allow(clippy::redundant_clone)]
10637 "image" => intermediate_rep.image.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10638 #[allow(clippy::redundant_clone)]
10639 "imagePullPolicy" => intermediate_rep.image_pull_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10640 #[allow(clippy::redundant_clone)]
10641 "lifecycle" => intermediate_rep.lifecycle.push(<models::Lifecycle as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10642 #[allow(clippy::redundant_clone)]
10643 "livenessProbe" => intermediate_rep.liveness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10644 #[allow(clippy::redundant_clone)]
10645 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10646 "ports" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10647 #[allow(clippy::redundant_clone)]
10648 "readinessProbe" => intermediate_rep.readiness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10649 #[allow(clippy::redundant_clone)]
10650 "resources" => intermediate_rep.resources.push(<models::ResourceRequirements as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10651 #[allow(clippy::redundant_clone)]
10652 "securityContext" => intermediate_rep.security_context.push(<models::SecurityContext as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10653 #[allow(clippy::redundant_clone)]
10654 "startupProbe" => intermediate_rep.startup_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10655 #[allow(clippy::redundant_clone)]
10656 "stdin" => intermediate_rep.stdin.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10657 #[allow(clippy::redundant_clone)]
10658 "stdinOnce" => intermediate_rep.stdin_once.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10659 #[allow(clippy::redundant_clone)]
10660 "targetContainerName" => intermediate_rep.target_container_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10661 #[allow(clippy::redundant_clone)]
10662 "terminationMessagePath" => intermediate_rep.termination_message_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10663 #[allow(clippy::redundant_clone)]
10664 "terminationMessagePolicy" => intermediate_rep.termination_message_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10665 #[allow(clippy::redundant_clone)]
10666 "tty" => intermediate_rep.tty.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10667 "volumeDevices" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10668 "volumeMounts" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainer".to_string()),
10669 #[allow(clippy::redundant_clone)]
10670 "workingDir" => intermediate_rep.working_dir.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
10671 _ => return std::result::Result::Err("Unexpected key while parsing EphemeralContainer".to_string())
10672 }
10673 }
10674
10675 key_result = string_iter.next();
10677 }
10678
10679 std::result::Result::Ok(EphemeralContainer {
10681 args: intermediate_rep.args.into_iter().next(),
10682 command: intermediate_rep.command.into_iter().next(),
10683 env: intermediate_rep.env.into_iter().next(),
10684 env_from: intermediate_rep.env_from.into_iter().next(),
10685 image: intermediate_rep.image.into_iter().next(),
10686 image_pull_policy: intermediate_rep.image_pull_policy.into_iter().next(),
10687 lifecycle: intermediate_rep.lifecycle.into_iter().next(),
10688 liveness_probe: intermediate_rep.liveness_probe.into_iter().next(),
10689 name: intermediate_rep.name.into_iter().next(),
10690 ports: intermediate_rep.ports.into_iter().next(),
10691 readiness_probe: intermediate_rep.readiness_probe.into_iter().next(),
10692 resources: intermediate_rep.resources.into_iter().next(),
10693 security_context: intermediate_rep.security_context.into_iter().next(),
10694 startup_probe: intermediate_rep.startup_probe.into_iter().next(),
10695 stdin: intermediate_rep.stdin.into_iter().next(),
10696 stdin_once: intermediate_rep.stdin_once.into_iter().next(),
10697 target_container_name: intermediate_rep.target_container_name.into_iter().next(),
10698 termination_message_path: intermediate_rep.termination_message_path.into_iter().next(),
10699 termination_message_policy: intermediate_rep.termination_message_policy.into_iter().next(),
10700 tty: intermediate_rep.tty.into_iter().next(),
10701 volume_devices: intermediate_rep.volume_devices.into_iter().next(),
10702 volume_mounts: intermediate_rep.volume_mounts.into_iter().next(),
10703 working_dir: intermediate_rep.working_dir.into_iter().next(),
10704 })
10705 }
10706}
10707
10708#[cfg(feature = "server")]
10711impl std::convert::TryFrom<header::IntoHeaderValue<EphemeralContainer>> for HeaderValue {
10712 type Error = String;
10713
10714 fn try_from(hdr_value: header::IntoHeaderValue<EphemeralContainer>) -> std::result::Result<Self, Self::Error> {
10715 let hdr_value = hdr_value.to_string();
10716 match HeaderValue::from_str(&hdr_value) {
10717 std::result::Result::Ok(value) => std::result::Result::Ok(value),
10718 std::result::Result::Err(e) => std::result::Result::Err(
10719 format!("Invalid header value for EphemeralContainer - value: {} is invalid {}",
10720 hdr_value, e))
10721 }
10722 }
10723}
10724
10725#[cfg(feature = "server")]
10726impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EphemeralContainer> {
10727 type Error = String;
10728
10729 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
10730 match hdr_value.to_str() {
10731 std::result::Result::Ok(value) => {
10732 match <EphemeralContainer as std::str::FromStr>::from_str(value) {
10733 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
10734 std::result::Result::Err(err) => std::result::Result::Err(
10735 format!("Unable to convert header value '{}' into EphemeralContainer - {}",
10736 value, err))
10737 }
10738 },
10739 std::result::Result::Err(e) => std::result::Result::Err(
10740 format!("Unable to convert header: {:?} to string: {}",
10741 hdr_value, e))
10742 }
10743 }
10744}
10745
10746
10747
10748
10749#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
10754#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
10755pub struct EphemeralContainerCommon {
10756#[serde(rename = "args")]
10758 #[serde(skip_serializing_if="Option::is_none")]
10759 pub args: Option<Vec<String>>,
10760
10761#[serde(rename = "command")]
10763 #[serde(skip_serializing_if="Option::is_none")]
10764 pub command: Option<Vec<String>>,
10765
10766#[serde(rename = "env")]
10768 #[serde(skip_serializing_if="Option::is_none")]
10769 pub env: Option<Vec<models::EnvVar>>,
10770
10771#[serde(rename = "envFrom")]
10773 #[serde(skip_serializing_if="Option::is_none")]
10774 pub env_from: Option<Vec<models::EnvFromSource>>,
10775
10776#[serde(rename = "image")]
10778 #[serde(skip_serializing_if="Option::is_none")]
10779 pub image: Option<String>,
10780
10781#[serde(rename = "imagePullPolicy")]
10783 #[serde(skip_serializing_if="Option::is_none")]
10784 pub image_pull_policy: Option<String>,
10785
10786 #[serde(rename = "lifecycle")]
10787 #[serde(skip_serializing_if="Option::is_none")]
10788 pub lifecycle: Option<models::Lifecycle>,
10789
10790 #[serde(rename = "livenessProbe")]
10791 #[serde(skip_serializing_if="Option::is_none")]
10792 pub liveness_probe: Option<models::Probe>,
10793
10794#[serde(rename = "name")]
10796 #[serde(skip_serializing_if="Option::is_none")]
10797 pub name: Option<String>,
10798
10799#[serde(rename = "ports")]
10801 #[serde(skip_serializing_if="Option::is_none")]
10802 pub ports: Option<Vec<models::ContainerPort>>,
10803
10804 #[serde(rename = "readinessProbe")]
10805 #[serde(skip_serializing_if="Option::is_none")]
10806 pub readiness_probe: Option<models::Probe>,
10807
10808 #[serde(rename = "resources")]
10809 #[serde(skip_serializing_if="Option::is_none")]
10810 pub resources: Option<models::ResourceRequirements>,
10811
10812 #[serde(rename = "securityContext")]
10813 #[serde(skip_serializing_if="Option::is_none")]
10814 pub security_context: Option<models::SecurityContext>,
10815
10816 #[serde(rename = "startupProbe")]
10817 #[serde(skip_serializing_if="Option::is_none")]
10818 pub startup_probe: Option<models::Probe>,
10819
10820#[serde(rename = "stdin")]
10822 #[serde(skip_serializing_if="Option::is_none")]
10823 pub stdin: Option<bool>,
10824
10825#[serde(rename = "stdinOnce")]
10827 #[serde(skip_serializing_if="Option::is_none")]
10828 pub stdin_once: Option<bool>,
10829
10830#[serde(rename = "terminationMessagePath")]
10832 #[serde(skip_serializing_if="Option::is_none")]
10833 pub termination_message_path: Option<String>,
10834
10835#[serde(rename = "terminationMessagePolicy")]
10837 #[serde(skip_serializing_if="Option::is_none")]
10838 pub termination_message_policy: Option<String>,
10839
10840#[serde(rename = "tty")]
10842 #[serde(skip_serializing_if="Option::is_none")]
10843 pub tty: Option<bool>,
10844
10845#[serde(rename = "volumeDevices")]
10847 #[serde(skip_serializing_if="Option::is_none")]
10848 pub volume_devices: Option<Vec<models::VolumeDevice>>,
10849
10850#[serde(rename = "volumeMounts")]
10852 #[serde(skip_serializing_if="Option::is_none")]
10853 pub volume_mounts: Option<Vec<models::VolumeMount>>,
10854
10855#[serde(rename = "workingDir")]
10857 #[serde(skip_serializing_if="Option::is_none")]
10858 pub working_dir: Option<String>,
10859
10860}
10861
10862
10863impl EphemeralContainerCommon {
10864 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
10865 pub fn new() -> EphemeralContainerCommon {
10866 EphemeralContainerCommon {
10867 args: None,
10868 command: None,
10869 env: None,
10870 env_from: None,
10871 image: None,
10872 image_pull_policy: None,
10873 lifecycle: None,
10874 liveness_probe: None,
10875 name: None,
10876 ports: None,
10877 readiness_probe: None,
10878 resources: None,
10879 security_context: None,
10880 startup_probe: None,
10881 stdin: None,
10882 stdin_once: None,
10883 termination_message_path: None,
10884 termination_message_policy: None,
10885 tty: None,
10886 volume_devices: None,
10887 volume_mounts: None,
10888 working_dir: None,
10889 }
10890 }
10891}
10892
10893impl std::string::ToString for EphemeralContainerCommon {
10897 fn to_string(&self) -> String {
10898 let params: Vec<Option<String>> = vec![
10899
10900 self.args.as_ref().map(|args| {
10901 [
10902 "args".to_string(),
10903 args.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
10904 ].join(",")
10905 }),
10906
10907
10908 self.command.as_ref().map(|command| {
10909 [
10910 "command".to_string(),
10911 command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
10912 ].join(",")
10913 }),
10914
10915 self.image.as_ref().map(|image| {
10921 [
10922 "image".to_string(),
10923 image.to_string(),
10924 ].join(",")
10925 }),
10926
10927
10928 self.image_pull_policy.as_ref().map(|image_pull_policy| {
10929 [
10930 "imagePullPolicy".to_string(),
10931 image_pull_policy.to_string(),
10932 ].join(",")
10933 }),
10934
10935 self.name.as_ref().map(|name| {
10941 [
10942 "name".to_string(),
10943 name.to_string(),
10944 ].join(",")
10945 }),
10946
10947 self.stdin.as_ref().map(|stdin| {
10959 [
10960 "stdin".to_string(),
10961 stdin.to_string(),
10962 ].join(",")
10963 }),
10964
10965
10966 self.stdin_once.as_ref().map(|stdin_once| {
10967 [
10968 "stdinOnce".to_string(),
10969 stdin_once.to_string(),
10970 ].join(",")
10971 }),
10972
10973
10974 self.termination_message_path.as_ref().map(|termination_message_path| {
10975 [
10976 "terminationMessagePath".to_string(),
10977 termination_message_path.to_string(),
10978 ].join(",")
10979 }),
10980
10981
10982 self.termination_message_policy.as_ref().map(|termination_message_policy| {
10983 [
10984 "terminationMessagePolicy".to_string(),
10985 termination_message_policy.to_string(),
10986 ].join(",")
10987 }),
10988
10989
10990 self.tty.as_ref().map(|tty| {
10991 [
10992 "tty".to_string(),
10993 tty.to_string(),
10994 ].join(",")
10995 }),
10996
10997 self.working_dir.as_ref().map(|working_dir| {
11003 [
11004 "workingDir".to_string(),
11005 working_dir.to_string(),
11006 ].join(",")
11007 }),
11008
11009 ];
11010
11011 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11012 }
11013}
11014
11015impl std::str::FromStr for EphemeralContainerCommon {
11019 type Err = String;
11020
11021 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11022 #[derive(Default)]
11024 #[allow(dead_code)]
11025 struct IntermediateRep {
11026 pub args: Vec<Vec<String>>,
11027 pub command: Vec<Vec<String>>,
11028 pub env: Vec<Vec<models::EnvVar>>,
11029 pub env_from: Vec<Vec<models::EnvFromSource>>,
11030 pub image: Vec<String>,
11031 pub image_pull_policy: Vec<String>,
11032 pub lifecycle: Vec<models::Lifecycle>,
11033 pub liveness_probe: Vec<models::Probe>,
11034 pub name: Vec<String>,
11035 pub ports: Vec<Vec<models::ContainerPort>>,
11036 pub readiness_probe: Vec<models::Probe>,
11037 pub resources: Vec<models::ResourceRequirements>,
11038 pub security_context: Vec<models::SecurityContext>,
11039 pub startup_probe: Vec<models::Probe>,
11040 pub stdin: Vec<bool>,
11041 pub stdin_once: Vec<bool>,
11042 pub termination_message_path: Vec<String>,
11043 pub termination_message_policy: Vec<String>,
11044 pub tty: Vec<bool>,
11045 pub volume_devices: Vec<Vec<models::VolumeDevice>>,
11046 pub volume_mounts: Vec<Vec<models::VolumeMount>>,
11047 pub working_dir: Vec<String>,
11048 }
11049
11050 let mut intermediate_rep = IntermediateRep::default();
11051
11052 let mut string_iter = s.split(',');
11054 let mut key_result = string_iter.next();
11055
11056 while key_result.is_some() {
11057 let val = match string_iter.next() {
11058 Some(x) => x,
11059 None => return std::result::Result::Err("Missing value while parsing EphemeralContainerCommon".to_string())
11060 };
11061
11062 if let Some(key) = key_result {
11063 #[allow(clippy::match_single_binding)]
11064 match key {
11065 "args" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11066 "command" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11067 "env" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11068 "envFrom" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11069 #[allow(clippy::redundant_clone)]
11070 "image" => intermediate_rep.image.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11071 #[allow(clippy::redundant_clone)]
11072 "imagePullPolicy" => intermediate_rep.image_pull_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11073 #[allow(clippy::redundant_clone)]
11074 "lifecycle" => intermediate_rep.lifecycle.push(<models::Lifecycle as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11075 #[allow(clippy::redundant_clone)]
11076 "livenessProbe" => intermediate_rep.liveness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11077 #[allow(clippy::redundant_clone)]
11078 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11079 "ports" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11080 #[allow(clippy::redundant_clone)]
11081 "readinessProbe" => intermediate_rep.readiness_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11082 #[allow(clippy::redundant_clone)]
11083 "resources" => intermediate_rep.resources.push(<models::ResourceRequirements as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11084 #[allow(clippy::redundant_clone)]
11085 "securityContext" => intermediate_rep.security_context.push(<models::SecurityContext as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11086 #[allow(clippy::redundant_clone)]
11087 "startupProbe" => intermediate_rep.startup_probe.push(<models::Probe as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11088 #[allow(clippy::redundant_clone)]
11089 "stdin" => intermediate_rep.stdin.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11090 #[allow(clippy::redundant_clone)]
11091 "stdinOnce" => intermediate_rep.stdin_once.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11092 #[allow(clippy::redundant_clone)]
11093 "terminationMessagePath" => intermediate_rep.termination_message_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11094 #[allow(clippy::redundant_clone)]
11095 "terminationMessagePolicy" => intermediate_rep.termination_message_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11096 #[allow(clippy::redundant_clone)]
11097 "tty" => intermediate_rep.tty.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11098 "volumeDevices" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11099 "volumeMounts" => return std::result::Result::Err("Parsing a container in this style is not supported in EphemeralContainerCommon".to_string()),
11100 #[allow(clippy::redundant_clone)]
11101 "workingDir" => intermediate_rep.working_dir.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11102 _ => return std::result::Result::Err("Unexpected key while parsing EphemeralContainerCommon".to_string())
11103 }
11104 }
11105
11106 key_result = string_iter.next();
11108 }
11109
11110 std::result::Result::Ok(EphemeralContainerCommon {
11112 args: intermediate_rep.args.into_iter().next(),
11113 command: intermediate_rep.command.into_iter().next(),
11114 env: intermediate_rep.env.into_iter().next(),
11115 env_from: intermediate_rep.env_from.into_iter().next(),
11116 image: intermediate_rep.image.into_iter().next(),
11117 image_pull_policy: intermediate_rep.image_pull_policy.into_iter().next(),
11118 lifecycle: intermediate_rep.lifecycle.into_iter().next(),
11119 liveness_probe: intermediate_rep.liveness_probe.into_iter().next(),
11120 name: intermediate_rep.name.into_iter().next(),
11121 ports: intermediate_rep.ports.into_iter().next(),
11122 readiness_probe: intermediate_rep.readiness_probe.into_iter().next(),
11123 resources: intermediate_rep.resources.into_iter().next(),
11124 security_context: intermediate_rep.security_context.into_iter().next(),
11125 startup_probe: intermediate_rep.startup_probe.into_iter().next(),
11126 stdin: intermediate_rep.stdin.into_iter().next(),
11127 stdin_once: intermediate_rep.stdin_once.into_iter().next(),
11128 termination_message_path: intermediate_rep.termination_message_path.into_iter().next(),
11129 termination_message_policy: intermediate_rep.termination_message_policy.into_iter().next(),
11130 tty: intermediate_rep.tty.into_iter().next(),
11131 volume_devices: intermediate_rep.volume_devices.into_iter().next(),
11132 volume_mounts: intermediate_rep.volume_mounts.into_iter().next(),
11133 working_dir: intermediate_rep.working_dir.into_iter().next(),
11134 })
11135 }
11136}
11137
11138#[cfg(feature = "server")]
11141impl std::convert::TryFrom<header::IntoHeaderValue<EphemeralContainerCommon>> for HeaderValue {
11142 type Error = String;
11143
11144 fn try_from(hdr_value: header::IntoHeaderValue<EphemeralContainerCommon>) -> std::result::Result<Self, Self::Error> {
11145 let hdr_value = hdr_value.to_string();
11146 match HeaderValue::from_str(&hdr_value) {
11147 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11148 std::result::Result::Err(e) => std::result::Result::Err(
11149 format!("Invalid header value for EphemeralContainerCommon - value: {} is invalid {}",
11150 hdr_value, e))
11151 }
11152 }
11153}
11154
11155#[cfg(feature = "server")]
11156impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EphemeralContainerCommon> {
11157 type Error = String;
11158
11159 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11160 match hdr_value.to_str() {
11161 std::result::Result::Ok(value) => {
11162 match <EphemeralContainerCommon as std::str::FromStr>::from_str(value) {
11163 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11164 std::result::Result::Err(err) => std::result::Result::Err(
11165 format!("Unable to convert header value '{}' into EphemeralContainerCommon - {}",
11166 value, err))
11167 }
11168 },
11169 std::result::Result::Err(e) => std::result::Result::Err(
11170 format!("Unable to convert header: {:?} to string: {}",
11171 hdr_value, e))
11172 }
11173 }
11174}
11175
11176
11177
11178
11179
11180
11181
11182#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11183#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11184pub struct EphemeralVolumeSource {
11185 #[serde(rename = "volumeClaimTemplate")]
11186 #[serde(skip_serializing_if="Option::is_none")]
11187 pub volume_claim_template: Option<models::PersistentVolumeClaimTemplate>,
11188
11189}
11190
11191
11192impl EphemeralVolumeSource {
11193 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
11194 pub fn new() -> EphemeralVolumeSource {
11195 EphemeralVolumeSource {
11196 volume_claim_template: None,
11197 }
11198 }
11199}
11200
11201impl std::string::ToString for EphemeralVolumeSource {
11205 fn to_string(&self) -> String {
11206 let params: Vec<Option<String>> = vec![
11207 ];
11210
11211 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11212 }
11213}
11214
11215impl std::str::FromStr for EphemeralVolumeSource {
11219 type Err = String;
11220
11221 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11222 #[derive(Default)]
11224 #[allow(dead_code)]
11225 struct IntermediateRep {
11226 pub volume_claim_template: Vec<models::PersistentVolumeClaimTemplate>,
11227 }
11228
11229 let mut intermediate_rep = IntermediateRep::default();
11230
11231 let mut string_iter = s.split(',');
11233 let mut key_result = string_iter.next();
11234
11235 while key_result.is_some() {
11236 let val = match string_iter.next() {
11237 Some(x) => x,
11238 None => return std::result::Result::Err("Missing value while parsing EphemeralVolumeSource".to_string())
11239 };
11240
11241 if let Some(key) = key_result {
11242 #[allow(clippy::match_single_binding)]
11243 match key {
11244 #[allow(clippy::redundant_clone)]
11245 "volumeClaimTemplate" => intermediate_rep.volume_claim_template.push(<models::PersistentVolumeClaimTemplate as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11246 _ => return std::result::Result::Err("Unexpected key while parsing EphemeralVolumeSource".to_string())
11247 }
11248 }
11249
11250 key_result = string_iter.next();
11252 }
11253
11254 std::result::Result::Ok(EphemeralVolumeSource {
11256 volume_claim_template: intermediate_rep.volume_claim_template.into_iter().next(),
11257 })
11258 }
11259}
11260
11261#[cfg(feature = "server")]
11264impl std::convert::TryFrom<header::IntoHeaderValue<EphemeralVolumeSource>> for HeaderValue {
11265 type Error = String;
11266
11267 fn try_from(hdr_value: header::IntoHeaderValue<EphemeralVolumeSource>) -> std::result::Result<Self, Self::Error> {
11268 let hdr_value = hdr_value.to_string();
11269 match HeaderValue::from_str(&hdr_value) {
11270 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11271 std::result::Result::Err(e) => std::result::Result::Err(
11272 format!("Invalid header value for EphemeralVolumeSource - value: {} is invalid {}",
11273 hdr_value, e))
11274 }
11275 }
11276}
11277
11278#[cfg(feature = "server")]
11279impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<EphemeralVolumeSource> {
11280 type Error = String;
11281
11282 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11283 match hdr_value.to_str() {
11284 std::result::Result::Ok(value) => {
11285 match <EphemeralVolumeSource as std::str::FromStr>::from_str(value) {
11286 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11287 std::result::Result::Err(err) => std::result::Result::Err(
11288 format!("Unable to convert header value '{}' into EphemeralVolumeSource - {}",
11289 value, err))
11290 }
11291 },
11292 std::result::Result::Err(e) => std::result::Result::Err(
11293 format!("Unable to convert header: {:?} to string: {}",
11294 hdr_value, e))
11295 }
11296 }
11297}
11298
11299
11300
11301
11302
11303
11304
11305#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11306#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11307pub struct ErrorResponse {
11308#[serde(rename = "message")]
11310 pub message: String,
11311
11312}
11313
11314
11315impl ErrorResponse {
11316 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
11317 pub fn new(message: String, ) -> ErrorResponse {
11318 ErrorResponse {
11319 message,
11320 }
11321 }
11322}
11323
11324impl std::string::ToString for ErrorResponse {
11328 fn to_string(&self) -> String {
11329 let params: Vec<Option<String>> = vec![
11330
11331 Some("message".to_string()),
11332 Some(self.message.to_string()),
11333
11334 ];
11335
11336 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11337 }
11338}
11339
11340impl std::str::FromStr for ErrorResponse {
11344 type Err = String;
11345
11346 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11347 #[derive(Default)]
11349 #[allow(dead_code)]
11350 struct IntermediateRep {
11351 pub message: Vec<String>,
11352 }
11353
11354 let mut intermediate_rep = IntermediateRep::default();
11355
11356 let mut string_iter = s.split(',');
11358 let mut key_result = string_iter.next();
11359
11360 while key_result.is_some() {
11361 let val = match string_iter.next() {
11362 Some(x) => x,
11363 None => return std::result::Result::Err("Missing value while parsing ErrorResponse".to_string())
11364 };
11365
11366 if let Some(key) = key_result {
11367 #[allow(clippy::match_single_binding)]
11368 match key {
11369 #[allow(clippy::redundant_clone)]
11370 "message" => intermediate_rep.message.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11371 _ => return std::result::Result::Err("Unexpected key while parsing ErrorResponse".to_string())
11372 }
11373 }
11374
11375 key_result = string_iter.next();
11377 }
11378
11379 std::result::Result::Ok(ErrorResponse {
11381 message: intermediate_rep.message.into_iter().next().ok_or_else(|| "message missing in ErrorResponse".to_string())?,
11382 })
11383 }
11384}
11385
11386#[cfg(feature = "server")]
11389impl std::convert::TryFrom<header::IntoHeaderValue<ErrorResponse>> for HeaderValue {
11390 type Error = String;
11391
11392 fn try_from(hdr_value: header::IntoHeaderValue<ErrorResponse>) -> std::result::Result<Self, Self::Error> {
11393 let hdr_value = hdr_value.to_string();
11394 match HeaderValue::from_str(&hdr_value) {
11395 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11396 std::result::Result::Err(e) => std::result::Result::Err(
11397 format!("Invalid header value for ErrorResponse - value: {} is invalid {}",
11398 hdr_value, e))
11399 }
11400 }
11401}
11402
11403#[cfg(feature = "server")]
11404impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ErrorResponse> {
11405 type Error = String;
11406
11407 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11408 match hdr_value.to_str() {
11409 std::result::Result::Ok(value) => {
11410 match <ErrorResponse as std::str::FromStr>::from_str(value) {
11411 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11412 std::result::Result::Err(err) => std::result::Result::Err(
11413 format!("Unable to convert header value '{}' into ErrorResponse - {}",
11414 value, err))
11415 }
11416 },
11417 std::result::Result::Err(e) => std::result::Result::Err(
11418 format!("Unable to convert header: {:?} to string: {}",
11419 hdr_value, e))
11420 }
11421 }
11422}
11423
11424
11425
11426
11427
11428
11429
11430#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11431#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11432pub struct ExecAction {
11433#[serde(rename = "command")]
11435 #[serde(skip_serializing_if="Option::is_none")]
11436 pub command: Option<Vec<String>>,
11437
11438}
11439
11440
11441impl ExecAction {
11442 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
11443 pub fn new() -> ExecAction {
11444 ExecAction {
11445 command: None,
11446 }
11447 }
11448}
11449
11450impl std::string::ToString for ExecAction {
11454 fn to_string(&self) -> String {
11455 let params: Vec<Option<String>> = vec![
11456
11457 self.command.as_ref().map(|command| {
11458 [
11459 "command".to_string(),
11460 command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
11461 ].join(",")
11462 }),
11463
11464 ];
11465
11466 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11467 }
11468}
11469
11470impl std::str::FromStr for ExecAction {
11474 type Err = String;
11475
11476 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11477 #[derive(Default)]
11479 #[allow(dead_code)]
11480 struct IntermediateRep {
11481 pub command: Vec<Vec<String>>,
11482 }
11483
11484 let mut intermediate_rep = IntermediateRep::default();
11485
11486 let mut string_iter = s.split(',');
11488 let mut key_result = string_iter.next();
11489
11490 while key_result.is_some() {
11491 let val = match string_iter.next() {
11492 Some(x) => x,
11493 None => return std::result::Result::Err("Missing value while parsing ExecAction".to_string())
11494 };
11495
11496 if let Some(key) = key_result {
11497 #[allow(clippy::match_single_binding)]
11498 match key {
11499 "command" => return std::result::Result::Err("Parsing a container in this style is not supported in ExecAction".to_string()),
11500 _ => return std::result::Result::Err("Unexpected key while parsing ExecAction".to_string())
11501 }
11502 }
11503
11504 key_result = string_iter.next();
11506 }
11507
11508 std::result::Result::Ok(ExecAction {
11510 command: intermediate_rep.command.into_iter().next(),
11511 })
11512 }
11513}
11514
11515#[cfg(feature = "server")]
11518impl std::convert::TryFrom<header::IntoHeaderValue<ExecAction>> for HeaderValue {
11519 type Error = String;
11520
11521 fn try_from(hdr_value: header::IntoHeaderValue<ExecAction>) -> std::result::Result<Self, Self::Error> {
11522 let hdr_value = hdr_value.to_string();
11523 match HeaderValue::from_str(&hdr_value) {
11524 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11525 std::result::Result::Err(e) => std::result::Result::Err(
11526 format!("Invalid header value for ExecAction - value: {} is invalid {}",
11527 hdr_value, e))
11528 }
11529 }
11530}
11531
11532#[cfg(feature = "server")]
11533impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ExecAction> {
11534 type Error = String;
11535
11536 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11537 match hdr_value.to_str() {
11538 std::result::Result::Ok(value) => {
11539 match <ExecAction as std::str::FromStr>::from_str(value) {
11540 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11541 std::result::Result::Err(err) => std::result::Result::Err(
11542 format!("Unable to convert header value '{}' into ExecAction - {}",
11543 value, err))
11544 }
11545 },
11546 std::result::Result::Err(e) => std::result::Result::Err(
11547 format!("Unable to convert header: {:?} to string: {}",
11548 hdr_value, e))
11549 }
11550 }
11551}
11552
11553
11554
11555
11556#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11561#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11562pub struct FcVolumeSource {
11563#[serde(rename = "fsType")]
11565 #[serde(skip_serializing_if="Option::is_none")]
11566 pub fs_type: Option<String>,
11567
11568#[serde(rename = "lun")]
11570 #[serde(skip_serializing_if="Option::is_none")]
11571 pub lun: Option<i32>,
11572
11573#[serde(rename = "readOnly")]
11575 #[serde(skip_serializing_if="Option::is_none")]
11576 pub read_only: Option<bool>,
11577
11578#[serde(rename = "targetWWNs")]
11580 #[serde(skip_serializing_if="Option::is_none")]
11581 pub target_wwns: Option<Vec<String>>,
11582
11583#[serde(rename = "wwids")]
11585 #[serde(skip_serializing_if="Option::is_none")]
11586 pub wwids: Option<Vec<String>>,
11587
11588}
11589
11590
11591impl FcVolumeSource {
11592 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
11593 pub fn new() -> FcVolumeSource {
11594 FcVolumeSource {
11595 fs_type: None,
11596 lun: None,
11597 read_only: None,
11598 target_wwns: None,
11599 wwids: None,
11600 }
11601 }
11602}
11603
11604impl std::string::ToString for FcVolumeSource {
11608 fn to_string(&self) -> String {
11609 let params: Vec<Option<String>> = vec![
11610
11611 self.fs_type.as_ref().map(|fs_type| {
11612 [
11613 "fsType".to_string(),
11614 fs_type.to_string(),
11615 ].join(",")
11616 }),
11617
11618
11619 self.lun.as_ref().map(|lun| {
11620 [
11621 "lun".to_string(),
11622 lun.to_string(),
11623 ].join(",")
11624 }),
11625
11626
11627 self.read_only.as_ref().map(|read_only| {
11628 [
11629 "readOnly".to_string(),
11630 read_only.to_string(),
11631 ].join(",")
11632 }),
11633
11634
11635 self.target_wwns.as_ref().map(|target_wwns| {
11636 [
11637 "targetWWNs".to_string(),
11638 target_wwns.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
11639 ].join(",")
11640 }),
11641
11642
11643 self.wwids.as_ref().map(|wwids| {
11644 [
11645 "wwids".to_string(),
11646 wwids.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
11647 ].join(",")
11648 }),
11649
11650 ];
11651
11652 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11653 }
11654}
11655
11656impl std::str::FromStr for FcVolumeSource {
11660 type Err = String;
11661
11662 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11663 #[derive(Default)]
11665 #[allow(dead_code)]
11666 struct IntermediateRep {
11667 pub fs_type: Vec<String>,
11668 pub lun: Vec<i32>,
11669 pub read_only: Vec<bool>,
11670 pub target_wwns: Vec<Vec<String>>,
11671 pub wwids: Vec<Vec<String>>,
11672 }
11673
11674 let mut intermediate_rep = IntermediateRep::default();
11675
11676 let mut string_iter = s.split(',');
11678 let mut key_result = string_iter.next();
11679
11680 while key_result.is_some() {
11681 let val = match string_iter.next() {
11682 Some(x) => x,
11683 None => return std::result::Result::Err("Missing value while parsing FcVolumeSource".to_string())
11684 };
11685
11686 if let Some(key) = key_result {
11687 #[allow(clippy::match_single_binding)]
11688 match key {
11689 #[allow(clippy::redundant_clone)]
11690 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11691 #[allow(clippy::redundant_clone)]
11692 "lun" => intermediate_rep.lun.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11693 #[allow(clippy::redundant_clone)]
11694 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11695 "targetWWNs" => return std::result::Result::Err("Parsing a container in this style is not supported in FcVolumeSource".to_string()),
11696 "wwids" => return std::result::Result::Err("Parsing a container in this style is not supported in FcVolumeSource".to_string()),
11697 _ => return std::result::Result::Err("Unexpected key while parsing FcVolumeSource".to_string())
11698 }
11699 }
11700
11701 key_result = string_iter.next();
11703 }
11704
11705 std::result::Result::Ok(FcVolumeSource {
11707 fs_type: intermediate_rep.fs_type.into_iter().next(),
11708 lun: intermediate_rep.lun.into_iter().next(),
11709 read_only: intermediate_rep.read_only.into_iter().next(),
11710 target_wwns: intermediate_rep.target_wwns.into_iter().next(),
11711 wwids: intermediate_rep.wwids.into_iter().next(),
11712 })
11713 }
11714}
11715
11716#[cfg(feature = "server")]
11719impl std::convert::TryFrom<header::IntoHeaderValue<FcVolumeSource>> for HeaderValue {
11720 type Error = String;
11721
11722 fn try_from(hdr_value: header::IntoHeaderValue<FcVolumeSource>) -> std::result::Result<Self, Self::Error> {
11723 let hdr_value = hdr_value.to_string();
11724 match HeaderValue::from_str(&hdr_value) {
11725 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11726 std::result::Result::Err(e) => std::result::Result::Err(
11727 format!("Invalid header value for FcVolumeSource - value: {} is invalid {}",
11728 hdr_value, e))
11729 }
11730 }
11731}
11732
11733#[cfg(feature = "server")]
11734impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<FcVolumeSource> {
11735 type Error = String;
11736
11737 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11738 match hdr_value.to_str() {
11739 std::result::Result::Ok(value) => {
11740 match <FcVolumeSource as std::str::FromStr>::from_str(value) {
11741 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11742 std::result::Result::Err(err) => std::result::Result::Err(
11743 format!("Unable to convert header value '{}' into FcVolumeSource - {}",
11744 value, err))
11745 }
11746 },
11747 std::result::Result::Err(e) => std::result::Result::Err(
11748 format!("Unable to convert header: {:?} to string: {}",
11749 hdr_value, e))
11750 }
11751 }
11752}
11753
11754
11755
11756
11757#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
11759#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11760pub struct FileMode(i32);
11761
11762impl validator::Validate for FileMode {
11763 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
11764 std::result::Result::Ok(())
11765 }
11766}
11767
11768impl std::convert::From<i32> for FileMode {
11769 fn from(x: i32) -> Self {
11770 FileMode(x)
11771 }
11772}
11773
11774impl std::convert::From<FileMode> for i32 {
11775 fn from(x: FileMode) -> Self {
11776 x.0
11777 }
11778}
11779
11780impl std::ops::Deref for FileMode {
11781 type Target = i32;
11782 fn deref(&self) -> &i32 {
11783 &self.0
11784 }
11785}
11786
11787impl std::ops::DerefMut for FileMode {
11788 fn deref_mut(&mut self) -> &mut i32 {
11789 &mut self.0
11790 }
11791}
11792
11793
11794
11795#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11800#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11801pub struct FlexVolumeSource {
11802#[serde(rename = "driver")]
11804 #[serde(skip_serializing_if="Option::is_none")]
11805 pub driver: Option<String>,
11806
11807#[serde(rename = "fsType")]
11809 #[serde(skip_serializing_if="Option::is_none")]
11810 pub fs_type: Option<String>,
11811
11812#[serde(rename = "options")]
11814 #[serde(skip_serializing_if="Option::is_none")]
11815 pub options: Option<std::collections::HashMap<String, String>>,
11816
11817#[serde(rename = "readOnly")]
11819 #[serde(skip_serializing_if="Option::is_none")]
11820 pub read_only: Option<bool>,
11821
11822 #[serde(rename = "secretRef")]
11823 #[serde(skip_serializing_if="Option::is_none")]
11824 pub secret_ref: Option<models::LocalObjectReference>,
11825
11826}
11827
11828
11829impl FlexVolumeSource {
11830 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
11831 pub fn new() -> FlexVolumeSource {
11832 FlexVolumeSource {
11833 driver: None,
11834 fs_type: None,
11835 options: None,
11836 read_only: None,
11837 secret_ref: None,
11838 }
11839 }
11840}
11841
11842impl std::string::ToString for FlexVolumeSource {
11846 fn to_string(&self) -> String {
11847 let params: Vec<Option<String>> = vec![
11848
11849 self.driver.as_ref().map(|driver| {
11850 [
11851 "driver".to_string(),
11852 driver.to_string(),
11853 ].join(",")
11854 }),
11855
11856
11857 self.fs_type.as_ref().map(|fs_type| {
11858 [
11859 "fsType".to_string(),
11860 fs_type.to_string(),
11861 ].join(",")
11862 }),
11863
11864 self.read_only.as_ref().map(|read_only| {
11868 [
11869 "readOnly".to_string(),
11870 read_only.to_string(),
11871 ].join(",")
11872 }),
11873
11874 ];
11877
11878 params.into_iter().flatten().collect::<Vec<_>>().join(",")
11879 }
11880}
11881
11882impl std::str::FromStr for FlexVolumeSource {
11886 type Err = String;
11887
11888 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
11889 #[derive(Default)]
11891 #[allow(dead_code)]
11892 struct IntermediateRep {
11893 pub driver: Vec<String>,
11894 pub fs_type: Vec<String>,
11895 pub options: Vec<std::collections::HashMap<String, String>>,
11896 pub read_only: Vec<bool>,
11897 pub secret_ref: Vec<models::LocalObjectReference>,
11898 }
11899
11900 let mut intermediate_rep = IntermediateRep::default();
11901
11902 let mut string_iter = s.split(',');
11904 let mut key_result = string_iter.next();
11905
11906 while key_result.is_some() {
11907 let val = match string_iter.next() {
11908 Some(x) => x,
11909 None => return std::result::Result::Err("Missing value while parsing FlexVolumeSource".to_string())
11910 };
11911
11912 if let Some(key) = key_result {
11913 #[allow(clippy::match_single_binding)]
11914 match key {
11915 #[allow(clippy::redundant_clone)]
11916 "driver" => intermediate_rep.driver.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11917 #[allow(clippy::redundant_clone)]
11918 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11919 "options" => return std::result::Result::Err("Parsing a container in this style is not supported in FlexVolumeSource".to_string()),
11920 #[allow(clippy::redundant_clone)]
11921 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11922 #[allow(clippy::redundant_clone)]
11923 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
11924 _ => return std::result::Result::Err("Unexpected key while parsing FlexVolumeSource".to_string())
11925 }
11926 }
11927
11928 key_result = string_iter.next();
11930 }
11931
11932 std::result::Result::Ok(FlexVolumeSource {
11934 driver: intermediate_rep.driver.into_iter().next(),
11935 fs_type: intermediate_rep.fs_type.into_iter().next(),
11936 options: intermediate_rep.options.into_iter().next(),
11937 read_only: intermediate_rep.read_only.into_iter().next(),
11938 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
11939 })
11940 }
11941}
11942
11943#[cfg(feature = "server")]
11946impl std::convert::TryFrom<header::IntoHeaderValue<FlexVolumeSource>> for HeaderValue {
11947 type Error = String;
11948
11949 fn try_from(hdr_value: header::IntoHeaderValue<FlexVolumeSource>) -> std::result::Result<Self, Self::Error> {
11950 let hdr_value = hdr_value.to_string();
11951 match HeaderValue::from_str(&hdr_value) {
11952 std::result::Result::Ok(value) => std::result::Result::Ok(value),
11953 std::result::Result::Err(e) => std::result::Result::Err(
11954 format!("Invalid header value for FlexVolumeSource - value: {} is invalid {}",
11955 hdr_value, e))
11956 }
11957 }
11958}
11959
11960#[cfg(feature = "server")]
11961impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<FlexVolumeSource> {
11962 type Error = String;
11963
11964 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
11965 match hdr_value.to_str() {
11966 std::result::Result::Ok(value) => {
11967 match <FlexVolumeSource as std::str::FromStr>::from_str(value) {
11968 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
11969 std::result::Result::Err(err) => std::result::Result::Err(
11970 format!("Unable to convert header value '{}' into FlexVolumeSource - {}",
11971 value, err))
11972 }
11973 },
11974 std::result::Result::Err(e) => std::result::Result::Err(
11975 format!("Unable to convert header: {:?} to string: {}",
11976 hdr_value, e))
11977 }
11978 }
11979}
11980
11981
11982
11983
11984#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
11989#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
11990pub struct FlockerVolumeSource {
11991#[serde(rename = "datasetName")]
11993 #[serde(skip_serializing_if="Option::is_none")]
11994 pub dataset_name: Option<String>,
11995
11996#[serde(rename = "datasetUUID")]
11998 #[serde(skip_serializing_if="Option::is_none")]
11999 pub dataset_uuid: Option<String>,
12000
12001}
12002
12003
12004impl FlockerVolumeSource {
12005 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12006 pub fn new() -> FlockerVolumeSource {
12007 FlockerVolumeSource {
12008 dataset_name: None,
12009 dataset_uuid: None,
12010 }
12011 }
12012}
12013
12014impl std::string::ToString for FlockerVolumeSource {
12018 fn to_string(&self) -> String {
12019 let params: Vec<Option<String>> = vec![
12020
12021 self.dataset_name.as_ref().map(|dataset_name| {
12022 [
12023 "datasetName".to_string(),
12024 dataset_name.to_string(),
12025 ].join(",")
12026 }),
12027
12028
12029 self.dataset_uuid.as_ref().map(|dataset_uuid| {
12030 [
12031 "datasetUUID".to_string(),
12032 dataset_uuid.to_string(),
12033 ].join(",")
12034 }),
12035
12036 ];
12037
12038 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12039 }
12040}
12041
12042impl std::str::FromStr for FlockerVolumeSource {
12046 type Err = String;
12047
12048 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12049 #[derive(Default)]
12051 #[allow(dead_code)]
12052 struct IntermediateRep {
12053 pub dataset_name: Vec<String>,
12054 pub dataset_uuid: Vec<String>,
12055 }
12056
12057 let mut intermediate_rep = IntermediateRep::default();
12058
12059 let mut string_iter = s.split(',');
12061 let mut key_result = string_iter.next();
12062
12063 while key_result.is_some() {
12064 let val = match string_iter.next() {
12065 Some(x) => x,
12066 None => return std::result::Result::Err("Missing value while parsing FlockerVolumeSource".to_string())
12067 };
12068
12069 if let Some(key) = key_result {
12070 #[allow(clippy::match_single_binding)]
12071 match key {
12072 #[allow(clippy::redundant_clone)]
12073 "datasetName" => intermediate_rep.dataset_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12074 #[allow(clippy::redundant_clone)]
12075 "datasetUUID" => intermediate_rep.dataset_uuid.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12076 _ => return std::result::Result::Err("Unexpected key while parsing FlockerVolumeSource".to_string())
12077 }
12078 }
12079
12080 key_result = string_iter.next();
12082 }
12083
12084 std::result::Result::Ok(FlockerVolumeSource {
12086 dataset_name: intermediate_rep.dataset_name.into_iter().next(),
12087 dataset_uuid: intermediate_rep.dataset_uuid.into_iter().next(),
12088 })
12089 }
12090}
12091
12092#[cfg(feature = "server")]
12095impl std::convert::TryFrom<header::IntoHeaderValue<FlockerVolumeSource>> for HeaderValue {
12096 type Error = String;
12097
12098 fn try_from(hdr_value: header::IntoHeaderValue<FlockerVolumeSource>) -> std::result::Result<Self, Self::Error> {
12099 let hdr_value = hdr_value.to_string();
12100 match HeaderValue::from_str(&hdr_value) {
12101 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12102 std::result::Result::Err(e) => std::result::Result::Err(
12103 format!("Invalid header value for FlockerVolumeSource - value: {} is invalid {}",
12104 hdr_value, e))
12105 }
12106 }
12107}
12108
12109#[cfg(feature = "server")]
12110impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<FlockerVolumeSource> {
12111 type Error = String;
12112
12113 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12114 match hdr_value.to_str() {
12115 std::result::Result::Ok(value) => {
12116 match <FlockerVolumeSource as std::str::FromStr>::from_str(value) {
12117 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12118 std::result::Result::Err(err) => std::result::Result::Err(
12119 format!("Unable to convert header value '{}' into FlockerVolumeSource - {}",
12120 value, err))
12121 }
12122 },
12123 std::result::Result::Err(e) => std::result::Result::Err(
12124 format!("Unable to convert header: {:?} to string: {}",
12125 hdr_value, e))
12126 }
12127 }
12128}
12129
12130
12131
12132
12133
12134
12135
12136#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12137#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12138pub struct ForwardingConfig {
12139 #[serde(rename = "forwardingMode")]
12140 #[serde(skip_serializing_if="Option::is_none")]
12141 pub forwarding_mode: Option<String>,
12142
12143 #[serde(rename = "reverseForwardingMode")]
12144 #[serde(skip_serializing_if="Option::is_none")]
12145 pub reverse_forwarding_mode: Option<String>,
12146
12147 #[serde(rename = "socketForwardingMode")]
12148 #[serde(skip_serializing_if="Option::is_none")]
12149 pub socket_forwarding_mode: Option<String>,
12150
12151 #[serde(rename = "socketListenMode")]
12152 #[serde(skip_serializing_if="Option::is_none")]
12153 pub socket_listen_mode: Option<String>,
12154
12155 #[serde(rename = "x11ForwardingMode")]
12156 #[serde(skip_serializing_if="Option::is_none")]
12157 pub x11_forwarding_mode: Option<String>,
12158
12159}
12160
12161
12162impl ForwardingConfig {
12163 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12164 pub fn new() -> ForwardingConfig {
12165 ForwardingConfig {
12166 forwarding_mode: None,
12167 reverse_forwarding_mode: None,
12168 socket_forwarding_mode: None,
12169 socket_listen_mode: None,
12170 x11_forwarding_mode: None,
12171 }
12172 }
12173}
12174
12175impl std::string::ToString for ForwardingConfig {
12179 fn to_string(&self) -> String {
12180 let params: Vec<Option<String>> = vec![
12181
12182 self.forwarding_mode.as_ref().map(|forwarding_mode| {
12183 [
12184 "forwardingMode".to_string(),
12185 forwarding_mode.to_string(),
12186 ].join(",")
12187 }),
12188
12189
12190 self.reverse_forwarding_mode.as_ref().map(|reverse_forwarding_mode| {
12191 [
12192 "reverseForwardingMode".to_string(),
12193 reverse_forwarding_mode.to_string(),
12194 ].join(",")
12195 }),
12196
12197
12198 self.socket_forwarding_mode.as_ref().map(|socket_forwarding_mode| {
12199 [
12200 "socketForwardingMode".to_string(),
12201 socket_forwarding_mode.to_string(),
12202 ].join(",")
12203 }),
12204
12205
12206 self.socket_listen_mode.as_ref().map(|socket_listen_mode| {
12207 [
12208 "socketListenMode".to_string(),
12209 socket_listen_mode.to_string(),
12210 ].join(",")
12211 }),
12212
12213
12214 self.x11_forwarding_mode.as_ref().map(|x11_forwarding_mode| {
12215 [
12216 "x11ForwardingMode".to_string(),
12217 x11_forwarding_mode.to_string(),
12218 ].join(",")
12219 }),
12220
12221 ];
12222
12223 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12224 }
12225}
12226
12227impl std::str::FromStr for ForwardingConfig {
12231 type Err = String;
12232
12233 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12234 #[derive(Default)]
12236 #[allow(dead_code)]
12237 struct IntermediateRep {
12238 pub forwarding_mode: Vec<String>,
12239 pub reverse_forwarding_mode: Vec<String>,
12240 pub socket_forwarding_mode: Vec<String>,
12241 pub socket_listen_mode: Vec<String>,
12242 pub x11_forwarding_mode: Vec<String>,
12243 }
12244
12245 let mut intermediate_rep = IntermediateRep::default();
12246
12247 let mut string_iter = s.split(',');
12249 let mut key_result = string_iter.next();
12250
12251 while key_result.is_some() {
12252 let val = match string_iter.next() {
12253 Some(x) => x,
12254 None => return std::result::Result::Err("Missing value while parsing ForwardingConfig".to_string())
12255 };
12256
12257 if let Some(key) = key_result {
12258 #[allow(clippy::match_single_binding)]
12259 match key {
12260 #[allow(clippy::redundant_clone)]
12261 "forwardingMode" => intermediate_rep.forwarding_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12262 #[allow(clippy::redundant_clone)]
12263 "reverseForwardingMode" => intermediate_rep.reverse_forwarding_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12264 #[allow(clippy::redundant_clone)]
12265 "socketForwardingMode" => intermediate_rep.socket_forwarding_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12266 #[allow(clippy::redundant_clone)]
12267 "socketListenMode" => intermediate_rep.socket_listen_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12268 #[allow(clippy::redundant_clone)]
12269 "x11ForwardingMode" => intermediate_rep.x11_forwarding_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12270 _ => return std::result::Result::Err("Unexpected key while parsing ForwardingConfig".to_string())
12271 }
12272 }
12273
12274 key_result = string_iter.next();
12276 }
12277
12278 std::result::Result::Ok(ForwardingConfig {
12280 forwarding_mode: intermediate_rep.forwarding_mode.into_iter().next(),
12281 reverse_forwarding_mode: intermediate_rep.reverse_forwarding_mode.into_iter().next(),
12282 socket_forwarding_mode: intermediate_rep.socket_forwarding_mode.into_iter().next(),
12283 socket_listen_mode: intermediate_rep.socket_listen_mode.into_iter().next(),
12284 x11_forwarding_mode: intermediate_rep.x11_forwarding_mode.into_iter().next(),
12285 })
12286 }
12287}
12288
12289#[cfg(feature = "server")]
12292impl std::convert::TryFrom<header::IntoHeaderValue<ForwardingConfig>> for HeaderValue {
12293 type Error = String;
12294
12295 fn try_from(hdr_value: header::IntoHeaderValue<ForwardingConfig>) -> std::result::Result<Self, Self::Error> {
12296 let hdr_value = hdr_value.to_string();
12297 match HeaderValue::from_str(&hdr_value) {
12298 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12299 std::result::Result::Err(e) => std::result::Result::Err(
12300 format!("Invalid header value for ForwardingConfig - value: {} is invalid {}",
12301 hdr_value, e))
12302 }
12303 }
12304}
12305
12306#[cfg(feature = "server")]
12307impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ForwardingConfig> {
12308 type Error = String;
12309
12310 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12311 match hdr_value.to_str() {
12312 std::result::Result::Ok(value) => {
12313 match <ForwardingConfig as std::str::FromStr>::from_str(value) {
12314 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12315 std::result::Result::Err(err) => std::result::Result::Err(
12316 format!("Unable to convert header value '{}' into ForwardingConfig - {}",
12317 value, err))
12318 }
12319 },
12320 std::result::Result::Err(e) => std::result::Result::Err(
12321 format!("Unable to convert header: {:?} to string: {}",
12322 hdr_value, e))
12323 }
12324 }
12325}
12326
12327
12328
12329
12330#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12335#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12336pub struct GcePersistentDiskVolumeSource {
12337#[serde(rename = "fsType")]
12339 #[serde(skip_serializing_if="Option::is_none")]
12340 pub fs_type: Option<String>,
12341
12342#[serde(rename = "partition")]
12344 #[serde(skip_serializing_if="Option::is_none")]
12345 pub partition: Option<i32>,
12346
12347#[serde(rename = "pdName")]
12349 #[serde(skip_serializing_if="Option::is_none")]
12350 pub pd_name: Option<String>,
12351
12352#[serde(rename = "readOnly")]
12354 #[serde(skip_serializing_if="Option::is_none")]
12355 pub read_only: Option<bool>,
12356
12357}
12358
12359
12360impl GcePersistentDiskVolumeSource {
12361 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12362 pub fn new() -> GcePersistentDiskVolumeSource {
12363 GcePersistentDiskVolumeSource {
12364 fs_type: None,
12365 partition: None,
12366 pd_name: None,
12367 read_only: None,
12368 }
12369 }
12370}
12371
12372impl std::string::ToString for GcePersistentDiskVolumeSource {
12376 fn to_string(&self) -> String {
12377 let params: Vec<Option<String>> = vec![
12378
12379 self.fs_type.as_ref().map(|fs_type| {
12380 [
12381 "fsType".to_string(),
12382 fs_type.to_string(),
12383 ].join(",")
12384 }),
12385
12386
12387 self.partition.as_ref().map(|partition| {
12388 [
12389 "partition".to_string(),
12390 partition.to_string(),
12391 ].join(",")
12392 }),
12393
12394
12395 self.pd_name.as_ref().map(|pd_name| {
12396 [
12397 "pdName".to_string(),
12398 pd_name.to_string(),
12399 ].join(",")
12400 }),
12401
12402
12403 self.read_only.as_ref().map(|read_only| {
12404 [
12405 "readOnly".to_string(),
12406 read_only.to_string(),
12407 ].join(",")
12408 }),
12409
12410 ];
12411
12412 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12413 }
12414}
12415
12416impl std::str::FromStr for GcePersistentDiskVolumeSource {
12420 type Err = String;
12421
12422 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12423 #[derive(Default)]
12425 #[allow(dead_code)]
12426 struct IntermediateRep {
12427 pub fs_type: Vec<String>,
12428 pub partition: Vec<i32>,
12429 pub pd_name: Vec<String>,
12430 pub read_only: Vec<bool>,
12431 }
12432
12433 let mut intermediate_rep = IntermediateRep::default();
12434
12435 let mut string_iter = s.split(',');
12437 let mut key_result = string_iter.next();
12438
12439 while key_result.is_some() {
12440 let val = match string_iter.next() {
12441 Some(x) => x,
12442 None => return std::result::Result::Err("Missing value while parsing GcePersistentDiskVolumeSource".to_string())
12443 };
12444
12445 if let Some(key) = key_result {
12446 #[allow(clippy::match_single_binding)]
12447 match key {
12448 #[allow(clippy::redundant_clone)]
12449 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12450 #[allow(clippy::redundant_clone)]
12451 "partition" => intermediate_rep.partition.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12452 #[allow(clippy::redundant_clone)]
12453 "pdName" => intermediate_rep.pd_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12454 #[allow(clippy::redundant_clone)]
12455 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12456 _ => return std::result::Result::Err("Unexpected key while parsing GcePersistentDiskVolumeSource".to_string())
12457 }
12458 }
12459
12460 key_result = string_iter.next();
12462 }
12463
12464 std::result::Result::Ok(GcePersistentDiskVolumeSource {
12466 fs_type: intermediate_rep.fs_type.into_iter().next(),
12467 partition: intermediate_rep.partition.into_iter().next(),
12468 pd_name: intermediate_rep.pd_name.into_iter().next(),
12469 read_only: intermediate_rep.read_only.into_iter().next(),
12470 })
12471 }
12472}
12473
12474#[cfg(feature = "server")]
12477impl std::convert::TryFrom<header::IntoHeaderValue<GcePersistentDiskVolumeSource>> for HeaderValue {
12478 type Error = String;
12479
12480 fn try_from(hdr_value: header::IntoHeaderValue<GcePersistentDiskVolumeSource>) -> std::result::Result<Self, Self::Error> {
12481 let hdr_value = hdr_value.to_string();
12482 match HeaderValue::from_str(&hdr_value) {
12483 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12484 std::result::Result::Err(e) => std::result::Result::Err(
12485 format!("Invalid header value for GcePersistentDiskVolumeSource - value: {} is invalid {}",
12486 hdr_value, e))
12487 }
12488 }
12489}
12490
12491#[cfg(feature = "server")]
12492impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<GcePersistentDiskVolumeSource> {
12493 type Error = String;
12494
12495 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12496 match hdr_value.to_str() {
12497 std::result::Result::Ok(value) => {
12498 match <GcePersistentDiskVolumeSource as std::str::FromStr>::from_str(value) {
12499 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12500 std::result::Result::Err(err) => std::result::Result::Err(
12501 format!("Unable to convert header value '{}' into GcePersistentDiskVolumeSource - {}",
12502 value, err))
12503 }
12504 },
12505 std::result::Result::Err(e) => std::result::Result::Err(
12506 format!("Unable to convert header: {:?} to string: {}",
12507 hdr_value, e))
12508 }
12509 }
12510}
12511
12512
12513
12514
12515#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12520#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12521pub struct GitRepoVolumeSource {
12522#[serde(rename = "directory")]
12524 #[serde(skip_serializing_if="Option::is_none")]
12525 pub directory: Option<String>,
12526
12527#[serde(rename = "repository")]
12529 #[serde(skip_serializing_if="Option::is_none")]
12530 pub repository: Option<String>,
12531
12532#[serde(rename = "revision")]
12534 #[serde(skip_serializing_if="Option::is_none")]
12535 pub revision: Option<String>,
12536
12537}
12538
12539
12540impl GitRepoVolumeSource {
12541 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12542 pub fn new() -> GitRepoVolumeSource {
12543 GitRepoVolumeSource {
12544 directory: None,
12545 repository: None,
12546 revision: None,
12547 }
12548 }
12549}
12550
12551impl std::string::ToString for GitRepoVolumeSource {
12555 fn to_string(&self) -> String {
12556 let params: Vec<Option<String>> = vec![
12557
12558 self.directory.as_ref().map(|directory| {
12559 [
12560 "directory".to_string(),
12561 directory.to_string(),
12562 ].join(",")
12563 }),
12564
12565
12566 self.repository.as_ref().map(|repository| {
12567 [
12568 "repository".to_string(),
12569 repository.to_string(),
12570 ].join(",")
12571 }),
12572
12573
12574 self.revision.as_ref().map(|revision| {
12575 [
12576 "revision".to_string(),
12577 revision.to_string(),
12578 ].join(",")
12579 }),
12580
12581 ];
12582
12583 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12584 }
12585}
12586
12587impl std::str::FromStr for GitRepoVolumeSource {
12591 type Err = String;
12592
12593 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12594 #[derive(Default)]
12596 #[allow(dead_code)]
12597 struct IntermediateRep {
12598 pub directory: Vec<String>,
12599 pub repository: Vec<String>,
12600 pub revision: Vec<String>,
12601 }
12602
12603 let mut intermediate_rep = IntermediateRep::default();
12604
12605 let mut string_iter = s.split(',');
12607 let mut key_result = string_iter.next();
12608
12609 while key_result.is_some() {
12610 let val = match string_iter.next() {
12611 Some(x) => x,
12612 None => return std::result::Result::Err("Missing value while parsing GitRepoVolumeSource".to_string())
12613 };
12614
12615 if let Some(key) = key_result {
12616 #[allow(clippy::match_single_binding)]
12617 match key {
12618 #[allow(clippy::redundant_clone)]
12619 "directory" => intermediate_rep.directory.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12620 #[allow(clippy::redundant_clone)]
12621 "repository" => intermediate_rep.repository.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12622 #[allow(clippy::redundant_clone)]
12623 "revision" => intermediate_rep.revision.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12624 _ => return std::result::Result::Err("Unexpected key while parsing GitRepoVolumeSource".to_string())
12625 }
12626 }
12627
12628 key_result = string_iter.next();
12630 }
12631
12632 std::result::Result::Ok(GitRepoVolumeSource {
12634 directory: intermediate_rep.directory.into_iter().next(),
12635 repository: intermediate_rep.repository.into_iter().next(),
12636 revision: intermediate_rep.revision.into_iter().next(),
12637 })
12638 }
12639}
12640
12641#[cfg(feature = "server")]
12644impl std::convert::TryFrom<header::IntoHeaderValue<GitRepoVolumeSource>> for HeaderValue {
12645 type Error = String;
12646
12647 fn try_from(hdr_value: header::IntoHeaderValue<GitRepoVolumeSource>) -> std::result::Result<Self, Self::Error> {
12648 let hdr_value = hdr_value.to_string();
12649 match HeaderValue::from_str(&hdr_value) {
12650 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12651 std::result::Result::Err(e) => std::result::Result::Err(
12652 format!("Invalid header value for GitRepoVolumeSource - value: {} is invalid {}",
12653 hdr_value, e))
12654 }
12655 }
12656}
12657
12658#[cfg(feature = "server")]
12659impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<GitRepoVolumeSource> {
12660 type Error = String;
12661
12662 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12663 match hdr_value.to_str() {
12664 std::result::Result::Ok(value) => {
12665 match <GitRepoVolumeSource as std::str::FromStr>::from_str(value) {
12666 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12667 std::result::Result::Err(err) => std::result::Result::Err(
12668 format!("Unable to convert header value '{}' into GitRepoVolumeSource - {}",
12669 value, err))
12670 }
12671 },
12672 std::result::Result::Err(e) => std::result::Result::Err(
12673 format!("Unable to convert header: {:?} to string: {}",
12674 hdr_value, e))
12675 }
12676 }
12677}
12678
12679
12680
12681
12682#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12687#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12688pub struct GlusterfsVolumeSource {
12689#[serde(rename = "endpoints")]
12691 #[serde(skip_serializing_if="Option::is_none")]
12692 pub endpoints: Option<String>,
12693
12694#[serde(rename = "path")]
12696 #[serde(skip_serializing_if="Option::is_none")]
12697 pub path: Option<String>,
12698
12699#[serde(rename = "readOnly")]
12701 #[serde(skip_serializing_if="Option::is_none")]
12702 pub read_only: Option<bool>,
12703
12704}
12705
12706
12707impl GlusterfsVolumeSource {
12708 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12709 pub fn new() -> GlusterfsVolumeSource {
12710 GlusterfsVolumeSource {
12711 endpoints: None,
12712 path: None,
12713 read_only: None,
12714 }
12715 }
12716}
12717
12718impl std::string::ToString for GlusterfsVolumeSource {
12722 fn to_string(&self) -> String {
12723 let params: Vec<Option<String>> = vec![
12724
12725 self.endpoints.as_ref().map(|endpoints| {
12726 [
12727 "endpoints".to_string(),
12728 endpoints.to_string(),
12729 ].join(",")
12730 }),
12731
12732
12733 self.path.as_ref().map(|path| {
12734 [
12735 "path".to_string(),
12736 path.to_string(),
12737 ].join(",")
12738 }),
12739
12740
12741 self.read_only.as_ref().map(|read_only| {
12742 [
12743 "readOnly".to_string(),
12744 read_only.to_string(),
12745 ].join(",")
12746 }),
12747
12748 ];
12749
12750 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12751 }
12752}
12753
12754impl std::str::FromStr for GlusterfsVolumeSource {
12758 type Err = String;
12759
12760 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12761 #[derive(Default)]
12763 #[allow(dead_code)]
12764 struct IntermediateRep {
12765 pub endpoints: Vec<String>,
12766 pub path: Vec<String>,
12767 pub read_only: Vec<bool>,
12768 }
12769
12770 let mut intermediate_rep = IntermediateRep::default();
12771
12772 let mut string_iter = s.split(',');
12774 let mut key_result = string_iter.next();
12775
12776 while key_result.is_some() {
12777 let val = match string_iter.next() {
12778 Some(x) => x,
12779 None => return std::result::Result::Err("Missing value while parsing GlusterfsVolumeSource".to_string())
12780 };
12781
12782 if let Some(key) = key_result {
12783 #[allow(clippy::match_single_binding)]
12784 match key {
12785 #[allow(clippy::redundant_clone)]
12786 "endpoints" => intermediate_rep.endpoints.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12787 #[allow(clippy::redundant_clone)]
12788 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12789 #[allow(clippy::redundant_clone)]
12790 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12791 _ => return std::result::Result::Err("Unexpected key while parsing GlusterfsVolumeSource".to_string())
12792 }
12793 }
12794
12795 key_result = string_iter.next();
12797 }
12798
12799 std::result::Result::Ok(GlusterfsVolumeSource {
12801 endpoints: intermediate_rep.endpoints.into_iter().next(),
12802 path: intermediate_rep.path.into_iter().next(),
12803 read_only: intermediate_rep.read_only.into_iter().next(),
12804 })
12805 }
12806}
12807
12808#[cfg(feature = "server")]
12811impl std::convert::TryFrom<header::IntoHeaderValue<GlusterfsVolumeSource>> for HeaderValue {
12812 type Error = String;
12813
12814 fn try_from(hdr_value: header::IntoHeaderValue<GlusterfsVolumeSource>) -> std::result::Result<Self, Self::Error> {
12815 let hdr_value = hdr_value.to_string();
12816 match HeaderValue::from_str(&hdr_value) {
12817 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12818 std::result::Result::Err(e) => std::result::Result::Err(
12819 format!("Invalid header value for GlusterfsVolumeSource - value: {} is invalid {}",
12820 hdr_value, e))
12821 }
12822 }
12823}
12824
12825#[cfg(feature = "server")]
12826impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<GlusterfsVolumeSource> {
12827 type Error = String;
12828
12829 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12830 match hdr_value.to_str() {
12831 std::result::Result::Ok(value) => {
12832 match <GlusterfsVolumeSource as std::str::FromStr>::from_str(value) {
12833 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12834 std::result::Result::Err(err) => std::result::Result::Err(
12835 format!("Unable to convert header value '{}' into GlusterfsVolumeSource - {}",
12836 value, err))
12837 }
12838 },
12839 std::result::Result::Err(e) => std::result::Result::Err(
12840 format!("Unable to convert header: {:?} to string: {}",
12841 hdr_value, e))
12842 }
12843 }
12844}
12845
12846
12847
12848
12849
12850
12851
12852#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12853#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12854pub struct GraphDriverData {
12855#[serde(rename = "Data")]
12857 pub data: std::collections::HashMap<String, String>,
12858
12859#[serde(rename = "Name")]
12861 pub name: String,
12862
12863}
12864
12865
12866impl GraphDriverData {
12867 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
12868 pub fn new(data: std::collections::HashMap<String, String>, name: String, ) -> GraphDriverData {
12869 GraphDriverData {
12870 data,
12871 name,
12872 }
12873 }
12874}
12875
12876impl std::string::ToString for GraphDriverData {
12880 fn to_string(&self) -> String {
12881 let params: Vec<Option<String>> = vec![
12882 Some("Name".to_string()),
12886 Some(self.name.to_string()),
12887
12888 ];
12889
12890 params.into_iter().flatten().collect::<Vec<_>>().join(",")
12891 }
12892}
12893
12894impl std::str::FromStr for GraphDriverData {
12898 type Err = String;
12899
12900 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
12901 #[derive(Default)]
12903 #[allow(dead_code)]
12904 struct IntermediateRep {
12905 pub data: Vec<std::collections::HashMap<String, String>>,
12906 pub name: Vec<String>,
12907 }
12908
12909 let mut intermediate_rep = IntermediateRep::default();
12910
12911 let mut string_iter = s.split(',');
12913 let mut key_result = string_iter.next();
12914
12915 while key_result.is_some() {
12916 let val = match string_iter.next() {
12917 Some(x) => x,
12918 None => return std::result::Result::Err("Missing value while parsing GraphDriverData".to_string())
12919 };
12920
12921 if let Some(key) = key_result {
12922 #[allow(clippy::match_single_binding)]
12923 match key {
12924 "Data" => return std::result::Result::Err("Parsing a container in this style is not supported in GraphDriverData".to_string()),
12925 #[allow(clippy::redundant_clone)]
12926 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
12927 _ => return std::result::Result::Err("Unexpected key while parsing GraphDriverData".to_string())
12928 }
12929 }
12930
12931 key_result = string_iter.next();
12933 }
12934
12935 std::result::Result::Ok(GraphDriverData {
12937 data: intermediate_rep.data.into_iter().next().ok_or_else(|| "Data missing in GraphDriverData".to_string())?,
12938 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in GraphDriverData".to_string())?,
12939 })
12940 }
12941}
12942
12943#[cfg(feature = "server")]
12946impl std::convert::TryFrom<header::IntoHeaderValue<GraphDriverData>> for HeaderValue {
12947 type Error = String;
12948
12949 fn try_from(hdr_value: header::IntoHeaderValue<GraphDriverData>) -> std::result::Result<Self, Self::Error> {
12950 let hdr_value = hdr_value.to_string();
12951 match HeaderValue::from_str(&hdr_value) {
12952 std::result::Result::Ok(value) => std::result::Result::Ok(value),
12953 std::result::Result::Err(e) => std::result::Result::Err(
12954 format!("Invalid header value for GraphDriverData - value: {} is invalid {}",
12955 hdr_value, e))
12956 }
12957 }
12958}
12959
12960#[cfg(feature = "server")]
12961impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<GraphDriverData> {
12962 type Error = String;
12963
12964 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
12965 match hdr_value.to_str() {
12966 std::result::Result::Ok(value) => {
12967 match <GraphDriverData as std::str::FromStr>::from_str(value) {
12968 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
12969 std::result::Result::Err(err) => std::result::Result::Err(
12970 format!("Unable to convert header value '{}' into GraphDriverData - {}",
12971 value, err))
12972 }
12973 },
12974 std::result::Result::Err(e) => std::result::Result::Err(
12975 format!("Unable to convert header: {:?} to string: {}",
12976 hdr_value, e))
12977 }
12978 }
12979}
12980
12981
12982
12983
12984
12985
12986
12987#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
12988#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
12989pub struct GrpcAction {
12990#[serde(rename = "port")]
12992 #[serde(skip_serializing_if="Option::is_none")]
12993 pub port: Option<i32>,
12994
12995#[serde(rename = "service")]
12997 #[serde(skip_serializing_if="Option::is_none")]
12998 pub service: Option<String>,
12999
13000}
13001
13002
13003impl GrpcAction {
13004 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
13005 pub fn new() -> GrpcAction {
13006 GrpcAction {
13007 port: None,
13008 service: None,
13009 }
13010 }
13011}
13012
13013impl std::string::ToString for GrpcAction {
13017 fn to_string(&self) -> String {
13018 let params: Vec<Option<String>> = vec![
13019
13020 self.port.as_ref().map(|port| {
13021 [
13022 "port".to_string(),
13023 port.to_string(),
13024 ].join(",")
13025 }),
13026
13027
13028 self.service.as_ref().map(|service| {
13029 [
13030 "service".to_string(),
13031 service.to_string(),
13032 ].join(",")
13033 }),
13034
13035 ];
13036
13037 params.into_iter().flatten().collect::<Vec<_>>().join(",")
13038 }
13039}
13040
13041impl std::str::FromStr for GrpcAction {
13045 type Err = String;
13046
13047 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
13048 #[derive(Default)]
13050 #[allow(dead_code)]
13051 struct IntermediateRep {
13052 pub port: Vec<i32>,
13053 pub service: Vec<String>,
13054 }
13055
13056 let mut intermediate_rep = IntermediateRep::default();
13057
13058 let mut string_iter = s.split(',');
13060 let mut key_result = string_iter.next();
13061
13062 while key_result.is_some() {
13063 let val = match string_iter.next() {
13064 Some(x) => x,
13065 None => return std::result::Result::Err("Missing value while parsing GrpcAction".to_string())
13066 };
13067
13068 if let Some(key) = key_result {
13069 #[allow(clippy::match_single_binding)]
13070 match key {
13071 #[allow(clippy::redundant_clone)]
13072 "port" => intermediate_rep.port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13073 #[allow(clippy::redundant_clone)]
13074 "service" => intermediate_rep.service.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13075 _ => return std::result::Result::Err("Unexpected key while parsing GrpcAction".to_string())
13076 }
13077 }
13078
13079 key_result = string_iter.next();
13081 }
13082
13083 std::result::Result::Ok(GrpcAction {
13085 port: intermediate_rep.port.into_iter().next(),
13086 service: intermediate_rep.service.into_iter().next(),
13087 })
13088 }
13089}
13090
13091#[cfg(feature = "server")]
13094impl std::convert::TryFrom<header::IntoHeaderValue<GrpcAction>> for HeaderValue {
13095 type Error = String;
13096
13097 fn try_from(hdr_value: header::IntoHeaderValue<GrpcAction>) -> std::result::Result<Self, Self::Error> {
13098 let hdr_value = hdr_value.to_string();
13099 match HeaderValue::from_str(&hdr_value) {
13100 std::result::Result::Ok(value) => std::result::Result::Ok(value),
13101 std::result::Result::Err(e) => std::result::Result::Err(
13102 format!("Invalid header value for GrpcAction - value: {} is invalid {}",
13103 hdr_value, e))
13104 }
13105 }
13106}
13107
13108#[cfg(feature = "server")]
13109impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<GrpcAction> {
13110 type Error = String;
13111
13112 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
13113 match hdr_value.to_str() {
13114 std::result::Result::Ok(value) => {
13115 match <GrpcAction as std::str::FromStr>::from_str(value) {
13116 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
13117 std::result::Result::Err(err) => std::result::Result::Err(
13118 format!("Unable to convert header value '{}' into GrpcAction - {}",
13119 value, err))
13120 }
13121 },
13122 std::result::Result::Err(e) => std::result::Result::Err(
13123 format!("Unable to convert header: {:?} to string: {}",
13124 hdr_value, e))
13125 }
13126 }
13127}
13128
13129
13130
13131
13132
13133
13134
13135#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
13136#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
13137pub struct HealthConfig {
13138#[serde(rename = "Interval")]
13140 #[serde(skip_serializing_if="Option::is_none")]
13141 pub interval: Option<i64>,
13142
13143#[serde(rename = "Retries")]
13145 #[serde(skip_serializing_if="Option::is_none")]
13146 pub retries: Option<i64>,
13147
13148#[serde(rename = "StartPeriod")]
13150 #[serde(skip_serializing_if="Option::is_none")]
13151 pub start_period: Option<i64>,
13152
13153#[serde(rename = "Test")]
13155 #[serde(skip_serializing_if="Option::is_none")]
13156 pub test: Option<Vec<String>>,
13157
13158#[serde(rename = "Timeout")]
13160 #[serde(skip_serializing_if="Option::is_none")]
13161 pub timeout: Option<i64>,
13162
13163}
13164
13165
13166impl HealthConfig {
13167 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
13168 pub fn new() -> HealthConfig {
13169 HealthConfig {
13170 interval: None,
13171 retries: None,
13172 start_period: None,
13173 test: None,
13174 timeout: None,
13175 }
13176 }
13177}
13178
13179impl std::string::ToString for HealthConfig {
13183 fn to_string(&self) -> String {
13184 let params: Vec<Option<String>> = vec![
13185
13186 self.interval.as_ref().map(|interval| {
13187 [
13188 "Interval".to_string(),
13189 interval.to_string(),
13190 ].join(",")
13191 }),
13192
13193
13194 self.retries.as_ref().map(|retries| {
13195 [
13196 "Retries".to_string(),
13197 retries.to_string(),
13198 ].join(",")
13199 }),
13200
13201
13202 self.start_period.as_ref().map(|start_period| {
13203 [
13204 "StartPeriod".to_string(),
13205 start_period.to_string(),
13206 ].join(",")
13207 }),
13208
13209
13210 self.test.as_ref().map(|test| {
13211 [
13212 "Test".to_string(),
13213 test.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
13214 ].join(",")
13215 }),
13216
13217
13218 self.timeout.as_ref().map(|timeout| {
13219 [
13220 "Timeout".to_string(),
13221 timeout.to_string(),
13222 ].join(",")
13223 }),
13224
13225 ];
13226
13227 params.into_iter().flatten().collect::<Vec<_>>().join(",")
13228 }
13229}
13230
13231impl std::str::FromStr for HealthConfig {
13235 type Err = String;
13236
13237 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
13238 #[derive(Default)]
13240 #[allow(dead_code)]
13241 struct IntermediateRep {
13242 pub interval: Vec<i64>,
13243 pub retries: Vec<i64>,
13244 pub start_period: Vec<i64>,
13245 pub test: Vec<Vec<String>>,
13246 pub timeout: Vec<i64>,
13247 }
13248
13249 let mut intermediate_rep = IntermediateRep::default();
13250
13251 let mut string_iter = s.split(',');
13253 let mut key_result = string_iter.next();
13254
13255 while key_result.is_some() {
13256 let val = match string_iter.next() {
13257 Some(x) => x,
13258 None => return std::result::Result::Err("Missing value while parsing HealthConfig".to_string())
13259 };
13260
13261 if let Some(key) = key_result {
13262 #[allow(clippy::match_single_binding)]
13263 match key {
13264 #[allow(clippy::redundant_clone)]
13265 "Interval" => intermediate_rep.interval.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13266 #[allow(clippy::redundant_clone)]
13267 "Retries" => intermediate_rep.retries.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13268 #[allow(clippy::redundant_clone)]
13269 "StartPeriod" => intermediate_rep.start_period.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13270 "Test" => return std::result::Result::Err("Parsing a container in this style is not supported in HealthConfig".to_string()),
13271 #[allow(clippy::redundant_clone)]
13272 "Timeout" => intermediate_rep.timeout.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13273 _ => return std::result::Result::Err("Unexpected key while parsing HealthConfig".to_string())
13274 }
13275 }
13276
13277 key_result = string_iter.next();
13279 }
13280
13281 std::result::Result::Ok(HealthConfig {
13283 interval: intermediate_rep.interval.into_iter().next(),
13284 retries: intermediate_rep.retries.into_iter().next(),
13285 start_period: intermediate_rep.start_period.into_iter().next(),
13286 test: intermediate_rep.test.into_iter().next(),
13287 timeout: intermediate_rep.timeout.into_iter().next(),
13288 })
13289 }
13290}
13291
13292#[cfg(feature = "server")]
13295impl std::convert::TryFrom<header::IntoHeaderValue<HealthConfig>> for HeaderValue {
13296 type Error = String;
13297
13298 fn try_from(hdr_value: header::IntoHeaderValue<HealthConfig>) -> std::result::Result<Self, Self::Error> {
13299 let hdr_value = hdr_value.to_string();
13300 match HeaderValue::from_str(&hdr_value) {
13301 std::result::Result::Ok(value) => std::result::Result::Ok(value),
13302 std::result::Result::Err(e) => std::result::Result::Err(
13303 format!("Invalid header value for HealthConfig - value: {} is invalid {}",
13304 hdr_value, e))
13305 }
13306 }
13307}
13308
13309#[cfg(feature = "server")]
13310impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HealthConfig> {
13311 type Error = String;
13312
13313 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
13314 match hdr_value.to_str() {
13315 std::result::Result::Ok(value) => {
13316 match <HealthConfig as std::str::FromStr>::from_str(value) {
13317 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
13318 std::result::Result::Err(err) => std::result::Result::Err(
13319 format!("Unable to convert header value '{}' into HealthConfig - {}",
13320 value, err))
13321 }
13322 },
13323 std::result::Result::Err(e) => std::result::Result::Err(
13324 format!("Unable to convert header: {:?} to string: {}",
13325 hdr_value, e))
13326 }
13327 }
13328}
13329
13330
13331
13332
13333#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
13338#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
13339pub struct HistoryResponseItem {
13340#[serde(rename = "Comment")]
13342 pub comment: String,
13343
13344#[serde(rename = "Created")]
13346 pub created: i64,
13347
13348#[serde(rename = "CreatedBy")]
13350 pub created_by: String,
13351
13352#[serde(rename = "Id")]
13354 pub id: String,
13355
13356#[serde(rename = "Size")]
13358 pub size: i64,
13359
13360#[serde(rename = "Tags")]
13362 pub tags: Vec<String>,
13363
13364}
13365
13366
13367impl HistoryResponseItem {
13368 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
13369 pub fn new(comment: String, created: i64, created_by: String, id: String, size: i64, tags: Vec<String>, ) -> HistoryResponseItem {
13370 HistoryResponseItem {
13371 comment,
13372 created,
13373 created_by,
13374 id,
13375 size,
13376 tags,
13377 }
13378 }
13379}
13380
13381impl std::string::ToString for HistoryResponseItem {
13385 fn to_string(&self) -> String {
13386 let params: Vec<Option<String>> = vec![
13387
13388 Some("Comment".to_string()),
13389 Some(self.comment.to_string()),
13390
13391
13392 Some("Created".to_string()),
13393 Some(self.created.to_string()),
13394
13395
13396 Some("CreatedBy".to_string()),
13397 Some(self.created_by.to_string()),
13398
13399
13400 Some("Id".to_string()),
13401 Some(self.id.to_string()),
13402
13403
13404 Some("Size".to_string()),
13405 Some(self.size.to_string()),
13406
13407
13408 Some("Tags".to_string()),
13409 Some(self.tags.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
13410
13411 ];
13412
13413 params.into_iter().flatten().collect::<Vec<_>>().join(",")
13414 }
13415}
13416
13417impl std::str::FromStr for HistoryResponseItem {
13421 type Err = String;
13422
13423 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
13424 #[derive(Default)]
13426 #[allow(dead_code)]
13427 struct IntermediateRep {
13428 pub comment: Vec<String>,
13429 pub created: Vec<i64>,
13430 pub created_by: Vec<String>,
13431 pub id: Vec<String>,
13432 pub size: Vec<i64>,
13433 pub tags: Vec<Vec<String>>,
13434 }
13435
13436 let mut intermediate_rep = IntermediateRep::default();
13437
13438 let mut string_iter = s.split(',');
13440 let mut key_result = string_iter.next();
13441
13442 while key_result.is_some() {
13443 let val = match string_iter.next() {
13444 Some(x) => x,
13445 None => return std::result::Result::Err("Missing value while parsing HistoryResponseItem".to_string())
13446 };
13447
13448 if let Some(key) = key_result {
13449 #[allow(clippy::match_single_binding)]
13450 match key {
13451 #[allow(clippy::redundant_clone)]
13452 "Comment" => intermediate_rep.comment.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13453 #[allow(clippy::redundant_clone)]
13454 "Created" => intermediate_rep.created.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13455 #[allow(clippy::redundant_clone)]
13456 "CreatedBy" => intermediate_rep.created_by.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13457 #[allow(clippy::redundant_clone)]
13458 "Id" => intermediate_rep.id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13459 #[allow(clippy::redundant_clone)]
13460 "Size" => intermediate_rep.size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13461 "Tags" => return std::result::Result::Err("Parsing a container in this style is not supported in HistoryResponseItem".to_string()),
13462 _ => return std::result::Result::Err("Unexpected key while parsing HistoryResponseItem".to_string())
13463 }
13464 }
13465
13466 key_result = string_iter.next();
13468 }
13469
13470 std::result::Result::Ok(HistoryResponseItem {
13472 comment: intermediate_rep.comment.into_iter().next().ok_or_else(|| "Comment missing in HistoryResponseItem".to_string())?,
13473 created: intermediate_rep.created.into_iter().next().ok_or_else(|| "Created missing in HistoryResponseItem".to_string())?,
13474 created_by: intermediate_rep.created_by.into_iter().next().ok_or_else(|| "CreatedBy missing in HistoryResponseItem".to_string())?,
13475 id: intermediate_rep.id.into_iter().next().ok_or_else(|| "Id missing in HistoryResponseItem".to_string())?,
13476 size: intermediate_rep.size.into_iter().next().ok_or_else(|| "Size missing in HistoryResponseItem".to_string())?,
13477 tags: intermediate_rep.tags.into_iter().next().ok_or_else(|| "Tags missing in HistoryResponseItem".to_string())?,
13478 })
13479 }
13480}
13481
13482#[cfg(feature = "server")]
13485impl std::convert::TryFrom<header::IntoHeaderValue<HistoryResponseItem>> for HeaderValue {
13486 type Error = String;
13487
13488 fn try_from(hdr_value: header::IntoHeaderValue<HistoryResponseItem>) -> std::result::Result<Self, Self::Error> {
13489 let hdr_value = hdr_value.to_string();
13490 match HeaderValue::from_str(&hdr_value) {
13491 std::result::Result::Ok(value) => std::result::Result::Ok(value),
13492 std::result::Result::Err(e) => std::result::Result::Err(
13493 format!("Invalid header value for HistoryResponseItem - value: {} is invalid {}",
13494 hdr_value, e))
13495 }
13496 }
13497}
13498
13499#[cfg(feature = "server")]
13500impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HistoryResponseItem> {
13501 type Error = String;
13502
13503 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
13504 match hdr_value.to_str() {
13505 std::result::Result::Ok(value) => {
13506 match <HistoryResponseItem as std::str::FromStr>::from_str(value) {
13507 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
13508 std::result::Result::Err(err) => std::result::Result::Err(
13509 format!("Unable to convert header value '{}' into HistoryResponseItem - {}",
13510 value, err))
13511 }
13512 },
13513 std::result::Result::Err(e) => std::result::Result::Err(
13514 format!("Unable to convert header: {:?} to string: {}",
13515 hdr_value, e))
13516 }
13517 }
13518}
13519
13520
13521
13522
13523#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
13528#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
13529pub struct HostAlias {
13530#[serde(rename = "hostnames")]
13532 #[serde(skip_serializing_if="Option::is_none")]
13533 pub hostnames: Option<Vec<String>>,
13534
13535#[serde(rename = "ip")]
13537 #[serde(skip_serializing_if="Option::is_none")]
13538 pub ip: Option<String>,
13539
13540}
13541
13542
13543impl HostAlias {
13544 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
13545 pub fn new() -> HostAlias {
13546 HostAlias {
13547 hostnames: None,
13548 ip: None,
13549 }
13550 }
13551}
13552
13553impl std::string::ToString for HostAlias {
13557 fn to_string(&self) -> String {
13558 let params: Vec<Option<String>> = vec![
13559
13560 self.hostnames.as_ref().map(|hostnames| {
13561 [
13562 "hostnames".to_string(),
13563 hostnames.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
13564 ].join(",")
13565 }),
13566
13567
13568 self.ip.as_ref().map(|ip| {
13569 [
13570 "ip".to_string(),
13571 ip.to_string(),
13572 ].join(",")
13573 }),
13574
13575 ];
13576
13577 params.into_iter().flatten().collect::<Vec<_>>().join(",")
13578 }
13579}
13580
13581impl std::str::FromStr for HostAlias {
13585 type Err = String;
13586
13587 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
13588 #[derive(Default)]
13590 #[allow(dead_code)]
13591 struct IntermediateRep {
13592 pub hostnames: Vec<Vec<String>>,
13593 pub ip: Vec<String>,
13594 }
13595
13596 let mut intermediate_rep = IntermediateRep::default();
13597
13598 let mut string_iter = s.split(',');
13600 let mut key_result = string_iter.next();
13601
13602 while key_result.is_some() {
13603 let val = match string_iter.next() {
13604 Some(x) => x,
13605 None => return std::result::Result::Err("Missing value while parsing HostAlias".to_string())
13606 };
13607
13608 if let Some(key) = key_result {
13609 #[allow(clippy::match_single_binding)]
13610 match key {
13611 "hostnames" => return std::result::Result::Err("Parsing a container in this style is not supported in HostAlias".to_string()),
13612 #[allow(clippy::redundant_clone)]
13613 "ip" => intermediate_rep.ip.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
13614 _ => return std::result::Result::Err("Unexpected key while parsing HostAlias".to_string())
13615 }
13616 }
13617
13618 key_result = string_iter.next();
13620 }
13621
13622 std::result::Result::Ok(HostAlias {
13624 hostnames: intermediate_rep.hostnames.into_iter().next(),
13625 ip: intermediate_rep.ip.into_iter().next(),
13626 })
13627 }
13628}
13629
13630#[cfg(feature = "server")]
13633impl std::convert::TryFrom<header::IntoHeaderValue<HostAlias>> for HeaderValue {
13634 type Error = String;
13635
13636 fn try_from(hdr_value: header::IntoHeaderValue<HostAlias>) -> std::result::Result<Self, Self::Error> {
13637 let hdr_value = hdr_value.to_string();
13638 match HeaderValue::from_str(&hdr_value) {
13639 std::result::Result::Ok(value) => std::result::Result::Ok(value),
13640 std::result::Result::Err(e) => std::result::Result::Err(
13641 format!("Invalid header value for HostAlias - value: {} is invalid {}",
13642 hdr_value, e))
13643 }
13644 }
13645}
13646
13647#[cfg(feature = "server")]
13648impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HostAlias> {
13649 type Error = String;
13650
13651 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
13652 match hdr_value.to_str() {
13653 std::result::Result::Ok(value) => {
13654 match <HostAlias as std::str::FromStr>::from_str(value) {
13655 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
13656 std::result::Result::Err(err) => std::result::Result::Err(
13657 format!("Unable to convert header value '{}' into HostAlias - {}",
13658 value, err))
13659 }
13660 },
13661 std::result::Result::Err(e) => std::result::Result::Err(
13662 format!("Unable to convert header: {:?} to string: {}",
13663 hdr_value, e))
13664 }
13665 }
13666}
13667
13668
13669
13670
13671#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
13676#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
13677pub struct HostConfig {
13678 #[serde(rename = "AutoRemove")]
13679 #[serde(skip_serializing_if="Option::is_none")]
13680 pub auto_remove: Option<bool>,
13681
13682#[serde(rename = "Binds")]
13684 #[serde(skip_serializing_if="Option::is_none")]
13685 pub binds: Option<Vec<String>>,
13686
13687 #[serde(rename = "BlkioDeviceReadBps")]
13688 #[serde(skip_serializing_if="Option::is_none")]
13689 pub blkio_device_read_bps: Option<Vec<models::ThrottleDevice>>,
13690
13691 #[serde(rename = "BlkioDeviceReadIOps")]
13692 #[serde(skip_serializing_if="Option::is_none")]
13693 pub blkio_device_read_i_ops: Option<Vec<models::ThrottleDevice>>,
13694
13695 #[serde(rename = "BlkioDeviceWriteBps")]
13696 #[serde(skip_serializing_if="Option::is_none")]
13697 pub blkio_device_write_bps: Option<Vec<models::ThrottleDevice>>,
13698
13699 #[serde(rename = "BlkioDeviceWriteIOps")]
13700 #[serde(skip_serializing_if="Option::is_none")]
13701 pub blkio_device_write_i_ops: Option<Vec<models::ThrottleDevice>>,
13702
13703 #[serde(rename = "BlkioWeight")]
13704 #[serde(skip_serializing_if="Option::is_none")]
13705 pub blkio_weight: Option<i32>,
13706
13707 #[serde(rename = "BlkioWeightDevice")]
13708 #[serde(skip_serializing_if="Option::is_none")]
13709 pub blkio_weight_device: Option<Vec<models::WeightDevice>>,
13710
13711#[serde(rename = "CapAdd")]
13713 #[serde(skip_serializing_if="Option::is_none")]
13714 pub cap_add: Option<Vec<String>>,
13715
13716#[serde(rename = "CapDrop")]
13718 #[serde(skip_serializing_if="Option::is_none")]
13719 pub cap_drop: Option<Vec<String>>,
13720
13721 #[serde(rename = "Cgroup")]
13722 #[serde(skip_serializing_if="Option::is_none")]
13723 pub cgroup: Option<String>,
13724
13725#[serde(rename = "CgroupParent")]
13727 #[serde(skip_serializing_if="Option::is_none")]
13728 pub cgroup_parent: Option<String>,
13729
13730#[serde(rename = "CgroupnsMode")]
13732 #[serde(skip_serializing_if="Option::is_none")]
13733 pub cgroupns_mode: Option<String>,
13734
13735#[serde(rename = "ConsoleSize")]
13737 #[serde(skip_serializing_if="Option::is_none")]
13738 pub console_size: Option<Vec<i32>>,
13739
13740 #[serde(rename = "ContainerIDFile")]
13741 #[serde(skip_serializing_if="Option::is_none")]
13742 pub container_id_file: Option<String>,
13743
13744#[serde(rename = "CpuCount")]
13746 #[serde(skip_serializing_if="Option::is_none")]
13747 pub cpu_count: Option<i64>,
13748
13749 #[serde(rename = "CpuPercent")]
13750 #[serde(skip_serializing_if="Option::is_none")]
13751 pub cpu_percent: Option<i64>,
13752
13753 #[serde(rename = "CpuPeriod")]
13754 #[serde(skip_serializing_if="Option::is_none")]
13755 pub cpu_period: Option<i64>,
13756
13757 #[serde(rename = "CpuQuota")]
13758 #[serde(skip_serializing_if="Option::is_none")]
13759 pub cpu_quota: Option<i64>,
13760
13761 #[serde(rename = "CpuRealtimePeriod")]
13762 #[serde(skip_serializing_if="Option::is_none")]
13763 pub cpu_realtime_period: Option<i64>,
13764
13765 #[serde(rename = "CpuRealtimeRuntime")]
13766 #[serde(skip_serializing_if="Option::is_none")]
13767 pub cpu_realtime_runtime: Option<i64>,
13768
13769#[serde(rename = "CpuShares")]
13771 #[serde(skip_serializing_if="Option::is_none")]
13772 pub cpu_shares: Option<i64>,
13773
13774 #[serde(rename = "CpusetCpus")]
13775 #[serde(skip_serializing_if="Option::is_none")]
13776 pub cpuset_cpus: Option<String>,
13777
13778 #[serde(rename = "CpusetMems")]
13779 #[serde(skip_serializing_if="Option::is_none")]
13780 pub cpuset_mems: Option<String>,
13781
13782 #[serde(rename = "DeviceCgroupRules")]
13783 #[serde(skip_serializing_if="Option::is_none")]
13784 pub device_cgroup_rules: Option<Vec<String>>,
13785
13786 #[serde(rename = "DeviceRequests")]
13787 #[serde(skip_serializing_if="Option::is_none")]
13788 pub device_requests: Option<Vec<models::DeviceRequest>>,
13789
13790 #[serde(rename = "Devices")]
13791 #[serde(skip_serializing_if="Option::is_none")]
13792 pub devices: Option<Vec<models::DeviceMapping>>,
13793
13794 #[serde(rename = "Dns")]
13795 #[serde(skip_serializing_if="Option::is_none")]
13796 pub dns: Option<Vec<String>>,
13797
13798 #[serde(rename = "DnsOptions")]
13799 #[serde(skip_serializing_if="Option::is_none")]
13800 pub dns_options: Option<Vec<String>>,
13801
13802 #[serde(rename = "DnsSearch")]
13803 #[serde(skip_serializing_if="Option::is_none")]
13804 pub dns_search: Option<Vec<String>>,
13805
13806 #[serde(rename = "ExtraHosts")]
13807 #[serde(skip_serializing_if="Option::is_none")]
13808 pub extra_hosts: Option<Vec<String>>,
13809
13810 #[serde(rename = "GroupAdd")]
13811 #[serde(skip_serializing_if="Option::is_none")]
13812 pub group_add: Option<Vec<String>>,
13813
13814 #[serde(rename = "IOMaximumBandwidth")]
13815 #[serde(skip_serializing_if="Option::is_none")]
13816 pub io_maximum_bandwidth: Option<i32>,
13817
13818 #[serde(rename = "IOMaximumIOps")]
13819 #[serde(skip_serializing_if="Option::is_none")]
13820 pub io_maximum_i_ops: Option<i32>,
13821
13822#[serde(rename = "Init")]
13824 #[serde(skip_serializing_if="Option::is_none")]
13825 pub init: Option<bool>,
13826
13827 #[serde(rename = "IpcMode")]
13828 #[serde(skip_serializing_if="Option::is_none")]
13829 pub ipc_mode: Option<String>,
13830
13831#[serde(rename = "Isolation")]
13833 #[serde(skip_serializing_if="Option::is_none")]
13834 pub isolation: Option<String>,
13835
13836 #[serde(rename = "KernelMemory")]
13837 #[serde(skip_serializing_if="Option::is_none")]
13838 pub kernel_memory: Option<i64>,
13839
13840 #[serde(rename = "KernelMemoryTCP")]
13841 #[serde(skip_serializing_if="Option::is_none")]
13842 pub kernel_memory_tcp: Option<i64>,
13843
13844 #[serde(rename = "Links")]
13845 #[serde(skip_serializing_if="Option::is_none")]
13846 pub links: Option<Vec<String>>,
13847
13848 #[serde(rename = "LogConfig")]
13849 #[serde(skip_serializing_if="Option::is_none")]
13850 pub log_config: Option<models::LogConfig>,
13851
13852#[serde(rename = "MaskedPaths")]
13854 #[serde(skip_serializing_if="Option::is_none")]
13855 pub masked_paths: Option<Vec<String>>,
13856
13857 #[serde(rename = "Memory")]
13858 #[serde(skip_serializing_if="Option::is_none")]
13859 pub memory: Option<i64>,
13860
13861 #[serde(rename = "MemoryReservation")]
13862 #[serde(skip_serializing_if="Option::is_none")]
13863 pub memory_reservation: Option<i64>,
13864
13865 #[serde(rename = "MemorySwap")]
13866 #[serde(skip_serializing_if="Option::is_none")]
13867 pub memory_swap: Option<i64>,
13868
13869 #[serde(rename = "MemorySwappiness")]
13870 #[serde(skip_serializing_if="Option::is_none")]
13871 pub memory_swappiness: Option<i64>,
13872
13873#[serde(rename = "Mounts")]
13875 #[serde(skip_serializing_if="Option::is_none")]
13876 pub mounts: Option<Vec<models::Mount>>,
13877
13878 #[serde(rename = "NanoCpus")]
13879 #[serde(skip_serializing_if="Option::is_none")]
13880 pub nano_cpus: Option<i64>,
13881
13882 #[serde(rename = "NetworkMode")]
13883 #[serde(skip_serializing_if="Option::is_none")]
13884 pub network_mode: Option<String>,
13885
13886 #[serde(rename = "OomKillDisable")]
13887 #[serde(skip_serializing_if="Option::is_none")]
13888 pub oom_kill_disable: Option<bool>,
13889
13890 #[serde(rename = "OomScoreAdj")]
13891 #[serde(skip_serializing_if="Option::is_none")]
13892 pub oom_score_adj: Option<i64>,
13893
13894 #[serde(rename = "PidMode")]
13895 #[serde(skip_serializing_if="Option::is_none")]
13896 pub pid_mode: Option<String>,
13897
13898 #[serde(rename = "PidsLimit")]
13899 #[serde(skip_serializing_if="Option::is_none")]
13900 pub pids_limit: Option<i64>,
13901
13902#[serde(rename = "PortBindings")]
13904 #[serde(skip_serializing_if="Option::is_none")]
13905 pub port_bindings: Option<std::collections::HashMap<String, Vec<models::PortBinding>>>,
13906
13907 #[serde(rename = "Privileged")]
13908 #[serde(skip_serializing_if="Option::is_none")]
13909 pub privileged: Option<bool>,
13910
13911 #[serde(rename = "PublishAllPorts")]
13912 #[serde(skip_serializing_if="Option::is_none")]
13913 pub publish_all_ports: Option<bool>,
13914
13915#[serde(rename = "ReadonlyPaths")]
13917 #[serde(skip_serializing_if="Option::is_none")]
13918 pub readonly_paths: Option<Vec<String>>,
13919
13920 #[serde(rename = "ReadonlyRootfs")]
13921 #[serde(skip_serializing_if="Option::is_none")]
13922 pub readonly_rootfs: Option<bool>,
13923
13924#[serde(rename = "RestartPolicy")]
13926 #[serde(skip_serializing_if="Option::is_none")]
13927 pub restart_policy: Option<String>,
13928
13929 #[serde(rename = "Runtime")]
13930 #[serde(skip_serializing_if="Option::is_none")]
13931 pub runtime: Option<String>,
13932
13933 #[serde(rename = "SecurityOpt")]
13934 #[serde(skip_serializing_if="Option::is_none")]
13935 pub security_opt: Option<Vec<String>>,
13936
13937 #[serde(rename = "ShmSize")]
13938 #[serde(skip_serializing_if="Option::is_none")]
13939 pub shm_size: Option<i64>,
13940
13941 #[serde(rename = "StorageOpt")]
13942 #[serde(skip_serializing_if="Option::is_none")]
13943 pub storage_opt: Option<std::collections::HashMap<String, String>>,
13944
13945 #[serde(rename = "Sysctls")]
13946 #[serde(skip_serializing_if="Option::is_none")]
13947 pub sysctls: Option<std::collections::HashMap<String, String>>,
13948
13949 #[serde(rename = "Tmpfs")]
13950 #[serde(skip_serializing_if="Option::is_none")]
13951 pub tmpfs: Option<std::collections::HashMap<String, String>>,
13952
13953 #[serde(rename = "UTSMode")]
13954 #[serde(skip_serializing_if="Option::is_none")]
13955 pub uts_mode: Option<String>,
13956
13957 #[serde(rename = "Ulimits")]
13958 #[serde(skip_serializing_if="Option::is_none")]
13959 pub ulimits: Option<Vec<models::Ulimit>>,
13960
13961 #[serde(rename = "UsernsMode")]
13962 #[serde(skip_serializing_if="Option::is_none")]
13963 pub userns_mode: Option<String>,
13964
13965 #[serde(rename = "VolumeDriver")]
13966 #[serde(skip_serializing_if="Option::is_none")]
13967 pub volume_driver: Option<String>,
13968
13969 #[serde(rename = "VolumesFrom")]
13970 #[serde(skip_serializing_if="Option::is_none")]
13971 pub volumes_from: Option<Vec<String>>,
13972
13973}
13974
13975
13976impl HostConfig {
13977 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
13978 pub fn new() -> HostConfig {
13979 HostConfig {
13980 auto_remove: None,
13981 binds: None,
13982 blkio_device_read_bps: None,
13983 blkio_device_read_i_ops: None,
13984 blkio_device_write_bps: None,
13985 blkio_device_write_i_ops: None,
13986 blkio_weight: None,
13987 blkio_weight_device: None,
13988 cap_add: None,
13989 cap_drop: None,
13990 cgroup: None,
13991 cgroup_parent: None,
13992 cgroupns_mode: None,
13993 console_size: None,
13994 container_id_file: None,
13995 cpu_count: None,
13996 cpu_percent: None,
13997 cpu_period: None,
13998 cpu_quota: None,
13999 cpu_realtime_period: None,
14000 cpu_realtime_runtime: None,
14001 cpu_shares: None,
14002 cpuset_cpus: None,
14003 cpuset_mems: None,
14004 device_cgroup_rules: None,
14005 device_requests: None,
14006 devices: None,
14007 dns: None,
14008 dns_options: None,
14009 dns_search: None,
14010 extra_hosts: None,
14011 group_add: None,
14012 io_maximum_bandwidth: None,
14013 io_maximum_i_ops: None,
14014 init: None,
14015 ipc_mode: None,
14016 isolation: None,
14017 kernel_memory: None,
14018 kernel_memory_tcp: None,
14019 links: None,
14020 log_config: None,
14021 masked_paths: None,
14022 memory: None,
14023 memory_reservation: None,
14024 memory_swap: None,
14025 memory_swappiness: None,
14026 mounts: None,
14027 nano_cpus: None,
14028 network_mode: None,
14029 oom_kill_disable: None,
14030 oom_score_adj: None,
14031 pid_mode: None,
14032 pids_limit: None,
14033 port_bindings: None,
14034 privileged: None,
14035 publish_all_ports: None,
14036 readonly_paths: None,
14037 readonly_rootfs: None,
14038 restart_policy: None,
14039 runtime: None,
14040 security_opt: None,
14041 shm_size: None,
14042 storage_opt: None,
14043 sysctls: None,
14044 tmpfs: None,
14045 uts_mode: None,
14046 ulimits: None,
14047 userns_mode: None,
14048 volume_driver: None,
14049 volumes_from: None,
14050 }
14051 }
14052}
14053
14054impl std::string::ToString for HostConfig {
14058 fn to_string(&self) -> String {
14059 let params: Vec<Option<String>> = vec![
14060
14061 self.auto_remove.as_ref().map(|auto_remove| {
14062 [
14063 "AutoRemove".to_string(),
14064 auto_remove.to_string(),
14065 ].join(",")
14066 }),
14067
14068
14069 self.binds.as_ref().map(|binds| {
14070 [
14071 "Binds".to_string(),
14072 binds.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14073 ].join(",")
14074 }),
14075
14076 self.blkio_weight.as_ref().map(|blkio_weight| {
14086 [
14087 "BlkioWeight".to_string(),
14088 blkio_weight.to_string(),
14089 ].join(",")
14090 }),
14091
14092 self.cap_add.as_ref().map(|cap_add| {
14096 [
14097 "CapAdd".to_string(),
14098 cap_add.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14099 ].join(",")
14100 }),
14101
14102
14103 self.cap_drop.as_ref().map(|cap_drop| {
14104 [
14105 "CapDrop".to_string(),
14106 cap_drop.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14107 ].join(",")
14108 }),
14109
14110
14111 self.cgroup.as_ref().map(|cgroup| {
14112 [
14113 "Cgroup".to_string(),
14114 cgroup.to_string(),
14115 ].join(",")
14116 }),
14117
14118
14119 self.cgroup_parent.as_ref().map(|cgroup_parent| {
14120 [
14121 "CgroupParent".to_string(),
14122 cgroup_parent.to_string(),
14123 ].join(",")
14124 }),
14125
14126
14127 self.cgroupns_mode.as_ref().map(|cgroupns_mode| {
14128 [
14129 "CgroupnsMode".to_string(),
14130 cgroupns_mode.to_string(),
14131 ].join(",")
14132 }),
14133
14134
14135 self.console_size.as_ref().map(|console_size| {
14136 [
14137 "ConsoleSize".to_string(),
14138 console_size.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14139 ].join(",")
14140 }),
14141
14142
14143 self.container_id_file.as_ref().map(|container_id_file| {
14144 [
14145 "ContainerIDFile".to_string(),
14146 container_id_file.to_string(),
14147 ].join(",")
14148 }),
14149
14150
14151 self.cpu_count.as_ref().map(|cpu_count| {
14152 [
14153 "CpuCount".to_string(),
14154 cpu_count.to_string(),
14155 ].join(",")
14156 }),
14157
14158
14159 self.cpu_percent.as_ref().map(|cpu_percent| {
14160 [
14161 "CpuPercent".to_string(),
14162 cpu_percent.to_string(),
14163 ].join(",")
14164 }),
14165
14166
14167 self.cpu_period.as_ref().map(|cpu_period| {
14168 [
14169 "CpuPeriod".to_string(),
14170 cpu_period.to_string(),
14171 ].join(",")
14172 }),
14173
14174
14175 self.cpu_quota.as_ref().map(|cpu_quota| {
14176 [
14177 "CpuQuota".to_string(),
14178 cpu_quota.to_string(),
14179 ].join(",")
14180 }),
14181
14182
14183 self.cpu_realtime_period.as_ref().map(|cpu_realtime_period| {
14184 [
14185 "CpuRealtimePeriod".to_string(),
14186 cpu_realtime_period.to_string(),
14187 ].join(",")
14188 }),
14189
14190
14191 self.cpu_realtime_runtime.as_ref().map(|cpu_realtime_runtime| {
14192 [
14193 "CpuRealtimeRuntime".to_string(),
14194 cpu_realtime_runtime.to_string(),
14195 ].join(",")
14196 }),
14197
14198
14199 self.cpu_shares.as_ref().map(|cpu_shares| {
14200 [
14201 "CpuShares".to_string(),
14202 cpu_shares.to_string(),
14203 ].join(",")
14204 }),
14205
14206
14207 self.cpuset_cpus.as_ref().map(|cpuset_cpus| {
14208 [
14209 "CpusetCpus".to_string(),
14210 cpuset_cpus.to_string(),
14211 ].join(",")
14212 }),
14213
14214
14215 self.cpuset_mems.as_ref().map(|cpuset_mems| {
14216 [
14217 "CpusetMems".to_string(),
14218 cpuset_mems.to_string(),
14219 ].join(",")
14220 }),
14221
14222
14223 self.device_cgroup_rules.as_ref().map(|device_cgroup_rules| {
14224 [
14225 "DeviceCgroupRules".to_string(),
14226 device_cgroup_rules.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14227 ].join(",")
14228 }),
14229
14230 self.dns.as_ref().map(|dns| {
14236 [
14237 "Dns".to_string(),
14238 dns.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14239 ].join(",")
14240 }),
14241
14242
14243 self.dns_options.as_ref().map(|dns_options| {
14244 [
14245 "DnsOptions".to_string(),
14246 dns_options.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14247 ].join(",")
14248 }),
14249
14250
14251 self.dns_search.as_ref().map(|dns_search| {
14252 [
14253 "DnsSearch".to_string(),
14254 dns_search.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14255 ].join(",")
14256 }),
14257
14258
14259 self.extra_hosts.as_ref().map(|extra_hosts| {
14260 [
14261 "ExtraHosts".to_string(),
14262 extra_hosts.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14263 ].join(",")
14264 }),
14265
14266
14267 self.group_add.as_ref().map(|group_add| {
14268 [
14269 "GroupAdd".to_string(),
14270 group_add.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14271 ].join(",")
14272 }),
14273
14274
14275 self.io_maximum_bandwidth.as_ref().map(|io_maximum_bandwidth| {
14276 [
14277 "IOMaximumBandwidth".to_string(),
14278 io_maximum_bandwidth.to_string(),
14279 ].join(",")
14280 }),
14281
14282
14283 self.io_maximum_i_ops.as_ref().map(|io_maximum_i_ops| {
14284 [
14285 "IOMaximumIOps".to_string(),
14286 io_maximum_i_ops.to_string(),
14287 ].join(",")
14288 }),
14289
14290
14291 self.init.as_ref().map(|init| {
14292 [
14293 "Init".to_string(),
14294 init.to_string(),
14295 ].join(",")
14296 }),
14297
14298
14299 self.ipc_mode.as_ref().map(|ipc_mode| {
14300 [
14301 "IpcMode".to_string(),
14302 ipc_mode.to_string(),
14303 ].join(",")
14304 }),
14305
14306
14307 self.isolation.as_ref().map(|isolation| {
14308 [
14309 "Isolation".to_string(),
14310 isolation.to_string(),
14311 ].join(",")
14312 }),
14313
14314
14315 self.kernel_memory.as_ref().map(|kernel_memory| {
14316 [
14317 "KernelMemory".to_string(),
14318 kernel_memory.to_string(),
14319 ].join(",")
14320 }),
14321
14322
14323 self.kernel_memory_tcp.as_ref().map(|kernel_memory_tcp| {
14324 [
14325 "KernelMemoryTCP".to_string(),
14326 kernel_memory_tcp.to_string(),
14327 ].join(",")
14328 }),
14329
14330
14331 self.links.as_ref().map(|links| {
14332 [
14333 "Links".to_string(),
14334 links.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14335 ].join(",")
14336 }),
14337
14338 self.masked_paths.as_ref().map(|masked_paths| {
14342 [
14343 "MaskedPaths".to_string(),
14344 masked_paths.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14345 ].join(",")
14346 }),
14347
14348
14349 self.memory.as_ref().map(|memory| {
14350 [
14351 "Memory".to_string(),
14352 memory.to_string(),
14353 ].join(",")
14354 }),
14355
14356
14357 self.memory_reservation.as_ref().map(|memory_reservation| {
14358 [
14359 "MemoryReservation".to_string(),
14360 memory_reservation.to_string(),
14361 ].join(",")
14362 }),
14363
14364
14365 self.memory_swap.as_ref().map(|memory_swap| {
14366 [
14367 "MemorySwap".to_string(),
14368 memory_swap.to_string(),
14369 ].join(",")
14370 }),
14371
14372
14373 self.memory_swappiness.as_ref().map(|memory_swappiness| {
14374 [
14375 "MemorySwappiness".to_string(),
14376 memory_swappiness.to_string(),
14377 ].join(",")
14378 }),
14379
14380 self.nano_cpus.as_ref().map(|nano_cpus| {
14384 [
14385 "NanoCpus".to_string(),
14386 nano_cpus.to_string(),
14387 ].join(",")
14388 }),
14389
14390
14391 self.network_mode.as_ref().map(|network_mode| {
14392 [
14393 "NetworkMode".to_string(),
14394 network_mode.to_string(),
14395 ].join(",")
14396 }),
14397
14398
14399 self.oom_kill_disable.as_ref().map(|oom_kill_disable| {
14400 [
14401 "OomKillDisable".to_string(),
14402 oom_kill_disable.to_string(),
14403 ].join(",")
14404 }),
14405
14406
14407 self.oom_score_adj.as_ref().map(|oom_score_adj| {
14408 [
14409 "OomScoreAdj".to_string(),
14410 oom_score_adj.to_string(),
14411 ].join(",")
14412 }),
14413
14414
14415 self.pid_mode.as_ref().map(|pid_mode| {
14416 [
14417 "PidMode".to_string(),
14418 pid_mode.to_string(),
14419 ].join(",")
14420 }),
14421
14422
14423 self.pids_limit.as_ref().map(|pids_limit| {
14424 [
14425 "PidsLimit".to_string(),
14426 pids_limit.to_string(),
14427 ].join(",")
14428 }),
14429
14430 self.privileged.as_ref().map(|privileged| {
14435 [
14436 "Privileged".to_string(),
14437 privileged.to_string(),
14438 ].join(",")
14439 }),
14440
14441
14442 self.publish_all_ports.as_ref().map(|publish_all_ports| {
14443 [
14444 "PublishAllPorts".to_string(),
14445 publish_all_ports.to_string(),
14446 ].join(",")
14447 }),
14448
14449
14450 self.readonly_paths.as_ref().map(|readonly_paths| {
14451 [
14452 "ReadonlyPaths".to_string(),
14453 readonly_paths.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14454 ].join(",")
14455 }),
14456
14457
14458 self.readonly_rootfs.as_ref().map(|readonly_rootfs| {
14459 [
14460 "ReadonlyRootfs".to_string(),
14461 readonly_rootfs.to_string(),
14462 ].join(",")
14463 }),
14464
14465
14466 self.restart_policy.as_ref().map(|restart_policy| {
14467 [
14468 "RestartPolicy".to_string(),
14469 restart_policy.to_string(),
14470 ].join(",")
14471 }),
14472
14473
14474 self.runtime.as_ref().map(|runtime| {
14475 [
14476 "Runtime".to_string(),
14477 runtime.to_string(),
14478 ].join(",")
14479 }),
14480
14481
14482 self.security_opt.as_ref().map(|security_opt| {
14483 [
14484 "SecurityOpt".to_string(),
14485 security_opt.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14486 ].join(",")
14487 }),
14488
14489
14490 self.shm_size.as_ref().map(|shm_size| {
14491 [
14492 "ShmSize".to_string(),
14493 shm_size.to_string(),
14494 ].join(",")
14495 }),
14496
14497 self.uts_mode.as_ref().map(|uts_mode| {
14505 [
14506 "UTSMode".to_string(),
14507 uts_mode.to_string(),
14508 ].join(",")
14509 }),
14510
14511 self.userns_mode.as_ref().map(|userns_mode| {
14515 [
14516 "UsernsMode".to_string(),
14517 userns_mode.to_string(),
14518 ].join(",")
14519 }),
14520
14521
14522 self.volume_driver.as_ref().map(|volume_driver| {
14523 [
14524 "VolumeDriver".to_string(),
14525 volume_driver.to_string(),
14526 ].join(",")
14527 }),
14528
14529
14530 self.volumes_from.as_ref().map(|volumes_from| {
14531 [
14532 "VolumesFrom".to_string(),
14533 volumes_from.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
14534 ].join(",")
14535 }),
14536
14537 ];
14538
14539 params.into_iter().flatten().collect::<Vec<_>>().join(",")
14540 }
14541}
14542
14543impl std::str::FromStr for HostConfig {
14547 type Err = String;
14548
14549 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
14550 #[derive(Default)]
14552 #[allow(dead_code)]
14553 struct IntermediateRep {
14554 pub auto_remove: Vec<bool>,
14555 pub binds: Vec<Vec<String>>,
14556 pub blkio_device_read_bps: Vec<Vec<models::ThrottleDevice>>,
14557 pub blkio_device_read_i_ops: Vec<Vec<models::ThrottleDevice>>,
14558 pub blkio_device_write_bps: Vec<Vec<models::ThrottleDevice>>,
14559 pub blkio_device_write_i_ops: Vec<Vec<models::ThrottleDevice>>,
14560 pub blkio_weight: Vec<i32>,
14561 pub blkio_weight_device: Vec<Vec<models::WeightDevice>>,
14562 pub cap_add: Vec<Vec<String>>,
14563 pub cap_drop: Vec<Vec<String>>,
14564 pub cgroup: Vec<String>,
14565 pub cgroup_parent: Vec<String>,
14566 pub cgroupns_mode: Vec<String>,
14567 pub console_size: Vec<Vec<i32>>,
14568 pub container_id_file: Vec<String>,
14569 pub cpu_count: Vec<i64>,
14570 pub cpu_percent: Vec<i64>,
14571 pub cpu_period: Vec<i64>,
14572 pub cpu_quota: Vec<i64>,
14573 pub cpu_realtime_period: Vec<i64>,
14574 pub cpu_realtime_runtime: Vec<i64>,
14575 pub cpu_shares: Vec<i64>,
14576 pub cpuset_cpus: Vec<String>,
14577 pub cpuset_mems: Vec<String>,
14578 pub device_cgroup_rules: Vec<Vec<String>>,
14579 pub device_requests: Vec<Vec<models::DeviceRequest>>,
14580 pub devices: Vec<Vec<models::DeviceMapping>>,
14581 pub dns: Vec<Vec<String>>,
14582 pub dns_options: Vec<Vec<String>>,
14583 pub dns_search: Vec<Vec<String>>,
14584 pub extra_hosts: Vec<Vec<String>>,
14585 pub group_add: Vec<Vec<String>>,
14586 pub io_maximum_bandwidth: Vec<i32>,
14587 pub io_maximum_i_ops: Vec<i32>,
14588 pub init: Vec<bool>,
14589 pub ipc_mode: Vec<String>,
14590 pub isolation: Vec<String>,
14591 pub kernel_memory: Vec<i64>,
14592 pub kernel_memory_tcp: Vec<i64>,
14593 pub links: Vec<Vec<String>>,
14594 pub log_config: Vec<models::LogConfig>,
14595 pub masked_paths: Vec<Vec<String>>,
14596 pub memory: Vec<i64>,
14597 pub memory_reservation: Vec<i64>,
14598 pub memory_swap: Vec<i64>,
14599 pub memory_swappiness: Vec<i64>,
14600 pub mounts: Vec<Vec<models::Mount>>,
14601 pub nano_cpus: Vec<i64>,
14602 pub network_mode: Vec<String>,
14603 pub oom_kill_disable: Vec<bool>,
14604 pub oom_score_adj: Vec<i64>,
14605 pub pid_mode: Vec<String>,
14606 pub pids_limit: Vec<i64>,
14607 pub port_bindings: Vec<std::collections::HashMap<String, Vec<models::PortBinding>>>,
14608 pub privileged: Vec<bool>,
14609 pub publish_all_ports: Vec<bool>,
14610 pub readonly_paths: Vec<Vec<String>>,
14611 pub readonly_rootfs: Vec<bool>,
14612 pub restart_policy: Vec<String>,
14613 pub runtime: Vec<String>,
14614 pub security_opt: Vec<Vec<String>>,
14615 pub shm_size: Vec<i64>,
14616 pub storage_opt: Vec<std::collections::HashMap<String, String>>,
14617 pub sysctls: Vec<std::collections::HashMap<String, String>>,
14618 pub tmpfs: Vec<std::collections::HashMap<String, String>>,
14619 pub uts_mode: Vec<String>,
14620 pub ulimits: Vec<Vec<models::Ulimit>>,
14621 pub userns_mode: Vec<String>,
14622 pub volume_driver: Vec<String>,
14623 pub volumes_from: Vec<Vec<String>>,
14624 }
14625
14626 let mut intermediate_rep = IntermediateRep::default();
14627
14628 let mut string_iter = s.split(',');
14630 let mut key_result = string_iter.next();
14631
14632 while key_result.is_some() {
14633 let val = match string_iter.next() {
14634 Some(x) => x,
14635 None => return std::result::Result::Err("Missing value while parsing HostConfig".to_string())
14636 };
14637
14638 if let Some(key) = key_result {
14639 #[allow(clippy::match_single_binding)]
14640 match key {
14641 #[allow(clippy::redundant_clone)]
14642 "AutoRemove" => intermediate_rep.auto_remove.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14643 "Binds" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14644 "BlkioDeviceReadBps" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14645 "BlkioDeviceReadIOps" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14646 "BlkioDeviceWriteBps" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14647 "BlkioDeviceWriteIOps" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14648 #[allow(clippy::redundant_clone)]
14649 "BlkioWeight" => intermediate_rep.blkio_weight.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14650 "BlkioWeightDevice" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14651 "CapAdd" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14652 "CapDrop" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14653 #[allow(clippy::redundant_clone)]
14654 "Cgroup" => intermediate_rep.cgroup.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14655 #[allow(clippy::redundant_clone)]
14656 "CgroupParent" => intermediate_rep.cgroup_parent.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14657 #[allow(clippy::redundant_clone)]
14658 "CgroupnsMode" => intermediate_rep.cgroupns_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14659 "ConsoleSize" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14660 #[allow(clippy::redundant_clone)]
14661 "ContainerIDFile" => intermediate_rep.container_id_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14662 #[allow(clippy::redundant_clone)]
14663 "CpuCount" => intermediate_rep.cpu_count.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14664 #[allow(clippy::redundant_clone)]
14665 "CpuPercent" => intermediate_rep.cpu_percent.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14666 #[allow(clippy::redundant_clone)]
14667 "CpuPeriod" => intermediate_rep.cpu_period.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14668 #[allow(clippy::redundant_clone)]
14669 "CpuQuota" => intermediate_rep.cpu_quota.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14670 #[allow(clippy::redundant_clone)]
14671 "CpuRealtimePeriod" => intermediate_rep.cpu_realtime_period.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14672 #[allow(clippy::redundant_clone)]
14673 "CpuRealtimeRuntime" => intermediate_rep.cpu_realtime_runtime.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14674 #[allow(clippy::redundant_clone)]
14675 "CpuShares" => intermediate_rep.cpu_shares.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14676 #[allow(clippy::redundant_clone)]
14677 "CpusetCpus" => intermediate_rep.cpuset_cpus.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14678 #[allow(clippy::redundant_clone)]
14679 "CpusetMems" => intermediate_rep.cpuset_mems.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14680 "DeviceCgroupRules" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14681 "DeviceRequests" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14682 "Devices" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14683 "Dns" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14684 "DnsOptions" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14685 "DnsSearch" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14686 "ExtraHosts" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14687 "GroupAdd" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14688 #[allow(clippy::redundant_clone)]
14689 "IOMaximumBandwidth" => intermediate_rep.io_maximum_bandwidth.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14690 #[allow(clippy::redundant_clone)]
14691 "IOMaximumIOps" => intermediate_rep.io_maximum_i_ops.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14692 #[allow(clippy::redundant_clone)]
14693 "Init" => intermediate_rep.init.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14694 #[allow(clippy::redundant_clone)]
14695 "IpcMode" => intermediate_rep.ipc_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14696 #[allow(clippy::redundant_clone)]
14697 "Isolation" => intermediate_rep.isolation.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14698 #[allow(clippy::redundant_clone)]
14699 "KernelMemory" => intermediate_rep.kernel_memory.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14700 #[allow(clippy::redundant_clone)]
14701 "KernelMemoryTCP" => intermediate_rep.kernel_memory_tcp.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14702 "Links" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14703 #[allow(clippy::redundant_clone)]
14704 "LogConfig" => intermediate_rep.log_config.push(<models::LogConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14705 "MaskedPaths" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14706 #[allow(clippy::redundant_clone)]
14707 "Memory" => intermediate_rep.memory.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14708 #[allow(clippy::redundant_clone)]
14709 "MemoryReservation" => intermediate_rep.memory_reservation.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14710 #[allow(clippy::redundant_clone)]
14711 "MemorySwap" => intermediate_rep.memory_swap.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14712 #[allow(clippy::redundant_clone)]
14713 "MemorySwappiness" => intermediate_rep.memory_swappiness.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14714 "Mounts" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14715 #[allow(clippy::redundant_clone)]
14716 "NanoCpus" => intermediate_rep.nano_cpus.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14717 #[allow(clippy::redundant_clone)]
14718 "NetworkMode" => intermediate_rep.network_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14719 #[allow(clippy::redundant_clone)]
14720 "OomKillDisable" => intermediate_rep.oom_kill_disable.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14721 #[allow(clippy::redundant_clone)]
14722 "OomScoreAdj" => intermediate_rep.oom_score_adj.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14723 #[allow(clippy::redundant_clone)]
14724 "PidMode" => intermediate_rep.pid_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14725 #[allow(clippy::redundant_clone)]
14726 "PidsLimit" => intermediate_rep.pids_limit.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14727 "PortBindings" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14728 #[allow(clippy::redundant_clone)]
14729 "Privileged" => intermediate_rep.privileged.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14730 #[allow(clippy::redundant_clone)]
14731 "PublishAllPorts" => intermediate_rep.publish_all_ports.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14732 "ReadonlyPaths" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14733 #[allow(clippy::redundant_clone)]
14734 "ReadonlyRootfs" => intermediate_rep.readonly_rootfs.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14735 #[allow(clippy::redundant_clone)]
14736 "RestartPolicy" => intermediate_rep.restart_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14737 #[allow(clippy::redundant_clone)]
14738 "Runtime" => intermediate_rep.runtime.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14739 "SecurityOpt" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14740 #[allow(clippy::redundant_clone)]
14741 "ShmSize" => intermediate_rep.shm_size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14742 "StorageOpt" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14743 "Sysctls" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14744 "Tmpfs" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14745 #[allow(clippy::redundant_clone)]
14746 "UTSMode" => intermediate_rep.uts_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14747 "Ulimits" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14748 #[allow(clippy::redundant_clone)]
14749 "UsernsMode" => intermediate_rep.userns_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14750 #[allow(clippy::redundant_clone)]
14751 "VolumeDriver" => intermediate_rep.volume_driver.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
14752 "VolumesFrom" => return std::result::Result::Err("Parsing a container in this style is not supported in HostConfig".to_string()),
14753 _ => return std::result::Result::Err("Unexpected key while parsing HostConfig".to_string())
14754 }
14755 }
14756
14757 key_result = string_iter.next();
14759 }
14760
14761 std::result::Result::Ok(HostConfig {
14763 auto_remove: intermediate_rep.auto_remove.into_iter().next(),
14764 binds: intermediate_rep.binds.into_iter().next(),
14765 blkio_device_read_bps: intermediate_rep.blkio_device_read_bps.into_iter().next(),
14766 blkio_device_read_i_ops: intermediate_rep.blkio_device_read_i_ops.into_iter().next(),
14767 blkio_device_write_bps: intermediate_rep.blkio_device_write_bps.into_iter().next(),
14768 blkio_device_write_i_ops: intermediate_rep.blkio_device_write_i_ops.into_iter().next(),
14769 blkio_weight: intermediate_rep.blkio_weight.into_iter().next(),
14770 blkio_weight_device: intermediate_rep.blkio_weight_device.into_iter().next(),
14771 cap_add: intermediate_rep.cap_add.into_iter().next(),
14772 cap_drop: intermediate_rep.cap_drop.into_iter().next(),
14773 cgroup: intermediate_rep.cgroup.into_iter().next(),
14774 cgroup_parent: intermediate_rep.cgroup_parent.into_iter().next(),
14775 cgroupns_mode: intermediate_rep.cgroupns_mode.into_iter().next(),
14776 console_size: intermediate_rep.console_size.into_iter().next(),
14777 container_id_file: intermediate_rep.container_id_file.into_iter().next(),
14778 cpu_count: intermediate_rep.cpu_count.into_iter().next(),
14779 cpu_percent: intermediate_rep.cpu_percent.into_iter().next(),
14780 cpu_period: intermediate_rep.cpu_period.into_iter().next(),
14781 cpu_quota: intermediate_rep.cpu_quota.into_iter().next(),
14782 cpu_realtime_period: intermediate_rep.cpu_realtime_period.into_iter().next(),
14783 cpu_realtime_runtime: intermediate_rep.cpu_realtime_runtime.into_iter().next(),
14784 cpu_shares: intermediate_rep.cpu_shares.into_iter().next(),
14785 cpuset_cpus: intermediate_rep.cpuset_cpus.into_iter().next(),
14786 cpuset_mems: intermediate_rep.cpuset_mems.into_iter().next(),
14787 device_cgroup_rules: intermediate_rep.device_cgroup_rules.into_iter().next(),
14788 device_requests: intermediate_rep.device_requests.into_iter().next(),
14789 devices: intermediate_rep.devices.into_iter().next(),
14790 dns: intermediate_rep.dns.into_iter().next(),
14791 dns_options: intermediate_rep.dns_options.into_iter().next(),
14792 dns_search: intermediate_rep.dns_search.into_iter().next(),
14793 extra_hosts: intermediate_rep.extra_hosts.into_iter().next(),
14794 group_add: intermediate_rep.group_add.into_iter().next(),
14795 io_maximum_bandwidth: intermediate_rep.io_maximum_bandwidth.into_iter().next(),
14796 io_maximum_i_ops: intermediate_rep.io_maximum_i_ops.into_iter().next(),
14797 init: intermediate_rep.init.into_iter().next(),
14798 ipc_mode: intermediate_rep.ipc_mode.into_iter().next(),
14799 isolation: intermediate_rep.isolation.into_iter().next(),
14800 kernel_memory: intermediate_rep.kernel_memory.into_iter().next(),
14801 kernel_memory_tcp: intermediate_rep.kernel_memory_tcp.into_iter().next(),
14802 links: intermediate_rep.links.into_iter().next(),
14803 log_config: intermediate_rep.log_config.into_iter().next(),
14804 masked_paths: intermediate_rep.masked_paths.into_iter().next(),
14805 memory: intermediate_rep.memory.into_iter().next(),
14806 memory_reservation: intermediate_rep.memory_reservation.into_iter().next(),
14807 memory_swap: intermediate_rep.memory_swap.into_iter().next(),
14808 memory_swappiness: intermediate_rep.memory_swappiness.into_iter().next(),
14809 mounts: intermediate_rep.mounts.into_iter().next(),
14810 nano_cpus: intermediate_rep.nano_cpus.into_iter().next(),
14811 network_mode: intermediate_rep.network_mode.into_iter().next(),
14812 oom_kill_disable: intermediate_rep.oom_kill_disable.into_iter().next(),
14813 oom_score_adj: intermediate_rep.oom_score_adj.into_iter().next(),
14814 pid_mode: intermediate_rep.pid_mode.into_iter().next(),
14815 pids_limit: intermediate_rep.pids_limit.into_iter().next(),
14816 port_bindings: intermediate_rep.port_bindings.into_iter().next(),
14817 privileged: intermediate_rep.privileged.into_iter().next(),
14818 publish_all_ports: intermediate_rep.publish_all_ports.into_iter().next(),
14819 readonly_paths: intermediate_rep.readonly_paths.into_iter().next(),
14820 readonly_rootfs: intermediate_rep.readonly_rootfs.into_iter().next(),
14821 restart_policy: intermediate_rep.restart_policy.into_iter().next(),
14822 runtime: intermediate_rep.runtime.into_iter().next(),
14823 security_opt: intermediate_rep.security_opt.into_iter().next(),
14824 shm_size: intermediate_rep.shm_size.into_iter().next(),
14825 storage_opt: intermediate_rep.storage_opt.into_iter().next(),
14826 sysctls: intermediate_rep.sysctls.into_iter().next(),
14827 tmpfs: intermediate_rep.tmpfs.into_iter().next(),
14828 uts_mode: intermediate_rep.uts_mode.into_iter().next(),
14829 ulimits: intermediate_rep.ulimits.into_iter().next(),
14830 userns_mode: intermediate_rep.userns_mode.into_iter().next(),
14831 volume_driver: intermediate_rep.volume_driver.into_iter().next(),
14832 volumes_from: intermediate_rep.volumes_from.into_iter().next(),
14833 })
14834 }
14835}
14836
14837#[cfg(feature = "server")]
14840impl std::convert::TryFrom<header::IntoHeaderValue<HostConfig>> for HeaderValue {
14841 type Error = String;
14842
14843 fn try_from(hdr_value: header::IntoHeaderValue<HostConfig>) -> std::result::Result<Self, Self::Error> {
14844 let hdr_value = hdr_value.to_string();
14845 match HeaderValue::from_str(&hdr_value) {
14846 std::result::Result::Ok(value) => std::result::Result::Ok(value),
14847 std::result::Result::Err(e) => std::result::Result::Err(
14848 format!("Invalid header value for HostConfig - value: {} is invalid {}",
14849 hdr_value, e))
14850 }
14851 }
14852}
14853
14854#[cfg(feature = "server")]
14855impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HostConfig> {
14856 type Error = String;
14857
14858 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
14859 match hdr_value.to_str() {
14860 std::result::Result::Ok(value) => {
14861 match <HostConfig as std::str::FromStr>::from_str(value) {
14862 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
14863 std::result::Result::Err(err) => std::result::Result::Err(
14864 format!("Unable to convert header value '{}' into HostConfig - {}",
14865 value, err))
14866 }
14867 },
14868 std::result::Result::Err(e) => std::result::Result::Err(
14869 format!("Unable to convert header: {:?} to string: {}",
14870 hdr_value, e))
14871 }
14872 }
14873}
14874
14875
14876
14877
14878#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
14880#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
14881pub struct HostPathType(String);
14882
14883impl validator::Validate for HostPathType {
14884 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
14885 std::result::Result::Ok(())
14886 }
14887}
14888
14889impl std::convert::From<String> for HostPathType {
14890 fn from(x: String) -> Self {
14891 HostPathType(x)
14892 }
14893}
14894
14895impl std::string::ToString for HostPathType {
14896 fn to_string(&self) -> String {
14897 self.0.to_string()
14898 }
14899}
14900
14901impl std::str::FromStr for HostPathType {
14902 type Err = std::string::ParseError;
14903 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
14904 std::result::Result::Ok(HostPathType(x.to_string()))
14905 }
14906}
14907
14908impl std::convert::From<HostPathType> for String {
14909 fn from(x: HostPathType) -> Self {
14910 x.0
14911 }
14912}
14913
14914impl std::ops::Deref for HostPathType {
14915 type Target = String;
14916 fn deref(&self) -> &String {
14917 &self.0
14918 }
14919}
14920
14921impl std::ops::DerefMut for HostPathType {
14922 fn deref_mut(&mut self) -> &mut String {
14923 &mut self.0
14924 }
14925}
14926
14927
14928
14929#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
14934#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
14935pub struct HostPathVolumeSource {
14936#[serde(rename = "path")]
14938 #[serde(skip_serializing_if="Option::is_none")]
14939 pub path: Option<String>,
14940
14941#[serde(rename = "type")]
14943 #[serde(skip_serializing_if="Option::is_none")]
14944 pub r#type: Option<String>,
14945
14946}
14947
14948
14949impl HostPathVolumeSource {
14950 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
14951 pub fn new() -> HostPathVolumeSource {
14952 HostPathVolumeSource {
14953 path: None,
14954 r#type: None,
14955 }
14956 }
14957}
14958
14959impl std::string::ToString for HostPathVolumeSource {
14963 fn to_string(&self) -> String {
14964 let params: Vec<Option<String>> = vec![
14965
14966 self.path.as_ref().map(|path| {
14967 [
14968 "path".to_string(),
14969 path.to_string(),
14970 ].join(",")
14971 }),
14972
14973
14974 self.r#type.as_ref().map(|r#type| {
14975 [
14976 "type".to_string(),
14977 r#type.to_string(),
14978 ].join(",")
14979 }),
14980
14981 ];
14982
14983 params.into_iter().flatten().collect::<Vec<_>>().join(",")
14984 }
14985}
14986
14987impl std::str::FromStr for HostPathVolumeSource {
14991 type Err = String;
14992
14993 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
14994 #[derive(Default)]
14996 #[allow(dead_code)]
14997 struct IntermediateRep {
14998 pub path: Vec<String>,
14999 pub r#type: Vec<String>,
15000 }
15001
15002 let mut intermediate_rep = IntermediateRep::default();
15003
15004 let mut string_iter = s.split(',');
15006 let mut key_result = string_iter.next();
15007
15008 while key_result.is_some() {
15009 let val = match string_iter.next() {
15010 Some(x) => x,
15011 None => return std::result::Result::Err("Missing value while parsing HostPathVolumeSource".to_string())
15012 };
15013
15014 if let Some(key) = key_result {
15015 #[allow(clippy::match_single_binding)]
15016 match key {
15017 #[allow(clippy::redundant_clone)]
15018 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15019 #[allow(clippy::redundant_clone)]
15020 "type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15021 _ => return std::result::Result::Err("Unexpected key while parsing HostPathVolumeSource".to_string())
15022 }
15023 }
15024
15025 key_result = string_iter.next();
15027 }
15028
15029 std::result::Result::Ok(HostPathVolumeSource {
15031 path: intermediate_rep.path.into_iter().next(),
15032 r#type: intermediate_rep.r#type.into_iter().next(),
15033 })
15034 }
15035}
15036
15037#[cfg(feature = "server")]
15040impl std::convert::TryFrom<header::IntoHeaderValue<HostPathVolumeSource>> for HeaderValue {
15041 type Error = String;
15042
15043 fn try_from(hdr_value: header::IntoHeaderValue<HostPathVolumeSource>) -> std::result::Result<Self, Self::Error> {
15044 let hdr_value = hdr_value.to_string();
15045 match HeaderValue::from_str(&hdr_value) {
15046 std::result::Result::Ok(value) => std::result::Result::Ok(value),
15047 std::result::Result::Err(e) => std::result::Result::Err(
15048 format!("Invalid header value for HostPathVolumeSource - value: {} is invalid {}",
15049 hdr_value, e))
15050 }
15051 }
15052}
15053
15054#[cfg(feature = "server")]
15055impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HostPathVolumeSource> {
15056 type Error = String;
15057
15058 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
15059 match hdr_value.to_str() {
15060 std::result::Result::Ok(value) => {
15061 match <HostPathVolumeSource as std::str::FromStr>::from_str(value) {
15062 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
15063 std::result::Result::Err(err) => std::result::Result::Err(
15064 format!("Unable to convert header value '{}' into HostPathVolumeSource - {}",
15065 value, err))
15066 }
15067 },
15068 std::result::Result::Err(e) => std::result::Result::Err(
15069 format!("Unable to convert header: {:?} to string: {}",
15070 hdr_value, e))
15071 }
15072 }
15073}
15074
15075
15076
15077
15078#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
15083#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
15084pub struct HttpClientConfiguration {
15085#[serde(rename = "allowRedirects")]
15087 #[serde(skip_serializing_if="Option::is_none")]
15088 pub allow_redirects: Option<bool>,
15089
15090#[serde(rename = "cacert")]
15092 #[serde(skip_serializing_if="Option::is_none")]
15093 pub cacert: Option<String>,
15094
15095#[serde(rename = "cert")]
15097 #[serde(skip_serializing_if="Option::is_none")]
15098 pub cert: Option<String>,
15099
15100 #[serde(rename = "cipher")]
15101 #[serde(skip_serializing_if="Option::is_none")]
15102 pub cipher: Option<Vec<models::CipherSuite>>,
15103
15104#[serde(rename = "curves")]
15106 #[serde(skip_serializing_if="Option::is_none")]
15107 pub curves: Option<Vec<models::EcdhCurve>>,
15108
15109#[serde(rename = "key")]
15111 #[serde(skip_serializing_if="Option::is_none")]
15112 pub key: Option<String>,
15113
15114#[serde(rename = "timeout")]
15116 #[serde(skip_serializing_if="Option::is_none")]
15117 pub timeout: Option<i64>,
15118
15119 #[serde(rename = "tlsVersion")]
15120 #[serde(skip_serializing_if="Option::is_none")]
15121 pub tls_version: Option<String>,
15122
15123#[serde(rename = "url")]
15125 #[serde(skip_serializing_if="Option::is_none")]
15126 pub url: Option<String>,
15127
15128}
15129
15130
15131impl HttpClientConfiguration {
15132 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
15133 pub fn new() -> HttpClientConfiguration {
15134 HttpClientConfiguration {
15135 allow_redirects: None,
15136 cacert: None,
15137 cert: None,
15138 cipher: None,
15139 curves: None,
15140 key: None,
15141 timeout: None,
15142 tls_version: None,
15143 url: None,
15144 }
15145 }
15146}
15147
15148impl std::string::ToString for HttpClientConfiguration {
15152 fn to_string(&self) -> String {
15153 let params: Vec<Option<String>> = vec![
15154
15155 self.allow_redirects.as_ref().map(|allow_redirects| {
15156 [
15157 "allowRedirects".to_string(),
15158 allow_redirects.to_string(),
15159 ].join(",")
15160 }),
15161
15162
15163 self.cacert.as_ref().map(|cacert| {
15164 [
15165 "cacert".to_string(),
15166 cacert.to_string(),
15167 ].join(",")
15168 }),
15169
15170
15171 self.cert.as_ref().map(|cert| {
15172 [
15173 "cert".to_string(),
15174 cert.to_string(),
15175 ].join(",")
15176 }),
15177
15178
15179 self.cipher.as_ref().map(|cipher| {
15180 [
15181 "cipher".to_string(),
15182 cipher.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
15183 ].join(",")
15184 }),
15185
15186
15187 self.curves.as_ref().map(|curves| {
15188 [
15189 "curves".to_string(),
15190 curves.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
15191 ].join(",")
15192 }),
15193
15194
15195 self.key.as_ref().map(|key| {
15196 [
15197 "key".to_string(),
15198 key.to_string(),
15199 ].join(",")
15200 }),
15201
15202
15203 self.timeout.as_ref().map(|timeout| {
15204 [
15205 "timeout".to_string(),
15206 timeout.to_string(),
15207 ].join(",")
15208 }),
15209
15210
15211 self.tls_version.as_ref().map(|tls_version| {
15212 [
15213 "tlsVersion".to_string(),
15214 tls_version.to_string(),
15215 ].join(",")
15216 }),
15217
15218
15219 self.url.as_ref().map(|url| {
15220 [
15221 "url".to_string(),
15222 url.to_string(),
15223 ].join(",")
15224 }),
15225
15226 ];
15227
15228 params.into_iter().flatten().collect::<Vec<_>>().join(",")
15229 }
15230}
15231
15232impl std::str::FromStr for HttpClientConfiguration {
15236 type Err = String;
15237
15238 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
15239 #[derive(Default)]
15241 #[allow(dead_code)]
15242 struct IntermediateRep {
15243 pub allow_redirects: Vec<bool>,
15244 pub cacert: Vec<String>,
15245 pub cert: Vec<String>,
15246 pub cipher: Vec<Vec<models::CipherSuite>>,
15247 pub curves: Vec<Vec<models::EcdhCurve>>,
15248 pub key: Vec<String>,
15249 pub timeout: Vec<i64>,
15250 pub tls_version: Vec<String>,
15251 pub url: Vec<String>,
15252 }
15253
15254 let mut intermediate_rep = IntermediateRep::default();
15255
15256 let mut string_iter = s.split(',');
15258 let mut key_result = string_iter.next();
15259
15260 while key_result.is_some() {
15261 let val = match string_iter.next() {
15262 Some(x) => x,
15263 None => return std::result::Result::Err("Missing value while parsing HttpClientConfiguration".to_string())
15264 };
15265
15266 if let Some(key) = key_result {
15267 #[allow(clippy::match_single_binding)]
15268 match key {
15269 #[allow(clippy::redundant_clone)]
15270 "allowRedirects" => intermediate_rep.allow_redirects.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15271 #[allow(clippy::redundant_clone)]
15272 "cacert" => intermediate_rep.cacert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15273 #[allow(clippy::redundant_clone)]
15274 "cert" => intermediate_rep.cert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15275 "cipher" => return std::result::Result::Err("Parsing a container in this style is not supported in HttpClientConfiguration".to_string()),
15276 "curves" => return std::result::Result::Err("Parsing a container in this style is not supported in HttpClientConfiguration".to_string()),
15277 #[allow(clippy::redundant_clone)]
15278 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15279 #[allow(clippy::redundant_clone)]
15280 "timeout" => intermediate_rep.timeout.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15281 #[allow(clippy::redundant_clone)]
15282 "tlsVersion" => intermediate_rep.tls_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15283 #[allow(clippy::redundant_clone)]
15284 "url" => intermediate_rep.url.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15285 _ => return std::result::Result::Err("Unexpected key while parsing HttpClientConfiguration".to_string())
15286 }
15287 }
15288
15289 key_result = string_iter.next();
15291 }
15292
15293 std::result::Result::Ok(HttpClientConfiguration {
15295 allow_redirects: intermediate_rep.allow_redirects.into_iter().next(),
15296 cacert: intermediate_rep.cacert.into_iter().next(),
15297 cert: intermediate_rep.cert.into_iter().next(),
15298 cipher: intermediate_rep.cipher.into_iter().next(),
15299 curves: intermediate_rep.curves.into_iter().next(),
15300 key: intermediate_rep.key.into_iter().next(),
15301 timeout: intermediate_rep.timeout.into_iter().next(),
15302 tls_version: intermediate_rep.tls_version.into_iter().next(),
15303 url: intermediate_rep.url.into_iter().next(),
15304 })
15305 }
15306}
15307
15308#[cfg(feature = "server")]
15311impl std::convert::TryFrom<header::IntoHeaderValue<HttpClientConfiguration>> for HeaderValue {
15312 type Error = String;
15313
15314 fn try_from(hdr_value: header::IntoHeaderValue<HttpClientConfiguration>) -> std::result::Result<Self, Self::Error> {
15315 let hdr_value = hdr_value.to_string();
15316 match HeaderValue::from_str(&hdr_value) {
15317 std::result::Result::Ok(value) => std::result::Result::Ok(value),
15318 std::result::Result::Err(e) => std::result::Result::Err(
15319 format!("Invalid header value for HttpClientConfiguration - value: {} is invalid {}",
15320 hdr_value, e))
15321 }
15322 }
15323}
15324
15325#[cfg(feature = "server")]
15326impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HttpClientConfiguration> {
15327 type Error = String;
15328
15329 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
15330 match hdr_value.to_str() {
15331 std::result::Result::Ok(value) => {
15332 match <HttpClientConfiguration as std::str::FromStr>::from_str(value) {
15333 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
15334 std::result::Result::Err(err) => std::result::Result::Err(
15335 format!("Unable to convert header value '{}' into HttpClientConfiguration - {}",
15336 value, err))
15337 }
15338 },
15339 std::result::Result::Err(e) => std::result::Result::Err(
15340 format!("Unable to convert header: {:?} to string: {}",
15341 hdr_value, e))
15342 }
15343 }
15344}
15345
15346
15347
15348
15349
15350
15351
15352#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
15353#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
15354pub struct HttpGetAction {
15355#[serde(rename = "host")]
15357 #[serde(skip_serializing_if="Option::is_none")]
15358 pub host: Option<String>,
15359
15360#[serde(rename = "httpHeaders")]
15362 #[serde(skip_serializing_if="Option::is_none")]
15363 pub http_headers: Option<Vec<models::HttpHeader>>,
15364
15365#[serde(rename = "path")]
15367 #[serde(skip_serializing_if="Option::is_none")]
15368 pub path: Option<String>,
15369
15370 #[serde(rename = "port")]
15371 #[serde(skip_serializing_if="Option::is_none")]
15372 pub port: Option<models::IntOrString>,
15373
15374#[serde(rename = "scheme")]
15376 #[serde(skip_serializing_if="Option::is_none")]
15377 pub scheme: Option<String>,
15378
15379}
15380
15381
15382impl HttpGetAction {
15383 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
15384 pub fn new() -> HttpGetAction {
15385 HttpGetAction {
15386 host: None,
15387 http_headers: None,
15388 path: None,
15389 port: None,
15390 scheme: None,
15391 }
15392 }
15393}
15394
15395impl std::string::ToString for HttpGetAction {
15399 fn to_string(&self) -> String {
15400 let params: Vec<Option<String>> = vec![
15401
15402 self.host.as_ref().map(|host| {
15403 [
15404 "host".to_string(),
15405 host.to_string(),
15406 ].join(",")
15407 }),
15408
15409 self.path.as_ref().map(|path| {
15413 [
15414 "path".to_string(),
15415 path.to_string(),
15416 ].join(",")
15417 }),
15418
15419 self.scheme.as_ref().map(|scheme| {
15423 [
15424 "scheme".to_string(),
15425 scheme.to_string(),
15426 ].join(",")
15427 }),
15428
15429 ];
15430
15431 params.into_iter().flatten().collect::<Vec<_>>().join(",")
15432 }
15433}
15434
15435impl std::str::FromStr for HttpGetAction {
15439 type Err = String;
15440
15441 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
15442 #[derive(Default)]
15444 #[allow(dead_code)]
15445 struct IntermediateRep {
15446 pub host: Vec<String>,
15447 pub http_headers: Vec<Vec<models::HttpHeader>>,
15448 pub path: Vec<String>,
15449 pub port: Vec<models::IntOrString>,
15450 pub scheme: Vec<String>,
15451 }
15452
15453 let mut intermediate_rep = IntermediateRep::default();
15454
15455 let mut string_iter = s.split(',');
15457 let mut key_result = string_iter.next();
15458
15459 while key_result.is_some() {
15460 let val = match string_iter.next() {
15461 Some(x) => x,
15462 None => return std::result::Result::Err("Missing value while parsing HttpGetAction".to_string())
15463 };
15464
15465 if let Some(key) = key_result {
15466 #[allow(clippy::match_single_binding)]
15467 match key {
15468 #[allow(clippy::redundant_clone)]
15469 "host" => intermediate_rep.host.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15470 "httpHeaders" => return std::result::Result::Err("Parsing a container in this style is not supported in HttpGetAction".to_string()),
15471 #[allow(clippy::redundant_clone)]
15472 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15473 #[allow(clippy::redundant_clone)]
15474 "port" => intermediate_rep.port.push(<models::IntOrString as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15475 #[allow(clippy::redundant_clone)]
15476 "scheme" => intermediate_rep.scheme.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15477 _ => return std::result::Result::Err("Unexpected key while parsing HttpGetAction".to_string())
15478 }
15479 }
15480
15481 key_result = string_iter.next();
15483 }
15484
15485 std::result::Result::Ok(HttpGetAction {
15487 host: intermediate_rep.host.into_iter().next(),
15488 http_headers: intermediate_rep.http_headers.into_iter().next(),
15489 path: intermediate_rep.path.into_iter().next(),
15490 port: intermediate_rep.port.into_iter().next(),
15491 scheme: intermediate_rep.scheme.into_iter().next(),
15492 })
15493 }
15494}
15495
15496#[cfg(feature = "server")]
15499impl std::convert::TryFrom<header::IntoHeaderValue<HttpGetAction>> for HeaderValue {
15500 type Error = String;
15501
15502 fn try_from(hdr_value: header::IntoHeaderValue<HttpGetAction>) -> std::result::Result<Self, Self::Error> {
15503 let hdr_value = hdr_value.to_string();
15504 match HeaderValue::from_str(&hdr_value) {
15505 std::result::Result::Ok(value) => std::result::Result::Ok(value),
15506 std::result::Result::Err(e) => std::result::Result::Err(
15507 format!("Invalid header value for HttpGetAction - value: {} is invalid {}",
15508 hdr_value, e))
15509 }
15510 }
15511}
15512
15513#[cfg(feature = "server")]
15514impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HttpGetAction> {
15515 type Error = String;
15516
15517 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
15518 match hdr_value.to_str() {
15519 std::result::Result::Ok(value) => {
15520 match <HttpGetAction as std::str::FromStr>::from_str(value) {
15521 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
15522 std::result::Result::Err(err) => std::result::Result::Err(
15523 format!("Unable to convert header value '{}' into HttpGetAction - {}",
15524 value, err))
15525 }
15526 },
15527 std::result::Result::Err(e) => std::result::Result::Err(
15528 format!("Unable to convert header: {:?} to string: {}",
15529 hdr_value, e))
15530 }
15531 }
15532}
15533
15534
15535
15536
15537#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
15542#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
15543pub struct HttpHeader {
15544#[serde(rename = "name")]
15546 #[serde(skip_serializing_if="Option::is_none")]
15547 pub name: Option<String>,
15548
15549#[serde(rename = "value")]
15551 #[serde(skip_serializing_if="Option::is_none")]
15552 pub value: Option<String>,
15553
15554}
15555
15556
15557impl HttpHeader {
15558 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
15559 pub fn new() -> HttpHeader {
15560 HttpHeader {
15561 name: None,
15562 value: None,
15563 }
15564 }
15565}
15566
15567impl std::string::ToString for HttpHeader {
15571 fn to_string(&self) -> String {
15572 let params: Vec<Option<String>> = vec![
15573
15574 self.name.as_ref().map(|name| {
15575 [
15576 "name".to_string(),
15577 name.to_string(),
15578 ].join(",")
15579 }),
15580
15581
15582 self.value.as_ref().map(|value| {
15583 [
15584 "value".to_string(),
15585 value.to_string(),
15586 ].join(",")
15587 }),
15588
15589 ];
15590
15591 params.into_iter().flatten().collect::<Vec<_>>().join(",")
15592 }
15593}
15594
15595impl std::str::FromStr for HttpHeader {
15599 type Err = String;
15600
15601 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
15602 #[derive(Default)]
15604 #[allow(dead_code)]
15605 struct IntermediateRep {
15606 pub name: Vec<String>,
15607 pub value: Vec<String>,
15608 }
15609
15610 let mut intermediate_rep = IntermediateRep::default();
15611
15612 let mut string_iter = s.split(',');
15614 let mut key_result = string_iter.next();
15615
15616 while key_result.is_some() {
15617 let val = match string_iter.next() {
15618 Some(x) => x,
15619 None => return std::result::Result::Err("Missing value while parsing HttpHeader".to_string())
15620 };
15621
15622 if let Some(key) = key_result {
15623 #[allow(clippy::match_single_binding)]
15624 match key {
15625 #[allow(clippy::redundant_clone)]
15626 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15627 #[allow(clippy::redundant_clone)]
15628 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15629 _ => return std::result::Result::Err("Unexpected key while parsing HttpHeader".to_string())
15630 }
15631 }
15632
15633 key_result = string_iter.next();
15635 }
15636
15637 std::result::Result::Ok(HttpHeader {
15639 name: intermediate_rep.name.into_iter().next(),
15640 value: intermediate_rep.value.into_iter().next(),
15641 })
15642 }
15643}
15644
15645#[cfg(feature = "server")]
15648impl std::convert::TryFrom<header::IntoHeaderValue<HttpHeader>> for HeaderValue {
15649 type Error = String;
15650
15651 fn try_from(hdr_value: header::IntoHeaderValue<HttpHeader>) -> std::result::Result<Self, Self::Error> {
15652 let hdr_value = hdr_value.to_string();
15653 match HeaderValue::from_str(&hdr_value) {
15654 std::result::Result::Ok(value) => std::result::Result::Ok(value),
15655 std::result::Result::Err(e) => std::result::Result::Err(
15656 format!("Invalid header value for HttpHeader - value: {} is invalid {}",
15657 hdr_value, e))
15658 }
15659 }
15660}
15661
15662#[cfg(feature = "server")]
15663impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HttpHeader> {
15664 type Error = String;
15665
15666 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
15667 match hdr_value.to_str() {
15668 std::result::Result::Ok(value) => {
15669 match <HttpHeader as std::str::FromStr>::from_str(value) {
15670 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
15671 std::result::Result::Err(err) => std::result::Result::Err(
15672 format!("Unable to convert header value '{}' into HttpHeader - {}",
15673 value, err))
15674 }
15675 },
15676 std::result::Result::Err(e) => std::result::Result::Err(
15677 format!("Unable to convert header: {:?} to string: {}",
15678 hdr_value, e))
15679 }
15680 }
15681}
15682
15683
15684
15685
15686#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
15691#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
15692pub struct HttpServerConfiguration {
15693#[serde(rename = "cert")]
15695 #[serde(skip_serializing_if="Option::is_none")]
15696 pub cert: Option<String>,
15697
15698 #[serde(rename = "cipher")]
15699 #[serde(skip_serializing_if="Option::is_none")]
15700 pub cipher: Option<Vec<models::CipherSuite>>,
15701
15702#[serde(rename = "clientcacert")]
15704 #[serde(skip_serializing_if="Option::is_none")]
15705 pub clientcacert: Option<String>,
15706
15707#[serde(rename = "curves")]
15709 #[serde(skip_serializing_if="Option::is_none")]
15710 pub curves: Option<Vec<models::EcdhCurve>>,
15711
15712#[serde(rename = "key")]
15714 #[serde(skip_serializing_if="Option::is_none")]
15715 pub key: Option<String>,
15716
15717#[serde(rename = "listen")]
15719 #[serde(skip_serializing_if="Option::is_none")]
15720 pub listen: Option<String>,
15721
15722 #[serde(rename = "tlsVersion")]
15723 #[serde(skip_serializing_if="Option::is_none")]
15724 pub tls_version: Option<String>,
15725
15726}
15727
15728
15729impl HttpServerConfiguration {
15730 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
15731 pub fn new() -> HttpServerConfiguration {
15732 HttpServerConfiguration {
15733 cert: None,
15734 cipher: None,
15735 clientcacert: None,
15736 curves: None,
15737 key: None,
15738 listen: None,
15739 tls_version: None,
15740 }
15741 }
15742}
15743
15744impl std::string::ToString for HttpServerConfiguration {
15748 fn to_string(&self) -> String {
15749 let params: Vec<Option<String>> = vec![
15750
15751 self.cert.as_ref().map(|cert| {
15752 [
15753 "cert".to_string(),
15754 cert.to_string(),
15755 ].join(",")
15756 }),
15757
15758
15759 self.cipher.as_ref().map(|cipher| {
15760 [
15761 "cipher".to_string(),
15762 cipher.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
15763 ].join(",")
15764 }),
15765
15766
15767 self.clientcacert.as_ref().map(|clientcacert| {
15768 [
15769 "clientcacert".to_string(),
15770 clientcacert.to_string(),
15771 ].join(",")
15772 }),
15773
15774
15775 self.curves.as_ref().map(|curves| {
15776 [
15777 "curves".to_string(),
15778 curves.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
15779 ].join(",")
15780 }),
15781
15782
15783 self.key.as_ref().map(|key| {
15784 [
15785 "key".to_string(),
15786 key.to_string(),
15787 ].join(",")
15788 }),
15789
15790
15791 self.listen.as_ref().map(|listen| {
15792 [
15793 "listen".to_string(),
15794 listen.to_string(),
15795 ].join(",")
15796 }),
15797
15798
15799 self.tls_version.as_ref().map(|tls_version| {
15800 [
15801 "tlsVersion".to_string(),
15802 tls_version.to_string(),
15803 ].join(",")
15804 }),
15805
15806 ];
15807
15808 params.into_iter().flatten().collect::<Vec<_>>().join(",")
15809 }
15810}
15811
15812impl std::str::FromStr for HttpServerConfiguration {
15816 type Err = String;
15817
15818 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
15819 #[derive(Default)]
15821 #[allow(dead_code)]
15822 struct IntermediateRep {
15823 pub cert: Vec<String>,
15824 pub cipher: Vec<Vec<models::CipherSuite>>,
15825 pub clientcacert: Vec<String>,
15826 pub curves: Vec<Vec<models::EcdhCurve>>,
15827 pub key: Vec<String>,
15828 pub listen: Vec<String>,
15829 pub tls_version: Vec<String>,
15830 }
15831
15832 let mut intermediate_rep = IntermediateRep::default();
15833
15834 let mut string_iter = s.split(',');
15836 let mut key_result = string_iter.next();
15837
15838 while key_result.is_some() {
15839 let val = match string_iter.next() {
15840 Some(x) => x,
15841 None => return std::result::Result::Err("Missing value while parsing HttpServerConfiguration".to_string())
15842 };
15843
15844 if let Some(key) = key_result {
15845 #[allow(clippy::match_single_binding)]
15846 match key {
15847 #[allow(clippy::redundant_clone)]
15848 "cert" => intermediate_rep.cert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15849 "cipher" => return std::result::Result::Err("Parsing a container in this style is not supported in HttpServerConfiguration".to_string()),
15850 #[allow(clippy::redundant_clone)]
15851 "clientcacert" => intermediate_rep.clientcacert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15852 "curves" => return std::result::Result::Err("Parsing a container in this style is not supported in HttpServerConfiguration".to_string()),
15853 #[allow(clippy::redundant_clone)]
15854 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15855 #[allow(clippy::redundant_clone)]
15856 "listen" => intermediate_rep.listen.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15857 #[allow(clippy::redundant_clone)]
15858 "tlsVersion" => intermediate_rep.tls_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15859 _ => return std::result::Result::Err("Unexpected key while parsing HttpServerConfiguration".to_string())
15860 }
15861 }
15862
15863 key_result = string_iter.next();
15865 }
15866
15867 std::result::Result::Ok(HttpServerConfiguration {
15869 cert: intermediate_rep.cert.into_iter().next(),
15870 cipher: intermediate_rep.cipher.into_iter().next(),
15871 clientcacert: intermediate_rep.clientcacert.into_iter().next(),
15872 curves: intermediate_rep.curves.into_iter().next(),
15873 key: intermediate_rep.key.into_iter().next(),
15874 listen: intermediate_rep.listen.into_iter().next(),
15875 tls_version: intermediate_rep.tls_version.into_iter().next(),
15876 })
15877 }
15878}
15879
15880#[cfg(feature = "server")]
15883impl std::convert::TryFrom<header::IntoHeaderValue<HttpServerConfiguration>> for HeaderValue {
15884 type Error = String;
15885
15886 fn try_from(hdr_value: header::IntoHeaderValue<HttpServerConfiguration>) -> std::result::Result<Self, Self::Error> {
15887 let hdr_value = hdr_value.to_string();
15888 match HeaderValue::from_str(&hdr_value) {
15889 std::result::Result::Ok(value) => std::result::Result::Ok(value),
15890 std::result::Result::Err(e) => std::result::Result::Err(
15891 format!("Invalid header value for HttpServerConfiguration - value: {} is invalid {}",
15892 hdr_value, e))
15893 }
15894 }
15895}
15896
15897#[cfg(feature = "server")]
15898impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<HttpServerConfiguration> {
15899 type Error = String;
15900
15901 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
15902 match hdr_value.to_str() {
15903 std::result::Result::Ok(value) => {
15904 match <HttpServerConfiguration as std::str::FromStr>::from_str(value) {
15905 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
15906 std::result::Result::Err(err) => std::result::Result::Err(
15907 format!("Unable to convert header value '{}' into HttpServerConfiguration - {}",
15908 value, err))
15909 }
15910 },
15911 std::result::Result::Err(e) => std::result::Result::Err(
15912 format!("Unable to convert header: {:?} to string: {}",
15913 hdr_value, e))
15914 }
15915 }
15916}
15917
15918
15919
15920
15921#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
15926#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
15927pub struct IdResponse {
15928#[serde(rename = "Id")]
15930 pub id: String,
15931
15932}
15933
15934
15935impl IdResponse {
15936 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
15937 pub fn new(id: String, ) -> IdResponse {
15938 IdResponse {
15939 id,
15940 }
15941 }
15942}
15943
15944impl std::string::ToString for IdResponse {
15948 fn to_string(&self) -> String {
15949 let params: Vec<Option<String>> = vec![
15950
15951 Some("Id".to_string()),
15952 Some(self.id.to_string()),
15953
15954 ];
15955
15956 params.into_iter().flatten().collect::<Vec<_>>().join(",")
15957 }
15958}
15959
15960impl std::str::FromStr for IdResponse {
15964 type Err = String;
15965
15966 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
15967 #[derive(Default)]
15969 #[allow(dead_code)]
15970 struct IntermediateRep {
15971 pub id: Vec<String>,
15972 }
15973
15974 let mut intermediate_rep = IntermediateRep::default();
15975
15976 let mut string_iter = s.split(',');
15978 let mut key_result = string_iter.next();
15979
15980 while key_result.is_some() {
15981 let val = match string_iter.next() {
15982 Some(x) => x,
15983 None => return std::result::Result::Err("Missing value while parsing IdResponse".to_string())
15984 };
15985
15986 if let Some(key) = key_result {
15987 #[allow(clippy::match_single_binding)]
15988 match key {
15989 #[allow(clippy::redundant_clone)]
15990 "Id" => intermediate_rep.id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
15991 _ => return std::result::Result::Err("Unexpected key while parsing IdResponse".to_string())
15992 }
15993 }
15994
15995 key_result = string_iter.next();
15997 }
15998
15999 std::result::Result::Ok(IdResponse {
16001 id: intermediate_rep.id.into_iter().next().ok_or_else(|| "Id missing in IdResponse".to_string())?,
16002 })
16003 }
16004}
16005
16006#[cfg(feature = "server")]
16009impl std::convert::TryFrom<header::IntoHeaderValue<IdResponse>> for HeaderValue {
16010 type Error = String;
16011
16012 fn try_from(hdr_value: header::IntoHeaderValue<IdResponse>) -> std::result::Result<Self, Self::Error> {
16013 let hdr_value = hdr_value.to_string();
16014 match HeaderValue::from_str(&hdr_value) {
16015 std::result::Result::Ok(value) => std::result::Result::Ok(value),
16016 std::result::Result::Err(e) => std::result::Result::Err(
16017 format!("Invalid header value for IdResponse - value: {} is invalid {}",
16018 hdr_value, e))
16019 }
16020 }
16021}
16022
16023#[cfg(feature = "server")]
16024impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<IdResponse> {
16025 type Error = String;
16026
16027 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
16028 match hdr_value.to_str() {
16029 std::result::Result::Ok(value) => {
16030 match <IdResponse as std::str::FromStr>::from_str(value) {
16031 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
16032 std::result::Result::Err(err) => std::result::Result::Err(
16033 format!("Unable to convert header value '{}' into IdResponse - {}",
16034 value, err))
16035 }
16036 },
16037 std::result::Result::Err(e) => std::result::Result::Err(
16038 format!("Unable to convert header: {:?} to string: {}",
16039 hdr_value, e))
16040 }
16041 }
16042}
16043
16044
16045
16046
16047#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
16052#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16053pub struct ImageDeleteResponseItem {
16054#[serde(rename = "Deleted")]
16056 #[serde(skip_serializing_if="Option::is_none")]
16057 pub deleted: Option<String>,
16058
16059#[serde(rename = "Untagged")]
16061 #[serde(skip_serializing_if="Option::is_none")]
16062 pub untagged: Option<String>,
16063
16064}
16065
16066
16067impl ImageDeleteResponseItem {
16068 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
16069 pub fn new() -> ImageDeleteResponseItem {
16070 ImageDeleteResponseItem {
16071 deleted: None,
16072 untagged: None,
16073 }
16074 }
16075}
16076
16077impl std::string::ToString for ImageDeleteResponseItem {
16081 fn to_string(&self) -> String {
16082 let params: Vec<Option<String>> = vec![
16083
16084 self.deleted.as_ref().map(|deleted| {
16085 [
16086 "Deleted".to_string(),
16087 deleted.to_string(),
16088 ].join(",")
16089 }),
16090
16091
16092 self.untagged.as_ref().map(|untagged| {
16093 [
16094 "Untagged".to_string(),
16095 untagged.to_string(),
16096 ].join(",")
16097 }),
16098
16099 ];
16100
16101 params.into_iter().flatten().collect::<Vec<_>>().join(",")
16102 }
16103}
16104
16105impl std::str::FromStr for ImageDeleteResponseItem {
16109 type Err = String;
16110
16111 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
16112 #[derive(Default)]
16114 #[allow(dead_code)]
16115 struct IntermediateRep {
16116 pub deleted: Vec<String>,
16117 pub untagged: Vec<String>,
16118 }
16119
16120 let mut intermediate_rep = IntermediateRep::default();
16121
16122 let mut string_iter = s.split(',');
16124 let mut key_result = string_iter.next();
16125
16126 while key_result.is_some() {
16127 let val = match string_iter.next() {
16128 Some(x) => x,
16129 None => return std::result::Result::Err("Missing value while parsing ImageDeleteResponseItem".to_string())
16130 };
16131
16132 if let Some(key) = key_result {
16133 #[allow(clippy::match_single_binding)]
16134 match key {
16135 #[allow(clippy::redundant_clone)]
16136 "Deleted" => intermediate_rep.deleted.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16137 #[allow(clippy::redundant_clone)]
16138 "Untagged" => intermediate_rep.untagged.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16139 _ => return std::result::Result::Err("Unexpected key while parsing ImageDeleteResponseItem".to_string())
16140 }
16141 }
16142
16143 key_result = string_iter.next();
16145 }
16146
16147 std::result::Result::Ok(ImageDeleteResponseItem {
16149 deleted: intermediate_rep.deleted.into_iter().next(),
16150 untagged: intermediate_rep.untagged.into_iter().next(),
16151 })
16152 }
16153}
16154
16155#[cfg(feature = "server")]
16158impl std::convert::TryFrom<header::IntoHeaderValue<ImageDeleteResponseItem>> for HeaderValue {
16159 type Error = String;
16160
16161 fn try_from(hdr_value: header::IntoHeaderValue<ImageDeleteResponseItem>) -> std::result::Result<Self, Self::Error> {
16162 let hdr_value = hdr_value.to_string();
16163 match HeaderValue::from_str(&hdr_value) {
16164 std::result::Result::Ok(value) => std::result::Result::Ok(value),
16165 std::result::Result::Err(e) => std::result::Result::Err(
16166 format!("Invalid header value for ImageDeleteResponseItem - value: {} is invalid {}",
16167 hdr_value, e))
16168 }
16169 }
16170}
16171
16172#[cfg(feature = "server")]
16173impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ImageDeleteResponseItem> {
16174 type Error = String;
16175
16176 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
16177 match hdr_value.to_str() {
16178 std::result::Result::Ok(value) => {
16179 match <ImageDeleteResponseItem as std::str::FromStr>::from_str(value) {
16180 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
16181 std::result::Result::Err(err) => std::result::Result::Err(
16182 format!("Unable to convert header value '{}' into ImageDeleteResponseItem - {}",
16183 value, err))
16184 }
16185 },
16186 std::result::Result::Err(e) => std::result::Result::Err(
16187 format!("Unable to convert header: {:?} to string: {}",
16188 hdr_value, e))
16189 }
16190 }
16191}
16192
16193
16194
16195
16196#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
16201#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16202pub struct ImageSummary {
16203#[serde(rename = "Containers")]
16205 pub containers: i64,
16206
16207#[serde(rename = "Created")]
16209 pub created: i64,
16210
16211#[serde(rename = "Id")]
16213 pub id: String,
16214
16215#[serde(rename = "Labels")]
16217 pub labels: std::collections::HashMap<String, String>,
16218
16219#[serde(rename = "ParentId")]
16221 pub parent_id: String,
16222
16223#[serde(rename = "RepoDigests")]
16225 pub repo_digests: Vec<String>,
16226
16227#[serde(rename = "RepoTags")]
16229 pub repo_tags: Vec<String>,
16230
16231#[serde(rename = "SharedSize")]
16233 pub shared_size: i64,
16234
16235#[serde(rename = "Size")]
16237 pub size: i64,
16238
16239#[serde(rename = "VirtualSize")]
16241 pub virtual_size: i64,
16242
16243}
16244
16245
16246impl ImageSummary {
16247 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
16248 pub fn new(containers: i64, created: i64, id: String, labels: std::collections::HashMap<String, String>, parent_id: String, repo_digests: Vec<String>, repo_tags: Vec<String>, shared_size: i64, size: i64, virtual_size: i64, ) -> ImageSummary {
16249 ImageSummary {
16250 containers,
16251 created,
16252 id,
16253 labels,
16254 parent_id,
16255 repo_digests,
16256 repo_tags,
16257 shared_size,
16258 size,
16259 virtual_size,
16260 }
16261 }
16262}
16263
16264impl std::string::ToString for ImageSummary {
16268 fn to_string(&self) -> String {
16269 let params: Vec<Option<String>> = vec![
16270
16271 Some("Containers".to_string()),
16272 Some(self.containers.to_string()),
16273
16274
16275 Some("Created".to_string()),
16276 Some(self.created.to_string()),
16277
16278
16279 Some("Id".to_string()),
16280 Some(self.id.to_string()),
16281
16282 Some("ParentId".to_string()),
16286 Some(self.parent_id.to_string()),
16287
16288
16289 Some("RepoDigests".to_string()),
16290 Some(self.repo_digests.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
16291
16292
16293 Some("RepoTags".to_string()),
16294 Some(self.repo_tags.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
16295
16296
16297 Some("SharedSize".to_string()),
16298 Some(self.shared_size.to_string()),
16299
16300
16301 Some("Size".to_string()),
16302 Some(self.size.to_string()),
16303
16304
16305 Some("VirtualSize".to_string()),
16306 Some(self.virtual_size.to_string()),
16307
16308 ];
16309
16310 params.into_iter().flatten().collect::<Vec<_>>().join(",")
16311 }
16312}
16313
16314impl std::str::FromStr for ImageSummary {
16318 type Err = String;
16319
16320 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
16321 #[derive(Default)]
16323 #[allow(dead_code)]
16324 struct IntermediateRep {
16325 pub containers: Vec<i64>,
16326 pub created: Vec<i64>,
16327 pub id: Vec<String>,
16328 pub labels: Vec<std::collections::HashMap<String, String>>,
16329 pub parent_id: Vec<String>,
16330 pub repo_digests: Vec<Vec<String>>,
16331 pub repo_tags: Vec<Vec<String>>,
16332 pub shared_size: Vec<i64>,
16333 pub size: Vec<i64>,
16334 pub virtual_size: Vec<i64>,
16335 }
16336
16337 let mut intermediate_rep = IntermediateRep::default();
16338
16339 let mut string_iter = s.split(',');
16341 let mut key_result = string_iter.next();
16342
16343 while key_result.is_some() {
16344 let val = match string_iter.next() {
16345 Some(x) => x,
16346 None => return std::result::Result::Err("Missing value while parsing ImageSummary".to_string())
16347 };
16348
16349 if let Some(key) = key_result {
16350 #[allow(clippy::match_single_binding)]
16351 match key {
16352 #[allow(clippy::redundant_clone)]
16353 "Containers" => intermediate_rep.containers.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16354 #[allow(clippy::redundant_clone)]
16355 "Created" => intermediate_rep.created.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16356 #[allow(clippy::redundant_clone)]
16357 "Id" => intermediate_rep.id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16358 "Labels" => return std::result::Result::Err("Parsing a container in this style is not supported in ImageSummary".to_string()),
16359 #[allow(clippy::redundant_clone)]
16360 "ParentId" => intermediate_rep.parent_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16361 "RepoDigests" => return std::result::Result::Err("Parsing a container in this style is not supported in ImageSummary".to_string()),
16362 "RepoTags" => return std::result::Result::Err("Parsing a container in this style is not supported in ImageSummary".to_string()),
16363 #[allow(clippy::redundant_clone)]
16364 "SharedSize" => intermediate_rep.shared_size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16365 #[allow(clippy::redundant_clone)]
16366 "Size" => intermediate_rep.size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16367 #[allow(clippy::redundant_clone)]
16368 "VirtualSize" => intermediate_rep.virtual_size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16369 _ => return std::result::Result::Err("Unexpected key while parsing ImageSummary".to_string())
16370 }
16371 }
16372
16373 key_result = string_iter.next();
16375 }
16376
16377 std::result::Result::Ok(ImageSummary {
16379 containers: intermediate_rep.containers.into_iter().next().ok_or_else(|| "Containers missing in ImageSummary".to_string())?,
16380 created: intermediate_rep.created.into_iter().next().ok_or_else(|| "Created missing in ImageSummary".to_string())?,
16381 id: intermediate_rep.id.into_iter().next().ok_or_else(|| "Id missing in ImageSummary".to_string())?,
16382 labels: intermediate_rep.labels.into_iter().next().ok_or_else(|| "Labels missing in ImageSummary".to_string())?,
16383 parent_id: intermediate_rep.parent_id.into_iter().next().ok_or_else(|| "ParentId missing in ImageSummary".to_string())?,
16384 repo_digests: intermediate_rep.repo_digests.into_iter().next().ok_or_else(|| "RepoDigests missing in ImageSummary".to_string())?,
16385 repo_tags: intermediate_rep.repo_tags.into_iter().next().ok_or_else(|| "RepoTags missing in ImageSummary".to_string())?,
16386 shared_size: intermediate_rep.shared_size.into_iter().next().ok_or_else(|| "SharedSize missing in ImageSummary".to_string())?,
16387 size: intermediate_rep.size.into_iter().next().ok_or_else(|| "Size missing in ImageSummary".to_string())?,
16388 virtual_size: intermediate_rep.virtual_size.into_iter().next().ok_or_else(|| "VirtualSize missing in ImageSummary".to_string())?,
16389 })
16390 }
16391}
16392
16393#[cfg(feature = "server")]
16396impl std::convert::TryFrom<header::IntoHeaderValue<ImageSummary>> for HeaderValue {
16397 type Error = String;
16398
16399 fn try_from(hdr_value: header::IntoHeaderValue<ImageSummary>) -> std::result::Result<Self, Self::Error> {
16400 let hdr_value = hdr_value.to_string();
16401 match HeaderValue::from_str(&hdr_value) {
16402 std::result::Result::Ok(value) => std::result::Result::Ok(value),
16403 std::result::Result::Err(e) => std::result::Result::Err(
16404 format!("Invalid header value for ImageSummary - value: {} is invalid {}",
16405 hdr_value, e))
16406 }
16407 }
16408}
16409
16410#[cfg(feature = "server")]
16411impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ImageSummary> {
16412 type Error = String;
16413
16414 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
16415 match hdr_value.to_str() {
16416 std::result::Result::Ok(value) => {
16417 match <ImageSummary as std::str::FromStr>::from_str(value) {
16418 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
16419 std::result::Result::Err(err) => std::result::Result::Err(
16420 format!("Unable to convert header value '{}' into ImageSummary - {}",
16421 value, err))
16422 }
16423 },
16424 std::result::Result::Err(e) => std::result::Result::Err(
16425 format!("Unable to convert header: {:?} to string: {}",
16426 hdr_value, e))
16427 }
16428 }
16429}
16430
16431
16432
16433
16434#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
16439#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16440pub struct IntOrString {
16441 #[serde(rename = "IntVal")]
16442 #[serde(skip_serializing_if="Option::is_none")]
16443 pub int_val: Option<i32>,
16444
16445 #[serde(rename = "StrVal")]
16446 #[serde(skip_serializing_if="Option::is_none")]
16447 pub str_val: Option<String>,
16448
16449 #[serde(rename = "Type")]
16450 #[serde(skip_serializing_if="Option::is_none")]
16451 pub r#type: Option<i64>,
16452
16453}
16454
16455
16456impl IntOrString {
16457 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
16458 pub fn new() -> IntOrString {
16459 IntOrString {
16460 int_val: None,
16461 str_val: None,
16462 r#type: None,
16463 }
16464 }
16465}
16466
16467impl std::string::ToString for IntOrString {
16471 fn to_string(&self) -> String {
16472 let params: Vec<Option<String>> = vec![
16473
16474 self.int_val.as_ref().map(|int_val| {
16475 [
16476 "IntVal".to_string(),
16477 int_val.to_string(),
16478 ].join(",")
16479 }),
16480
16481
16482 self.str_val.as_ref().map(|str_val| {
16483 [
16484 "StrVal".to_string(),
16485 str_val.to_string(),
16486 ].join(",")
16487 }),
16488
16489
16490 self.r#type.as_ref().map(|r#type| {
16491 [
16492 "Type".to_string(),
16493 r#type.to_string(),
16494 ].join(",")
16495 }),
16496
16497 ];
16498
16499 params.into_iter().flatten().collect::<Vec<_>>().join(",")
16500 }
16501}
16502
16503impl std::str::FromStr for IntOrString {
16507 type Err = String;
16508
16509 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
16510 #[derive(Default)]
16512 #[allow(dead_code)]
16513 struct IntermediateRep {
16514 pub int_val: Vec<i32>,
16515 pub str_val: Vec<String>,
16516 pub r#type: Vec<i64>,
16517 }
16518
16519 let mut intermediate_rep = IntermediateRep::default();
16520
16521 let mut string_iter = s.split(',');
16523 let mut key_result = string_iter.next();
16524
16525 while key_result.is_some() {
16526 let val = match string_iter.next() {
16527 Some(x) => x,
16528 None => return std::result::Result::Err("Missing value while parsing IntOrString".to_string())
16529 };
16530
16531 if let Some(key) = key_result {
16532 #[allow(clippy::match_single_binding)]
16533 match key {
16534 #[allow(clippy::redundant_clone)]
16535 "IntVal" => intermediate_rep.int_val.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16536 #[allow(clippy::redundant_clone)]
16537 "StrVal" => intermediate_rep.str_val.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16538 #[allow(clippy::redundant_clone)]
16539 "Type" => intermediate_rep.r#type.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16540 _ => return std::result::Result::Err("Unexpected key while parsing IntOrString".to_string())
16541 }
16542 }
16543
16544 key_result = string_iter.next();
16546 }
16547
16548 std::result::Result::Ok(IntOrString {
16550 int_val: intermediate_rep.int_val.into_iter().next(),
16551 str_val: intermediate_rep.str_val.into_iter().next(),
16552 r#type: intermediate_rep.r#type.into_iter().next(),
16553 })
16554 }
16555}
16556
16557#[cfg(feature = "server")]
16560impl std::convert::TryFrom<header::IntoHeaderValue<IntOrString>> for HeaderValue {
16561 type Error = String;
16562
16563 fn try_from(hdr_value: header::IntoHeaderValue<IntOrString>) -> std::result::Result<Self, Self::Error> {
16564 let hdr_value = hdr_value.to_string();
16565 match HeaderValue::from_str(&hdr_value) {
16566 std::result::Result::Ok(value) => std::result::Result::Ok(value),
16567 std::result::Result::Err(e) => std::result::Result::Err(
16568 format!("Invalid header value for IntOrString - value: {} is invalid {}",
16569 hdr_value, e))
16570 }
16571 }
16572}
16573
16574#[cfg(feature = "server")]
16575impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<IntOrString> {
16576 type Error = String;
16577
16578 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
16579 match hdr_value.to_str() {
16580 std::result::Result::Ok(value) => {
16581 match <IntOrString as std::str::FromStr>::from_str(value) {
16582 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
16583 std::result::Result::Err(err) => std::result::Result::Err(
16584 format!("Unable to convert header value '{}' into IntOrString - {}",
16585 value, err))
16586 }
16587 },
16588 std::result::Result::Err(e) => std::result::Result::Err(
16589 format!("Unable to convert header: {:?} to string: {}",
16590 hdr_value, e))
16591 }
16592 }
16593}
16594
16595
16596
16597
16598#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
16599#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16600pub struct IpcMode(String);
16601
16602impl validator::Validate for IpcMode {
16603 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
16604 std::result::Result::Ok(())
16605 }
16606}
16607
16608impl std::convert::From<String> for IpcMode {
16609 fn from(x: String) -> Self {
16610 IpcMode(x)
16611 }
16612}
16613
16614impl std::string::ToString for IpcMode {
16615 fn to_string(&self) -> String {
16616 self.0.to_string()
16617 }
16618}
16619
16620impl std::str::FromStr for IpcMode {
16621 type Err = std::string::ParseError;
16622 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
16623 std::result::Result::Ok(IpcMode(x.to_string()))
16624 }
16625}
16626
16627impl std::convert::From<IpcMode> for String {
16628 fn from(x: IpcMode) -> Self {
16629 x.0
16630 }
16631}
16632
16633impl std::ops::Deref for IpcMode {
16634 type Target = String;
16635 fn deref(&self) -> &String {
16636 &self.0
16637 }
16638}
16639
16640impl std::ops::DerefMut for IpcMode {
16641 fn deref_mut(&mut self) -> &mut String {
16642 &mut self.0
16643 }
16644}
16645
16646
16647
16648#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
16653#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16654pub struct IscsiVolumeSource {
16655#[serde(rename = "chapAuthDiscovery")]
16657 #[serde(skip_serializing_if="Option::is_none")]
16658 pub chap_auth_discovery: Option<bool>,
16659
16660#[serde(rename = "chapAuthSession")]
16662 #[serde(skip_serializing_if="Option::is_none")]
16663 pub chap_auth_session: Option<bool>,
16664
16665#[serde(rename = "fsType")]
16667 #[serde(skip_serializing_if="Option::is_none")]
16668 pub fs_type: Option<String>,
16669
16670#[serde(rename = "initiatorName")]
16672 #[serde(skip_serializing_if="Option::is_none")]
16673 pub initiator_name: Option<String>,
16674
16675#[serde(rename = "iqn")]
16677 #[serde(skip_serializing_if="Option::is_none")]
16678 pub iqn: Option<String>,
16679
16680#[serde(rename = "iscsiInterface")]
16682 #[serde(skip_serializing_if="Option::is_none")]
16683 pub iscsi_interface: Option<String>,
16684
16685#[serde(rename = "lun")]
16687 #[serde(skip_serializing_if="Option::is_none")]
16688 pub lun: Option<i32>,
16689
16690#[serde(rename = "portals")]
16692 #[serde(skip_serializing_if="Option::is_none")]
16693 pub portals: Option<Vec<String>>,
16694
16695#[serde(rename = "readOnly")]
16697 #[serde(skip_serializing_if="Option::is_none")]
16698 pub read_only: Option<bool>,
16699
16700 #[serde(rename = "secretRef")]
16701 #[serde(skip_serializing_if="Option::is_none")]
16702 pub secret_ref: Option<models::LocalObjectReference>,
16703
16704#[serde(rename = "targetPortal")]
16706 #[serde(skip_serializing_if="Option::is_none")]
16707 pub target_portal: Option<String>,
16708
16709}
16710
16711
16712impl IscsiVolumeSource {
16713 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
16714 pub fn new() -> IscsiVolumeSource {
16715 IscsiVolumeSource {
16716 chap_auth_discovery: None,
16717 chap_auth_session: None,
16718 fs_type: None,
16719 initiator_name: None,
16720 iqn: None,
16721 iscsi_interface: None,
16722 lun: None,
16723 portals: None,
16724 read_only: None,
16725 secret_ref: None,
16726 target_portal: None,
16727 }
16728 }
16729}
16730
16731impl std::string::ToString for IscsiVolumeSource {
16735 fn to_string(&self) -> String {
16736 let params: Vec<Option<String>> = vec![
16737
16738 self.chap_auth_discovery.as_ref().map(|chap_auth_discovery| {
16739 [
16740 "chapAuthDiscovery".to_string(),
16741 chap_auth_discovery.to_string(),
16742 ].join(",")
16743 }),
16744
16745
16746 self.chap_auth_session.as_ref().map(|chap_auth_session| {
16747 [
16748 "chapAuthSession".to_string(),
16749 chap_auth_session.to_string(),
16750 ].join(",")
16751 }),
16752
16753
16754 self.fs_type.as_ref().map(|fs_type| {
16755 [
16756 "fsType".to_string(),
16757 fs_type.to_string(),
16758 ].join(",")
16759 }),
16760
16761
16762 self.initiator_name.as_ref().map(|initiator_name| {
16763 [
16764 "initiatorName".to_string(),
16765 initiator_name.to_string(),
16766 ].join(",")
16767 }),
16768
16769
16770 self.iqn.as_ref().map(|iqn| {
16771 [
16772 "iqn".to_string(),
16773 iqn.to_string(),
16774 ].join(",")
16775 }),
16776
16777
16778 self.iscsi_interface.as_ref().map(|iscsi_interface| {
16779 [
16780 "iscsiInterface".to_string(),
16781 iscsi_interface.to_string(),
16782 ].join(",")
16783 }),
16784
16785
16786 self.lun.as_ref().map(|lun| {
16787 [
16788 "lun".to_string(),
16789 lun.to_string(),
16790 ].join(",")
16791 }),
16792
16793
16794 self.portals.as_ref().map(|portals| {
16795 [
16796 "portals".to_string(),
16797 portals.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
16798 ].join(",")
16799 }),
16800
16801
16802 self.read_only.as_ref().map(|read_only| {
16803 [
16804 "readOnly".to_string(),
16805 read_only.to_string(),
16806 ].join(",")
16807 }),
16808
16809 self.target_portal.as_ref().map(|target_portal| {
16813 [
16814 "targetPortal".to_string(),
16815 target_portal.to_string(),
16816 ].join(",")
16817 }),
16818
16819 ];
16820
16821 params.into_iter().flatten().collect::<Vec<_>>().join(",")
16822 }
16823}
16824
16825impl std::str::FromStr for IscsiVolumeSource {
16829 type Err = String;
16830
16831 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
16832 #[derive(Default)]
16834 #[allow(dead_code)]
16835 struct IntermediateRep {
16836 pub chap_auth_discovery: Vec<bool>,
16837 pub chap_auth_session: Vec<bool>,
16838 pub fs_type: Vec<String>,
16839 pub initiator_name: Vec<String>,
16840 pub iqn: Vec<String>,
16841 pub iscsi_interface: Vec<String>,
16842 pub lun: Vec<i32>,
16843 pub portals: Vec<Vec<String>>,
16844 pub read_only: Vec<bool>,
16845 pub secret_ref: Vec<models::LocalObjectReference>,
16846 pub target_portal: Vec<String>,
16847 }
16848
16849 let mut intermediate_rep = IntermediateRep::default();
16850
16851 let mut string_iter = s.split(',');
16853 let mut key_result = string_iter.next();
16854
16855 while key_result.is_some() {
16856 let val = match string_iter.next() {
16857 Some(x) => x,
16858 None => return std::result::Result::Err("Missing value while parsing IscsiVolumeSource".to_string())
16859 };
16860
16861 if let Some(key) = key_result {
16862 #[allow(clippy::match_single_binding)]
16863 match key {
16864 #[allow(clippy::redundant_clone)]
16865 "chapAuthDiscovery" => intermediate_rep.chap_auth_discovery.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16866 #[allow(clippy::redundant_clone)]
16867 "chapAuthSession" => intermediate_rep.chap_auth_session.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16868 #[allow(clippy::redundant_clone)]
16869 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16870 #[allow(clippy::redundant_clone)]
16871 "initiatorName" => intermediate_rep.initiator_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16872 #[allow(clippy::redundant_clone)]
16873 "iqn" => intermediate_rep.iqn.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16874 #[allow(clippy::redundant_clone)]
16875 "iscsiInterface" => intermediate_rep.iscsi_interface.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16876 #[allow(clippy::redundant_clone)]
16877 "lun" => intermediate_rep.lun.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16878 "portals" => return std::result::Result::Err("Parsing a container in this style is not supported in IscsiVolumeSource".to_string()),
16879 #[allow(clippy::redundant_clone)]
16880 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16881 #[allow(clippy::redundant_clone)]
16882 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16883 #[allow(clippy::redundant_clone)]
16884 "targetPortal" => intermediate_rep.target_portal.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
16885 _ => return std::result::Result::Err("Unexpected key while parsing IscsiVolumeSource".to_string())
16886 }
16887 }
16888
16889 key_result = string_iter.next();
16891 }
16892
16893 std::result::Result::Ok(IscsiVolumeSource {
16895 chap_auth_discovery: intermediate_rep.chap_auth_discovery.into_iter().next(),
16896 chap_auth_session: intermediate_rep.chap_auth_session.into_iter().next(),
16897 fs_type: intermediate_rep.fs_type.into_iter().next(),
16898 initiator_name: intermediate_rep.initiator_name.into_iter().next(),
16899 iqn: intermediate_rep.iqn.into_iter().next(),
16900 iscsi_interface: intermediate_rep.iscsi_interface.into_iter().next(),
16901 lun: intermediate_rep.lun.into_iter().next(),
16902 portals: intermediate_rep.portals.into_iter().next(),
16903 read_only: intermediate_rep.read_only.into_iter().next(),
16904 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
16905 target_portal: intermediate_rep.target_portal.into_iter().next(),
16906 })
16907 }
16908}
16909
16910#[cfg(feature = "server")]
16913impl std::convert::TryFrom<header::IntoHeaderValue<IscsiVolumeSource>> for HeaderValue {
16914 type Error = String;
16915
16916 fn try_from(hdr_value: header::IntoHeaderValue<IscsiVolumeSource>) -> std::result::Result<Self, Self::Error> {
16917 let hdr_value = hdr_value.to_string();
16918 match HeaderValue::from_str(&hdr_value) {
16919 std::result::Result::Ok(value) => std::result::Result::Ok(value),
16920 std::result::Result::Err(e) => std::result::Result::Err(
16921 format!("Invalid header value for IscsiVolumeSource - value: {} is invalid {}",
16922 hdr_value, e))
16923 }
16924 }
16925}
16926
16927#[cfg(feature = "server")]
16928impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<IscsiVolumeSource> {
16929 type Error = String;
16930
16931 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
16932 match hdr_value.to_str() {
16933 std::result::Result::Ok(value) => {
16934 match <IscsiVolumeSource as std::str::FromStr>::from_str(value) {
16935 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
16936 std::result::Result::Err(err) => std::result::Result::Err(
16937 format!("Unable to convert header value '{}' into IscsiVolumeSource - {}",
16938 value, err))
16939 }
16940 },
16941 std::result::Result::Err(e) => std::result::Result::Err(
16942 format!("Unable to convert header: {:?} to string: {}",
16943 hdr_value, e))
16944 }
16945 }
16946}
16947
16948
16949
16950
16951#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
16953#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
16954pub struct Isolation(String);
16955
16956impl validator::Validate for Isolation {
16957 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
16958 std::result::Result::Ok(())
16959 }
16960}
16961
16962impl std::convert::From<String> for Isolation {
16963 fn from(x: String) -> Self {
16964 Isolation(x)
16965 }
16966}
16967
16968impl std::string::ToString for Isolation {
16969 fn to_string(&self) -> String {
16970 self.0.to_string()
16971 }
16972}
16973
16974impl std::str::FromStr for Isolation {
16975 type Err = std::string::ParseError;
16976 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
16977 std::result::Result::Ok(Isolation(x.to_string()))
16978 }
16979}
16980
16981impl std::convert::From<Isolation> for String {
16982 fn from(x: Isolation) -> Self {
16983 x.0
16984 }
16985}
16986
16987impl std::ops::Deref for Isolation {
16988 type Target = String;
16989 fn deref(&self) -> &String {
16990 &self.0
16991 }
16992}
16993
16994impl std::ops::DerefMut for Isolation {
16995 fn deref_mut(&mut self) -> &mut String {
16996 &mut self.0
16997 }
16998}
16999
17000
17001
17002
17003
17004
17005#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
17006#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
17007pub struct KeyToPath {
17008#[serde(rename = "key")]
17010 #[serde(skip_serializing_if="Option::is_none")]
17011 pub key: Option<String>,
17012
17013#[serde(rename = "mode")]
17015 #[serde(skip_serializing_if="Option::is_none")]
17016 pub mode: Option<i32>,
17017
17018#[serde(rename = "path")]
17020 #[serde(skip_serializing_if="Option::is_none")]
17021 pub path: Option<String>,
17022
17023}
17024
17025
17026impl KeyToPath {
17027 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
17028 pub fn new() -> KeyToPath {
17029 KeyToPath {
17030 key: None,
17031 mode: None,
17032 path: None,
17033 }
17034 }
17035}
17036
17037impl std::string::ToString for KeyToPath {
17041 fn to_string(&self) -> String {
17042 let params: Vec<Option<String>> = vec![
17043
17044 self.key.as_ref().map(|key| {
17045 [
17046 "key".to_string(),
17047 key.to_string(),
17048 ].join(",")
17049 }),
17050
17051
17052 self.mode.as_ref().map(|mode| {
17053 [
17054 "mode".to_string(),
17055 mode.to_string(),
17056 ].join(",")
17057 }),
17058
17059
17060 self.path.as_ref().map(|path| {
17061 [
17062 "path".to_string(),
17063 path.to_string(),
17064 ].join(",")
17065 }),
17066
17067 ];
17068
17069 params.into_iter().flatten().collect::<Vec<_>>().join(",")
17070 }
17071}
17072
17073impl std::str::FromStr for KeyToPath {
17077 type Err = String;
17078
17079 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
17080 #[derive(Default)]
17082 #[allow(dead_code)]
17083 struct IntermediateRep {
17084 pub key: Vec<String>,
17085 pub mode: Vec<i32>,
17086 pub path: Vec<String>,
17087 }
17088
17089 let mut intermediate_rep = IntermediateRep::default();
17090
17091 let mut string_iter = s.split(',');
17093 let mut key_result = string_iter.next();
17094
17095 while key_result.is_some() {
17096 let val = match string_iter.next() {
17097 Some(x) => x,
17098 None => return std::result::Result::Err("Missing value while parsing KeyToPath".to_string())
17099 };
17100
17101 if let Some(key) = key_result {
17102 #[allow(clippy::match_single_binding)]
17103 match key {
17104 #[allow(clippy::redundant_clone)]
17105 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17106 #[allow(clippy::redundant_clone)]
17107 "mode" => intermediate_rep.mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17108 #[allow(clippy::redundant_clone)]
17109 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17110 _ => return std::result::Result::Err("Unexpected key while parsing KeyToPath".to_string())
17111 }
17112 }
17113
17114 key_result = string_iter.next();
17116 }
17117
17118 std::result::Result::Ok(KeyToPath {
17120 key: intermediate_rep.key.into_iter().next(),
17121 mode: intermediate_rep.mode.into_iter().next(),
17122 path: intermediate_rep.path.into_iter().next(),
17123 })
17124 }
17125}
17126
17127#[cfg(feature = "server")]
17130impl std::convert::TryFrom<header::IntoHeaderValue<KeyToPath>> for HeaderValue {
17131 type Error = String;
17132
17133 fn try_from(hdr_value: header::IntoHeaderValue<KeyToPath>) -> std::result::Result<Self, Self::Error> {
17134 let hdr_value = hdr_value.to_string();
17135 match HeaderValue::from_str(&hdr_value) {
17136 std::result::Result::Ok(value) => std::result::Result::Ok(value),
17137 std::result::Result::Err(e) => std::result::Result::Err(
17138 format!("Invalid header value for KeyToPath - value: {} is invalid {}",
17139 hdr_value, e))
17140 }
17141 }
17142}
17143
17144#[cfg(feature = "server")]
17145impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<KeyToPath> {
17146 type Error = String;
17147
17148 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
17149 match hdr_value.to_str() {
17150 std::result::Result::Ok(value) => {
17151 match <KeyToPath as std::str::FromStr>::from_str(value) {
17152 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
17153 std::result::Result::Err(err) => std::result::Result::Err(
17154 format!("Unable to convert header value '{}' into KeyToPath - {}",
17155 value, err))
17156 }
17157 },
17158 std::result::Result::Err(e) => std::result::Result::Err(
17159 format!("Unable to convert header: {:?} to string: {}",
17160 hdr_value, e))
17161 }
17162 }
17163}
17164
17165
17166
17167
17168#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
17173#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
17174pub struct KubernetesConfig {
17175 #[serde(rename = "connection")]
17176 #[serde(skip_serializing_if="Option::is_none")]
17177 pub connection: Option<models::KubernetesConnectionConfig>,
17178
17179 #[serde(rename = "pod")]
17180 #[serde(skip_serializing_if="Option::is_none")]
17181 pub pod: Option<models::KubernetesPodConfig>,
17182
17183 #[serde(rename = "timeouts")]
17184 #[serde(skip_serializing_if="Option::is_none")]
17185 pub timeouts: Option<models::KubernetesTimeoutConfig>,
17186
17187}
17188
17189
17190impl KubernetesConfig {
17191 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
17192 pub fn new() -> KubernetesConfig {
17193 KubernetesConfig {
17194 connection: None,
17195 pod: None,
17196 timeouts: None,
17197 }
17198 }
17199}
17200
17201impl std::string::ToString for KubernetesConfig {
17205 fn to_string(&self) -> String {
17206 let params: Vec<Option<String>> = vec![
17207 ];
17214
17215 params.into_iter().flatten().collect::<Vec<_>>().join(",")
17216 }
17217}
17218
17219impl std::str::FromStr for KubernetesConfig {
17223 type Err = String;
17224
17225 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
17226 #[derive(Default)]
17228 #[allow(dead_code)]
17229 struct IntermediateRep {
17230 pub connection: Vec<models::KubernetesConnectionConfig>,
17231 pub pod: Vec<models::KubernetesPodConfig>,
17232 pub timeouts: Vec<models::KubernetesTimeoutConfig>,
17233 }
17234
17235 let mut intermediate_rep = IntermediateRep::default();
17236
17237 let mut string_iter = s.split(',');
17239 let mut key_result = string_iter.next();
17240
17241 while key_result.is_some() {
17242 let val = match string_iter.next() {
17243 Some(x) => x,
17244 None => return std::result::Result::Err("Missing value while parsing KubernetesConfig".to_string())
17245 };
17246
17247 if let Some(key) = key_result {
17248 #[allow(clippy::match_single_binding)]
17249 match key {
17250 #[allow(clippy::redundant_clone)]
17251 "connection" => intermediate_rep.connection.push(<models::KubernetesConnectionConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17252 #[allow(clippy::redundant_clone)]
17253 "pod" => intermediate_rep.pod.push(<models::KubernetesPodConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17254 #[allow(clippy::redundant_clone)]
17255 "timeouts" => intermediate_rep.timeouts.push(<models::KubernetesTimeoutConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17256 _ => return std::result::Result::Err("Unexpected key while parsing KubernetesConfig".to_string())
17257 }
17258 }
17259
17260 key_result = string_iter.next();
17262 }
17263
17264 std::result::Result::Ok(KubernetesConfig {
17266 connection: intermediate_rep.connection.into_iter().next(),
17267 pod: intermediate_rep.pod.into_iter().next(),
17268 timeouts: intermediate_rep.timeouts.into_iter().next(),
17269 })
17270 }
17271}
17272
17273#[cfg(feature = "server")]
17276impl std::convert::TryFrom<header::IntoHeaderValue<KubernetesConfig>> for HeaderValue {
17277 type Error = String;
17278
17279 fn try_from(hdr_value: header::IntoHeaderValue<KubernetesConfig>) -> std::result::Result<Self, Self::Error> {
17280 let hdr_value = hdr_value.to_string();
17281 match HeaderValue::from_str(&hdr_value) {
17282 std::result::Result::Ok(value) => std::result::Result::Ok(value),
17283 std::result::Result::Err(e) => std::result::Result::Err(
17284 format!("Invalid header value for KubernetesConfig - value: {} is invalid {}",
17285 hdr_value, e))
17286 }
17287 }
17288}
17289
17290#[cfg(feature = "server")]
17291impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<KubernetesConfig> {
17292 type Error = String;
17293
17294 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
17295 match hdr_value.to_str() {
17296 std::result::Result::Ok(value) => {
17297 match <KubernetesConfig as std::str::FromStr>::from_str(value) {
17298 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
17299 std::result::Result::Err(err) => std::result::Result::Err(
17300 format!("Unable to convert header value '{}' into KubernetesConfig - {}",
17301 value, err))
17302 }
17303 },
17304 std::result::Result::Err(e) => std::result::Result::Err(
17305 format!("Unable to convert header: {:?} to string: {}",
17306 hdr_value, e))
17307 }
17308 }
17309}
17310
17311
17312
17313
17314#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
17319#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
17320pub struct KubernetesConnectionConfig {
17321#[serde(rename = "bearerToken")]
17323 #[serde(skip_serializing_if="Option::is_none")]
17324 pub bearer_token: Option<String>,
17325
17326#[serde(rename = "bearerTokenFile")]
17328 #[serde(skip_serializing_if="Option::is_none")]
17329 pub bearer_token_file: Option<String>,
17330
17331#[serde(rename = "burst")]
17333 #[serde(skip_serializing_if="Option::is_none")]
17334 pub burst: Option<i64>,
17335
17336#[serde(rename = "cacert")]
17338 #[serde(skip_serializing_if="Option::is_none")]
17339 pub cacert: Option<String>,
17340
17341#[serde(rename = "cacertFile")]
17343 #[serde(skip_serializing_if="Option::is_none")]
17344 pub cacert_file: Option<String>,
17345
17346#[serde(rename = "cert")]
17348 #[serde(skip_serializing_if="Option::is_none")]
17349 pub cert: Option<String>,
17350
17351#[serde(rename = "certFile")]
17353 #[serde(skip_serializing_if="Option::is_none")]
17354 pub cert_file: Option<String>,
17355
17356#[serde(rename = "host")]
17358 #[serde(skip_serializing_if="Option::is_none")]
17359 pub host: Option<String>,
17360
17361#[serde(rename = "key")]
17363 #[serde(skip_serializing_if="Option::is_none")]
17364 pub key: Option<String>,
17365
17366#[serde(rename = "keyFile")]
17368 #[serde(skip_serializing_if="Option::is_none")]
17369 pub key_file: Option<String>,
17370
17371#[serde(rename = "password")]
17373 #[serde(skip_serializing_if="Option::is_none")]
17374 pub password: Option<String>,
17375
17376#[serde(rename = "path")]
17378 #[serde(skip_serializing_if="Option::is_none")]
17379 pub path: Option<String>,
17380
17381#[serde(rename = "qps")]
17383 #[serde(skip_serializing_if="Option::is_none")]
17384 pub qps: Option<f32>,
17385
17386#[serde(rename = "serverName")]
17388 #[serde(skip_serializing_if="Option::is_none")]
17389 pub server_name: Option<String>,
17390
17391#[serde(rename = "username")]
17393 #[serde(skip_serializing_if="Option::is_none")]
17394 pub username: Option<String>,
17395
17396}
17397
17398
17399impl KubernetesConnectionConfig {
17400 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
17401 pub fn new() -> KubernetesConnectionConfig {
17402 KubernetesConnectionConfig {
17403 bearer_token: None,
17404 bearer_token_file: None,
17405 burst: None,
17406 cacert: None,
17407 cacert_file: None,
17408 cert: None,
17409 cert_file: None,
17410 host: None,
17411 key: None,
17412 key_file: None,
17413 password: None,
17414 path: None,
17415 qps: None,
17416 server_name: None,
17417 username: None,
17418 }
17419 }
17420}
17421
17422impl std::string::ToString for KubernetesConnectionConfig {
17426 fn to_string(&self) -> String {
17427 let params: Vec<Option<String>> = vec![
17428
17429 self.bearer_token.as_ref().map(|bearer_token| {
17430 [
17431 "bearerToken".to_string(),
17432 bearer_token.to_string(),
17433 ].join(",")
17434 }),
17435
17436
17437 self.bearer_token_file.as_ref().map(|bearer_token_file| {
17438 [
17439 "bearerTokenFile".to_string(),
17440 bearer_token_file.to_string(),
17441 ].join(",")
17442 }),
17443
17444
17445 self.burst.as_ref().map(|burst| {
17446 [
17447 "burst".to_string(),
17448 burst.to_string(),
17449 ].join(",")
17450 }),
17451
17452
17453 self.cacert.as_ref().map(|cacert| {
17454 [
17455 "cacert".to_string(),
17456 cacert.to_string(),
17457 ].join(",")
17458 }),
17459
17460
17461 self.cacert_file.as_ref().map(|cacert_file| {
17462 [
17463 "cacertFile".to_string(),
17464 cacert_file.to_string(),
17465 ].join(",")
17466 }),
17467
17468
17469 self.cert.as_ref().map(|cert| {
17470 [
17471 "cert".to_string(),
17472 cert.to_string(),
17473 ].join(",")
17474 }),
17475
17476
17477 self.cert_file.as_ref().map(|cert_file| {
17478 [
17479 "certFile".to_string(),
17480 cert_file.to_string(),
17481 ].join(",")
17482 }),
17483
17484
17485 self.host.as_ref().map(|host| {
17486 [
17487 "host".to_string(),
17488 host.to_string(),
17489 ].join(",")
17490 }),
17491
17492
17493 self.key.as_ref().map(|key| {
17494 [
17495 "key".to_string(),
17496 key.to_string(),
17497 ].join(",")
17498 }),
17499
17500
17501 self.key_file.as_ref().map(|key_file| {
17502 [
17503 "keyFile".to_string(),
17504 key_file.to_string(),
17505 ].join(",")
17506 }),
17507
17508
17509 self.password.as_ref().map(|password| {
17510 [
17511 "password".to_string(),
17512 password.to_string(),
17513 ].join(",")
17514 }),
17515
17516
17517 self.path.as_ref().map(|path| {
17518 [
17519 "path".to_string(),
17520 path.to_string(),
17521 ].join(",")
17522 }),
17523
17524
17525 self.qps.as_ref().map(|qps| {
17526 [
17527 "qps".to_string(),
17528 qps.to_string(),
17529 ].join(",")
17530 }),
17531
17532
17533 self.server_name.as_ref().map(|server_name| {
17534 [
17535 "serverName".to_string(),
17536 server_name.to_string(),
17537 ].join(",")
17538 }),
17539
17540
17541 self.username.as_ref().map(|username| {
17542 [
17543 "username".to_string(),
17544 username.to_string(),
17545 ].join(",")
17546 }),
17547
17548 ];
17549
17550 params.into_iter().flatten().collect::<Vec<_>>().join(",")
17551 }
17552}
17553
17554impl std::str::FromStr for KubernetesConnectionConfig {
17558 type Err = String;
17559
17560 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
17561 #[derive(Default)]
17563 #[allow(dead_code)]
17564 struct IntermediateRep {
17565 pub bearer_token: Vec<String>,
17566 pub bearer_token_file: Vec<String>,
17567 pub burst: Vec<i64>,
17568 pub cacert: Vec<String>,
17569 pub cacert_file: Vec<String>,
17570 pub cert: Vec<String>,
17571 pub cert_file: Vec<String>,
17572 pub host: Vec<String>,
17573 pub key: Vec<String>,
17574 pub key_file: Vec<String>,
17575 pub password: Vec<String>,
17576 pub path: Vec<String>,
17577 pub qps: Vec<f32>,
17578 pub server_name: Vec<String>,
17579 pub username: Vec<String>,
17580 }
17581
17582 let mut intermediate_rep = IntermediateRep::default();
17583
17584 let mut string_iter = s.split(',');
17586 let mut key_result = string_iter.next();
17587
17588 while key_result.is_some() {
17589 let val = match string_iter.next() {
17590 Some(x) => x,
17591 None => return std::result::Result::Err("Missing value while parsing KubernetesConnectionConfig".to_string())
17592 };
17593
17594 if let Some(key) = key_result {
17595 #[allow(clippy::match_single_binding)]
17596 match key {
17597 #[allow(clippy::redundant_clone)]
17598 "bearerToken" => intermediate_rep.bearer_token.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17599 #[allow(clippy::redundant_clone)]
17600 "bearerTokenFile" => intermediate_rep.bearer_token_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17601 #[allow(clippy::redundant_clone)]
17602 "burst" => intermediate_rep.burst.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17603 #[allow(clippy::redundant_clone)]
17604 "cacert" => intermediate_rep.cacert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17605 #[allow(clippy::redundant_clone)]
17606 "cacertFile" => intermediate_rep.cacert_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17607 #[allow(clippy::redundant_clone)]
17608 "cert" => intermediate_rep.cert.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17609 #[allow(clippy::redundant_clone)]
17610 "certFile" => intermediate_rep.cert_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17611 #[allow(clippy::redundant_clone)]
17612 "host" => intermediate_rep.host.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17613 #[allow(clippy::redundant_clone)]
17614 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17615 #[allow(clippy::redundant_clone)]
17616 "keyFile" => intermediate_rep.key_file.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17617 #[allow(clippy::redundant_clone)]
17618 "password" => intermediate_rep.password.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17619 #[allow(clippy::redundant_clone)]
17620 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17621 #[allow(clippy::redundant_clone)]
17622 "qps" => intermediate_rep.qps.push(<f32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17623 #[allow(clippy::redundant_clone)]
17624 "serverName" => intermediate_rep.server_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17625 #[allow(clippy::redundant_clone)]
17626 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17627 _ => return std::result::Result::Err("Unexpected key while parsing KubernetesConnectionConfig".to_string())
17628 }
17629 }
17630
17631 key_result = string_iter.next();
17633 }
17634
17635 std::result::Result::Ok(KubernetesConnectionConfig {
17637 bearer_token: intermediate_rep.bearer_token.into_iter().next(),
17638 bearer_token_file: intermediate_rep.bearer_token_file.into_iter().next(),
17639 burst: intermediate_rep.burst.into_iter().next(),
17640 cacert: intermediate_rep.cacert.into_iter().next(),
17641 cacert_file: intermediate_rep.cacert_file.into_iter().next(),
17642 cert: intermediate_rep.cert.into_iter().next(),
17643 cert_file: intermediate_rep.cert_file.into_iter().next(),
17644 host: intermediate_rep.host.into_iter().next(),
17645 key: intermediate_rep.key.into_iter().next(),
17646 key_file: intermediate_rep.key_file.into_iter().next(),
17647 password: intermediate_rep.password.into_iter().next(),
17648 path: intermediate_rep.path.into_iter().next(),
17649 qps: intermediate_rep.qps.into_iter().next(),
17650 server_name: intermediate_rep.server_name.into_iter().next(),
17651 username: intermediate_rep.username.into_iter().next(),
17652 })
17653 }
17654}
17655
17656#[cfg(feature = "server")]
17659impl std::convert::TryFrom<header::IntoHeaderValue<KubernetesConnectionConfig>> for HeaderValue {
17660 type Error = String;
17661
17662 fn try_from(hdr_value: header::IntoHeaderValue<KubernetesConnectionConfig>) -> std::result::Result<Self, Self::Error> {
17663 let hdr_value = hdr_value.to_string();
17664 match HeaderValue::from_str(&hdr_value) {
17665 std::result::Result::Ok(value) => std::result::Result::Ok(value),
17666 std::result::Result::Err(e) => std::result::Result::Err(
17667 format!("Invalid header value for KubernetesConnectionConfig - value: {} is invalid {}",
17668 hdr_value, e))
17669 }
17670 }
17671}
17672
17673#[cfg(feature = "server")]
17674impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<KubernetesConnectionConfig> {
17675 type Error = String;
17676
17677 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
17678 match hdr_value.to_str() {
17679 std::result::Result::Ok(value) => {
17680 match <KubernetesConnectionConfig as std::str::FromStr>::from_str(value) {
17681 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
17682 std::result::Result::Err(err) => std::result::Result::Err(
17683 format!("Unable to convert header value '{}' into KubernetesConnectionConfig - {}",
17684 value, err))
17685 }
17686 },
17687 std::result::Result::Err(e) => std::result::Result::Err(
17688 format!("Unable to convert header: {:?} to string: {}",
17689 hdr_value, e))
17690 }
17691 }
17692}
17693
17694
17695
17696
17697#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
17699#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
17700pub struct KubernetesExecutionMode(String);
17701
17702impl validator::Validate for KubernetesExecutionMode {
17703 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
17704 std::result::Result::Ok(())
17705 }
17706}
17707
17708impl std::convert::From<String> for KubernetesExecutionMode {
17709 fn from(x: String) -> Self {
17710 KubernetesExecutionMode(x)
17711 }
17712}
17713
17714impl std::string::ToString for KubernetesExecutionMode {
17715 fn to_string(&self) -> String {
17716 self.0.to_string()
17717 }
17718}
17719
17720impl std::str::FromStr for KubernetesExecutionMode {
17721 type Err = std::string::ParseError;
17722 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
17723 std::result::Result::Ok(KubernetesExecutionMode(x.to_string()))
17724 }
17725}
17726
17727impl std::convert::From<KubernetesExecutionMode> for String {
17728 fn from(x: KubernetesExecutionMode) -> Self {
17729 x.0
17730 }
17731}
17732
17733impl std::ops::Deref for KubernetesExecutionMode {
17734 type Target = String;
17735 fn deref(&self) -> &String {
17736 &self.0
17737 }
17738}
17739
17740impl std::ops::DerefMut for KubernetesExecutionMode {
17741 fn deref_mut(&mut self) -> &mut String {
17742 &mut self.0
17743 }
17744}
17745
17746
17747
17748#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
17753#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
17754pub struct KubernetesPodConfig {
17755#[serde(rename = "agentPath")]
17757 #[serde(skip_serializing_if="Option::is_none")]
17758 pub agent_path: Option<String>,
17759
17760#[serde(rename = "consoleContainerNumber")]
17762 #[serde(skip_serializing_if="Option::is_none")]
17763 pub console_container_number: Option<i64>,
17764
17765#[serde(rename = "disableAgent")]
17767 #[serde(skip_serializing_if="Option::is_none")]
17768 pub disable_agent: Option<bool>,
17769
17770#[serde(rename = "exposeAuthMetadataAsAnnotations")]
17772 #[serde(skip_serializing_if="Option::is_none")]
17773 pub expose_auth_metadata_as_annotations: Option<std::collections::HashMap<String, String>>,
17774
17775#[serde(rename = "exposeAuthMetadataAsEnv")]
17777 #[serde(skip_serializing_if="Option::is_none")]
17778 pub expose_auth_metadata_as_env: Option<std::collections::HashMap<String, String>>,
17779
17780#[serde(rename = "exposeAuthMetadataAsLabels")]
17782 #[serde(skip_serializing_if="Option::is_none")]
17783 pub expose_auth_metadata_as_labels: Option<std::collections::HashMap<String, String>>,
17784
17785#[serde(rename = "idleCommand")]
17787 #[serde(skip_serializing_if="Option::is_none")]
17788 pub idle_command: Option<Vec<String>>,
17789
17790 #[serde(rename = "metadata")]
17791 #[serde(skip_serializing_if="Option::is_none")]
17792 pub metadata: Option<models::ObjectMeta>,
17793
17794#[serde(rename = "mode")]
17796 #[serde(skip_serializing_if="Option::is_none")]
17797 pub mode: Option<String>,
17798
17799#[serde(rename = "shellCommand")]
17801 #[serde(skip_serializing_if="Option::is_none")]
17802 pub shell_command: Option<Vec<String>>,
17803
17804 #[serde(rename = "spec")]
17805 #[serde(skip_serializing_if="Option::is_none")]
17806 pub spec: Option<models::PodSpec>,
17807
17808#[serde(rename = "subsystems")]
17810 #[serde(skip_serializing_if="Option::is_none")]
17811 pub subsystems: Option<std::collections::HashMap<String, String>>,
17812
17813}
17814
17815
17816impl KubernetesPodConfig {
17817 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
17818 pub fn new() -> KubernetesPodConfig {
17819 KubernetesPodConfig {
17820 agent_path: None,
17821 console_container_number: None,
17822 disable_agent: None,
17823 expose_auth_metadata_as_annotations: None,
17824 expose_auth_metadata_as_env: None,
17825 expose_auth_metadata_as_labels: None,
17826 idle_command: None,
17827 metadata: None,
17828 mode: None,
17829 shell_command: None,
17830 spec: None,
17831 subsystems: None,
17832 }
17833 }
17834}
17835
17836impl std::string::ToString for KubernetesPodConfig {
17840 fn to_string(&self) -> String {
17841 let params: Vec<Option<String>> = vec![
17842
17843 self.agent_path.as_ref().map(|agent_path| {
17844 [
17845 "agentPath".to_string(),
17846 agent_path.to_string(),
17847 ].join(",")
17848 }),
17849
17850
17851 self.console_container_number.as_ref().map(|console_container_number| {
17852 [
17853 "consoleContainerNumber".to_string(),
17854 console_container_number.to_string(),
17855 ].join(",")
17856 }),
17857
17858
17859 self.disable_agent.as_ref().map(|disable_agent| {
17860 [
17861 "disableAgent".to_string(),
17862 disable_agent.to_string(),
17863 ].join(",")
17864 }),
17865
17866 self.idle_command.as_ref().map(|idle_command| {
17874 [
17875 "idleCommand".to_string(),
17876 idle_command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
17877 ].join(",")
17878 }),
17879
17880 self.mode.as_ref().map(|mode| {
17884 [
17885 "mode".to_string(),
17886 mode.to_string(),
17887 ].join(",")
17888 }),
17889
17890
17891 self.shell_command.as_ref().map(|shell_command| {
17892 [
17893 "shellCommand".to_string(),
17894 shell_command.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
17895 ].join(",")
17896 }),
17897
17898 ];
17903
17904 params.into_iter().flatten().collect::<Vec<_>>().join(",")
17905 }
17906}
17907
17908impl std::str::FromStr for KubernetesPodConfig {
17912 type Err = String;
17913
17914 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
17915 #[derive(Default)]
17917 #[allow(dead_code)]
17918 struct IntermediateRep {
17919 pub agent_path: Vec<String>,
17920 pub console_container_number: Vec<i64>,
17921 pub disable_agent: Vec<bool>,
17922 pub expose_auth_metadata_as_annotations: Vec<std::collections::HashMap<String, String>>,
17923 pub expose_auth_metadata_as_env: Vec<std::collections::HashMap<String, String>>,
17924 pub expose_auth_metadata_as_labels: Vec<std::collections::HashMap<String, String>>,
17925 pub idle_command: Vec<Vec<String>>,
17926 pub metadata: Vec<models::ObjectMeta>,
17927 pub mode: Vec<String>,
17928 pub shell_command: Vec<Vec<String>>,
17929 pub spec: Vec<models::PodSpec>,
17930 pub subsystems: Vec<std::collections::HashMap<String, String>>,
17931 }
17932
17933 let mut intermediate_rep = IntermediateRep::default();
17934
17935 let mut string_iter = s.split(',');
17937 let mut key_result = string_iter.next();
17938
17939 while key_result.is_some() {
17940 let val = match string_iter.next() {
17941 Some(x) => x,
17942 None => return std::result::Result::Err("Missing value while parsing KubernetesPodConfig".to_string())
17943 };
17944
17945 if let Some(key) = key_result {
17946 #[allow(clippy::match_single_binding)]
17947 match key {
17948 #[allow(clippy::redundant_clone)]
17949 "agentPath" => intermediate_rep.agent_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17950 #[allow(clippy::redundant_clone)]
17951 "consoleContainerNumber" => intermediate_rep.console_container_number.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17952 #[allow(clippy::redundant_clone)]
17953 "disableAgent" => intermediate_rep.disable_agent.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17954 "exposeAuthMetadataAsAnnotations" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17955 "exposeAuthMetadataAsEnv" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17956 "exposeAuthMetadataAsLabels" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17957 "idleCommand" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17958 #[allow(clippy::redundant_clone)]
17959 "metadata" => intermediate_rep.metadata.push(<models::ObjectMeta as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17960 #[allow(clippy::redundant_clone)]
17961 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17962 "shellCommand" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17963 #[allow(clippy::redundant_clone)]
17964 "spec" => intermediate_rep.spec.push(<models::PodSpec as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
17965 "subsystems" => return std::result::Result::Err("Parsing a container in this style is not supported in KubernetesPodConfig".to_string()),
17966 _ => return std::result::Result::Err("Unexpected key while parsing KubernetesPodConfig".to_string())
17967 }
17968 }
17969
17970 key_result = string_iter.next();
17972 }
17973
17974 std::result::Result::Ok(KubernetesPodConfig {
17976 agent_path: intermediate_rep.agent_path.into_iter().next(),
17977 console_container_number: intermediate_rep.console_container_number.into_iter().next(),
17978 disable_agent: intermediate_rep.disable_agent.into_iter().next(),
17979 expose_auth_metadata_as_annotations: intermediate_rep.expose_auth_metadata_as_annotations.into_iter().next(),
17980 expose_auth_metadata_as_env: intermediate_rep.expose_auth_metadata_as_env.into_iter().next(),
17981 expose_auth_metadata_as_labels: intermediate_rep.expose_auth_metadata_as_labels.into_iter().next(),
17982 idle_command: intermediate_rep.idle_command.into_iter().next(),
17983 metadata: intermediate_rep.metadata.into_iter().next(),
17984 mode: intermediate_rep.mode.into_iter().next(),
17985 shell_command: intermediate_rep.shell_command.into_iter().next(),
17986 spec: intermediate_rep.spec.into_iter().next(),
17987 subsystems: intermediate_rep.subsystems.into_iter().next(),
17988 })
17989 }
17990}
17991
17992#[cfg(feature = "server")]
17995impl std::convert::TryFrom<header::IntoHeaderValue<KubernetesPodConfig>> for HeaderValue {
17996 type Error = String;
17997
17998 fn try_from(hdr_value: header::IntoHeaderValue<KubernetesPodConfig>) -> std::result::Result<Self, Self::Error> {
17999 let hdr_value = hdr_value.to_string();
18000 match HeaderValue::from_str(&hdr_value) {
18001 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18002 std::result::Result::Err(e) => std::result::Result::Err(
18003 format!("Invalid header value for KubernetesPodConfig - value: {} is invalid {}",
18004 hdr_value, e))
18005 }
18006 }
18007}
18008
18009#[cfg(feature = "server")]
18010impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<KubernetesPodConfig> {
18011 type Error = String;
18012
18013 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18014 match hdr_value.to_str() {
18015 std::result::Result::Ok(value) => {
18016 match <KubernetesPodConfig as std::str::FromStr>::from_str(value) {
18017 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18018 std::result::Result::Err(err) => std::result::Result::Err(
18019 format!("Unable to convert header value '{}' into KubernetesPodConfig - {}",
18020 value, err))
18021 }
18022 },
18023 std::result::Result::Err(e) => std::result::Result::Err(
18024 format!("Unable to convert header: {:?} to string: {}",
18025 hdr_value, e))
18026 }
18027 }
18028}
18029
18030
18031
18032
18033
18034
18035
18036#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18037#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18038pub struct KubernetesTimeoutConfig {
18039#[serde(rename = "commandStart")]
18041 #[serde(skip_serializing_if="Option::is_none")]
18042 pub command_start: Option<i64>,
18043
18044#[serde(rename = "http")]
18046 #[serde(skip_serializing_if="Option::is_none")]
18047 pub http: Option<i64>,
18048
18049#[serde(rename = "podStart")]
18051 #[serde(skip_serializing_if="Option::is_none")]
18052 pub pod_start: Option<i64>,
18053
18054#[serde(rename = "podStop")]
18056 #[serde(skip_serializing_if="Option::is_none")]
18057 pub pod_stop: Option<i64>,
18058
18059#[serde(rename = "signal")]
18061 #[serde(skip_serializing_if="Option::is_none")]
18062 pub signal: Option<i64>,
18063
18064#[serde(rename = "window")]
18066 #[serde(skip_serializing_if="Option::is_none")]
18067 pub window: Option<i64>,
18068
18069}
18070
18071
18072impl KubernetesTimeoutConfig {
18073 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18074 pub fn new() -> KubernetesTimeoutConfig {
18075 KubernetesTimeoutConfig {
18076 command_start: None,
18077 http: None,
18078 pod_start: None,
18079 pod_stop: None,
18080 signal: None,
18081 window: None,
18082 }
18083 }
18084}
18085
18086impl std::string::ToString for KubernetesTimeoutConfig {
18090 fn to_string(&self) -> String {
18091 let params: Vec<Option<String>> = vec![
18092
18093 self.command_start.as_ref().map(|command_start| {
18094 [
18095 "commandStart".to_string(),
18096 command_start.to_string(),
18097 ].join(",")
18098 }),
18099
18100
18101 self.http.as_ref().map(|http| {
18102 [
18103 "http".to_string(),
18104 http.to_string(),
18105 ].join(",")
18106 }),
18107
18108
18109 self.pod_start.as_ref().map(|pod_start| {
18110 [
18111 "podStart".to_string(),
18112 pod_start.to_string(),
18113 ].join(",")
18114 }),
18115
18116
18117 self.pod_stop.as_ref().map(|pod_stop| {
18118 [
18119 "podStop".to_string(),
18120 pod_stop.to_string(),
18121 ].join(",")
18122 }),
18123
18124
18125 self.signal.as_ref().map(|signal| {
18126 [
18127 "signal".to_string(),
18128 signal.to_string(),
18129 ].join(",")
18130 }),
18131
18132
18133 self.window.as_ref().map(|window| {
18134 [
18135 "window".to_string(),
18136 window.to_string(),
18137 ].join(",")
18138 }),
18139
18140 ];
18141
18142 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18143 }
18144}
18145
18146impl std::str::FromStr for KubernetesTimeoutConfig {
18150 type Err = String;
18151
18152 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18153 #[derive(Default)]
18155 #[allow(dead_code)]
18156 struct IntermediateRep {
18157 pub command_start: Vec<i64>,
18158 pub http: Vec<i64>,
18159 pub pod_start: Vec<i64>,
18160 pub pod_stop: Vec<i64>,
18161 pub signal: Vec<i64>,
18162 pub window: Vec<i64>,
18163 }
18164
18165 let mut intermediate_rep = IntermediateRep::default();
18166
18167 let mut string_iter = s.split(',');
18169 let mut key_result = string_iter.next();
18170
18171 while key_result.is_some() {
18172 let val = match string_iter.next() {
18173 Some(x) => x,
18174 None => return std::result::Result::Err("Missing value while parsing KubernetesTimeoutConfig".to_string())
18175 };
18176
18177 if let Some(key) = key_result {
18178 #[allow(clippy::match_single_binding)]
18179 match key {
18180 #[allow(clippy::redundant_clone)]
18181 "commandStart" => intermediate_rep.command_start.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18182 #[allow(clippy::redundant_clone)]
18183 "http" => intermediate_rep.http.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18184 #[allow(clippy::redundant_clone)]
18185 "podStart" => intermediate_rep.pod_start.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18186 #[allow(clippy::redundant_clone)]
18187 "podStop" => intermediate_rep.pod_stop.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18188 #[allow(clippy::redundant_clone)]
18189 "signal" => intermediate_rep.signal.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18190 #[allow(clippy::redundant_clone)]
18191 "window" => intermediate_rep.window.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18192 _ => return std::result::Result::Err("Unexpected key while parsing KubernetesTimeoutConfig".to_string())
18193 }
18194 }
18195
18196 key_result = string_iter.next();
18198 }
18199
18200 std::result::Result::Ok(KubernetesTimeoutConfig {
18202 command_start: intermediate_rep.command_start.into_iter().next(),
18203 http: intermediate_rep.http.into_iter().next(),
18204 pod_start: intermediate_rep.pod_start.into_iter().next(),
18205 pod_stop: intermediate_rep.pod_stop.into_iter().next(),
18206 signal: intermediate_rep.signal.into_iter().next(),
18207 window: intermediate_rep.window.into_iter().next(),
18208 })
18209 }
18210}
18211
18212#[cfg(feature = "server")]
18215impl std::convert::TryFrom<header::IntoHeaderValue<KubernetesTimeoutConfig>> for HeaderValue {
18216 type Error = String;
18217
18218 fn try_from(hdr_value: header::IntoHeaderValue<KubernetesTimeoutConfig>) -> std::result::Result<Self, Self::Error> {
18219 let hdr_value = hdr_value.to_string();
18220 match HeaderValue::from_str(&hdr_value) {
18221 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18222 std::result::Result::Err(e) => std::result::Result::Err(
18223 format!("Invalid header value for KubernetesTimeoutConfig - value: {} is invalid {}",
18224 hdr_value, e))
18225 }
18226 }
18227}
18228
18229#[cfg(feature = "server")]
18230impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<KubernetesTimeoutConfig> {
18231 type Error = String;
18232
18233 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18234 match hdr_value.to_str() {
18235 std::result::Result::Ok(value) => {
18236 match <KubernetesTimeoutConfig as std::str::FromStr>::from_str(value) {
18237 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18238 std::result::Result::Err(err) => std::result::Result::Err(
18239 format!("Unable to convert header value '{}' into KubernetesTimeoutConfig - {}",
18240 value, err))
18241 }
18242 },
18243 std::result::Result::Err(e) => std::result::Result::Err(
18244 format!("Unable to convert header: {:?} to string: {}",
18245 hdr_value, e))
18246 }
18247 }
18248}
18249
18250
18251
18252
18253#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18258#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18259pub struct LabelSelector {
18260#[serde(rename = "matchExpressions")]
18262 #[serde(skip_serializing_if="Option::is_none")]
18263 pub match_expressions: Option<Vec<models::LabelSelectorRequirement>>,
18264
18265#[serde(rename = "matchLabels")]
18267 #[serde(skip_serializing_if="Option::is_none")]
18268 pub match_labels: Option<std::collections::HashMap<String, String>>,
18269
18270}
18271
18272
18273impl LabelSelector {
18274 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18275 pub fn new() -> LabelSelector {
18276 LabelSelector {
18277 match_expressions: None,
18278 match_labels: None,
18279 }
18280 }
18281}
18282
18283impl std::string::ToString for LabelSelector {
18287 fn to_string(&self) -> String {
18288 let params: Vec<Option<String>> = vec![
18289 ];
18294
18295 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18296 }
18297}
18298
18299impl std::str::FromStr for LabelSelector {
18303 type Err = String;
18304
18305 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18306 #[derive(Default)]
18308 #[allow(dead_code)]
18309 struct IntermediateRep {
18310 pub match_expressions: Vec<Vec<models::LabelSelectorRequirement>>,
18311 pub match_labels: Vec<std::collections::HashMap<String, String>>,
18312 }
18313
18314 let mut intermediate_rep = IntermediateRep::default();
18315
18316 let mut string_iter = s.split(',');
18318 let mut key_result = string_iter.next();
18319
18320 while key_result.is_some() {
18321 let val = match string_iter.next() {
18322 Some(x) => x,
18323 None => return std::result::Result::Err("Missing value while parsing LabelSelector".to_string())
18324 };
18325
18326 if let Some(key) = key_result {
18327 #[allow(clippy::match_single_binding)]
18328 match key {
18329 "matchExpressions" => return std::result::Result::Err("Parsing a container in this style is not supported in LabelSelector".to_string()),
18330 "matchLabels" => return std::result::Result::Err("Parsing a container in this style is not supported in LabelSelector".to_string()),
18331 _ => return std::result::Result::Err("Unexpected key while parsing LabelSelector".to_string())
18332 }
18333 }
18334
18335 key_result = string_iter.next();
18337 }
18338
18339 std::result::Result::Ok(LabelSelector {
18341 match_expressions: intermediate_rep.match_expressions.into_iter().next(),
18342 match_labels: intermediate_rep.match_labels.into_iter().next(),
18343 })
18344 }
18345}
18346
18347#[cfg(feature = "server")]
18350impl std::convert::TryFrom<header::IntoHeaderValue<LabelSelector>> for HeaderValue {
18351 type Error = String;
18352
18353 fn try_from(hdr_value: header::IntoHeaderValue<LabelSelector>) -> std::result::Result<Self, Self::Error> {
18354 let hdr_value = hdr_value.to_string();
18355 match HeaderValue::from_str(&hdr_value) {
18356 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18357 std::result::Result::Err(e) => std::result::Result::Err(
18358 format!("Invalid header value for LabelSelector - value: {} is invalid {}",
18359 hdr_value, e))
18360 }
18361 }
18362}
18363
18364#[cfg(feature = "server")]
18365impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<LabelSelector> {
18366 type Error = String;
18367
18368 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18369 match hdr_value.to_str() {
18370 std::result::Result::Ok(value) => {
18371 match <LabelSelector as std::str::FromStr>::from_str(value) {
18372 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18373 std::result::Result::Err(err) => std::result::Result::Err(
18374 format!("Unable to convert header value '{}' into LabelSelector - {}",
18375 value, err))
18376 }
18377 },
18378 std::result::Result::Err(e) => std::result::Result::Err(
18379 format!("Unable to convert header: {:?} to string: {}",
18380 hdr_value, e))
18381 }
18382 }
18383}
18384
18385
18386
18387
18388#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
18389#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18390pub struct LabelSelectorOperator(String);
18391
18392impl validator::Validate for LabelSelectorOperator {
18393 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
18394 std::result::Result::Ok(())
18395 }
18396}
18397
18398impl std::convert::From<String> for LabelSelectorOperator {
18399 fn from(x: String) -> Self {
18400 LabelSelectorOperator(x)
18401 }
18402}
18403
18404impl std::string::ToString for LabelSelectorOperator {
18405 fn to_string(&self) -> String {
18406 self.0.to_string()
18407 }
18408}
18409
18410impl std::str::FromStr for LabelSelectorOperator {
18411 type Err = std::string::ParseError;
18412 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
18413 std::result::Result::Ok(LabelSelectorOperator(x.to_string()))
18414 }
18415}
18416
18417impl std::convert::From<LabelSelectorOperator> for String {
18418 fn from(x: LabelSelectorOperator) -> Self {
18419 x.0
18420 }
18421}
18422
18423impl std::ops::Deref for LabelSelectorOperator {
18424 type Target = String;
18425 fn deref(&self) -> &String {
18426 &self.0
18427 }
18428}
18429
18430impl std::ops::DerefMut for LabelSelectorOperator {
18431 fn deref_mut(&mut self) -> &mut String {
18432 &mut self.0
18433 }
18434}
18435
18436
18437
18438#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18443#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18444pub struct LabelSelectorRequirement {
18445#[serde(rename = "key")]
18447 #[serde(skip_serializing_if="Option::is_none")]
18448 pub key: Option<String>,
18449
18450 #[serde(rename = "operator")]
18451 #[serde(skip_serializing_if="Option::is_none")]
18452 pub operator: Option<String>,
18453
18454#[serde(rename = "values")]
18456 #[serde(skip_serializing_if="Option::is_none")]
18457 pub values: Option<Vec<String>>,
18458
18459}
18460
18461
18462impl LabelSelectorRequirement {
18463 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18464 pub fn new() -> LabelSelectorRequirement {
18465 LabelSelectorRequirement {
18466 key: None,
18467 operator: None,
18468 values: None,
18469 }
18470 }
18471}
18472
18473impl std::string::ToString for LabelSelectorRequirement {
18477 fn to_string(&self) -> String {
18478 let params: Vec<Option<String>> = vec![
18479
18480 self.key.as_ref().map(|key| {
18481 [
18482 "key".to_string(),
18483 key.to_string(),
18484 ].join(",")
18485 }),
18486
18487
18488 self.operator.as_ref().map(|operator| {
18489 [
18490 "operator".to_string(),
18491 operator.to_string(),
18492 ].join(",")
18493 }),
18494
18495
18496 self.values.as_ref().map(|values| {
18497 [
18498 "values".to_string(),
18499 values.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
18500 ].join(",")
18501 }),
18502
18503 ];
18504
18505 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18506 }
18507}
18508
18509impl std::str::FromStr for LabelSelectorRequirement {
18513 type Err = String;
18514
18515 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18516 #[derive(Default)]
18518 #[allow(dead_code)]
18519 struct IntermediateRep {
18520 pub key: Vec<String>,
18521 pub operator: Vec<String>,
18522 pub values: Vec<Vec<String>>,
18523 }
18524
18525 let mut intermediate_rep = IntermediateRep::default();
18526
18527 let mut string_iter = s.split(',');
18529 let mut key_result = string_iter.next();
18530
18531 while key_result.is_some() {
18532 let val = match string_iter.next() {
18533 Some(x) => x,
18534 None => return std::result::Result::Err("Missing value while parsing LabelSelectorRequirement".to_string())
18535 };
18536
18537 if let Some(key) = key_result {
18538 #[allow(clippy::match_single_binding)]
18539 match key {
18540 #[allow(clippy::redundant_clone)]
18541 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18542 #[allow(clippy::redundant_clone)]
18543 "operator" => intermediate_rep.operator.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18544 "values" => return std::result::Result::Err("Parsing a container in this style is not supported in LabelSelectorRequirement".to_string()),
18545 _ => return std::result::Result::Err("Unexpected key while parsing LabelSelectorRequirement".to_string())
18546 }
18547 }
18548
18549 key_result = string_iter.next();
18551 }
18552
18553 std::result::Result::Ok(LabelSelectorRequirement {
18555 key: intermediate_rep.key.into_iter().next(),
18556 operator: intermediate_rep.operator.into_iter().next(),
18557 values: intermediate_rep.values.into_iter().next(),
18558 })
18559 }
18560}
18561
18562#[cfg(feature = "server")]
18565impl std::convert::TryFrom<header::IntoHeaderValue<LabelSelectorRequirement>> for HeaderValue {
18566 type Error = String;
18567
18568 fn try_from(hdr_value: header::IntoHeaderValue<LabelSelectorRequirement>) -> std::result::Result<Self, Self::Error> {
18569 let hdr_value = hdr_value.to_string();
18570 match HeaderValue::from_str(&hdr_value) {
18571 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18572 std::result::Result::Err(e) => std::result::Result::Err(
18573 format!("Invalid header value for LabelSelectorRequirement - value: {} is invalid {}",
18574 hdr_value, e))
18575 }
18576 }
18577}
18578
18579#[cfg(feature = "server")]
18580impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<LabelSelectorRequirement> {
18581 type Error = String;
18582
18583 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18584 match hdr_value.to_str() {
18585 std::result::Result::Ok(value) => {
18586 match <LabelSelectorRequirement as std::str::FromStr>::from_str(value) {
18587 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18588 std::result::Result::Err(err) => std::result::Result::Err(
18589 format!("Unable to convert header value '{}' into LabelSelectorRequirement - {}",
18590 value, err))
18591 }
18592 },
18593 std::result::Result::Err(e) => std::result::Result::Err(
18594 format!("Unable to convert header: {:?} to string: {}",
18595 hdr_value, e))
18596 }
18597 }
18598}
18599
18600
18601
18602
18603#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18608#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18609pub struct Lifecycle {
18610 #[serde(rename = "postStart")]
18611 #[serde(skip_serializing_if="Option::is_none")]
18612 pub post_start: Option<models::LifecycleHandler>,
18613
18614 #[serde(rename = "preStop")]
18615 #[serde(skip_serializing_if="Option::is_none")]
18616 pub pre_stop: Option<models::LifecycleHandler>,
18617
18618}
18619
18620
18621impl Lifecycle {
18622 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18623 pub fn new() -> Lifecycle {
18624 Lifecycle {
18625 post_start: None,
18626 pre_stop: None,
18627 }
18628 }
18629}
18630
18631impl std::string::ToString for Lifecycle {
18635 fn to_string(&self) -> String {
18636 let params: Vec<Option<String>> = vec![
18637 ];
18642
18643 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18644 }
18645}
18646
18647impl std::str::FromStr for Lifecycle {
18651 type Err = String;
18652
18653 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18654 #[derive(Default)]
18656 #[allow(dead_code)]
18657 struct IntermediateRep {
18658 pub post_start: Vec<models::LifecycleHandler>,
18659 pub pre_stop: Vec<models::LifecycleHandler>,
18660 }
18661
18662 let mut intermediate_rep = IntermediateRep::default();
18663
18664 let mut string_iter = s.split(',');
18666 let mut key_result = string_iter.next();
18667
18668 while key_result.is_some() {
18669 let val = match string_iter.next() {
18670 Some(x) => x,
18671 None => return std::result::Result::Err("Missing value while parsing Lifecycle".to_string())
18672 };
18673
18674 if let Some(key) = key_result {
18675 #[allow(clippy::match_single_binding)]
18676 match key {
18677 #[allow(clippy::redundant_clone)]
18678 "postStart" => intermediate_rep.post_start.push(<models::LifecycleHandler as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18679 #[allow(clippy::redundant_clone)]
18680 "preStop" => intermediate_rep.pre_stop.push(<models::LifecycleHandler as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18681 _ => return std::result::Result::Err("Unexpected key while parsing Lifecycle".to_string())
18682 }
18683 }
18684
18685 key_result = string_iter.next();
18687 }
18688
18689 std::result::Result::Ok(Lifecycle {
18691 post_start: intermediate_rep.post_start.into_iter().next(),
18692 pre_stop: intermediate_rep.pre_stop.into_iter().next(),
18693 })
18694 }
18695}
18696
18697#[cfg(feature = "server")]
18700impl std::convert::TryFrom<header::IntoHeaderValue<Lifecycle>> for HeaderValue {
18701 type Error = String;
18702
18703 fn try_from(hdr_value: header::IntoHeaderValue<Lifecycle>) -> std::result::Result<Self, Self::Error> {
18704 let hdr_value = hdr_value.to_string();
18705 match HeaderValue::from_str(&hdr_value) {
18706 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18707 std::result::Result::Err(e) => std::result::Result::Err(
18708 format!("Invalid header value for Lifecycle - value: {} is invalid {}",
18709 hdr_value, e))
18710 }
18711 }
18712}
18713
18714#[cfg(feature = "server")]
18715impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Lifecycle> {
18716 type Error = String;
18717
18718 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18719 match hdr_value.to_str() {
18720 std::result::Result::Ok(value) => {
18721 match <Lifecycle as std::str::FromStr>::from_str(value) {
18722 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18723 std::result::Result::Err(err) => std::result::Result::Err(
18724 format!("Unable to convert header value '{}' into Lifecycle - {}",
18725 value, err))
18726 }
18727 },
18728 std::result::Result::Err(e) => std::result::Result::Err(
18729 format!("Unable to convert header: {:?} to string: {}",
18730 hdr_value, e))
18731 }
18732 }
18733}
18734
18735
18736
18737
18738#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18743#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18744pub struct LifecycleHandler {
18745 #[serde(rename = "exec")]
18746 #[serde(skip_serializing_if="Option::is_none")]
18747 pub exec: Option<models::ExecAction>,
18748
18749 #[serde(rename = "httpGet")]
18750 #[serde(skip_serializing_if="Option::is_none")]
18751 pub http_get: Option<models::HttpGetAction>,
18752
18753 #[serde(rename = "tcpSocket")]
18754 #[serde(skip_serializing_if="Option::is_none")]
18755 pub tcp_socket: Option<models::TcpSocketAction>,
18756
18757}
18758
18759
18760impl LifecycleHandler {
18761 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18762 pub fn new() -> LifecycleHandler {
18763 LifecycleHandler {
18764 exec: None,
18765 http_get: None,
18766 tcp_socket: None,
18767 }
18768 }
18769}
18770
18771impl std::string::ToString for LifecycleHandler {
18775 fn to_string(&self) -> String {
18776 let params: Vec<Option<String>> = vec![
18777 ];
18784
18785 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18786 }
18787}
18788
18789impl std::str::FromStr for LifecycleHandler {
18793 type Err = String;
18794
18795 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18796 #[derive(Default)]
18798 #[allow(dead_code)]
18799 struct IntermediateRep {
18800 pub exec: Vec<models::ExecAction>,
18801 pub http_get: Vec<models::HttpGetAction>,
18802 pub tcp_socket: Vec<models::TcpSocketAction>,
18803 }
18804
18805 let mut intermediate_rep = IntermediateRep::default();
18806
18807 let mut string_iter = s.split(',');
18809 let mut key_result = string_iter.next();
18810
18811 while key_result.is_some() {
18812 let val = match string_iter.next() {
18813 Some(x) => x,
18814 None => return std::result::Result::Err("Missing value while parsing LifecycleHandler".to_string())
18815 };
18816
18817 if let Some(key) = key_result {
18818 #[allow(clippy::match_single_binding)]
18819 match key {
18820 #[allow(clippy::redundant_clone)]
18821 "exec" => intermediate_rep.exec.push(<models::ExecAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18822 #[allow(clippy::redundant_clone)]
18823 "httpGet" => intermediate_rep.http_get.push(<models::HttpGetAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18824 #[allow(clippy::redundant_clone)]
18825 "tcpSocket" => intermediate_rep.tcp_socket.push(<models::TcpSocketAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18826 _ => return std::result::Result::Err("Unexpected key while parsing LifecycleHandler".to_string())
18827 }
18828 }
18829
18830 key_result = string_iter.next();
18832 }
18833
18834 std::result::Result::Ok(LifecycleHandler {
18836 exec: intermediate_rep.exec.into_iter().next(),
18837 http_get: intermediate_rep.http_get.into_iter().next(),
18838 tcp_socket: intermediate_rep.tcp_socket.into_iter().next(),
18839 })
18840 }
18841}
18842
18843#[cfg(feature = "server")]
18846impl std::convert::TryFrom<header::IntoHeaderValue<LifecycleHandler>> for HeaderValue {
18847 type Error = String;
18848
18849 fn try_from(hdr_value: header::IntoHeaderValue<LifecycleHandler>) -> std::result::Result<Self, Self::Error> {
18850 let hdr_value = hdr_value.to_string();
18851 match HeaderValue::from_str(&hdr_value) {
18852 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18853 std::result::Result::Err(e) => std::result::Result::Err(
18854 format!("Invalid header value for LifecycleHandler - value: {} is invalid {}",
18855 hdr_value, e))
18856 }
18857 }
18858}
18859
18860#[cfg(feature = "server")]
18861impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<LifecycleHandler> {
18862 type Error = String;
18863
18864 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18865 match hdr_value.to_str() {
18866 std::result::Result::Ok(value) => {
18867 match <LifecycleHandler as std::str::FromStr>::from_str(value) {
18868 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
18869 std::result::Result::Err(err) => std::result::Result::Err(
18870 format!("Unable to convert header value '{}' into LifecycleHandler - {}",
18871 value, err))
18872 }
18873 },
18874 std::result::Result::Err(e) => std::result::Result::Err(
18875 format!("Unable to convert header: {:?} to string: {}",
18876 hdr_value, e))
18877 }
18878 }
18879}
18880
18881
18882
18883
18884#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
18889#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
18890pub struct LocalObjectReference {
18891#[serde(rename = "name")]
18893 #[serde(skip_serializing_if="Option::is_none")]
18894 pub name: Option<String>,
18895
18896}
18897
18898
18899impl LocalObjectReference {
18900 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
18901 pub fn new() -> LocalObjectReference {
18902 LocalObjectReference {
18903 name: None,
18904 }
18905 }
18906}
18907
18908impl std::string::ToString for LocalObjectReference {
18912 fn to_string(&self) -> String {
18913 let params: Vec<Option<String>> = vec![
18914
18915 self.name.as_ref().map(|name| {
18916 [
18917 "name".to_string(),
18918 name.to_string(),
18919 ].join(",")
18920 }),
18921
18922 ];
18923
18924 params.into_iter().flatten().collect::<Vec<_>>().join(",")
18925 }
18926}
18927
18928impl std::str::FromStr for LocalObjectReference {
18932 type Err = String;
18933
18934 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
18935 #[derive(Default)]
18937 #[allow(dead_code)]
18938 struct IntermediateRep {
18939 pub name: Vec<String>,
18940 }
18941
18942 let mut intermediate_rep = IntermediateRep::default();
18943
18944 let mut string_iter = s.split(',');
18946 let mut key_result = string_iter.next();
18947
18948 while key_result.is_some() {
18949 let val = match string_iter.next() {
18950 Some(x) => x,
18951 None => return std::result::Result::Err("Missing value while parsing LocalObjectReference".to_string())
18952 };
18953
18954 if let Some(key) = key_result {
18955 #[allow(clippy::match_single_binding)]
18956 match key {
18957 #[allow(clippy::redundant_clone)]
18958 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
18959 _ => return std::result::Result::Err("Unexpected key while parsing LocalObjectReference".to_string())
18960 }
18961 }
18962
18963 key_result = string_iter.next();
18965 }
18966
18967 std::result::Result::Ok(LocalObjectReference {
18969 name: intermediate_rep.name.into_iter().next(),
18970 })
18971 }
18972}
18973
18974#[cfg(feature = "server")]
18977impl std::convert::TryFrom<header::IntoHeaderValue<LocalObjectReference>> for HeaderValue {
18978 type Error = String;
18979
18980 fn try_from(hdr_value: header::IntoHeaderValue<LocalObjectReference>) -> std::result::Result<Self, Self::Error> {
18981 let hdr_value = hdr_value.to_string();
18982 match HeaderValue::from_str(&hdr_value) {
18983 std::result::Result::Ok(value) => std::result::Result::Ok(value),
18984 std::result::Result::Err(e) => std::result::Result::Err(
18985 format!("Invalid header value for LocalObjectReference - value: {} is invalid {}",
18986 hdr_value, e))
18987 }
18988 }
18989}
18990
18991#[cfg(feature = "server")]
18992impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<LocalObjectReference> {
18993 type Error = String;
18994
18995 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
18996 match hdr_value.to_str() {
18997 std::result::Result::Ok(value) => {
18998 match <LocalObjectReference as std::str::FromStr>::from_str(value) {
18999 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
19000 std::result::Result::Err(err) => std::result::Result::Err(
19001 format!("Unable to convert header value '{}' into LocalObjectReference - {}",
19002 value, err))
19003 }
19004 },
19005 std::result::Result::Err(e) => std::result::Result::Err(
19006 format!("Unable to convert header: {:?} to string: {}",
19007 hdr_value, e))
19008 }
19009 }
19010}
19011
19012
19013
19014
19015
19016
19017
19018#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
19019#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19020pub struct LogConfig {
19021 #[serde(rename = "Config")]
19022 #[serde(skip_serializing_if="Option::is_none")]
19023 pub config: Option<std::collections::HashMap<String, String>>,
19024
19025 #[serde(rename = "Type")]
19026 #[serde(skip_serializing_if="Option::is_none")]
19027 pub r#type: Option<String>,
19028
19029}
19030
19031
19032impl LogConfig {
19033 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
19034 pub fn new() -> LogConfig {
19035 LogConfig {
19036 config: None,
19037 r#type: None,
19038 }
19039 }
19040}
19041
19042impl std::string::ToString for LogConfig {
19046 fn to_string(&self) -> String {
19047 let params: Vec<Option<String>> = vec![
19048 self.r#type.as_ref().map(|r#type| {
19052 [
19053 "Type".to_string(),
19054 r#type.to_string(),
19055 ].join(",")
19056 }),
19057
19058 ];
19059
19060 params.into_iter().flatten().collect::<Vec<_>>().join(",")
19061 }
19062}
19063
19064impl std::str::FromStr for LogConfig {
19068 type Err = String;
19069
19070 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
19071 #[derive(Default)]
19073 #[allow(dead_code)]
19074 struct IntermediateRep {
19075 pub config: Vec<std::collections::HashMap<String, String>>,
19076 pub r#type: Vec<String>,
19077 }
19078
19079 let mut intermediate_rep = IntermediateRep::default();
19080
19081 let mut string_iter = s.split(',');
19083 let mut key_result = string_iter.next();
19084
19085 while key_result.is_some() {
19086 let val = match string_iter.next() {
19087 Some(x) => x,
19088 None => return std::result::Result::Err("Missing value while parsing LogConfig".to_string())
19089 };
19090
19091 if let Some(key) = key_result {
19092 #[allow(clippy::match_single_binding)]
19093 match key {
19094 "Config" => return std::result::Result::Err("Parsing a container in this style is not supported in LogConfig".to_string()),
19095 #[allow(clippy::redundant_clone)]
19096 "Type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19097 _ => return std::result::Result::Err("Unexpected key while parsing LogConfig".to_string())
19098 }
19099 }
19100
19101 key_result = string_iter.next();
19103 }
19104
19105 std::result::Result::Ok(LogConfig {
19107 config: intermediate_rep.config.into_iter().next(),
19108 r#type: intermediate_rep.r#type.into_iter().next(),
19109 })
19110 }
19111}
19112
19113#[cfg(feature = "server")]
19116impl std::convert::TryFrom<header::IntoHeaderValue<LogConfig>> for HeaderValue {
19117 type Error = String;
19118
19119 fn try_from(hdr_value: header::IntoHeaderValue<LogConfig>) -> std::result::Result<Self, Self::Error> {
19120 let hdr_value = hdr_value.to_string();
19121 match HeaderValue::from_str(&hdr_value) {
19122 std::result::Result::Ok(value) => std::result::Result::Ok(value),
19123 std::result::Result::Err(e) => std::result::Result::Err(
19124 format!("Invalid header value for LogConfig - value: {} is invalid {}",
19125 hdr_value, e))
19126 }
19127 }
19128}
19129
19130#[cfg(feature = "server")]
19131impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<LogConfig> {
19132 type Error = String;
19133
19134 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
19135 match hdr_value.to_str() {
19136 std::result::Result::Ok(value) => {
19137 match <LogConfig as std::str::FromStr>::from_str(value) {
19138 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
19139 std::result::Result::Err(err) => std::result::Result::Err(
19140 format!("Unable to convert header value '{}' into LogConfig - {}",
19141 value, err))
19142 }
19143 },
19144 std::result::Result::Err(e) => std::result::Result::Err(
19145 format!("Unable to convert header: {:?} to string: {}",
19146 hdr_value, e))
19147 }
19148 }
19149}
19150
19151
19152
19153
19154#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
19159#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19160pub struct ManagedFieldsEntry {
19161#[serde(rename = "apiVersion")]
19163 #[serde(skip_serializing_if="Option::is_none")]
19164 pub api_version: Option<String>,
19165
19166#[serde(rename = "fieldsType")]
19168 #[serde(skip_serializing_if="Option::is_none")]
19169 pub fields_type: Option<String>,
19170
19171#[serde(rename = "fieldsV1")]
19173 #[serde(skip_serializing_if="Option::is_none")]
19174 pub fields_v1: Option<crate::types::Object>,
19175
19176#[serde(rename = "manager")]
19178 #[serde(skip_serializing_if="Option::is_none")]
19179 pub manager: Option<String>,
19180
19181 #[serde(rename = "operation")]
19182 #[serde(skip_serializing_if="Option::is_none")]
19183 pub operation: Option<String>,
19184
19185#[serde(rename = "subresource")]
19187 #[serde(skip_serializing_if="Option::is_none")]
19188 pub subresource: Option<String>,
19189
19190#[serde(rename = "time")]
19192 #[serde(skip_serializing_if="Option::is_none")]
19193 pub time: Option<String>,
19194
19195}
19196
19197
19198impl ManagedFieldsEntry {
19199 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
19200 pub fn new() -> ManagedFieldsEntry {
19201 ManagedFieldsEntry {
19202 api_version: None,
19203 fields_type: None,
19204 fields_v1: None,
19205 manager: None,
19206 operation: None,
19207 subresource: None,
19208 time: None,
19209 }
19210 }
19211}
19212
19213impl std::string::ToString for ManagedFieldsEntry {
19217 fn to_string(&self) -> String {
19218 let params: Vec<Option<String>> = vec![
19219
19220 self.api_version.as_ref().map(|api_version| {
19221 [
19222 "apiVersion".to_string(),
19223 api_version.to_string(),
19224 ].join(",")
19225 }),
19226
19227
19228 self.fields_type.as_ref().map(|fields_type| {
19229 [
19230 "fieldsType".to_string(),
19231 fields_type.to_string(),
19232 ].join(",")
19233 }),
19234
19235 self.manager.as_ref().map(|manager| {
19239 [
19240 "manager".to_string(),
19241 manager.to_string(),
19242 ].join(",")
19243 }),
19244
19245
19246 self.operation.as_ref().map(|operation| {
19247 [
19248 "operation".to_string(),
19249 operation.to_string(),
19250 ].join(",")
19251 }),
19252
19253
19254 self.subresource.as_ref().map(|subresource| {
19255 [
19256 "subresource".to_string(),
19257 subresource.to_string(),
19258 ].join(",")
19259 }),
19260
19261
19262 self.time.as_ref().map(|time| {
19263 [
19264 "time".to_string(),
19265 time.to_string(),
19266 ].join(",")
19267 }),
19268
19269 ];
19270
19271 params.into_iter().flatten().collect::<Vec<_>>().join(",")
19272 }
19273}
19274
19275impl std::str::FromStr for ManagedFieldsEntry {
19279 type Err = String;
19280
19281 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
19282 #[derive(Default)]
19284 #[allow(dead_code)]
19285 struct IntermediateRep {
19286 pub api_version: Vec<String>,
19287 pub fields_type: Vec<String>,
19288 pub fields_v1: Vec<crate::types::Object>,
19289 pub manager: Vec<String>,
19290 pub operation: Vec<String>,
19291 pub subresource: Vec<String>,
19292 pub time: Vec<String>,
19293 }
19294
19295 let mut intermediate_rep = IntermediateRep::default();
19296
19297 let mut string_iter = s.split(',');
19299 let mut key_result = string_iter.next();
19300
19301 while key_result.is_some() {
19302 let val = match string_iter.next() {
19303 Some(x) => x,
19304 None => return std::result::Result::Err("Missing value while parsing ManagedFieldsEntry".to_string())
19305 };
19306
19307 if let Some(key) = key_result {
19308 #[allow(clippy::match_single_binding)]
19309 match key {
19310 #[allow(clippy::redundant_clone)]
19311 "apiVersion" => intermediate_rep.api_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19312 #[allow(clippy::redundant_clone)]
19313 "fieldsType" => intermediate_rep.fields_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19314 #[allow(clippy::redundant_clone)]
19315 "fieldsV1" => intermediate_rep.fields_v1.push(<crate::types::Object as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19316 #[allow(clippy::redundant_clone)]
19317 "manager" => intermediate_rep.manager.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19318 #[allow(clippy::redundant_clone)]
19319 "operation" => intermediate_rep.operation.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19320 #[allow(clippy::redundant_clone)]
19321 "subresource" => intermediate_rep.subresource.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19322 #[allow(clippy::redundant_clone)]
19323 "time" => intermediate_rep.time.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19324 _ => return std::result::Result::Err("Unexpected key while parsing ManagedFieldsEntry".to_string())
19325 }
19326 }
19327
19328 key_result = string_iter.next();
19330 }
19331
19332 std::result::Result::Ok(ManagedFieldsEntry {
19334 api_version: intermediate_rep.api_version.into_iter().next(),
19335 fields_type: intermediate_rep.fields_type.into_iter().next(),
19336 fields_v1: intermediate_rep.fields_v1.into_iter().next(),
19337 manager: intermediate_rep.manager.into_iter().next(),
19338 operation: intermediate_rep.operation.into_iter().next(),
19339 subresource: intermediate_rep.subresource.into_iter().next(),
19340 time: intermediate_rep.time.into_iter().next(),
19341 })
19342 }
19343}
19344
19345#[cfg(feature = "server")]
19348impl std::convert::TryFrom<header::IntoHeaderValue<ManagedFieldsEntry>> for HeaderValue {
19349 type Error = String;
19350
19351 fn try_from(hdr_value: header::IntoHeaderValue<ManagedFieldsEntry>) -> std::result::Result<Self, Self::Error> {
19352 let hdr_value = hdr_value.to_string();
19353 match HeaderValue::from_str(&hdr_value) {
19354 std::result::Result::Ok(value) => std::result::Result::Ok(value),
19355 std::result::Result::Err(e) => std::result::Result::Err(
19356 format!("Invalid header value for ManagedFieldsEntry - value: {} is invalid {}",
19357 hdr_value, e))
19358 }
19359 }
19360}
19361
19362#[cfg(feature = "server")]
19363impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ManagedFieldsEntry> {
19364 type Error = String;
19365
19366 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
19367 match hdr_value.to_str() {
19368 std::result::Result::Ok(value) => {
19369 match <ManagedFieldsEntry as std::str::FromStr>::from_str(value) {
19370 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
19371 std::result::Result::Err(err) => std::result::Result::Err(
19372 format!("Unable to convert header value '{}' into ManagedFieldsEntry - {}",
19373 value, err))
19374 }
19375 },
19376 std::result::Result::Err(e) => std::result::Result::Err(
19377 format!("Unable to convert header: {:?} to string: {}",
19378 hdr_value, e))
19379 }
19380 }
19381}
19382
19383
19384
19385
19386#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
19387#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19388pub struct ManagedFieldsOperationType(String);
19389
19390impl validator::Validate for ManagedFieldsOperationType {
19391 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
19392 std::result::Result::Ok(())
19393 }
19394}
19395
19396impl std::convert::From<String> for ManagedFieldsOperationType {
19397 fn from(x: String) -> Self {
19398 ManagedFieldsOperationType(x)
19399 }
19400}
19401
19402impl std::string::ToString for ManagedFieldsOperationType {
19403 fn to_string(&self) -> String {
19404 self.0.to_string()
19405 }
19406}
19407
19408impl std::str::FromStr for ManagedFieldsOperationType {
19409 type Err = std::string::ParseError;
19410 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
19411 std::result::Result::Ok(ManagedFieldsOperationType(x.to_string()))
19412 }
19413}
19414
19415impl std::convert::From<ManagedFieldsOperationType> for String {
19416 fn from(x: ManagedFieldsOperationType) -> Self {
19417 x.0
19418 }
19419}
19420
19421impl std::ops::Deref for ManagedFieldsOperationType {
19422 type Target = String;
19423 fn deref(&self) -> &String {
19424 &self.0
19425 }
19426}
19427
19428impl std::ops::DerefMut for ManagedFieldsOperationType {
19429 fn deref_mut(&mut self) -> &mut String {
19430 &mut self.0
19431 }
19432}
19433
19434
19435
19436
19437
19438
19439#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
19440#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19441pub struct MetadataValue {
19442#[serde(rename = "sensitive")]
19444 #[serde(skip_serializing_if="Option::is_none")]
19445 pub sensitive: Option<bool>,
19446
19447#[serde(rename = "value")]
19449 #[serde(skip_serializing_if="Option::is_none")]
19450 pub value: Option<String>,
19451
19452}
19453
19454
19455impl MetadataValue {
19456 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
19457 pub fn new() -> MetadataValue {
19458 MetadataValue {
19459 sensitive: None,
19460 value: None,
19461 }
19462 }
19463}
19464
19465impl std::string::ToString for MetadataValue {
19469 fn to_string(&self) -> String {
19470 let params: Vec<Option<String>> = vec![
19471
19472 self.sensitive.as_ref().map(|sensitive| {
19473 [
19474 "sensitive".to_string(),
19475 sensitive.to_string(),
19476 ].join(",")
19477 }),
19478
19479
19480 self.value.as_ref().map(|value| {
19481 [
19482 "value".to_string(),
19483 value.to_string(),
19484 ].join(",")
19485 }),
19486
19487 ];
19488
19489 params.into_iter().flatten().collect::<Vec<_>>().join(",")
19490 }
19491}
19492
19493impl std::str::FromStr for MetadataValue {
19497 type Err = String;
19498
19499 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
19500 #[derive(Default)]
19502 #[allow(dead_code)]
19503 struct IntermediateRep {
19504 pub sensitive: Vec<bool>,
19505 pub value: Vec<String>,
19506 }
19507
19508 let mut intermediate_rep = IntermediateRep::default();
19509
19510 let mut string_iter = s.split(',');
19512 let mut key_result = string_iter.next();
19513
19514 while key_result.is_some() {
19515 let val = match string_iter.next() {
19516 Some(x) => x,
19517 None => return std::result::Result::Err("Missing value while parsing MetadataValue".to_string())
19518 };
19519
19520 if let Some(key) = key_result {
19521 #[allow(clippy::match_single_binding)]
19522 match key {
19523 #[allow(clippy::redundant_clone)]
19524 "sensitive" => intermediate_rep.sensitive.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19525 #[allow(clippy::redundant_clone)]
19526 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19527 _ => return std::result::Result::Err("Unexpected key while parsing MetadataValue".to_string())
19528 }
19529 }
19530
19531 key_result = string_iter.next();
19533 }
19534
19535 std::result::Result::Ok(MetadataValue {
19537 sensitive: intermediate_rep.sensitive.into_iter().next(),
19538 value: intermediate_rep.value.into_iter().next(),
19539 })
19540 }
19541}
19542
19543#[cfg(feature = "server")]
19546impl std::convert::TryFrom<header::IntoHeaderValue<MetadataValue>> for HeaderValue {
19547 type Error = String;
19548
19549 fn try_from(hdr_value: header::IntoHeaderValue<MetadataValue>) -> std::result::Result<Self, Self::Error> {
19550 let hdr_value = hdr_value.to_string();
19551 match HeaderValue::from_str(&hdr_value) {
19552 std::result::Result::Ok(value) => std::result::Result::Ok(value),
19553 std::result::Result::Err(e) => std::result::Result::Err(
19554 format!("Invalid header value for MetadataValue - value: {} is invalid {}",
19555 hdr_value, e))
19556 }
19557 }
19558}
19559
19560#[cfg(feature = "server")]
19561impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<MetadataValue> {
19562 type Error = String;
19563
19564 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
19565 match hdr_value.to_str() {
19566 std::result::Result::Ok(value) => {
19567 match <MetadataValue as std::str::FromStr>::from_str(value) {
19568 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
19569 std::result::Result::Err(err) => std::result::Result::Err(
19570 format!("Unable to convert header value '{}' into MetadataValue - {}",
19571 value, err))
19572 }
19573 },
19574 std::result::Result::Err(e) => std::result::Result::Err(
19575 format!("Unable to convert header: {:?} to string: {}",
19576 hdr_value, e))
19577 }
19578 }
19579}
19580
19581
19582
19583
19584
19585
19586
19587#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
19588#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19589pub struct Mount {
19590 #[serde(rename = "BindOptions")]
19591 #[serde(skip_serializing_if="Option::is_none")]
19592 pub bind_options: Option<models::BindOptions>,
19593
19594 #[serde(rename = "Consistency")]
19595 #[serde(skip_serializing_if="Option::is_none")]
19596 pub consistency: Option<String>,
19597
19598 #[serde(rename = "ReadOnly")]
19599 #[serde(skip_serializing_if="Option::is_none")]
19600 pub read_only: Option<bool>,
19601
19602#[serde(rename = "Source")]
19604 #[serde(skip_serializing_if="Option::is_none")]
19605 pub source: Option<String>,
19606
19607 #[serde(rename = "Target")]
19608 #[serde(skip_serializing_if="Option::is_none")]
19609 pub target: Option<String>,
19610
19611 #[serde(rename = "TmpfsOptions")]
19612 #[serde(skip_serializing_if="Option::is_none")]
19613 pub tmpfs_options: Option<models::TmpfsOptions>,
19614
19615 #[serde(rename = "Type")]
19616 #[serde(skip_serializing_if="Option::is_none")]
19617 pub r#type: Option<i64>,
19618
19619 #[serde(rename = "VolumeOptions")]
19620 #[serde(skip_serializing_if="Option::is_none")]
19621 pub volume_options: Option<models::VolumeOptions>,
19622
19623}
19624
19625
19626impl Mount {
19627 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
19628 pub fn new() -> Mount {
19629 Mount {
19630 bind_options: None,
19631 consistency: None,
19632 read_only: None,
19633 source: None,
19634 target: None,
19635 tmpfs_options: None,
19636 r#type: None,
19637 volume_options: None,
19638 }
19639 }
19640}
19641
19642impl std::string::ToString for Mount {
19646 fn to_string(&self) -> String {
19647 let params: Vec<Option<String>> = vec![
19648 self.consistency.as_ref().map(|consistency| {
19652 [
19653 "Consistency".to_string(),
19654 consistency.to_string(),
19655 ].join(",")
19656 }),
19657
19658
19659 self.read_only.as_ref().map(|read_only| {
19660 [
19661 "ReadOnly".to_string(),
19662 read_only.to_string(),
19663 ].join(",")
19664 }),
19665
19666
19667 self.source.as_ref().map(|source| {
19668 [
19669 "Source".to_string(),
19670 source.to_string(),
19671 ].join(",")
19672 }),
19673
19674
19675 self.target.as_ref().map(|target| {
19676 [
19677 "Target".to_string(),
19678 target.to_string(),
19679 ].join(",")
19680 }),
19681
19682 self.r#type.as_ref().map(|r#type| {
19686 [
19687 "Type".to_string(),
19688 r#type.to_string(),
19689 ].join(",")
19690 }),
19691
19692 ];
19695
19696 params.into_iter().flatten().collect::<Vec<_>>().join(",")
19697 }
19698}
19699
19700impl std::str::FromStr for Mount {
19704 type Err = String;
19705
19706 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
19707 #[derive(Default)]
19709 #[allow(dead_code)]
19710 struct IntermediateRep {
19711 pub bind_options: Vec<models::BindOptions>,
19712 pub consistency: Vec<String>,
19713 pub read_only: Vec<bool>,
19714 pub source: Vec<String>,
19715 pub target: Vec<String>,
19716 pub tmpfs_options: Vec<models::TmpfsOptions>,
19717 pub r#type: Vec<i64>,
19718 pub volume_options: Vec<models::VolumeOptions>,
19719 }
19720
19721 let mut intermediate_rep = IntermediateRep::default();
19722
19723 let mut string_iter = s.split(',');
19725 let mut key_result = string_iter.next();
19726
19727 while key_result.is_some() {
19728 let val = match string_iter.next() {
19729 Some(x) => x,
19730 None => return std::result::Result::Err("Missing value while parsing Mount".to_string())
19731 };
19732
19733 if let Some(key) = key_result {
19734 #[allow(clippy::match_single_binding)]
19735 match key {
19736 #[allow(clippy::redundant_clone)]
19737 "BindOptions" => intermediate_rep.bind_options.push(<models::BindOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19738 #[allow(clippy::redundant_clone)]
19739 "Consistency" => intermediate_rep.consistency.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19740 #[allow(clippy::redundant_clone)]
19741 "ReadOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19742 #[allow(clippy::redundant_clone)]
19743 "Source" => intermediate_rep.source.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19744 #[allow(clippy::redundant_clone)]
19745 "Target" => intermediate_rep.target.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19746 #[allow(clippy::redundant_clone)]
19747 "TmpfsOptions" => intermediate_rep.tmpfs_options.push(<models::TmpfsOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19748 #[allow(clippy::redundant_clone)]
19749 "Type" => intermediate_rep.r#type.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19750 #[allow(clippy::redundant_clone)]
19751 "VolumeOptions" => intermediate_rep.volume_options.push(<models::VolumeOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
19752 _ => return std::result::Result::Err("Unexpected key while parsing Mount".to_string())
19753 }
19754 }
19755
19756 key_result = string_iter.next();
19758 }
19759
19760 std::result::Result::Ok(Mount {
19762 bind_options: intermediate_rep.bind_options.into_iter().next(),
19763 consistency: intermediate_rep.consistency.into_iter().next(),
19764 read_only: intermediate_rep.read_only.into_iter().next(),
19765 source: intermediate_rep.source.into_iter().next(),
19766 target: intermediate_rep.target.into_iter().next(),
19767 tmpfs_options: intermediate_rep.tmpfs_options.into_iter().next(),
19768 r#type: intermediate_rep.r#type.into_iter().next(),
19769 volume_options: intermediate_rep.volume_options.into_iter().next(),
19770 })
19771 }
19772}
19773
19774#[cfg(feature = "server")]
19777impl std::convert::TryFrom<header::IntoHeaderValue<Mount>> for HeaderValue {
19778 type Error = String;
19779
19780 fn try_from(hdr_value: header::IntoHeaderValue<Mount>) -> std::result::Result<Self, Self::Error> {
19781 let hdr_value = hdr_value.to_string();
19782 match HeaderValue::from_str(&hdr_value) {
19783 std::result::Result::Ok(value) => std::result::Result::Ok(value),
19784 std::result::Result::Err(e) => std::result::Result::Err(
19785 format!("Invalid header value for Mount - value: {} is invalid {}",
19786 hdr_value, e))
19787 }
19788 }
19789}
19790
19791#[cfg(feature = "server")]
19792impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Mount> {
19793 type Error = String;
19794
19795 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
19796 match hdr_value.to_str() {
19797 std::result::Result::Ok(value) => {
19798 match <Mount as std::str::FromStr>::from_str(value) {
19799 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
19800 std::result::Result::Err(err) => std::result::Result::Err(
19801 format!("Unable to convert header value '{}' into Mount - {}",
19802 value, err))
19803 }
19804 },
19805 std::result::Result::Err(e) => std::result::Result::Err(
19806 format!("Unable to convert header: {:?} to string: {}",
19807 hdr_value, e))
19808 }
19809 }
19810}
19811
19812
19813
19814
19815#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
19817#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19818pub struct MountPropagationMode(String);
19819
19820impl validator::Validate for MountPropagationMode {
19821 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
19822 std::result::Result::Ok(())
19823 }
19824}
19825
19826impl std::convert::From<String> for MountPropagationMode {
19827 fn from(x: String) -> Self {
19828 MountPropagationMode(x)
19829 }
19830}
19831
19832impl std::string::ToString for MountPropagationMode {
19833 fn to_string(&self) -> String {
19834 self.0.to_string()
19835 }
19836}
19837
19838impl std::str::FromStr for MountPropagationMode {
19839 type Err = std::string::ParseError;
19840 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
19841 std::result::Result::Ok(MountPropagationMode(x.to_string()))
19842 }
19843}
19844
19845impl std::convert::From<MountPropagationMode> for String {
19846 fn from(x: MountPropagationMode) -> Self {
19847 x.0
19848 }
19849}
19850
19851impl std::ops::Deref for MountPropagationMode {
19852 type Target = String;
19853 fn deref(&self) -> &String {
19854 &self.0
19855 }
19856}
19857
19858impl std::ops::DerefMut for MountPropagationMode {
19859 fn deref_mut(&mut self) -> &mut String {
19860 &mut self.0
19861 }
19862}
19863
19864
19865
19866#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
19867#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19868pub struct NetworkMode(String);
19869
19870impl validator::Validate for NetworkMode {
19871 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
19872 std::result::Result::Ok(())
19873 }
19874}
19875
19876impl std::convert::From<String> for NetworkMode {
19877 fn from(x: String) -> Self {
19878 NetworkMode(x)
19879 }
19880}
19881
19882impl std::string::ToString for NetworkMode {
19883 fn to_string(&self) -> String {
19884 self.0.to_string()
19885 }
19886}
19887
19888impl std::str::FromStr for NetworkMode {
19889 type Err = std::string::ParseError;
19890 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
19891 std::result::Result::Ok(NetworkMode(x.to_string()))
19892 }
19893}
19894
19895impl std::convert::From<NetworkMode> for String {
19896 fn from(x: NetworkMode) -> Self {
19897 x.0
19898 }
19899}
19900
19901impl std::ops::Deref for NetworkMode {
19902 type Target = String;
19903 fn deref(&self) -> &String {
19904 &self.0
19905 }
19906}
19907
19908impl std::ops::DerefMut for NetworkMode {
19909 fn deref_mut(&mut self) -> &mut String {
19910 &mut self.0
19911 }
19912}
19913
19914
19915
19916#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
19921#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
19922pub struct NetworkingConfig {
19923 #[serde(rename = "EndpointsConfig")]
19924 #[serde(skip_serializing_if="Option::is_none")]
19925 pub endpoints_config: Option<std::collections::HashMap<String, models::EndpointSettings>>,
19926
19927}
19928
19929
19930impl NetworkingConfig {
19931 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
19932 pub fn new() -> NetworkingConfig {
19933 NetworkingConfig {
19934 endpoints_config: None,
19935 }
19936 }
19937}
19938
19939impl std::string::ToString for NetworkingConfig {
19943 fn to_string(&self) -> String {
19944 let params: Vec<Option<String>> = vec![
19945 ];
19949
19950 params.into_iter().flatten().collect::<Vec<_>>().join(",")
19951 }
19952}
19953
19954impl std::str::FromStr for NetworkingConfig {
19958 type Err = String;
19959
19960 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
19961 #[derive(Default)]
19963 #[allow(dead_code)]
19964 struct IntermediateRep {
19965 pub endpoints_config: Vec<std::collections::HashMap<String, models::EndpointSettings>>,
19966 }
19967
19968 let mut intermediate_rep = IntermediateRep::default();
19969
19970 let mut string_iter = s.split(',');
19972 let mut key_result = string_iter.next();
19973
19974 while key_result.is_some() {
19975 let val = match string_iter.next() {
19976 Some(x) => x,
19977 None => return std::result::Result::Err("Missing value while parsing NetworkingConfig".to_string())
19978 };
19979
19980 if let Some(key) = key_result {
19981 #[allow(clippy::match_single_binding)]
19982 match key {
19983 "EndpointsConfig" => return std::result::Result::Err("Parsing a container in this style is not supported in NetworkingConfig".to_string()),
19984 _ => return std::result::Result::Err("Unexpected key while parsing NetworkingConfig".to_string())
19985 }
19986 }
19987
19988 key_result = string_iter.next();
19990 }
19991
19992 std::result::Result::Ok(NetworkingConfig {
19994 endpoints_config: intermediate_rep.endpoints_config.into_iter().next(),
19995 })
19996 }
19997}
19998
19999#[cfg(feature = "server")]
20002impl std::convert::TryFrom<header::IntoHeaderValue<NetworkingConfig>> for HeaderValue {
20003 type Error = String;
20004
20005 fn try_from(hdr_value: header::IntoHeaderValue<NetworkingConfig>) -> std::result::Result<Self, Self::Error> {
20006 let hdr_value = hdr_value.to_string();
20007 match HeaderValue::from_str(&hdr_value) {
20008 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20009 std::result::Result::Err(e) => std::result::Result::Err(
20010 format!("Invalid header value for NetworkingConfig - value: {} is invalid {}",
20011 hdr_value, e))
20012 }
20013 }
20014}
20015
20016#[cfg(feature = "server")]
20017impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NetworkingConfig> {
20018 type Error = String;
20019
20020 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20021 match hdr_value.to_str() {
20022 std::result::Result::Ok(value) => {
20023 match <NetworkingConfig as std::str::FromStr>::from_str(value) {
20024 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20025 std::result::Result::Err(err) => std::result::Result::Err(
20026 format!("Unable to convert header value '{}' into NetworkingConfig - {}",
20027 value, err))
20028 }
20029 },
20030 std::result::Result::Err(e) => std::result::Result::Err(
20031 format!("Unable to convert header: {:?} to string: {}",
20032 hdr_value, e))
20033 }
20034 }
20035}
20036
20037
20038
20039
20040#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20045#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20046pub struct NfsVolumeSource {
20047#[serde(rename = "path")]
20049 #[serde(skip_serializing_if="Option::is_none")]
20050 pub path: Option<String>,
20051
20052#[serde(rename = "readOnly")]
20054 #[serde(skip_serializing_if="Option::is_none")]
20055 pub read_only: Option<bool>,
20056
20057#[serde(rename = "server")]
20059 #[serde(skip_serializing_if="Option::is_none")]
20060 pub server: Option<String>,
20061
20062}
20063
20064
20065impl NfsVolumeSource {
20066 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20067 pub fn new() -> NfsVolumeSource {
20068 NfsVolumeSource {
20069 path: None,
20070 read_only: None,
20071 server: None,
20072 }
20073 }
20074}
20075
20076impl std::string::ToString for NfsVolumeSource {
20080 fn to_string(&self) -> String {
20081 let params: Vec<Option<String>> = vec![
20082
20083 self.path.as_ref().map(|path| {
20084 [
20085 "path".to_string(),
20086 path.to_string(),
20087 ].join(",")
20088 }),
20089
20090
20091 self.read_only.as_ref().map(|read_only| {
20092 [
20093 "readOnly".to_string(),
20094 read_only.to_string(),
20095 ].join(",")
20096 }),
20097
20098
20099 self.server.as_ref().map(|server| {
20100 [
20101 "server".to_string(),
20102 server.to_string(),
20103 ].join(",")
20104 }),
20105
20106 ];
20107
20108 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20109 }
20110}
20111
20112impl std::str::FromStr for NfsVolumeSource {
20116 type Err = String;
20117
20118 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20119 #[derive(Default)]
20121 #[allow(dead_code)]
20122 struct IntermediateRep {
20123 pub path: Vec<String>,
20124 pub read_only: Vec<bool>,
20125 pub server: Vec<String>,
20126 }
20127
20128 let mut intermediate_rep = IntermediateRep::default();
20129
20130 let mut string_iter = s.split(',');
20132 let mut key_result = string_iter.next();
20133
20134 while key_result.is_some() {
20135 let val = match string_iter.next() {
20136 Some(x) => x,
20137 None => return std::result::Result::Err("Missing value while parsing NfsVolumeSource".to_string())
20138 };
20139
20140 if let Some(key) = key_result {
20141 #[allow(clippy::match_single_binding)]
20142 match key {
20143 #[allow(clippy::redundant_clone)]
20144 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20145 #[allow(clippy::redundant_clone)]
20146 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20147 #[allow(clippy::redundant_clone)]
20148 "server" => intermediate_rep.server.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20149 _ => return std::result::Result::Err("Unexpected key while parsing NfsVolumeSource".to_string())
20150 }
20151 }
20152
20153 key_result = string_iter.next();
20155 }
20156
20157 std::result::Result::Ok(NfsVolumeSource {
20159 path: intermediate_rep.path.into_iter().next(),
20160 read_only: intermediate_rep.read_only.into_iter().next(),
20161 server: intermediate_rep.server.into_iter().next(),
20162 })
20163 }
20164}
20165
20166#[cfg(feature = "server")]
20169impl std::convert::TryFrom<header::IntoHeaderValue<NfsVolumeSource>> for HeaderValue {
20170 type Error = String;
20171
20172 fn try_from(hdr_value: header::IntoHeaderValue<NfsVolumeSource>) -> std::result::Result<Self, Self::Error> {
20173 let hdr_value = hdr_value.to_string();
20174 match HeaderValue::from_str(&hdr_value) {
20175 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20176 std::result::Result::Err(e) => std::result::Result::Err(
20177 format!("Invalid header value for NfsVolumeSource - value: {} is invalid {}",
20178 hdr_value, e))
20179 }
20180 }
20181}
20182
20183#[cfg(feature = "server")]
20184impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NfsVolumeSource> {
20185 type Error = String;
20186
20187 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20188 match hdr_value.to_str() {
20189 std::result::Result::Ok(value) => {
20190 match <NfsVolumeSource as std::str::FromStr>::from_str(value) {
20191 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20192 std::result::Result::Err(err) => std::result::Result::Err(
20193 format!("Unable to convert header value '{}' into NfsVolumeSource - {}",
20194 value, err))
20195 }
20196 },
20197 std::result::Result::Err(e) => std::result::Result::Err(
20198 format!("Unable to convert header: {:?} to string: {}",
20199 hdr_value, e))
20200 }
20201 }
20202}
20203
20204
20205
20206
20207
20208
20209
20210#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20211#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20212pub struct NodeAffinity {
20213#[serde(rename = "preferredDuringSchedulingIgnoredDuringExecution")]
20215 #[serde(skip_serializing_if="Option::is_none")]
20216 pub preferred_during_scheduling_ignored_during_execution: Option<Vec<models::PreferredSchedulingTerm>>,
20217
20218 #[serde(rename = "requiredDuringSchedulingIgnoredDuringExecution")]
20219 #[serde(skip_serializing_if="Option::is_none")]
20220 pub required_during_scheduling_ignored_during_execution: Option<models::NodeSelector>,
20221
20222}
20223
20224
20225impl NodeAffinity {
20226 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20227 pub fn new() -> NodeAffinity {
20228 NodeAffinity {
20229 preferred_during_scheduling_ignored_during_execution: None,
20230 required_during_scheduling_ignored_during_execution: None,
20231 }
20232 }
20233}
20234
20235impl std::string::ToString for NodeAffinity {
20239 fn to_string(&self) -> String {
20240 let params: Vec<Option<String>> = vec![
20241 ];
20246
20247 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20248 }
20249}
20250
20251impl std::str::FromStr for NodeAffinity {
20255 type Err = String;
20256
20257 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20258 #[derive(Default)]
20260 #[allow(dead_code)]
20261 struct IntermediateRep {
20262 pub preferred_during_scheduling_ignored_during_execution: Vec<Vec<models::PreferredSchedulingTerm>>,
20263 pub required_during_scheduling_ignored_during_execution: Vec<models::NodeSelector>,
20264 }
20265
20266 let mut intermediate_rep = IntermediateRep::default();
20267
20268 let mut string_iter = s.split(',');
20270 let mut key_result = string_iter.next();
20271
20272 while key_result.is_some() {
20273 let val = match string_iter.next() {
20274 Some(x) => x,
20275 None => return std::result::Result::Err("Missing value while parsing NodeAffinity".to_string())
20276 };
20277
20278 if let Some(key) = key_result {
20279 #[allow(clippy::match_single_binding)]
20280 match key {
20281 "preferredDuringSchedulingIgnoredDuringExecution" => return std::result::Result::Err("Parsing a container in this style is not supported in NodeAffinity".to_string()),
20282 #[allow(clippy::redundant_clone)]
20283 "requiredDuringSchedulingIgnoredDuringExecution" => intermediate_rep.required_during_scheduling_ignored_during_execution.push(<models::NodeSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20284 _ => return std::result::Result::Err("Unexpected key while parsing NodeAffinity".to_string())
20285 }
20286 }
20287
20288 key_result = string_iter.next();
20290 }
20291
20292 std::result::Result::Ok(NodeAffinity {
20294 preferred_during_scheduling_ignored_during_execution: intermediate_rep.preferred_during_scheduling_ignored_during_execution.into_iter().next(),
20295 required_during_scheduling_ignored_during_execution: intermediate_rep.required_during_scheduling_ignored_during_execution.into_iter().next(),
20296 })
20297 }
20298}
20299
20300#[cfg(feature = "server")]
20303impl std::convert::TryFrom<header::IntoHeaderValue<NodeAffinity>> for HeaderValue {
20304 type Error = String;
20305
20306 fn try_from(hdr_value: header::IntoHeaderValue<NodeAffinity>) -> std::result::Result<Self, Self::Error> {
20307 let hdr_value = hdr_value.to_string();
20308 match HeaderValue::from_str(&hdr_value) {
20309 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20310 std::result::Result::Err(e) => std::result::Result::Err(
20311 format!("Invalid header value for NodeAffinity - value: {} is invalid {}",
20312 hdr_value, e))
20313 }
20314 }
20315}
20316
20317#[cfg(feature = "server")]
20318impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NodeAffinity> {
20319 type Error = String;
20320
20321 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20322 match hdr_value.to_str() {
20323 std::result::Result::Ok(value) => {
20324 match <NodeAffinity as std::str::FromStr>::from_str(value) {
20325 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20326 std::result::Result::Err(err) => std::result::Result::Err(
20327 format!("Unable to convert header value '{}' into NodeAffinity - {}",
20328 value, err))
20329 }
20330 },
20331 std::result::Result::Err(e) => std::result::Result::Err(
20332 format!("Unable to convert header: {:?} to string: {}",
20333 hdr_value, e))
20334 }
20335 }
20336}
20337
20338
20339
20340
20341#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20346#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20347pub struct NodeSelector {
20348#[serde(rename = "nodeSelectorTerms")]
20350 #[serde(skip_serializing_if="Option::is_none")]
20351 pub node_selector_terms: Option<Vec<models::NodeSelectorTerm>>,
20352
20353}
20354
20355
20356impl NodeSelector {
20357 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20358 pub fn new() -> NodeSelector {
20359 NodeSelector {
20360 node_selector_terms: None,
20361 }
20362 }
20363}
20364
20365impl std::string::ToString for NodeSelector {
20369 fn to_string(&self) -> String {
20370 let params: Vec<Option<String>> = vec![
20371 ];
20374
20375 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20376 }
20377}
20378
20379impl std::str::FromStr for NodeSelector {
20383 type Err = String;
20384
20385 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20386 #[derive(Default)]
20388 #[allow(dead_code)]
20389 struct IntermediateRep {
20390 pub node_selector_terms: Vec<Vec<models::NodeSelectorTerm>>,
20391 }
20392
20393 let mut intermediate_rep = IntermediateRep::default();
20394
20395 let mut string_iter = s.split(',');
20397 let mut key_result = string_iter.next();
20398
20399 while key_result.is_some() {
20400 let val = match string_iter.next() {
20401 Some(x) => x,
20402 None => return std::result::Result::Err("Missing value while parsing NodeSelector".to_string())
20403 };
20404
20405 if let Some(key) = key_result {
20406 #[allow(clippy::match_single_binding)]
20407 match key {
20408 "nodeSelectorTerms" => return std::result::Result::Err("Parsing a container in this style is not supported in NodeSelector".to_string()),
20409 _ => return std::result::Result::Err("Unexpected key while parsing NodeSelector".to_string())
20410 }
20411 }
20412
20413 key_result = string_iter.next();
20415 }
20416
20417 std::result::Result::Ok(NodeSelector {
20419 node_selector_terms: intermediate_rep.node_selector_terms.into_iter().next(),
20420 })
20421 }
20422}
20423
20424#[cfg(feature = "server")]
20427impl std::convert::TryFrom<header::IntoHeaderValue<NodeSelector>> for HeaderValue {
20428 type Error = String;
20429
20430 fn try_from(hdr_value: header::IntoHeaderValue<NodeSelector>) -> std::result::Result<Self, Self::Error> {
20431 let hdr_value = hdr_value.to_string();
20432 match HeaderValue::from_str(&hdr_value) {
20433 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20434 std::result::Result::Err(e) => std::result::Result::Err(
20435 format!("Invalid header value for NodeSelector - value: {} is invalid {}",
20436 hdr_value, e))
20437 }
20438 }
20439}
20440
20441#[cfg(feature = "server")]
20442impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NodeSelector> {
20443 type Error = String;
20444
20445 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20446 match hdr_value.to_str() {
20447 std::result::Result::Ok(value) => {
20448 match <NodeSelector as std::str::FromStr>::from_str(value) {
20449 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20450 std::result::Result::Err(err) => std::result::Result::Err(
20451 format!("Unable to convert header value '{}' into NodeSelector - {}",
20452 value, err))
20453 }
20454 },
20455 std::result::Result::Err(e) => std::result::Result::Err(
20456 format!("Unable to convert header: {:?} to string: {}",
20457 hdr_value, e))
20458 }
20459 }
20460}
20461
20462
20463
20464
20465#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
20467#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20468pub struct NodeSelectorOperator(String);
20469
20470impl validator::Validate for NodeSelectorOperator {
20471 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
20472 std::result::Result::Ok(())
20473 }
20474}
20475
20476impl std::convert::From<String> for NodeSelectorOperator {
20477 fn from(x: String) -> Self {
20478 NodeSelectorOperator(x)
20479 }
20480}
20481
20482impl std::string::ToString for NodeSelectorOperator {
20483 fn to_string(&self) -> String {
20484 self.0.to_string()
20485 }
20486}
20487
20488impl std::str::FromStr for NodeSelectorOperator {
20489 type Err = std::string::ParseError;
20490 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
20491 std::result::Result::Ok(NodeSelectorOperator(x.to_string()))
20492 }
20493}
20494
20495impl std::convert::From<NodeSelectorOperator> for String {
20496 fn from(x: NodeSelectorOperator) -> Self {
20497 x.0
20498 }
20499}
20500
20501impl std::ops::Deref for NodeSelectorOperator {
20502 type Target = String;
20503 fn deref(&self) -> &String {
20504 &self.0
20505 }
20506}
20507
20508impl std::ops::DerefMut for NodeSelectorOperator {
20509 fn deref_mut(&mut self) -> &mut String {
20510 &mut self.0
20511 }
20512}
20513
20514
20515
20516#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20521#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20522pub struct NodeSelectorRequirement {
20523#[serde(rename = "key")]
20525 #[serde(skip_serializing_if="Option::is_none")]
20526 pub key: Option<String>,
20527
20528#[serde(rename = "operator")]
20530 #[serde(skip_serializing_if="Option::is_none")]
20531 pub operator: Option<String>,
20532
20533#[serde(rename = "values")]
20535 #[serde(skip_serializing_if="Option::is_none")]
20536 pub values: Option<Vec<String>>,
20537
20538}
20539
20540
20541impl NodeSelectorRequirement {
20542 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20543 pub fn new() -> NodeSelectorRequirement {
20544 NodeSelectorRequirement {
20545 key: None,
20546 operator: None,
20547 values: None,
20548 }
20549 }
20550}
20551
20552impl std::string::ToString for NodeSelectorRequirement {
20556 fn to_string(&self) -> String {
20557 let params: Vec<Option<String>> = vec![
20558
20559 self.key.as_ref().map(|key| {
20560 [
20561 "key".to_string(),
20562 key.to_string(),
20563 ].join(",")
20564 }),
20565
20566
20567 self.operator.as_ref().map(|operator| {
20568 [
20569 "operator".to_string(),
20570 operator.to_string(),
20571 ].join(",")
20572 }),
20573
20574
20575 self.values.as_ref().map(|values| {
20576 [
20577 "values".to_string(),
20578 values.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
20579 ].join(",")
20580 }),
20581
20582 ];
20583
20584 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20585 }
20586}
20587
20588impl std::str::FromStr for NodeSelectorRequirement {
20592 type Err = String;
20593
20594 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20595 #[derive(Default)]
20597 #[allow(dead_code)]
20598 struct IntermediateRep {
20599 pub key: Vec<String>,
20600 pub operator: Vec<String>,
20601 pub values: Vec<Vec<String>>,
20602 }
20603
20604 let mut intermediate_rep = IntermediateRep::default();
20605
20606 let mut string_iter = s.split(',');
20608 let mut key_result = string_iter.next();
20609
20610 while key_result.is_some() {
20611 let val = match string_iter.next() {
20612 Some(x) => x,
20613 None => return std::result::Result::Err("Missing value while parsing NodeSelectorRequirement".to_string())
20614 };
20615
20616 if let Some(key) = key_result {
20617 #[allow(clippy::match_single_binding)]
20618 match key {
20619 #[allow(clippy::redundant_clone)]
20620 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20621 #[allow(clippy::redundant_clone)]
20622 "operator" => intermediate_rep.operator.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20623 "values" => return std::result::Result::Err("Parsing a container in this style is not supported in NodeSelectorRequirement".to_string()),
20624 _ => return std::result::Result::Err("Unexpected key while parsing NodeSelectorRequirement".to_string())
20625 }
20626 }
20627
20628 key_result = string_iter.next();
20630 }
20631
20632 std::result::Result::Ok(NodeSelectorRequirement {
20634 key: intermediate_rep.key.into_iter().next(),
20635 operator: intermediate_rep.operator.into_iter().next(),
20636 values: intermediate_rep.values.into_iter().next(),
20637 })
20638 }
20639}
20640
20641#[cfg(feature = "server")]
20644impl std::convert::TryFrom<header::IntoHeaderValue<NodeSelectorRequirement>> for HeaderValue {
20645 type Error = String;
20646
20647 fn try_from(hdr_value: header::IntoHeaderValue<NodeSelectorRequirement>) -> std::result::Result<Self, Self::Error> {
20648 let hdr_value = hdr_value.to_string();
20649 match HeaderValue::from_str(&hdr_value) {
20650 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20651 std::result::Result::Err(e) => std::result::Result::Err(
20652 format!("Invalid header value for NodeSelectorRequirement - value: {} is invalid {}",
20653 hdr_value, e))
20654 }
20655 }
20656}
20657
20658#[cfg(feature = "server")]
20659impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NodeSelectorRequirement> {
20660 type Error = String;
20661
20662 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20663 match hdr_value.to_str() {
20664 std::result::Result::Ok(value) => {
20665 match <NodeSelectorRequirement as std::str::FromStr>::from_str(value) {
20666 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20667 std::result::Result::Err(err) => std::result::Result::Err(
20668 format!("Unable to convert header value '{}' into NodeSelectorRequirement - {}",
20669 value, err))
20670 }
20671 },
20672 std::result::Result::Err(e) => std::result::Result::Err(
20673 format!("Unable to convert header: {:?} to string: {}",
20674 hdr_value, e))
20675 }
20676 }
20677}
20678
20679
20680
20681
20682#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20687#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20688pub struct NodeSelectorTerm {
20689#[serde(rename = "matchExpressions")]
20691 #[serde(skip_serializing_if="Option::is_none")]
20692 pub match_expressions: Option<Vec<models::NodeSelectorRequirement>>,
20693
20694#[serde(rename = "matchFields")]
20696 #[serde(skip_serializing_if="Option::is_none")]
20697 pub match_fields: Option<Vec<models::NodeSelectorRequirement>>,
20698
20699}
20700
20701
20702impl NodeSelectorTerm {
20703 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20704 pub fn new() -> NodeSelectorTerm {
20705 NodeSelectorTerm {
20706 match_expressions: None,
20707 match_fields: None,
20708 }
20709 }
20710}
20711
20712impl std::string::ToString for NodeSelectorTerm {
20716 fn to_string(&self) -> String {
20717 let params: Vec<Option<String>> = vec![
20718 ];
20723
20724 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20725 }
20726}
20727
20728impl std::str::FromStr for NodeSelectorTerm {
20732 type Err = String;
20733
20734 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20735 #[derive(Default)]
20737 #[allow(dead_code)]
20738 struct IntermediateRep {
20739 pub match_expressions: Vec<Vec<models::NodeSelectorRequirement>>,
20740 pub match_fields: Vec<Vec<models::NodeSelectorRequirement>>,
20741 }
20742
20743 let mut intermediate_rep = IntermediateRep::default();
20744
20745 let mut string_iter = s.split(',');
20747 let mut key_result = string_iter.next();
20748
20749 while key_result.is_some() {
20750 let val = match string_iter.next() {
20751 Some(x) => x,
20752 None => return std::result::Result::Err("Missing value while parsing NodeSelectorTerm".to_string())
20753 };
20754
20755 if let Some(key) = key_result {
20756 #[allow(clippy::match_single_binding)]
20757 match key {
20758 "matchExpressions" => return std::result::Result::Err("Parsing a container in this style is not supported in NodeSelectorTerm".to_string()),
20759 "matchFields" => return std::result::Result::Err("Parsing a container in this style is not supported in NodeSelectorTerm".to_string()),
20760 _ => return std::result::Result::Err("Unexpected key while parsing NodeSelectorTerm".to_string())
20761 }
20762 }
20763
20764 key_result = string_iter.next();
20766 }
20767
20768 std::result::Result::Ok(NodeSelectorTerm {
20770 match_expressions: intermediate_rep.match_expressions.into_iter().next(),
20771 match_fields: intermediate_rep.match_fields.into_iter().next(),
20772 })
20773 }
20774}
20775
20776#[cfg(feature = "server")]
20779impl std::convert::TryFrom<header::IntoHeaderValue<NodeSelectorTerm>> for HeaderValue {
20780 type Error = String;
20781
20782 fn try_from(hdr_value: header::IntoHeaderValue<NodeSelectorTerm>) -> std::result::Result<Self, Self::Error> {
20783 let hdr_value = hdr_value.to_string();
20784 match HeaderValue::from_str(&hdr_value) {
20785 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20786 std::result::Result::Err(e) => std::result::Result::Err(
20787 format!("Invalid header value for NodeSelectorTerm - value: {} is invalid {}",
20788 hdr_value, e))
20789 }
20790 }
20791}
20792
20793#[cfg(feature = "server")]
20794impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<NodeSelectorTerm> {
20795 type Error = String;
20796
20797 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20798 match hdr_value.to_str() {
20799 std::result::Result::Ok(value) => {
20800 match <NodeSelectorTerm as std::str::FromStr>::from_str(value) {
20801 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20802 std::result::Result::Err(err) => std::result::Result::Err(
20803 format!("Unable to convert header value '{}' into NodeSelectorTerm - {}",
20804 value, err))
20805 }
20806 },
20807 std::result::Result::Err(e) => std::result::Result::Err(
20808 format!("Unable to convert header: {:?} to string: {}",
20809 hdr_value, e))
20810 }
20811 }
20812}
20813
20814
20815
20816
20817#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20822#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20823pub struct ObjectFieldSelector {
20824#[serde(rename = "apiVersion")]
20826 #[serde(skip_serializing_if="Option::is_none")]
20827 pub api_version: Option<String>,
20828
20829#[serde(rename = "fieldPath")]
20831 #[serde(skip_serializing_if="Option::is_none")]
20832 pub field_path: Option<String>,
20833
20834}
20835
20836
20837impl ObjectFieldSelector {
20838 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
20839 pub fn new() -> ObjectFieldSelector {
20840 ObjectFieldSelector {
20841 api_version: None,
20842 field_path: None,
20843 }
20844 }
20845}
20846
20847impl std::string::ToString for ObjectFieldSelector {
20851 fn to_string(&self) -> String {
20852 let params: Vec<Option<String>> = vec![
20853
20854 self.api_version.as_ref().map(|api_version| {
20855 [
20856 "apiVersion".to_string(),
20857 api_version.to_string(),
20858 ].join(",")
20859 }),
20860
20861
20862 self.field_path.as_ref().map(|field_path| {
20863 [
20864 "fieldPath".to_string(),
20865 field_path.to_string(),
20866 ].join(",")
20867 }),
20868
20869 ];
20870
20871 params.into_iter().flatten().collect::<Vec<_>>().join(",")
20872 }
20873}
20874
20875impl std::str::FromStr for ObjectFieldSelector {
20879 type Err = String;
20880
20881 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
20882 #[derive(Default)]
20884 #[allow(dead_code)]
20885 struct IntermediateRep {
20886 pub api_version: Vec<String>,
20887 pub field_path: Vec<String>,
20888 }
20889
20890 let mut intermediate_rep = IntermediateRep::default();
20891
20892 let mut string_iter = s.split(',');
20894 let mut key_result = string_iter.next();
20895
20896 while key_result.is_some() {
20897 let val = match string_iter.next() {
20898 Some(x) => x,
20899 None => return std::result::Result::Err("Missing value while parsing ObjectFieldSelector".to_string())
20900 };
20901
20902 if let Some(key) = key_result {
20903 #[allow(clippy::match_single_binding)]
20904 match key {
20905 #[allow(clippy::redundant_clone)]
20906 "apiVersion" => intermediate_rep.api_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20907 #[allow(clippy::redundant_clone)]
20908 "fieldPath" => intermediate_rep.field_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
20909 _ => return std::result::Result::Err("Unexpected key while parsing ObjectFieldSelector".to_string())
20910 }
20911 }
20912
20913 key_result = string_iter.next();
20915 }
20916
20917 std::result::Result::Ok(ObjectFieldSelector {
20919 api_version: intermediate_rep.api_version.into_iter().next(),
20920 field_path: intermediate_rep.field_path.into_iter().next(),
20921 })
20922 }
20923}
20924
20925#[cfg(feature = "server")]
20928impl std::convert::TryFrom<header::IntoHeaderValue<ObjectFieldSelector>> for HeaderValue {
20929 type Error = String;
20930
20931 fn try_from(hdr_value: header::IntoHeaderValue<ObjectFieldSelector>) -> std::result::Result<Self, Self::Error> {
20932 let hdr_value = hdr_value.to_string();
20933 match HeaderValue::from_str(&hdr_value) {
20934 std::result::Result::Ok(value) => std::result::Result::Ok(value),
20935 std::result::Result::Err(e) => std::result::Result::Err(
20936 format!("Invalid header value for ObjectFieldSelector - value: {} is invalid {}",
20937 hdr_value, e))
20938 }
20939 }
20940}
20941
20942#[cfg(feature = "server")]
20943impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ObjectFieldSelector> {
20944 type Error = String;
20945
20946 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
20947 match hdr_value.to_str() {
20948 std::result::Result::Ok(value) => {
20949 match <ObjectFieldSelector as std::str::FromStr>::from_str(value) {
20950 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
20951 std::result::Result::Err(err) => std::result::Result::Err(
20952 format!("Unable to convert header value '{}' into ObjectFieldSelector - {}",
20953 value, err))
20954 }
20955 },
20956 std::result::Result::Err(e) => std::result::Result::Err(
20957 format!("Unable to convert header: {:?} to string: {}",
20958 hdr_value, e))
20959 }
20960 }
20961}
20962
20963
20964
20965
20966#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
20971#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
20972pub struct ObjectMeta {
20973#[serde(rename = "annotations")]
20975 #[serde(skip_serializing_if="Option::is_none")]
20976 pub annotations: Option<std::collections::HashMap<String, String>>,
20977
20978#[serde(rename = "clusterName")]
20980 #[serde(skip_serializing_if="Option::is_none")]
20981 pub cluster_name: Option<String>,
20982
20983#[serde(rename = "creationTimestamp")]
20985 #[serde(skip_serializing_if="Option::is_none")]
20986 pub creation_timestamp: Option<String>,
20987
20988#[serde(rename = "deletionGracePeriodSeconds")]
20990 #[serde(skip_serializing_if="Option::is_none")]
20991 pub deletion_grace_period_seconds: Option<i64>,
20992
20993#[serde(rename = "deletionTimestamp")]
20995 #[serde(skip_serializing_if="Option::is_none")]
20996 pub deletion_timestamp: Option<String>,
20997
20998#[serde(rename = "finalizers")]
21000 #[serde(skip_serializing_if="Option::is_none")]
21001 pub finalizers: Option<Vec<String>>,
21002
21003#[serde(rename = "generateName")]
21005 #[serde(skip_serializing_if="Option::is_none")]
21006 pub generate_name: Option<String>,
21007
21008#[serde(rename = "generation")]
21010 #[serde(skip_serializing_if="Option::is_none")]
21011 pub generation: Option<i64>,
21012
21013#[serde(rename = "labels")]
21015 #[serde(skip_serializing_if="Option::is_none")]
21016 pub labels: Option<std::collections::HashMap<String, String>>,
21017
21018#[serde(rename = "managedFields")]
21020 #[serde(skip_serializing_if="Option::is_none")]
21021 pub managed_fields: Option<Vec<models::ManagedFieldsEntry>>,
21022
21023#[serde(rename = "name")]
21025 #[serde(skip_serializing_if="Option::is_none")]
21026 pub name: Option<String>,
21027
21028#[serde(rename = "namespace")]
21030 #[serde(skip_serializing_if="Option::is_none")]
21031 pub namespace: Option<String>,
21032
21033#[serde(rename = "ownerReferences")]
21035 #[serde(skip_serializing_if="Option::is_none")]
21036 pub owner_references: Option<Vec<models::OwnerReference>>,
21037
21038#[serde(rename = "resourceVersion")]
21040 #[serde(skip_serializing_if="Option::is_none")]
21041 pub resource_version: Option<String>,
21042
21043#[serde(rename = "selfLink")]
21045 #[serde(skip_serializing_if="Option::is_none")]
21046 pub self_link: Option<String>,
21047
21048#[serde(rename = "uid")]
21050 #[serde(skip_serializing_if="Option::is_none")]
21051 pub uid: Option<String>,
21052
21053}
21054
21055
21056impl ObjectMeta {
21057 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
21058 pub fn new() -> ObjectMeta {
21059 ObjectMeta {
21060 annotations: None,
21061 cluster_name: None,
21062 creation_timestamp: None,
21063 deletion_grace_period_seconds: None,
21064 deletion_timestamp: None,
21065 finalizers: None,
21066 generate_name: None,
21067 generation: None,
21068 labels: None,
21069 managed_fields: None,
21070 name: None,
21071 namespace: None,
21072 owner_references: None,
21073 resource_version: None,
21074 self_link: None,
21075 uid: None,
21076 }
21077 }
21078}
21079
21080impl std::string::ToString for ObjectMeta {
21084 fn to_string(&self) -> String {
21085 let params: Vec<Option<String>> = vec![
21086 self.cluster_name.as_ref().map(|cluster_name| {
21090 [
21091 "clusterName".to_string(),
21092 cluster_name.to_string(),
21093 ].join(",")
21094 }),
21095
21096
21097 self.creation_timestamp.as_ref().map(|creation_timestamp| {
21098 [
21099 "creationTimestamp".to_string(),
21100 creation_timestamp.to_string(),
21101 ].join(",")
21102 }),
21103
21104
21105 self.deletion_grace_period_seconds.as_ref().map(|deletion_grace_period_seconds| {
21106 [
21107 "deletionGracePeriodSeconds".to_string(),
21108 deletion_grace_period_seconds.to_string(),
21109 ].join(",")
21110 }),
21111
21112
21113 self.deletion_timestamp.as_ref().map(|deletion_timestamp| {
21114 [
21115 "deletionTimestamp".to_string(),
21116 deletion_timestamp.to_string(),
21117 ].join(",")
21118 }),
21119
21120
21121 self.finalizers.as_ref().map(|finalizers| {
21122 [
21123 "finalizers".to_string(),
21124 finalizers.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
21125 ].join(",")
21126 }),
21127
21128
21129 self.generate_name.as_ref().map(|generate_name| {
21130 [
21131 "generateName".to_string(),
21132 generate_name.to_string(),
21133 ].join(",")
21134 }),
21135
21136
21137 self.generation.as_ref().map(|generation| {
21138 [
21139 "generation".to_string(),
21140 generation.to_string(),
21141 ].join(",")
21142 }),
21143
21144 self.name.as_ref().map(|name| {
21150 [
21151 "name".to_string(),
21152 name.to_string(),
21153 ].join(",")
21154 }),
21155
21156
21157 self.namespace.as_ref().map(|namespace| {
21158 [
21159 "namespace".to_string(),
21160 namespace.to_string(),
21161 ].join(",")
21162 }),
21163
21164 self.resource_version.as_ref().map(|resource_version| {
21168 [
21169 "resourceVersion".to_string(),
21170 resource_version.to_string(),
21171 ].join(",")
21172 }),
21173
21174
21175 self.self_link.as_ref().map(|self_link| {
21176 [
21177 "selfLink".to_string(),
21178 self_link.to_string(),
21179 ].join(",")
21180 }),
21181
21182
21183 self.uid.as_ref().map(|uid| {
21184 [
21185 "uid".to_string(),
21186 uid.to_string(),
21187 ].join(",")
21188 }),
21189
21190 ];
21191
21192 params.into_iter().flatten().collect::<Vec<_>>().join(",")
21193 }
21194}
21195
21196impl std::str::FromStr for ObjectMeta {
21200 type Err = String;
21201
21202 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
21203 #[derive(Default)]
21205 #[allow(dead_code)]
21206 struct IntermediateRep {
21207 pub annotations: Vec<std::collections::HashMap<String, String>>,
21208 pub cluster_name: Vec<String>,
21209 pub creation_timestamp: Vec<String>,
21210 pub deletion_grace_period_seconds: Vec<i64>,
21211 pub deletion_timestamp: Vec<String>,
21212 pub finalizers: Vec<Vec<String>>,
21213 pub generate_name: Vec<String>,
21214 pub generation: Vec<i64>,
21215 pub labels: Vec<std::collections::HashMap<String, String>>,
21216 pub managed_fields: Vec<Vec<models::ManagedFieldsEntry>>,
21217 pub name: Vec<String>,
21218 pub namespace: Vec<String>,
21219 pub owner_references: Vec<Vec<models::OwnerReference>>,
21220 pub resource_version: Vec<String>,
21221 pub self_link: Vec<String>,
21222 pub uid: Vec<String>,
21223 }
21224
21225 let mut intermediate_rep = IntermediateRep::default();
21226
21227 let mut string_iter = s.split(',');
21229 let mut key_result = string_iter.next();
21230
21231 while key_result.is_some() {
21232 let val = match string_iter.next() {
21233 Some(x) => x,
21234 None => return std::result::Result::Err("Missing value while parsing ObjectMeta".to_string())
21235 };
21236
21237 if let Some(key) = key_result {
21238 #[allow(clippy::match_single_binding)]
21239 match key {
21240 "annotations" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectMeta".to_string()),
21241 #[allow(clippy::redundant_clone)]
21242 "clusterName" => intermediate_rep.cluster_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21243 #[allow(clippy::redundant_clone)]
21244 "creationTimestamp" => intermediate_rep.creation_timestamp.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21245 #[allow(clippy::redundant_clone)]
21246 "deletionGracePeriodSeconds" => intermediate_rep.deletion_grace_period_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21247 #[allow(clippy::redundant_clone)]
21248 "deletionTimestamp" => intermediate_rep.deletion_timestamp.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21249 "finalizers" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectMeta".to_string()),
21250 #[allow(clippy::redundant_clone)]
21251 "generateName" => intermediate_rep.generate_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21252 #[allow(clippy::redundant_clone)]
21253 "generation" => intermediate_rep.generation.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21254 "labels" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectMeta".to_string()),
21255 "managedFields" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectMeta".to_string()),
21256 #[allow(clippy::redundant_clone)]
21257 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21258 #[allow(clippy::redundant_clone)]
21259 "namespace" => intermediate_rep.namespace.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21260 "ownerReferences" => return std::result::Result::Err("Parsing a container in this style is not supported in ObjectMeta".to_string()),
21261 #[allow(clippy::redundant_clone)]
21262 "resourceVersion" => intermediate_rep.resource_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21263 #[allow(clippy::redundant_clone)]
21264 "selfLink" => intermediate_rep.self_link.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21265 #[allow(clippy::redundant_clone)]
21266 "uid" => intermediate_rep.uid.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21267 _ => return std::result::Result::Err("Unexpected key while parsing ObjectMeta".to_string())
21268 }
21269 }
21270
21271 key_result = string_iter.next();
21273 }
21274
21275 std::result::Result::Ok(ObjectMeta {
21277 annotations: intermediate_rep.annotations.into_iter().next(),
21278 cluster_name: intermediate_rep.cluster_name.into_iter().next(),
21279 creation_timestamp: intermediate_rep.creation_timestamp.into_iter().next(),
21280 deletion_grace_period_seconds: intermediate_rep.deletion_grace_period_seconds.into_iter().next(),
21281 deletion_timestamp: intermediate_rep.deletion_timestamp.into_iter().next(),
21282 finalizers: intermediate_rep.finalizers.into_iter().next(),
21283 generate_name: intermediate_rep.generate_name.into_iter().next(),
21284 generation: intermediate_rep.generation.into_iter().next(),
21285 labels: intermediate_rep.labels.into_iter().next(),
21286 managed_fields: intermediate_rep.managed_fields.into_iter().next(),
21287 name: intermediate_rep.name.into_iter().next(),
21288 namespace: intermediate_rep.namespace.into_iter().next(),
21289 owner_references: intermediate_rep.owner_references.into_iter().next(),
21290 resource_version: intermediate_rep.resource_version.into_iter().next(),
21291 self_link: intermediate_rep.self_link.into_iter().next(),
21292 uid: intermediate_rep.uid.into_iter().next(),
21293 })
21294 }
21295}
21296
21297#[cfg(feature = "server")]
21300impl std::convert::TryFrom<header::IntoHeaderValue<ObjectMeta>> for HeaderValue {
21301 type Error = String;
21302
21303 fn try_from(hdr_value: header::IntoHeaderValue<ObjectMeta>) -> std::result::Result<Self, Self::Error> {
21304 let hdr_value = hdr_value.to_string();
21305 match HeaderValue::from_str(&hdr_value) {
21306 std::result::Result::Ok(value) => std::result::Result::Ok(value),
21307 std::result::Result::Err(e) => std::result::Result::Err(
21308 format!("Invalid header value for ObjectMeta - value: {} is invalid {}",
21309 hdr_value, e))
21310 }
21311 }
21312}
21313
21314#[cfg(feature = "server")]
21315impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ObjectMeta> {
21316 type Error = String;
21317
21318 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
21319 match hdr_value.to_str() {
21320 std::result::Result::Ok(value) => {
21321 match <ObjectMeta as std::str::FromStr>::from_str(value) {
21322 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
21323 std::result::Result::Err(err) => std::result::Result::Err(
21324 format!("Unable to convert header value '{}' into ObjectMeta - {}",
21325 value, err))
21326 }
21327 },
21328 std::result::Result::Err(e) => std::result::Result::Err(
21329 format!("Unable to convert header: {:?} to string: {}",
21330 hdr_value, e))
21331 }
21332 }
21333}
21334
21335
21336
21337
21338#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
21339#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21340pub struct OsName(String);
21341
21342impl validator::Validate for OsName {
21343 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
21344 std::result::Result::Ok(())
21345 }
21346}
21347
21348impl std::convert::From<String> for OsName {
21349 fn from(x: String) -> Self {
21350 OsName(x)
21351 }
21352}
21353
21354impl std::string::ToString for OsName {
21355 fn to_string(&self) -> String {
21356 self.0.to_string()
21357 }
21358}
21359
21360impl std::str::FromStr for OsName {
21361 type Err = std::string::ParseError;
21362 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
21363 std::result::Result::Ok(OsName(x.to_string()))
21364 }
21365}
21366
21367impl std::convert::From<OsName> for String {
21368 fn from(x: OsName) -> Self {
21369 x.0
21370 }
21371}
21372
21373impl std::ops::Deref for OsName {
21374 type Target = String;
21375 fn deref(&self) -> &String {
21376 &self.0
21377 }
21378}
21379
21380impl std::ops::DerefMut for OsName {
21381 fn deref_mut(&mut self) -> &mut String {
21382 &mut self.0
21383 }
21384}
21385
21386
21387
21388#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
21393#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21394pub struct OwnerReference {
21395#[serde(rename = "apiVersion")]
21397 #[serde(skip_serializing_if="Option::is_none")]
21398 pub api_version: Option<String>,
21399
21400#[serde(rename = "blockOwnerDeletion")]
21402 #[serde(skip_serializing_if="Option::is_none")]
21403 pub block_owner_deletion: Option<bool>,
21404
21405#[serde(rename = "controller")]
21407 #[serde(skip_serializing_if="Option::is_none")]
21408 pub controller: Option<bool>,
21409
21410#[serde(rename = "kind")]
21412 #[serde(skip_serializing_if="Option::is_none")]
21413 pub kind: Option<String>,
21414
21415#[serde(rename = "name")]
21417 #[serde(skip_serializing_if="Option::is_none")]
21418 pub name: Option<String>,
21419
21420#[serde(rename = "uid")]
21422 #[serde(skip_serializing_if="Option::is_none")]
21423 pub uid: Option<String>,
21424
21425}
21426
21427
21428impl OwnerReference {
21429 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
21430 pub fn new() -> OwnerReference {
21431 OwnerReference {
21432 api_version: None,
21433 block_owner_deletion: None,
21434 controller: None,
21435 kind: None,
21436 name: None,
21437 uid: None,
21438 }
21439 }
21440}
21441
21442impl std::string::ToString for OwnerReference {
21446 fn to_string(&self) -> String {
21447 let params: Vec<Option<String>> = vec![
21448
21449 self.api_version.as_ref().map(|api_version| {
21450 [
21451 "apiVersion".to_string(),
21452 api_version.to_string(),
21453 ].join(",")
21454 }),
21455
21456
21457 self.block_owner_deletion.as_ref().map(|block_owner_deletion| {
21458 [
21459 "blockOwnerDeletion".to_string(),
21460 block_owner_deletion.to_string(),
21461 ].join(",")
21462 }),
21463
21464
21465 self.controller.as_ref().map(|controller| {
21466 [
21467 "controller".to_string(),
21468 controller.to_string(),
21469 ].join(",")
21470 }),
21471
21472
21473 self.kind.as_ref().map(|kind| {
21474 [
21475 "kind".to_string(),
21476 kind.to_string(),
21477 ].join(",")
21478 }),
21479
21480
21481 self.name.as_ref().map(|name| {
21482 [
21483 "name".to_string(),
21484 name.to_string(),
21485 ].join(",")
21486 }),
21487
21488
21489 self.uid.as_ref().map(|uid| {
21490 [
21491 "uid".to_string(),
21492 uid.to_string(),
21493 ].join(",")
21494 }),
21495
21496 ];
21497
21498 params.into_iter().flatten().collect::<Vec<_>>().join(",")
21499 }
21500}
21501
21502impl std::str::FromStr for OwnerReference {
21506 type Err = String;
21507
21508 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
21509 #[derive(Default)]
21511 #[allow(dead_code)]
21512 struct IntermediateRep {
21513 pub api_version: Vec<String>,
21514 pub block_owner_deletion: Vec<bool>,
21515 pub controller: Vec<bool>,
21516 pub kind: Vec<String>,
21517 pub name: Vec<String>,
21518 pub uid: Vec<String>,
21519 }
21520
21521 let mut intermediate_rep = IntermediateRep::default();
21522
21523 let mut string_iter = s.split(',');
21525 let mut key_result = string_iter.next();
21526
21527 while key_result.is_some() {
21528 let val = match string_iter.next() {
21529 Some(x) => x,
21530 None => return std::result::Result::Err("Missing value while parsing OwnerReference".to_string())
21531 };
21532
21533 if let Some(key) = key_result {
21534 #[allow(clippy::match_single_binding)]
21535 match key {
21536 #[allow(clippy::redundant_clone)]
21537 "apiVersion" => intermediate_rep.api_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21538 #[allow(clippy::redundant_clone)]
21539 "blockOwnerDeletion" => intermediate_rep.block_owner_deletion.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21540 #[allow(clippy::redundant_clone)]
21541 "controller" => intermediate_rep.controller.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21542 #[allow(clippy::redundant_clone)]
21543 "kind" => intermediate_rep.kind.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21544 #[allow(clippy::redundant_clone)]
21545 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21546 #[allow(clippy::redundant_clone)]
21547 "uid" => intermediate_rep.uid.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21548 _ => return std::result::Result::Err("Unexpected key while parsing OwnerReference".to_string())
21549 }
21550 }
21551
21552 key_result = string_iter.next();
21554 }
21555
21556 std::result::Result::Ok(OwnerReference {
21558 api_version: intermediate_rep.api_version.into_iter().next(),
21559 block_owner_deletion: intermediate_rep.block_owner_deletion.into_iter().next(),
21560 controller: intermediate_rep.controller.into_iter().next(),
21561 kind: intermediate_rep.kind.into_iter().next(),
21562 name: intermediate_rep.name.into_iter().next(),
21563 uid: intermediate_rep.uid.into_iter().next(),
21564 })
21565 }
21566}
21567
21568#[cfg(feature = "server")]
21571impl std::convert::TryFrom<header::IntoHeaderValue<OwnerReference>> for HeaderValue {
21572 type Error = String;
21573
21574 fn try_from(hdr_value: header::IntoHeaderValue<OwnerReference>) -> std::result::Result<Self, Self::Error> {
21575 let hdr_value = hdr_value.to_string();
21576 match HeaderValue::from_str(&hdr_value) {
21577 std::result::Result::Ok(value) => std::result::Result::Ok(value),
21578 std::result::Result::Err(e) => std::result::Result::Err(
21579 format!("Invalid header value for OwnerReference - value: {} is invalid {}",
21580 hdr_value, e))
21581 }
21582 }
21583}
21584
21585#[cfg(feature = "server")]
21586impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<OwnerReference> {
21587 type Error = String;
21588
21589 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
21590 match hdr_value.to_str() {
21591 std::result::Result::Ok(value) => {
21592 match <OwnerReference as std::str::FromStr>::from_str(value) {
21593 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
21594 std::result::Result::Err(err) => std::result::Result::Err(
21595 format!("Unable to convert header value '{}' into OwnerReference - {}",
21596 value, err))
21597 }
21598 },
21599 std::result::Result::Err(e) => std::result::Result::Err(
21600 format!("Unable to convert header: {:?} to string: {}",
21601 hdr_value, e))
21602 }
21603 }
21604}
21605
21606
21607
21608
21609
21610
21611
21612#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
21613#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21614pub struct PasswordAuthRequest {
21615#[serde(rename = "clientVersion")]
21617 #[serde(skip_serializing_if="Option::is_none")]
21618 pub client_version: Option<String>,
21619
21620#[serde(rename = "connectionId")]
21622 pub connection_id: String,
21623
21624#[serde(rename = "environment")]
21626 #[serde(skip_serializing_if="Option::is_none")]
21627 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
21628
21629#[serde(rename = "files")]
21631 #[serde(skip_serializing_if="Option::is_none")]
21632 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
21633
21634#[serde(rename = "metadata")]
21636 #[serde(skip_serializing_if="Option::is_none")]
21637 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
21638
21639#[serde(rename = "passwordBase64")]
21641 pub password_base64: String,
21642
21643#[serde(rename = "remoteAddress")]
21645 pub remote_address: String,
21646
21647#[serde(rename = "username")]
21649 pub username: String,
21650
21651}
21652
21653
21654impl PasswordAuthRequest {
21655 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
21656 pub fn new(connection_id: String, password_base64: String, remote_address: String, username: String, ) -> PasswordAuthRequest {
21657 PasswordAuthRequest {
21658 client_version: None,
21659 connection_id,
21660 environment: None,
21661 files: None,
21662 metadata: None,
21663 password_base64,
21664 remote_address,
21665 username,
21666 }
21667 }
21668}
21669
21670impl std::string::ToString for PasswordAuthRequest {
21674 fn to_string(&self) -> String {
21675 let params: Vec<Option<String>> = vec![
21676
21677 self.client_version.as_ref().map(|client_version| {
21678 [
21679 "clientVersion".to_string(),
21680 client_version.to_string(),
21681 ].join(",")
21682 }),
21683
21684
21685 Some("connectionId".to_string()),
21686 Some(self.connection_id.to_string()),
21687
21688 Some("passwordBase64".to_string()),
21699 Some(self.password_base64.to_string()),
21700
21701
21702 Some("remoteAddress".to_string()),
21703 Some(self.remote_address.to_string()),
21704
21705
21706 Some("username".to_string()),
21707 Some(self.username.to_string()),
21708
21709 ];
21710
21711 params.into_iter().flatten().collect::<Vec<_>>().join(",")
21712 }
21713}
21714
21715impl std::str::FromStr for PasswordAuthRequest {
21719 type Err = String;
21720
21721 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
21722 #[derive(Default)]
21724 #[allow(dead_code)]
21725 struct IntermediateRep {
21726 pub client_version: Vec<String>,
21727 pub connection_id: Vec<String>,
21728 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
21729 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
21730 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
21731 pub password_base64: Vec<String>,
21732 pub remote_address: Vec<String>,
21733 pub username: Vec<String>,
21734 }
21735
21736 let mut intermediate_rep = IntermediateRep::default();
21737
21738 let mut string_iter = s.split(',');
21740 let mut key_result = string_iter.next();
21741
21742 while key_result.is_some() {
21743 let val = match string_iter.next() {
21744 Some(x) => x,
21745 None => return std::result::Result::Err("Missing value while parsing PasswordAuthRequest".to_string())
21746 };
21747
21748 if let Some(key) = key_result {
21749 #[allow(clippy::match_single_binding)]
21750 match key {
21751 #[allow(clippy::redundant_clone)]
21752 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21753 #[allow(clippy::redundant_clone)]
21754 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21755 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in PasswordAuthRequest".to_string()),
21756 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in PasswordAuthRequest".to_string()),
21757 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in PasswordAuthRequest".to_string()),
21758 #[allow(clippy::redundant_clone)]
21759 "passwordBase64" => intermediate_rep.password_base64.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21760 #[allow(clippy::redundant_clone)]
21761 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21762 #[allow(clippy::redundant_clone)]
21763 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
21764 _ => return std::result::Result::Err("Unexpected key while parsing PasswordAuthRequest".to_string())
21765 }
21766 }
21767
21768 key_result = string_iter.next();
21770 }
21771
21772 std::result::Result::Ok(PasswordAuthRequest {
21774 client_version: intermediate_rep.client_version.into_iter().next(),
21775 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in PasswordAuthRequest".to_string())?,
21776 environment: intermediate_rep.environment.into_iter().next(),
21777 files: intermediate_rep.files.into_iter().next(),
21778 metadata: intermediate_rep.metadata.into_iter().next(),
21779 password_base64: intermediate_rep.password_base64.into_iter().next().ok_or_else(|| "passwordBase64 missing in PasswordAuthRequest".to_string())?,
21780 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in PasswordAuthRequest".to_string())?,
21781 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in PasswordAuthRequest".to_string())?,
21782 })
21783 }
21784}
21785
21786#[cfg(feature = "server")]
21789impl std::convert::TryFrom<header::IntoHeaderValue<PasswordAuthRequest>> for HeaderValue {
21790 type Error = String;
21791
21792 fn try_from(hdr_value: header::IntoHeaderValue<PasswordAuthRequest>) -> std::result::Result<Self, Self::Error> {
21793 let hdr_value = hdr_value.to_string();
21794 match HeaderValue::from_str(&hdr_value) {
21795 std::result::Result::Ok(value) => std::result::Result::Ok(value),
21796 std::result::Result::Err(e) => std::result::Result::Err(
21797 format!("Invalid header value for PasswordAuthRequest - value: {} is invalid {}",
21798 hdr_value, e))
21799 }
21800 }
21801}
21802
21803#[cfg(feature = "server")]
21804impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PasswordAuthRequest> {
21805 type Error = String;
21806
21807 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
21808 match hdr_value.to_str() {
21809 std::result::Result::Ok(value) => {
21810 match <PasswordAuthRequest as std::str::FromStr>::from_str(value) {
21811 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
21812 std::result::Result::Err(err) => std::result::Result::Err(
21813 format!("Unable to convert header value '{}' into PasswordAuthRequest - {}",
21814 value, err))
21815 }
21816 },
21817 std::result::Result::Err(e) => std::result::Result::Err(
21818 format!("Unable to convert header: {:?} to string: {}",
21819 hdr_value, e))
21820 }
21821 }
21822}
21823
21824
21825
21826
21827#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
21829#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21830pub struct PersistentVolumeAccessMode(String);
21831
21832impl validator::Validate for PersistentVolumeAccessMode {
21833 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
21834 std::result::Result::Ok(())
21835 }
21836}
21837
21838impl std::convert::From<String> for PersistentVolumeAccessMode {
21839 fn from(x: String) -> Self {
21840 PersistentVolumeAccessMode(x)
21841 }
21842}
21843
21844impl std::string::ToString for PersistentVolumeAccessMode {
21845 fn to_string(&self) -> String {
21846 self.0.to_string()
21847 }
21848}
21849
21850impl std::str::FromStr for PersistentVolumeAccessMode {
21851 type Err = std::string::ParseError;
21852 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
21853 std::result::Result::Ok(PersistentVolumeAccessMode(x.to_string()))
21854 }
21855}
21856
21857impl std::convert::From<PersistentVolumeAccessMode> for String {
21858 fn from(x: PersistentVolumeAccessMode) -> Self {
21859 x.0
21860 }
21861}
21862
21863impl std::ops::Deref for PersistentVolumeAccessMode {
21864 type Target = String;
21865 fn deref(&self) -> &String {
21866 &self.0
21867 }
21868}
21869
21870impl std::ops::DerefMut for PersistentVolumeAccessMode {
21871 fn deref_mut(&mut self) -> &mut String {
21872 &mut self.0
21873 }
21874}
21875
21876
21877
21878#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
21883#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
21884pub struct PersistentVolumeClaimSpec {
21885#[serde(rename = "accessModes")]
21887 #[serde(skip_serializing_if="Option::is_none")]
21888 pub access_modes: Option<Vec<models::PersistentVolumeAccessMode>>,
21889
21890 #[serde(rename = "dataSource")]
21891 #[serde(skip_serializing_if="Option::is_none")]
21892 pub data_source: Option<models::TypedLocalObjectReference>,
21893
21894 #[serde(rename = "dataSourceRef")]
21895 #[serde(skip_serializing_if="Option::is_none")]
21896 pub data_source_ref: Option<models::TypedLocalObjectReference>,
21897
21898 #[serde(rename = "resources")]
21899 #[serde(skip_serializing_if="Option::is_none")]
21900 pub resources: Option<models::ResourceRequirements>,
21901
21902 #[serde(rename = "selector")]
21903 #[serde(skip_serializing_if="Option::is_none")]
21904 pub selector: Option<models::LabelSelector>,
21905
21906#[serde(rename = "storageClassName")]
21908 #[serde(skip_serializing_if="Option::is_none")]
21909 pub storage_class_name: Option<String>,
21910
21911#[serde(rename = "volumeMode")]
21913 #[serde(skip_serializing_if="Option::is_none")]
21914 pub volume_mode: Option<String>,
21915
21916#[serde(rename = "volumeName")]
21918 #[serde(skip_serializing_if="Option::is_none")]
21919 pub volume_name: Option<String>,
21920
21921}
21922
21923
21924impl PersistentVolumeClaimSpec {
21925 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
21926 pub fn new() -> PersistentVolumeClaimSpec {
21927 PersistentVolumeClaimSpec {
21928 access_modes: None,
21929 data_source: None,
21930 data_source_ref: None,
21931 resources: None,
21932 selector: None,
21933 storage_class_name: None,
21934 volume_mode: None,
21935 volume_name: None,
21936 }
21937 }
21938}
21939
21940impl std::string::ToString for PersistentVolumeClaimSpec {
21944 fn to_string(&self) -> String {
21945 let params: Vec<Option<String>> = vec![
21946
21947 self.access_modes.as_ref().map(|access_modes| {
21948 [
21949 "accessModes".to_string(),
21950 access_modes.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
21951 ].join(",")
21952 }),
21953
21954 self.storage_class_name.as_ref().map(|storage_class_name| {
21964 [
21965 "storageClassName".to_string(),
21966 storage_class_name.to_string(),
21967 ].join(",")
21968 }),
21969
21970
21971 self.volume_mode.as_ref().map(|volume_mode| {
21972 [
21973 "volumeMode".to_string(),
21974 volume_mode.to_string(),
21975 ].join(",")
21976 }),
21977
21978
21979 self.volume_name.as_ref().map(|volume_name| {
21980 [
21981 "volumeName".to_string(),
21982 volume_name.to_string(),
21983 ].join(",")
21984 }),
21985
21986 ];
21987
21988 params.into_iter().flatten().collect::<Vec<_>>().join(",")
21989 }
21990}
21991
21992impl std::str::FromStr for PersistentVolumeClaimSpec {
21996 type Err = String;
21997
21998 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
21999 #[derive(Default)]
22001 #[allow(dead_code)]
22002 struct IntermediateRep {
22003 pub access_modes: Vec<Vec<models::PersistentVolumeAccessMode>>,
22004 pub data_source: Vec<models::TypedLocalObjectReference>,
22005 pub data_source_ref: Vec<models::TypedLocalObjectReference>,
22006 pub resources: Vec<models::ResourceRequirements>,
22007 pub selector: Vec<models::LabelSelector>,
22008 pub storage_class_name: Vec<String>,
22009 pub volume_mode: Vec<String>,
22010 pub volume_name: Vec<String>,
22011 }
22012
22013 let mut intermediate_rep = IntermediateRep::default();
22014
22015 let mut string_iter = s.split(',');
22017 let mut key_result = string_iter.next();
22018
22019 while key_result.is_some() {
22020 let val = match string_iter.next() {
22021 Some(x) => x,
22022 None => return std::result::Result::Err("Missing value while parsing PersistentVolumeClaimSpec".to_string())
22023 };
22024
22025 if let Some(key) = key_result {
22026 #[allow(clippy::match_single_binding)]
22027 match key {
22028 "accessModes" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimSpec".to_string()),
22029 #[allow(clippy::redundant_clone)]
22030 "dataSource" => intermediate_rep.data_source.push(<models::TypedLocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22031 #[allow(clippy::redundant_clone)]
22032 "dataSourceRef" => intermediate_rep.data_source_ref.push(<models::TypedLocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22033 #[allow(clippy::redundant_clone)]
22034 "resources" => intermediate_rep.resources.push(<models::ResourceRequirements as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22035 #[allow(clippy::redundant_clone)]
22036 "selector" => intermediate_rep.selector.push(<models::LabelSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22037 #[allow(clippy::redundant_clone)]
22038 "storageClassName" => intermediate_rep.storage_class_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22039 #[allow(clippy::redundant_clone)]
22040 "volumeMode" => intermediate_rep.volume_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22041 #[allow(clippy::redundant_clone)]
22042 "volumeName" => intermediate_rep.volume_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22043 _ => return std::result::Result::Err("Unexpected key while parsing PersistentVolumeClaimSpec".to_string())
22044 }
22045 }
22046
22047 key_result = string_iter.next();
22049 }
22050
22051 std::result::Result::Ok(PersistentVolumeClaimSpec {
22053 access_modes: intermediate_rep.access_modes.into_iter().next(),
22054 data_source: intermediate_rep.data_source.into_iter().next(),
22055 data_source_ref: intermediate_rep.data_source_ref.into_iter().next(),
22056 resources: intermediate_rep.resources.into_iter().next(),
22057 selector: intermediate_rep.selector.into_iter().next(),
22058 storage_class_name: intermediate_rep.storage_class_name.into_iter().next(),
22059 volume_mode: intermediate_rep.volume_mode.into_iter().next(),
22060 volume_name: intermediate_rep.volume_name.into_iter().next(),
22061 })
22062 }
22063}
22064
22065#[cfg(feature = "server")]
22068impl std::convert::TryFrom<header::IntoHeaderValue<PersistentVolumeClaimSpec>> for HeaderValue {
22069 type Error = String;
22070
22071 fn try_from(hdr_value: header::IntoHeaderValue<PersistentVolumeClaimSpec>) -> std::result::Result<Self, Self::Error> {
22072 let hdr_value = hdr_value.to_string();
22073 match HeaderValue::from_str(&hdr_value) {
22074 std::result::Result::Ok(value) => std::result::Result::Ok(value),
22075 std::result::Result::Err(e) => std::result::Result::Err(
22076 format!("Invalid header value for PersistentVolumeClaimSpec - value: {} is invalid {}",
22077 hdr_value, e))
22078 }
22079 }
22080}
22081
22082#[cfg(feature = "server")]
22083impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PersistentVolumeClaimSpec> {
22084 type Error = String;
22085
22086 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
22087 match hdr_value.to_str() {
22088 std::result::Result::Ok(value) => {
22089 match <PersistentVolumeClaimSpec as std::str::FromStr>::from_str(value) {
22090 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
22091 std::result::Result::Err(err) => std::result::Result::Err(
22092 format!("Unable to convert header value '{}' into PersistentVolumeClaimSpec - {}",
22093 value, err))
22094 }
22095 },
22096 std::result::Result::Err(e) => std::result::Result::Err(
22097 format!("Unable to convert header: {:?} to string: {}",
22098 hdr_value, e))
22099 }
22100 }
22101}
22102
22103
22104
22105
22106#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
22111#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22112pub struct PersistentVolumeClaimTemplate {
22113#[serde(rename = "annotations")]
22115 #[serde(skip_serializing_if="Option::is_none")]
22116 pub annotations: Option<std::collections::HashMap<String, String>>,
22117
22118#[serde(rename = "clusterName")]
22120 #[serde(skip_serializing_if="Option::is_none")]
22121 pub cluster_name: Option<String>,
22122
22123#[serde(rename = "creationTimestamp")]
22125 #[serde(skip_serializing_if="Option::is_none")]
22126 pub creation_timestamp: Option<String>,
22127
22128#[serde(rename = "deletionGracePeriodSeconds")]
22130 #[serde(skip_serializing_if="Option::is_none")]
22131 pub deletion_grace_period_seconds: Option<i64>,
22132
22133#[serde(rename = "deletionTimestamp")]
22135 #[serde(skip_serializing_if="Option::is_none")]
22136 pub deletion_timestamp: Option<String>,
22137
22138#[serde(rename = "finalizers")]
22140 #[serde(skip_serializing_if="Option::is_none")]
22141 pub finalizers: Option<Vec<String>>,
22142
22143#[serde(rename = "generateName")]
22145 #[serde(skip_serializing_if="Option::is_none")]
22146 pub generate_name: Option<String>,
22147
22148#[serde(rename = "generation")]
22150 #[serde(skip_serializing_if="Option::is_none")]
22151 pub generation: Option<i64>,
22152
22153#[serde(rename = "labels")]
22155 #[serde(skip_serializing_if="Option::is_none")]
22156 pub labels: Option<std::collections::HashMap<String, String>>,
22157
22158#[serde(rename = "managedFields")]
22160 #[serde(skip_serializing_if="Option::is_none")]
22161 pub managed_fields: Option<Vec<models::ManagedFieldsEntry>>,
22162
22163#[serde(rename = "name")]
22165 #[serde(skip_serializing_if="Option::is_none")]
22166 pub name: Option<String>,
22167
22168#[serde(rename = "namespace")]
22170 #[serde(skip_serializing_if="Option::is_none")]
22171 pub namespace: Option<String>,
22172
22173#[serde(rename = "ownerReferences")]
22175 #[serde(skip_serializing_if="Option::is_none")]
22176 pub owner_references: Option<Vec<models::OwnerReference>>,
22177
22178#[serde(rename = "resourceVersion")]
22180 #[serde(skip_serializing_if="Option::is_none")]
22181 pub resource_version: Option<String>,
22182
22183#[serde(rename = "selfLink")]
22185 #[serde(skip_serializing_if="Option::is_none")]
22186 pub self_link: Option<String>,
22187
22188 #[serde(rename = "spec")]
22189 #[serde(skip_serializing_if="Option::is_none")]
22190 pub spec: Option<models::PersistentVolumeClaimSpec>,
22191
22192#[serde(rename = "uid")]
22194 #[serde(skip_serializing_if="Option::is_none")]
22195 pub uid: Option<String>,
22196
22197}
22198
22199
22200impl PersistentVolumeClaimTemplate {
22201 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
22202 pub fn new() -> PersistentVolumeClaimTemplate {
22203 PersistentVolumeClaimTemplate {
22204 annotations: None,
22205 cluster_name: None,
22206 creation_timestamp: None,
22207 deletion_grace_period_seconds: None,
22208 deletion_timestamp: None,
22209 finalizers: None,
22210 generate_name: None,
22211 generation: None,
22212 labels: None,
22213 managed_fields: None,
22214 name: None,
22215 namespace: None,
22216 owner_references: None,
22217 resource_version: None,
22218 self_link: None,
22219 spec: None,
22220 uid: None,
22221 }
22222 }
22223}
22224
22225impl std::string::ToString for PersistentVolumeClaimTemplate {
22229 fn to_string(&self) -> String {
22230 let params: Vec<Option<String>> = vec![
22231 self.cluster_name.as_ref().map(|cluster_name| {
22235 [
22236 "clusterName".to_string(),
22237 cluster_name.to_string(),
22238 ].join(",")
22239 }),
22240
22241
22242 self.creation_timestamp.as_ref().map(|creation_timestamp| {
22243 [
22244 "creationTimestamp".to_string(),
22245 creation_timestamp.to_string(),
22246 ].join(",")
22247 }),
22248
22249
22250 self.deletion_grace_period_seconds.as_ref().map(|deletion_grace_period_seconds| {
22251 [
22252 "deletionGracePeriodSeconds".to_string(),
22253 deletion_grace_period_seconds.to_string(),
22254 ].join(",")
22255 }),
22256
22257
22258 self.deletion_timestamp.as_ref().map(|deletion_timestamp| {
22259 [
22260 "deletionTimestamp".to_string(),
22261 deletion_timestamp.to_string(),
22262 ].join(",")
22263 }),
22264
22265
22266 self.finalizers.as_ref().map(|finalizers| {
22267 [
22268 "finalizers".to_string(),
22269 finalizers.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
22270 ].join(",")
22271 }),
22272
22273
22274 self.generate_name.as_ref().map(|generate_name| {
22275 [
22276 "generateName".to_string(),
22277 generate_name.to_string(),
22278 ].join(",")
22279 }),
22280
22281
22282 self.generation.as_ref().map(|generation| {
22283 [
22284 "generation".to_string(),
22285 generation.to_string(),
22286 ].join(",")
22287 }),
22288
22289 self.name.as_ref().map(|name| {
22295 [
22296 "name".to_string(),
22297 name.to_string(),
22298 ].join(",")
22299 }),
22300
22301
22302 self.namespace.as_ref().map(|namespace| {
22303 [
22304 "namespace".to_string(),
22305 namespace.to_string(),
22306 ].join(",")
22307 }),
22308
22309 self.resource_version.as_ref().map(|resource_version| {
22313 [
22314 "resourceVersion".to_string(),
22315 resource_version.to_string(),
22316 ].join(",")
22317 }),
22318
22319
22320 self.self_link.as_ref().map(|self_link| {
22321 [
22322 "selfLink".to_string(),
22323 self_link.to_string(),
22324 ].join(",")
22325 }),
22326
22327 self.uid.as_ref().map(|uid| {
22331 [
22332 "uid".to_string(),
22333 uid.to_string(),
22334 ].join(",")
22335 }),
22336
22337 ];
22338
22339 params.into_iter().flatten().collect::<Vec<_>>().join(",")
22340 }
22341}
22342
22343impl std::str::FromStr for PersistentVolumeClaimTemplate {
22347 type Err = String;
22348
22349 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
22350 #[derive(Default)]
22352 #[allow(dead_code)]
22353 struct IntermediateRep {
22354 pub annotations: Vec<std::collections::HashMap<String, String>>,
22355 pub cluster_name: Vec<String>,
22356 pub creation_timestamp: Vec<String>,
22357 pub deletion_grace_period_seconds: Vec<i64>,
22358 pub deletion_timestamp: Vec<String>,
22359 pub finalizers: Vec<Vec<String>>,
22360 pub generate_name: Vec<String>,
22361 pub generation: Vec<i64>,
22362 pub labels: Vec<std::collections::HashMap<String, String>>,
22363 pub managed_fields: Vec<Vec<models::ManagedFieldsEntry>>,
22364 pub name: Vec<String>,
22365 pub namespace: Vec<String>,
22366 pub owner_references: Vec<Vec<models::OwnerReference>>,
22367 pub resource_version: Vec<String>,
22368 pub self_link: Vec<String>,
22369 pub spec: Vec<models::PersistentVolumeClaimSpec>,
22370 pub uid: Vec<String>,
22371 }
22372
22373 let mut intermediate_rep = IntermediateRep::default();
22374
22375 let mut string_iter = s.split(',');
22377 let mut key_result = string_iter.next();
22378
22379 while key_result.is_some() {
22380 let val = match string_iter.next() {
22381 Some(x) => x,
22382 None => return std::result::Result::Err("Missing value while parsing PersistentVolumeClaimTemplate".to_string())
22383 };
22384
22385 if let Some(key) = key_result {
22386 #[allow(clippy::match_single_binding)]
22387 match key {
22388 "annotations" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimTemplate".to_string()),
22389 #[allow(clippy::redundant_clone)]
22390 "clusterName" => intermediate_rep.cluster_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22391 #[allow(clippy::redundant_clone)]
22392 "creationTimestamp" => intermediate_rep.creation_timestamp.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22393 #[allow(clippy::redundant_clone)]
22394 "deletionGracePeriodSeconds" => intermediate_rep.deletion_grace_period_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22395 #[allow(clippy::redundant_clone)]
22396 "deletionTimestamp" => intermediate_rep.deletion_timestamp.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22397 "finalizers" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimTemplate".to_string()),
22398 #[allow(clippy::redundant_clone)]
22399 "generateName" => intermediate_rep.generate_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22400 #[allow(clippy::redundant_clone)]
22401 "generation" => intermediate_rep.generation.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22402 "labels" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimTemplate".to_string()),
22403 "managedFields" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimTemplate".to_string()),
22404 #[allow(clippy::redundant_clone)]
22405 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22406 #[allow(clippy::redundant_clone)]
22407 "namespace" => intermediate_rep.namespace.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22408 "ownerReferences" => return std::result::Result::Err("Parsing a container in this style is not supported in PersistentVolumeClaimTemplate".to_string()),
22409 #[allow(clippy::redundant_clone)]
22410 "resourceVersion" => intermediate_rep.resource_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22411 #[allow(clippy::redundant_clone)]
22412 "selfLink" => intermediate_rep.self_link.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22413 #[allow(clippy::redundant_clone)]
22414 "spec" => intermediate_rep.spec.push(<models::PersistentVolumeClaimSpec as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22415 #[allow(clippy::redundant_clone)]
22416 "uid" => intermediate_rep.uid.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22417 _ => return std::result::Result::Err("Unexpected key while parsing PersistentVolumeClaimTemplate".to_string())
22418 }
22419 }
22420
22421 key_result = string_iter.next();
22423 }
22424
22425 std::result::Result::Ok(PersistentVolumeClaimTemplate {
22427 annotations: intermediate_rep.annotations.into_iter().next(),
22428 cluster_name: intermediate_rep.cluster_name.into_iter().next(),
22429 creation_timestamp: intermediate_rep.creation_timestamp.into_iter().next(),
22430 deletion_grace_period_seconds: intermediate_rep.deletion_grace_period_seconds.into_iter().next(),
22431 deletion_timestamp: intermediate_rep.deletion_timestamp.into_iter().next(),
22432 finalizers: intermediate_rep.finalizers.into_iter().next(),
22433 generate_name: intermediate_rep.generate_name.into_iter().next(),
22434 generation: intermediate_rep.generation.into_iter().next(),
22435 labels: intermediate_rep.labels.into_iter().next(),
22436 managed_fields: intermediate_rep.managed_fields.into_iter().next(),
22437 name: intermediate_rep.name.into_iter().next(),
22438 namespace: intermediate_rep.namespace.into_iter().next(),
22439 owner_references: intermediate_rep.owner_references.into_iter().next(),
22440 resource_version: intermediate_rep.resource_version.into_iter().next(),
22441 self_link: intermediate_rep.self_link.into_iter().next(),
22442 spec: intermediate_rep.spec.into_iter().next(),
22443 uid: intermediate_rep.uid.into_iter().next(),
22444 })
22445 }
22446}
22447
22448#[cfg(feature = "server")]
22451impl std::convert::TryFrom<header::IntoHeaderValue<PersistentVolumeClaimTemplate>> for HeaderValue {
22452 type Error = String;
22453
22454 fn try_from(hdr_value: header::IntoHeaderValue<PersistentVolumeClaimTemplate>) -> std::result::Result<Self, Self::Error> {
22455 let hdr_value = hdr_value.to_string();
22456 match HeaderValue::from_str(&hdr_value) {
22457 std::result::Result::Ok(value) => std::result::Result::Ok(value),
22458 std::result::Result::Err(e) => std::result::Result::Err(
22459 format!("Invalid header value for PersistentVolumeClaimTemplate - value: {} is invalid {}",
22460 hdr_value, e))
22461 }
22462 }
22463}
22464
22465#[cfg(feature = "server")]
22466impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PersistentVolumeClaimTemplate> {
22467 type Error = String;
22468
22469 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
22470 match hdr_value.to_str() {
22471 std::result::Result::Ok(value) => {
22472 match <PersistentVolumeClaimTemplate as std::str::FromStr>::from_str(value) {
22473 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
22474 std::result::Result::Err(err) => std::result::Result::Err(
22475 format!("Unable to convert header value '{}' into PersistentVolumeClaimTemplate - {}",
22476 value, err))
22477 }
22478 },
22479 std::result::Result::Err(e) => std::result::Result::Err(
22480 format!("Unable to convert header: {:?} to string: {}",
22481 hdr_value, e))
22482 }
22483 }
22484}
22485
22486
22487
22488
22489#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
22494#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22495pub struct PersistentVolumeClaimVolumeSource {
22496#[serde(rename = "claimName")]
22498 #[serde(skip_serializing_if="Option::is_none")]
22499 pub claim_name: Option<String>,
22500
22501#[serde(rename = "readOnly")]
22503 #[serde(skip_serializing_if="Option::is_none")]
22504 pub read_only: Option<bool>,
22505
22506}
22507
22508
22509impl PersistentVolumeClaimVolumeSource {
22510 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
22511 pub fn new() -> PersistentVolumeClaimVolumeSource {
22512 PersistentVolumeClaimVolumeSource {
22513 claim_name: None,
22514 read_only: None,
22515 }
22516 }
22517}
22518
22519impl std::string::ToString for PersistentVolumeClaimVolumeSource {
22523 fn to_string(&self) -> String {
22524 let params: Vec<Option<String>> = vec![
22525
22526 self.claim_name.as_ref().map(|claim_name| {
22527 [
22528 "claimName".to_string(),
22529 claim_name.to_string(),
22530 ].join(",")
22531 }),
22532
22533
22534 self.read_only.as_ref().map(|read_only| {
22535 [
22536 "readOnly".to_string(),
22537 read_only.to_string(),
22538 ].join(",")
22539 }),
22540
22541 ];
22542
22543 params.into_iter().flatten().collect::<Vec<_>>().join(",")
22544 }
22545}
22546
22547impl std::str::FromStr for PersistentVolumeClaimVolumeSource {
22551 type Err = String;
22552
22553 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
22554 #[derive(Default)]
22556 #[allow(dead_code)]
22557 struct IntermediateRep {
22558 pub claim_name: Vec<String>,
22559 pub read_only: Vec<bool>,
22560 }
22561
22562 let mut intermediate_rep = IntermediateRep::default();
22563
22564 let mut string_iter = s.split(',');
22566 let mut key_result = string_iter.next();
22567
22568 while key_result.is_some() {
22569 let val = match string_iter.next() {
22570 Some(x) => x,
22571 None => return std::result::Result::Err("Missing value while parsing PersistentVolumeClaimVolumeSource".to_string())
22572 };
22573
22574 if let Some(key) = key_result {
22575 #[allow(clippy::match_single_binding)]
22576 match key {
22577 #[allow(clippy::redundant_clone)]
22578 "claimName" => intermediate_rep.claim_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22579 #[allow(clippy::redundant_clone)]
22580 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22581 _ => return std::result::Result::Err("Unexpected key while parsing PersistentVolumeClaimVolumeSource".to_string())
22582 }
22583 }
22584
22585 key_result = string_iter.next();
22587 }
22588
22589 std::result::Result::Ok(PersistentVolumeClaimVolumeSource {
22591 claim_name: intermediate_rep.claim_name.into_iter().next(),
22592 read_only: intermediate_rep.read_only.into_iter().next(),
22593 })
22594 }
22595}
22596
22597#[cfg(feature = "server")]
22600impl std::convert::TryFrom<header::IntoHeaderValue<PersistentVolumeClaimVolumeSource>> for HeaderValue {
22601 type Error = String;
22602
22603 fn try_from(hdr_value: header::IntoHeaderValue<PersistentVolumeClaimVolumeSource>) -> std::result::Result<Self, Self::Error> {
22604 let hdr_value = hdr_value.to_string();
22605 match HeaderValue::from_str(&hdr_value) {
22606 std::result::Result::Ok(value) => std::result::Result::Ok(value),
22607 std::result::Result::Err(e) => std::result::Result::Err(
22608 format!("Invalid header value for PersistentVolumeClaimVolumeSource - value: {} is invalid {}",
22609 hdr_value, e))
22610 }
22611 }
22612}
22613
22614#[cfg(feature = "server")]
22615impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PersistentVolumeClaimVolumeSource> {
22616 type Error = String;
22617
22618 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
22619 match hdr_value.to_str() {
22620 std::result::Result::Ok(value) => {
22621 match <PersistentVolumeClaimVolumeSource as std::str::FromStr>::from_str(value) {
22622 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
22623 std::result::Result::Err(err) => std::result::Result::Err(
22624 format!("Unable to convert header value '{}' into PersistentVolumeClaimVolumeSource - {}",
22625 value, err))
22626 }
22627 },
22628 std::result::Result::Err(e) => std::result::Result::Err(
22629 format!("Unable to convert header: {:?} to string: {}",
22630 hdr_value, e))
22631 }
22632 }
22633}
22634
22635
22636
22637
22638#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
22640#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22641pub struct PersistentVolumeMode(String);
22642
22643impl validator::Validate for PersistentVolumeMode {
22644 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
22645 std::result::Result::Ok(())
22646 }
22647}
22648
22649impl std::convert::From<String> for PersistentVolumeMode {
22650 fn from(x: String) -> Self {
22651 PersistentVolumeMode(x)
22652 }
22653}
22654
22655impl std::string::ToString for PersistentVolumeMode {
22656 fn to_string(&self) -> String {
22657 self.0.to_string()
22658 }
22659}
22660
22661impl std::str::FromStr for PersistentVolumeMode {
22662 type Err = std::string::ParseError;
22663 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
22664 std::result::Result::Ok(PersistentVolumeMode(x.to_string()))
22665 }
22666}
22667
22668impl std::convert::From<PersistentVolumeMode> for String {
22669 fn from(x: PersistentVolumeMode) -> Self {
22670 x.0
22671 }
22672}
22673
22674impl std::ops::Deref for PersistentVolumeMode {
22675 type Target = String;
22676 fn deref(&self) -> &String {
22677 &self.0
22678 }
22679}
22680
22681impl std::ops::DerefMut for PersistentVolumeMode {
22682 fn deref_mut(&mut self) -> &mut String {
22683 &mut self.0
22684 }
22685}
22686
22687
22688
22689
22690
22691
22692#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
22693#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22694pub struct PhotonPersistentDiskVolumeSource {
22695#[serde(rename = "fsType")]
22697 #[serde(skip_serializing_if="Option::is_none")]
22698 pub fs_type: Option<String>,
22699
22700#[serde(rename = "pdID")]
22702 #[serde(skip_serializing_if="Option::is_none")]
22703 pub pd_id: Option<String>,
22704
22705}
22706
22707
22708impl PhotonPersistentDiskVolumeSource {
22709 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
22710 pub fn new() -> PhotonPersistentDiskVolumeSource {
22711 PhotonPersistentDiskVolumeSource {
22712 fs_type: None,
22713 pd_id: None,
22714 }
22715 }
22716}
22717
22718impl std::string::ToString for PhotonPersistentDiskVolumeSource {
22722 fn to_string(&self) -> String {
22723 let params: Vec<Option<String>> = vec![
22724
22725 self.fs_type.as_ref().map(|fs_type| {
22726 [
22727 "fsType".to_string(),
22728 fs_type.to_string(),
22729 ].join(",")
22730 }),
22731
22732
22733 self.pd_id.as_ref().map(|pd_id| {
22734 [
22735 "pdID".to_string(),
22736 pd_id.to_string(),
22737 ].join(",")
22738 }),
22739
22740 ];
22741
22742 params.into_iter().flatten().collect::<Vec<_>>().join(",")
22743 }
22744}
22745
22746impl std::str::FromStr for PhotonPersistentDiskVolumeSource {
22750 type Err = String;
22751
22752 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
22753 #[derive(Default)]
22755 #[allow(dead_code)]
22756 struct IntermediateRep {
22757 pub fs_type: Vec<String>,
22758 pub pd_id: Vec<String>,
22759 }
22760
22761 let mut intermediate_rep = IntermediateRep::default();
22762
22763 let mut string_iter = s.split(',');
22765 let mut key_result = string_iter.next();
22766
22767 while key_result.is_some() {
22768 let val = match string_iter.next() {
22769 Some(x) => x,
22770 None => return std::result::Result::Err("Missing value while parsing PhotonPersistentDiskVolumeSource".to_string())
22771 };
22772
22773 if let Some(key) = key_result {
22774 #[allow(clippy::match_single_binding)]
22775 match key {
22776 #[allow(clippy::redundant_clone)]
22777 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22778 #[allow(clippy::redundant_clone)]
22779 "pdID" => intermediate_rep.pd_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
22780 _ => return std::result::Result::Err("Unexpected key while parsing PhotonPersistentDiskVolumeSource".to_string())
22781 }
22782 }
22783
22784 key_result = string_iter.next();
22786 }
22787
22788 std::result::Result::Ok(PhotonPersistentDiskVolumeSource {
22790 fs_type: intermediate_rep.fs_type.into_iter().next(),
22791 pd_id: intermediate_rep.pd_id.into_iter().next(),
22792 })
22793 }
22794}
22795
22796#[cfg(feature = "server")]
22799impl std::convert::TryFrom<header::IntoHeaderValue<PhotonPersistentDiskVolumeSource>> for HeaderValue {
22800 type Error = String;
22801
22802 fn try_from(hdr_value: header::IntoHeaderValue<PhotonPersistentDiskVolumeSource>) -> std::result::Result<Self, Self::Error> {
22803 let hdr_value = hdr_value.to_string();
22804 match HeaderValue::from_str(&hdr_value) {
22805 std::result::Result::Ok(value) => std::result::Result::Ok(value),
22806 std::result::Result::Err(e) => std::result::Result::Err(
22807 format!("Invalid header value for PhotonPersistentDiskVolumeSource - value: {} is invalid {}",
22808 hdr_value, e))
22809 }
22810 }
22811}
22812
22813#[cfg(feature = "server")]
22814impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PhotonPersistentDiskVolumeSource> {
22815 type Error = String;
22816
22817 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
22818 match hdr_value.to_str() {
22819 std::result::Result::Ok(value) => {
22820 match <PhotonPersistentDiskVolumeSource as std::str::FromStr>::from_str(value) {
22821 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
22822 std::result::Result::Err(err) => std::result::Result::Err(
22823 format!("Unable to convert header value '{}' into PhotonPersistentDiskVolumeSource - {}",
22824 value, err))
22825 }
22826 },
22827 std::result::Result::Err(e) => std::result::Result::Err(
22828 format!("Unable to convert header: {:?} to string: {}",
22829 hdr_value, e))
22830 }
22831 }
22832}
22833
22834
22835
22836
22837#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
22838#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22839pub struct PidMode(String);
22840
22841impl validator::Validate for PidMode {
22842 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
22843 std::result::Result::Ok(())
22844 }
22845}
22846
22847impl std::convert::From<String> for PidMode {
22848 fn from(x: String) -> Self {
22849 PidMode(x)
22850 }
22851}
22852
22853impl std::string::ToString for PidMode {
22854 fn to_string(&self) -> String {
22855 self.0.to_string()
22856 }
22857}
22858
22859impl std::str::FromStr for PidMode {
22860 type Err = std::string::ParseError;
22861 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
22862 std::result::Result::Ok(PidMode(x.to_string()))
22863 }
22864}
22865
22866impl std::convert::From<PidMode> for String {
22867 fn from(x: PidMode) -> Self {
22868 x.0
22869 }
22870}
22871
22872impl std::ops::Deref for PidMode {
22873 type Target = String;
22874 fn deref(&self) -> &String {
22875 &self.0
22876 }
22877}
22878
22879impl std::ops::DerefMut for PidMode {
22880 fn deref_mut(&mut self) -> &mut String {
22881 &mut self.0
22882 }
22883}
22884
22885
22886
22887
22888
22889
22890#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
22891#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
22892pub struct Platform {
22893#[serde(rename = "architecture")]
22895 #[serde(skip_serializing_if="Option::is_none")]
22896 pub architecture: Option<String>,
22897
22898#[serde(rename = "os")]
22900 #[serde(skip_serializing_if="Option::is_none")]
22901 pub os: Option<String>,
22902
22903#[serde(rename = "os.features")]
22905 #[serde(skip_serializing_if="Option::is_none")]
22906 pub os_period_features: Option<Vec<String>>,
22907
22908#[serde(rename = "os.version")]
22910 #[serde(skip_serializing_if="Option::is_none")]
22911 pub os_period_version: Option<String>,
22912
22913#[serde(rename = "variant")]
22915 #[serde(skip_serializing_if="Option::is_none")]
22916 pub variant: Option<String>,
22917
22918}
22919
22920
22921impl Platform {
22922 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
22923 pub fn new() -> Platform {
22924 Platform {
22925 architecture: None,
22926 os: None,
22927 os_period_features: None,
22928 os_period_version: None,
22929 variant: None,
22930 }
22931 }
22932}
22933
22934impl std::string::ToString for Platform {
22938 fn to_string(&self) -> String {
22939 let params: Vec<Option<String>> = vec![
22940
22941 self.architecture.as_ref().map(|architecture| {
22942 [
22943 "architecture".to_string(),
22944 architecture.to_string(),
22945 ].join(",")
22946 }),
22947
22948
22949 self.os.as_ref().map(|os| {
22950 [
22951 "os".to_string(),
22952 os.to_string(),
22953 ].join(",")
22954 }),
22955
22956
22957 self.os_period_features.as_ref().map(|os_period_features| {
22958 [
22959 "os.features".to_string(),
22960 os_period_features.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
22961 ].join(",")
22962 }),
22963
22964
22965 self.os_period_version.as_ref().map(|os_period_version| {
22966 [
22967 "os.version".to_string(),
22968 os_period_version.to_string(),
22969 ].join(",")
22970 }),
22971
22972
22973 self.variant.as_ref().map(|variant| {
22974 [
22975 "variant".to_string(),
22976 variant.to_string(),
22977 ].join(",")
22978 }),
22979
22980 ];
22981
22982 params.into_iter().flatten().collect::<Vec<_>>().join(",")
22983 }
22984}
22985
22986impl std::str::FromStr for Platform {
22990 type Err = String;
22991
22992 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
22993 #[derive(Default)]
22995 #[allow(dead_code)]
22996 struct IntermediateRep {
22997 pub architecture: Vec<String>,
22998 pub os: Vec<String>,
22999 pub os_period_features: Vec<Vec<String>>,
23000 pub os_period_version: Vec<String>,
23001 pub variant: Vec<String>,
23002 }
23003
23004 let mut intermediate_rep = IntermediateRep::default();
23005
23006 let mut string_iter = s.split(',');
23008 let mut key_result = string_iter.next();
23009
23010 while key_result.is_some() {
23011 let val = match string_iter.next() {
23012 Some(x) => x,
23013 None => return std::result::Result::Err("Missing value while parsing Platform".to_string())
23014 };
23015
23016 if let Some(key) = key_result {
23017 #[allow(clippy::match_single_binding)]
23018 match key {
23019 #[allow(clippy::redundant_clone)]
23020 "architecture" => intermediate_rep.architecture.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23021 #[allow(clippy::redundant_clone)]
23022 "os" => intermediate_rep.os.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23023 "os.features" => return std::result::Result::Err("Parsing a container in this style is not supported in Platform".to_string()),
23024 #[allow(clippy::redundant_clone)]
23025 "os.version" => intermediate_rep.os_period_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23026 #[allow(clippy::redundant_clone)]
23027 "variant" => intermediate_rep.variant.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23028 _ => return std::result::Result::Err("Unexpected key while parsing Platform".to_string())
23029 }
23030 }
23031
23032 key_result = string_iter.next();
23034 }
23035
23036 std::result::Result::Ok(Platform {
23038 architecture: intermediate_rep.architecture.into_iter().next(),
23039 os: intermediate_rep.os.into_iter().next(),
23040 os_period_features: intermediate_rep.os_period_features.into_iter().next(),
23041 os_period_version: intermediate_rep.os_period_version.into_iter().next(),
23042 variant: intermediate_rep.variant.into_iter().next(),
23043 })
23044 }
23045}
23046
23047#[cfg(feature = "server")]
23050impl std::convert::TryFrom<header::IntoHeaderValue<Platform>> for HeaderValue {
23051 type Error = String;
23052
23053 fn try_from(hdr_value: header::IntoHeaderValue<Platform>) -> std::result::Result<Self, Self::Error> {
23054 let hdr_value = hdr_value.to_string();
23055 match HeaderValue::from_str(&hdr_value) {
23056 std::result::Result::Ok(value) => std::result::Result::Ok(value),
23057 std::result::Result::Err(e) => std::result::Result::Err(
23058 format!("Invalid header value for Platform - value: {} is invalid {}",
23059 hdr_value, e))
23060 }
23061 }
23062}
23063
23064#[cfg(feature = "server")]
23065impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Platform> {
23066 type Error = String;
23067
23068 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
23069 match hdr_value.to_str() {
23070 std::result::Result::Ok(value) => {
23071 match <Platform as std::str::FromStr>::from_str(value) {
23072 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
23073 std::result::Result::Err(err) => std::result::Result::Err(
23074 format!("Unable to convert header value '{}' into Platform - {}",
23075 value, err))
23076 }
23077 },
23078 std::result::Result::Err(e) => std::result::Result::Err(
23079 format!("Unable to convert header: {:?} to string: {}",
23080 hdr_value, e))
23081 }
23082 }
23083}
23084
23085
23086
23087
23088#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
23093#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
23094pub struct Plugin {
23095 #[serde(rename = "Config")]
23096 pub config: models::PluginConfig,
23097
23098#[serde(rename = "Enabled")]
23100 pub enabled: bool,
23101
23102#[serde(rename = "Id")]
23104 #[serde(skip_serializing_if="Option::is_none")]
23105 pub id: Option<String>,
23106
23107#[serde(rename = "Name")]
23109 pub name: String,
23110
23111#[serde(rename = "PluginReference")]
23113 #[serde(skip_serializing_if="Option::is_none")]
23114 pub plugin_reference: Option<String>,
23115
23116 #[serde(rename = "Settings")]
23117 pub settings: models::PluginSettings,
23118
23119}
23120
23121
23122impl Plugin {
23123 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
23124 pub fn new(config: models::PluginConfig, enabled: bool, name: String, settings: models::PluginSettings, ) -> Plugin {
23125 Plugin {
23126 config,
23127 enabled,
23128 id: None,
23129 name,
23130 plugin_reference: None,
23131 settings,
23132 }
23133 }
23134}
23135
23136impl std::string::ToString for Plugin {
23140 fn to_string(&self) -> String {
23141 let params: Vec<Option<String>> = vec![
23142 Some("Enabled".to_string()),
23146 Some(self.enabled.to_string()),
23147
23148
23149 self.id.as_ref().map(|id| {
23150 [
23151 "Id".to_string(),
23152 id.to_string(),
23153 ].join(",")
23154 }),
23155
23156
23157 Some("Name".to_string()),
23158 Some(self.name.to_string()),
23159
23160
23161 self.plugin_reference.as_ref().map(|plugin_reference| {
23162 [
23163 "PluginReference".to_string(),
23164 plugin_reference.to_string(),
23165 ].join(",")
23166 }),
23167
23168 ];
23171
23172 params.into_iter().flatten().collect::<Vec<_>>().join(",")
23173 }
23174}
23175
23176impl std::str::FromStr for Plugin {
23180 type Err = String;
23181
23182 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
23183 #[derive(Default)]
23185 #[allow(dead_code)]
23186 struct IntermediateRep {
23187 pub config: Vec<models::PluginConfig>,
23188 pub enabled: Vec<bool>,
23189 pub id: Vec<String>,
23190 pub name: Vec<String>,
23191 pub plugin_reference: Vec<String>,
23192 pub settings: Vec<models::PluginSettings>,
23193 }
23194
23195 let mut intermediate_rep = IntermediateRep::default();
23196
23197 let mut string_iter = s.split(',');
23199 let mut key_result = string_iter.next();
23200
23201 while key_result.is_some() {
23202 let val = match string_iter.next() {
23203 Some(x) => x,
23204 None => return std::result::Result::Err("Missing value while parsing Plugin".to_string())
23205 };
23206
23207 if let Some(key) = key_result {
23208 #[allow(clippy::match_single_binding)]
23209 match key {
23210 #[allow(clippy::redundant_clone)]
23211 "Config" => intermediate_rep.config.push(<models::PluginConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23212 #[allow(clippy::redundant_clone)]
23213 "Enabled" => intermediate_rep.enabled.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23214 #[allow(clippy::redundant_clone)]
23215 "Id" => intermediate_rep.id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23216 #[allow(clippy::redundant_clone)]
23217 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23218 #[allow(clippy::redundant_clone)]
23219 "PluginReference" => intermediate_rep.plugin_reference.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23220 #[allow(clippy::redundant_clone)]
23221 "Settings" => intermediate_rep.settings.push(<models::PluginSettings as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23222 _ => return std::result::Result::Err("Unexpected key while parsing Plugin".to_string())
23223 }
23224 }
23225
23226 key_result = string_iter.next();
23228 }
23229
23230 std::result::Result::Ok(Plugin {
23232 config: intermediate_rep.config.into_iter().next().ok_or_else(|| "Config missing in Plugin".to_string())?,
23233 enabled: intermediate_rep.enabled.into_iter().next().ok_or_else(|| "Enabled missing in Plugin".to_string())?,
23234 id: intermediate_rep.id.into_iter().next(),
23235 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in Plugin".to_string())?,
23236 plugin_reference: intermediate_rep.plugin_reference.into_iter().next(),
23237 settings: intermediate_rep.settings.into_iter().next().ok_or_else(|| "Settings missing in Plugin".to_string())?,
23238 })
23239 }
23240}
23241
23242#[cfg(feature = "server")]
23245impl std::convert::TryFrom<header::IntoHeaderValue<Plugin>> for HeaderValue {
23246 type Error = String;
23247
23248 fn try_from(hdr_value: header::IntoHeaderValue<Plugin>) -> std::result::Result<Self, Self::Error> {
23249 let hdr_value = hdr_value.to_string();
23250 match HeaderValue::from_str(&hdr_value) {
23251 std::result::Result::Ok(value) => std::result::Result::Ok(value),
23252 std::result::Result::Err(e) => std::result::Result::Err(
23253 format!("Invalid header value for Plugin - value: {} is invalid {}",
23254 hdr_value, e))
23255 }
23256 }
23257}
23258
23259#[cfg(feature = "server")]
23260impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Plugin> {
23261 type Error = String;
23262
23263 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
23264 match hdr_value.to_str() {
23265 std::result::Result::Ok(value) => {
23266 match <Plugin as std::str::FromStr>::from_str(value) {
23267 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
23268 std::result::Result::Err(err) => std::result::Result::Err(
23269 format!("Unable to convert header value '{}' into Plugin - {}",
23270 value, err))
23271 }
23272 },
23273 std::result::Result::Err(e) => std::result::Result::Err(
23274 format!("Unable to convert header: {:?} to string: {}",
23275 hdr_value, e))
23276 }
23277 }
23278}
23279
23280
23281
23282
23283
23284
23285
23286#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
23287#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
23288pub struct PluginConfig {
23289 #[serde(rename = "Args")]
23290 pub args: models::PluginConfigArgs,
23291
23292#[serde(rename = "Description")]
23294 pub description: String,
23295
23296#[serde(rename = "DockerVersion")]
23298 #[serde(skip_serializing_if="Option::is_none")]
23299 pub docker_version: Option<String>,
23300
23301#[serde(rename = "Documentation")]
23303 pub documentation: String,
23304
23305#[serde(rename = "Entrypoint")]
23307 pub entrypoint: Vec<String>,
23308
23309#[serde(rename = "Env")]
23311 pub env: Vec<models::PluginEnv>,
23312
23313 #[serde(rename = "Interface")]
23314 pub interface: models::PluginConfigInterface,
23315
23316#[serde(rename = "IpcHost")]
23318 pub ipc_host: bool,
23319
23320 #[serde(rename = "Linux")]
23321 pub linux: models::PluginConfigLinux,
23322
23323#[serde(rename = "Mounts")]
23325 pub mounts: Vec<models::PluginMount>,
23326
23327 #[serde(rename = "Network")]
23328 pub network: models::PluginConfigNetwork,
23329
23330#[serde(rename = "PidHost")]
23332 pub pid_host: bool,
23333
23334#[serde(rename = "PropagatedMount")]
23336 pub propagated_mount: String,
23337
23338 #[serde(rename = "User")]
23339 #[serde(skip_serializing_if="Option::is_none")]
23340 pub user: Option<models::PluginConfigUser>,
23341
23342#[serde(rename = "WorkDir")]
23344 pub work_dir: String,
23345
23346 #[serde(rename = "rootfs")]
23347 #[serde(skip_serializing_if="Option::is_none")]
23348 pub rootfs: Option<models::PluginConfigRootfs>,
23349
23350}
23351
23352
23353impl PluginConfig {
23354 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
23355 pub fn new(args: models::PluginConfigArgs, description: String, documentation: String, entrypoint: Vec<String>, env: Vec<models::PluginEnv>, interface: models::PluginConfigInterface, ipc_host: bool, linux: models::PluginConfigLinux, mounts: Vec<models::PluginMount>, network: models::PluginConfigNetwork, pid_host: bool, propagated_mount: String, work_dir: String, ) -> PluginConfig {
23356 PluginConfig {
23357 args,
23358 description,
23359 docker_version: None,
23360 documentation,
23361 entrypoint,
23362 env,
23363 interface,
23364 ipc_host,
23365 linux,
23366 mounts,
23367 network,
23368 pid_host,
23369 propagated_mount,
23370 user: None,
23371 work_dir,
23372 rootfs: None,
23373 }
23374 }
23375}
23376
23377impl std::string::ToString for PluginConfig {
23381 fn to_string(&self) -> String {
23382 let params: Vec<Option<String>> = vec![
23383 Some("Description".to_string()),
23387 Some(self.description.to_string()),
23388
23389
23390 self.docker_version.as_ref().map(|docker_version| {
23391 [
23392 "DockerVersion".to_string(),
23393 docker_version.to_string(),
23394 ].join(",")
23395 }),
23396
23397
23398 Some("Documentation".to_string()),
23399 Some(self.documentation.to_string()),
23400
23401
23402 Some("Entrypoint".to_string()),
23403 Some(self.entrypoint.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
23404
23405 Some("IpcHost".to_string()),
23411 Some(self.ipc_host.to_string()),
23412
23413 Some("PidHost".to_string()),
23421 Some(self.pid_host.to_string()),
23422
23423
23424 Some("PropagatedMount".to_string()),
23425 Some(self.propagated_mount.to_string()),
23426
23427 Some("WorkDir".to_string()),
23431 Some(self.work_dir.to_string()),
23432
23433 ];
23436
23437 params.into_iter().flatten().collect::<Vec<_>>().join(",")
23438 }
23439}
23440
23441impl std::str::FromStr for PluginConfig {
23445 type Err = String;
23446
23447 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
23448 #[derive(Default)]
23450 #[allow(dead_code)]
23451 struct IntermediateRep {
23452 pub args: Vec<models::PluginConfigArgs>,
23453 pub description: Vec<String>,
23454 pub docker_version: Vec<String>,
23455 pub documentation: Vec<String>,
23456 pub entrypoint: Vec<Vec<String>>,
23457 pub env: Vec<Vec<models::PluginEnv>>,
23458 pub interface: Vec<models::PluginConfigInterface>,
23459 pub ipc_host: Vec<bool>,
23460 pub linux: Vec<models::PluginConfigLinux>,
23461 pub mounts: Vec<Vec<models::PluginMount>>,
23462 pub network: Vec<models::PluginConfigNetwork>,
23463 pub pid_host: Vec<bool>,
23464 pub propagated_mount: Vec<String>,
23465 pub user: Vec<models::PluginConfigUser>,
23466 pub work_dir: Vec<String>,
23467 pub rootfs: Vec<models::PluginConfigRootfs>,
23468 }
23469
23470 let mut intermediate_rep = IntermediateRep::default();
23471
23472 let mut string_iter = s.split(',');
23474 let mut key_result = string_iter.next();
23475
23476 while key_result.is_some() {
23477 let val = match string_iter.next() {
23478 Some(x) => x,
23479 None => return std::result::Result::Err("Missing value while parsing PluginConfig".to_string())
23480 };
23481
23482 if let Some(key) = key_result {
23483 #[allow(clippy::match_single_binding)]
23484 match key {
23485 #[allow(clippy::redundant_clone)]
23486 "Args" => intermediate_rep.args.push(<models::PluginConfigArgs as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23487 #[allow(clippy::redundant_clone)]
23488 "Description" => intermediate_rep.description.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23489 #[allow(clippy::redundant_clone)]
23490 "DockerVersion" => intermediate_rep.docker_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23491 #[allow(clippy::redundant_clone)]
23492 "Documentation" => intermediate_rep.documentation.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23493 "Entrypoint" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfig".to_string()),
23494 "Env" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfig".to_string()),
23495 #[allow(clippy::redundant_clone)]
23496 "Interface" => intermediate_rep.interface.push(<models::PluginConfigInterface as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23497 #[allow(clippy::redundant_clone)]
23498 "IpcHost" => intermediate_rep.ipc_host.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23499 #[allow(clippy::redundant_clone)]
23500 "Linux" => intermediate_rep.linux.push(<models::PluginConfigLinux as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23501 "Mounts" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfig".to_string()),
23502 #[allow(clippy::redundant_clone)]
23503 "Network" => intermediate_rep.network.push(<models::PluginConfigNetwork as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23504 #[allow(clippy::redundant_clone)]
23505 "PidHost" => intermediate_rep.pid_host.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23506 #[allow(clippy::redundant_clone)]
23507 "PropagatedMount" => intermediate_rep.propagated_mount.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23508 #[allow(clippy::redundant_clone)]
23509 "User" => intermediate_rep.user.push(<models::PluginConfigUser as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23510 #[allow(clippy::redundant_clone)]
23511 "WorkDir" => intermediate_rep.work_dir.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23512 #[allow(clippy::redundant_clone)]
23513 "rootfs" => intermediate_rep.rootfs.push(<models::PluginConfigRootfs as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23514 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfig".to_string())
23515 }
23516 }
23517
23518 key_result = string_iter.next();
23520 }
23521
23522 std::result::Result::Ok(PluginConfig {
23524 args: intermediate_rep.args.into_iter().next().ok_or_else(|| "Args missing in PluginConfig".to_string())?,
23525 description: intermediate_rep.description.into_iter().next().ok_or_else(|| "Description missing in PluginConfig".to_string())?,
23526 docker_version: intermediate_rep.docker_version.into_iter().next(),
23527 documentation: intermediate_rep.documentation.into_iter().next().ok_or_else(|| "Documentation missing in PluginConfig".to_string())?,
23528 entrypoint: intermediate_rep.entrypoint.into_iter().next().ok_or_else(|| "Entrypoint missing in PluginConfig".to_string())?,
23529 env: intermediate_rep.env.into_iter().next().ok_or_else(|| "Env missing in PluginConfig".to_string())?,
23530 interface: intermediate_rep.interface.into_iter().next().ok_or_else(|| "Interface missing in PluginConfig".to_string())?,
23531 ipc_host: intermediate_rep.ipc_host.into_iter().next().ok_or_else(|| "IpcHost missing in PluginConfig".to_string())?,
23532 linux: intermediate_rep.linux.into_iter().next().ok_or_else(|| "Linux missing in PluginConfig".to_string())?,
23533 mounts: intermediate_rep.mounts.into_iter().next().ok_or_else(|| "Mounts missing in PluginConfig".to_string())?,
23534 network: intermediate_rep.network.into_iter().next().ok_or_else(|| "Network missing in PluginConfig".to_string())?,
23535 pid_host: intermediate_rep.pid_host.into_iter().next().ok_or_else(|| "PidHost missing in PluginConfig".to_string())?,
23536 propagated_mount: intermediate_rep.propagated_mount.into_iter().next().ok_or_else(|| "PropagatedMount missing in PluginConfig".to_string())?,
23537 user: intermediate_rep.user.into_iter().next(),
23538 work_dir: intermediate_rep.work_dir.into_iter().next().ok_or_else(|| "WorkDir missing in PluginConfig".to_string())?,
23539 rootfs: intermediate_rep.rootfs.into_iter().next(),
23540 })
23541 }
23542}
23543
23544#[cfg(feature = "server")]
23547impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfig>> for HeaderValue {
23548 type Error = String;
23549
23550 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfig>) -> std::result::Result<Self, Self::Error> {
23551 let hdr_value = hdr_value.to_string();
23552 match HeaderValue::from_str(&hdr_value) {
23553 std::result::Result::Ok(value) => std::result::Result::Ok(value),
23554 std::result::Result::Err(e) => std::result::Result::Err(
23555 format!("Invalid header value for PluginConfig - value: {} is invalid {}",
23556 hdr_value, e))
23557 }
23558 }
23559}
23560
23561#[cfg(feature = "server")]
23562impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfig> {
23563 type Error = String;
23564
23565 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
23566 match hdr_value.to_str() {
23567 std::result::Result::Ok(value) => {
23568 match <PluginConfig as std::str::FromStr>::from_str(value) {
23569 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
23570 std::result::Result::Err(err) => std::result::Result::Err(
23571 format!("Unable to convert header value '{}' into PluginConfig - {}",
23572 value, err))
23573 }
23574 },
23575 std::result::Result::Err(e) => std::result::Result::Err(
23576 format!("Unable to convert header: {:?} to string: {}",
23577 hdr_value, e))
23578 }
23579 }
23580}
23581
23582
23583
23584
23585#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
23590#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
23591pub struct PluginConfigArgs {
23592#[serde(rename = "Description")]
23594 pub description: String,
23595
23596#[serde(rename = "Name")]
23598 pub name: String,
23599
23600#[serde(rename = "Settable")]
23602 pub settable: Vec<String>,
23603
23604#[serde(rename = "Value")]
23606 pub value: Vec<String>,
23607
23608}
23609
23610
23611impl PluginConfigArgs {
23612 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
23613 pub fn new(description: String, name: String, settable: Vec<String>, value: Vec<String>, ) -> PluginConfigArgs {
23614 PluginConfigArgs {
23615 description,
23616 name,
23617 settable,
23618 value,
23619 }
23620 }
23621}
23622
23623impl std::string::ToString for PluginConfigArgs {
23627 fn to_string(&self) -> String {
23628 let params: Vec<Option<String>> = vec![
23629
23630 Some("Description".to_string()),
23631 Some(self.description.to_string()),
23632
23633
23634 Some("Name".to_string()),
23635 Some(self.name.to_string()),
23636
23637
23638 Some("Settable".to_string()),
23639 Some(self.settable.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
23640
23641
23642 Some("Value".to_string()),
23643 Some(self.value.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
23644
23645 ];
23646
23647 params.into_iter().flatten().collect::<Vec<_>>().join(",")
23648 }
23649}
23650
23651impl std::str::FromStr for PluginConfigArgs {
23655 type Err = String;
23656
23657 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
23658 #[derive(Default)]
23660 #[allow(dead_code)]
23661 struct IntermediateRep {
23662 pub description: Vec<String>,
23663 pub name: Vec<String>,
23664 pub settable: Vec<Vec<String>>,
23665 pub value: Vec<Vec<String>>,
23666 }
23667
23668 let mut intermediate_rep = IntermediateRep::default();
23669
23670 let mut string_iter = s.split(',');
23672 let mut key_result = string_iter.next();
23673
23674 while key_result.is_some() {
23675 let val = match string_iter.next() {
23676 Some(x) => x,
23677 None => return std::result::Result::Err("Missing value while parsing PluginConfigArgs".to_string())
23678 };
23679
23680 if let Some(key) = key_result {
23681 #[allow(clippy::match_single_binding)]
23682 match key {
23683 #[allow(clippy::redundant_clone)]
23684 "Description" => intermediate_rep.description.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23685 #[allow(clippy::redundant_clone)]
23686 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23687 "Settable" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigArgs".to_string()),
23688 "Value" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigArgs".to_string()),
23689 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigArgs".to_string())
23690 }
23691 }
23692
23693 key_result = string_iter.next();
23695 }
23696
23697 std::result::Result::Ok(PluginConfigArgs {
23699 description: intermediate_rep.description.into_iter().next().ok_or_else(|| "Description missing in PluginConfigArgs".to_string())?,
23700 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in PluginConfigArgs".to_string())?,
23701 settable: intermediate_rep.settable.into_iter().next().ok_or_else(|| "Settable missing in PluginConfigArgs".to_string())?,
23702 value: intermediate_rep.value.into_iter().next().ok_or_else(|| "Value missing in PluginConfigArgs".to_string())?,
23703 })
23704 }
23705}
23706
23707#[cfg(feature = "server")]
23710impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigArgs>> for HeaderValue {
23711 type Error = String;
23712
23713 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigArgs>) -> std::result::Result<Self, Self::Error> {
23714 let hdr_value = hdr_value.to_string();
23715 match HeaderValue::from_str(&hdr_value) {
23716 std::result::Result::Ok(value) => std::result::Result::Ok(value),
23717 std::result::Result::Err(e) => std::result::Result::Err(
23718 format!("Invalid header value for PluginConfigArgs - value: {} is invalid {}",
23719 hdr_value, e))
23720 }
23721 }
23722}
23723
23724#[cfg(feature = "server")]
23725impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigArgs> {
23726 type Error = String;
23727
23728 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
23729 match hdr_value.to_str() {
23730 std::result::Result::Ok(value) => {
23731 match <PluginConfigArgs as std::str::FromStr>::from_str(value) {
23732 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
23733 std::result::Result::Err(err) => std::result::Result::Err(
23734 format!("Unable to convert header value '{}' into PluginConfigArgs - {}",
23735 value, err))
23736 }
23737 },
23738 std::result::Result::Err(e) => std::result::Result::Err(
23739 format!("Unable to convert header: {:?} to string: {}",
23740 hdr_value, e))
23741 }
23742 }
23743}
23744
23745
23746
23747
23748#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
23753#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
23754pub struct PluginConfigInterface {
23755#[serde(rename = "ProtocolScheme")]
23757 #[serde(skip_serializing_if="Option::is_none")]
23758 pub protocol_scheme: Option<String>,
23759
23760#[serde(rename = "Socket")]
23762 pub socket: String,
23763
23764#[serde(rename = "Types")]
23766 pub types: Vec<models::PluginInterfaceType>,
23767
23768}
23769
23770
23771impl PluginConfigInterface {
23772 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
23773 pub fn new(socket: String, types: Vec<models::PluginInterfaceType>, ) -> PluginConfigInterface {
23774 PluginConfigInterface {
23775 protocol_scheme: None,
23776 socket,
23777 types,
23778 }
23779 }
23780}
23781
23782impl std::string::ToString for PluginConfigInterface {
23786 fn to_string(&self) -> String {
23787 let params: Vec<Option<String>> = vec![
23788
23789 self.protocol_scheme.as_ref().map(|protocol_scheme| {
23790 [
23791 "ProtocolScheme".to_string(),
23792 protocol_scheme.to_string(),
23793 ].join(",")
23794 }),
23795
23796
23797 Some("Socket".to_string()),
23798 Some(self.socket.to_string()),
23799
23800 ];
23803
23804 params.into_iter().flatten().collect::<Vec<_>>().join(",")
23805 }
23806}
23807
23808impl std::str::FromStr for PluginConfigInterface {
23812 type Err = String;
23813
23814 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
23815 #[derive(Default)]
23817 #[allow(dead_code)]
23818 struct IntermediateRep {
23819 pub protocol_scheme: Vec<String>,
23820 pub socket: Vec<String>,
23821 pub types: Vec<Vec<models::PluginInterfaceType>>,
23822 }
23823
23824 let mut intermediate_rep = IntermediateRep::default();
23825
23826 let mut string_iter = s.split(',');
23828 let mut key_result = string_iter.next();
23829
23830 while key_result.is_some() {
23831 let val = match string_iter.next() {
23832 Some(x) => x,
23833 None => return std::result::Result::Err("Missing value while parsing PluginConfigInterface".to_string())
23834 };
23835
23836 if let Some(key) = key_result {
23837 #[allow(clippy::match_single_binding)]
23838 match key {
23839 #[allow(clippy::redundant_clone)]
23840 "ProtocolScheme" => intermediate_rep.protocol_scheme.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23841 #[allow(clippy::redundant_clone)]
23842 "Socket" => intermediate_rep.socket.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23843 "Types" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigInterface".to_string()),
23844 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigInterface".to_string())
23845 }
23846 }
23847
23848 key_result = string_iter.next();
23850 }
23851
23852 std::result::Result::Ok(PluginConfigInterface {
23854 protocol_scheme: intermediate_rep.protocol_scheme.into_iter().next(),
23855 socket: intermediate_rep.socket.into_iter().next().ok_or_else(|| "Socket missing in PluginConfigInterface".to_string())?,
23856 types: intermediate_rep.types.into_iter().next().ok_or_else(|| "Types missing in PluginConfigInterface".to_string())?,
23857 })
23858 }
23859}
23860
23861#[cfg(feature = "server")]
23864impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigInterface>> for HeaderValue {
23865 type Error = String;
23866
23867 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigInterface>) -> std::result::Result<Self, Self::Error> {
23868 let hdr_value = hdr_value.to_string();
23869 match HeaderValue::from_str(&hdr_value) {
23870 std::result::Result::Ok(value) => std::result::Result::Ok(value),
23871 std::result::Result::Err(e) => std::result::Result::Err(
23872 format!("Invalid header value for PluginConfigInterface - value: {} is invalid {}",
23873 hdr_value, e))
23874 }
23875 }
23876}
23877
23878#[cfg(feature = "server")]
23879impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigInterface> {
23880 type Error = String;
23881
23882 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
23883 match hdr_value.to_str() {
23884 std::result::Result::Ok(value) => {
23885 match <PluginConfigInterface as std::str::FromStr>::from_str(value) {
23886 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
23887 std::result::Result::Err(err) => std::result::Result::Err(
23888 format!("Unable to convert header value '{}' into PluginConfigInterface - {}",
23889 value, err))
23890 }
23891 },
23892 std::result::Result::Err(e) => std::result::Result::Err(
23893 format!("Unable to convert header: {:?} to string: {}",
23894 hdr_value, e))
23895 }
23896 }
23897}
23898
23899
23900
23901
23902#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
23907#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
23908pub struct PluginConfigLinux {
23909#[serde(rename = "AllowAllDevices")]
23911 pub allow_all_devices: bool,
23912
23913#[serde(rename = "Capabilities")]
23915 pub capabilities: Vec<String>,
23916
23917#[serde(rename = "Devices")]
23919 pub devices: Vec<models::PluginDevice>,
23920
23921}
23922
23923
23924impl PluginConfigLinux {
23925 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
23926 pub fn new(allow_all_devices: bool, capabilities: Vec<String>, devices: Vec<models::PluginDevice>, ) -> PluginConfigLinux {
23927 PluginConfigLinux {
23928 allow_all_devices,
23929 capabilities,
23930 devices,
23931 }
23932 }
23933}
23934
23935impl std::string::ToString for PluginConfigLinux {
23939 fn to_string(&self) -> String {
23940 let params: Vec<Option<String>> = vec![
23941
23942 Some("AllowAllDevices".to_string()),
23943 Some(self.allow_all_devices.to_string()),
23944
23945
23946 Some("Capabilities".to_string()),
23947 Some(self.capabilities.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
23948
23949 ];
23952
23953 params.into_iter().flatten().collect::<Vec<_>>().join(",")
23954 }
23955}
23956
23957impl std::str::FromStr for PluginConfigLinux {
23961 type Err = String;
23962
23963 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
23964 #[derive(Default)]
23966 #[allow(dead_code)]
23967 struct IntermediateRep {
23968 pub allow_all_devices: Vec<bool>,
23969 pub capabilities: Vec<Vec<String>>,
23970 pub devices: Vec<Vec<models::PluginDevice>>,
23971 }
23972
23973 let mut intermediate_rep = IntermediateRep::default();
23974
23975 let mut string_iter = s.split(',');
23977 let mut key_result = string_iter.next();
23978
23979 while key_result.is_some() {
23980 let val = match string_iter.next() {
23981 Some(x) => x,
23982 None => return std::result::Result::Err("Missing value while parsing PluginConfigLinux".to_string())
23983 };
23984
23985 if let Some(key) = key_result {
23986 #[allow(clippy::match_single_binding)]
23987 match key {
23988 #[allow(clippy::redundant_clone)]
23989 "AllowAllDevices" => intermediate_rep.allow_all_devices.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
23990 "Capabilities" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigLinux".to_string()),
23991 "Devices" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigLinux".to_string()),
23992 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigLinux".to_string())
23993 }
23994 }
23995
23996 key_result = string_iter.next();
23998 }
23999
24000 std::result::Result::Ok(PluginConfigLinux {
24002 allow_all_devices: intermediate_rep.allow_all_devices.into_iter().next().ok_or_else(|| "AllowAllDevices missing in PluginConfigLinux".to_string())?,
24003 capabilities: intermediate_rep.capabilities.into_iter().next().ok_or_else(|| "Capabilities missing in PluginConfigLinux".to_string())?,
24004 devices: intermediate_rep.devices.into_iter().next().ok_or_else(|| "Devices missing in PluginConfigLinux".to_string())?,
24005 })
24006 }
24007}
24008
24009#[cfg(feature = "server")]
24012impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigLinux>> for HeaderValue {
24013 type Error = String;
24014
24015 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigLinux>) -> std::result::Result<Self, Self::Error> {
24016 let hdr_value = hdr_value.to_string();
24017 match HeaderValue::from_str(&hdr_value) {
24018 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24019 std::result::Result::Err(e) => std::result::Result::Err(
24020 format!("Invalid header value for PluginConfigLinux - value: {} is invalid {}",
24021 hdr_value, e))
24022 }
24023 }
24024}
24025
24026#[cfg(feature = "server")]
24027impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigLinux> {
24028 type Error = String;
24029
24030 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24031 match hdr_value.to_str() {
24032 std::result::Result::Ok(value) => {
24033 match <PluginConfigLinux as std::str::FromStr>::from_str(value) {
24034 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24035 std::result::Result::Err(err) => std::result::Result::Err(
24036 format!("Unable to convert header value '{}' into PluginConfigLinux - {}",
24037 value, err))
24038 }
24039 },
24040 std::result::Result::Err(e) => std::result::Result::Err(
24041 format!("Unable to convert header: {:?} to string: {}",
24042 hdr_value, e))
24043 }
24044 }
24045}
24046
24047
24048
24049
24050#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24055#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24056pub struct PluginConfigNetwork {
24057#[serde(rename = "Type")]
24059 pub r#type: String,
24060
24061}
24062
24063
24064impl PluginConfigNetwork {
24065 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24066 pub fn new(r#type: String, ) -> PluginConfigNetwork {
24067 PluginConfigNetwork {
24068 r#type,
24069 }
24070 }
24071}
24072
24073impl std::string::ToString for PluginConfigNetwork {
24077 fn to_string(&self) -> String {
24078 let params: Vec<Option<String>> = vec![
24079
24080 Some("Type".to_string()),
24081 Some(self.r#type.to_string()),
24082
24083 ];
24084
24085 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24086 }
24087}
24088
24089impl std::str::FromStr for PluginConfigNetwork {
24093 type Err = String;
24094
24095 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24096 #[derive(Default)]
24098 #[allow(dead_code)]
24099 struct IntermediateRep {
24100 pub r#type: Vec<String>,
24101 }
24102
24103 let mut intermediate_rep = IntermediateRep::default();
24104
24105 let mut string_iter = s.split(',');
24107 let mut key_result = string_iter.next();
24108
24109 while key_result.is_some() {
24110 let val = match string_iter.next() {
24111 Some(x) => x,
24112 None => return std::result::Result::Err("Missing value while parsing PluginConfigNetwork".to_string())
24113 };
24114
24115 if let Some(key) = key_result {
24116 #[allow(clippy::match_single_binding)]
24117 match key {
24118 #[allow(clippy::redundant_clone)]
24119 "Type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24120 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigNetwork".to_string())
24121 }
24122 }
24123
24124 key_result = string_iter.next();
24126 }
24127
24128 std::result::Result::Ok(PluginConfigNetwork {
24130 r#type: intermediate_rep.r#type.into_iter().next().ok_or_else(|| "Type missing in PluginConfigNetwork".to_string())?,
24131 })
24132 }
24133}
24134
24135#[cfg(feature = "server")]
24138impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigNetwork>> for HeaderValue {
24139 type Error = String;
24140
24141 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigNetwork>) -> std::result::Result<Self, Self::Error> {
24142 let hdr_value = hdr_value.to_string();
24143 match HeaderValue::from_str(&hdr_value) {
24144 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24145 std::result::Result::Err(e) => std::result::Result::Err(
24146 format!("Invalid header value for PluginConfigNetwork - value: {} is invalid {}",
24147 hdr_value, e))
24148 }
24149 }
24150}
24151
24152#[cfg(feature = "server")]
24153impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigNetwork> {
24154 type Error = String;
24155
24156 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24157 match hdr_value.to_str() {
24158 std::result::Result::Ok(value) => {
24159 match <PluginConfigNetwork as std::str::FromStr>::from_str(value) {
24160 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24161 std::result::Result::Err(err) => std::result::Result::Err(
24162 format!("Unable to convert header value '{}' into PluginConfigNetwork - {}",
24163 value, err))
24164 }
24165 },
24166 std::result::Result::Err(e) => std::result::Result::Err(
24167 format!("Unable to convert header: {:?} to string: {}",
24168 hdr_value, e))
24169 }
24170 }
24171}
24172
24173
24174
24175
24176#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24181#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24182pub struct PluginConfigRootfs {
24183#[serde(rename = "diff_ids")]
24185 #[serde(skip_serializing_if="Option::is_none")]
24186 pub diff_ids: Option<Vec<String>>,
24187
24188#[serde(rename = "type")]
24190 #[serde(skip_serializing_if="Option::is_none")]
24191 pub r#type: Option<String>,
24192
24193}
24194
24195
24196impl PluginConfigRootfs {
24197 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24198 pub fn new() -> PluginConfigRootfs {
24199 PluginConfigRootfs {
24200 diff_ids: None,
24201 r#type: None,
24202 }
24203 }
24204}
24205
24206impl std::string::ToString for PluginConfigRootfs {
24210 fn to_string(&self) -> String {
24211 let params: Vec<Option<String>> = vec![
24212
24213 self.diff_ids.as_ref().map(|diff_ids| {
24214 [
24215 "diff_ids".to_string(),
24216 diff_ids.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
24217 ].join(",")
24218 }),
24219
24220
24221 self.r#type.as_ref().map(|r#type| {
24222 [
24223 "type".to_string(),
24224 r#type.to_string(),
24225 ].join(",")
24226 }),
24227
24228 ];
24229
24230 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24231 }
24232}
24233
24234impl std::str::FromStr for PluginConfigRootfs {
24238 type Err = String;
24239
24240 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24241 #[derive(Default)]
24243 #[allow(dead_code)]
24244 struct IntermediateRep {
24245 pub diff_ids: Vec<Vec<String>>,
24246 pub r#type: Vec<String>,
24247 }
24248
24249 let mut intermediate_rep = IntermediateRep::default();
24250
24251 let mut string_iter = s.split(',');
24253 let mut key_result = string_iter.next();
24254
24255 while key_result.is_some() {
24256 let val = match string_iter.next() {
24257 Some(x) => x,
24258 None => return std::result::Result::Err("Missing value while parsing PluginConfigRootfs".to_string())
24259 };
24260
24261 if let Some(key) = key_result {
24262 #[allow(clippy::match_single_binding)]
24263 match key {
24264 "diff_ids" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginConfigRootfs".to_string()),
24265 #[allow(clippy::redundant_clone)]
24266 "type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24267 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigRootfs".to_string())
24268 }
24269 }
24270
24271 key_result = string_iter.next();
24273 }
24274
24275 std::result::Result::Ok(PluginConfigRootfs {
24277 diff_ids: intermediate_rep.diff_ids.into_iter().next(),
24278 r#type: intermediate_rep.r#type.into_iter().next(),
24279 })
24280 }
24281}
24282
24283#[cfg(feature = "server")]
24286impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigRootfs>> for HeaderValue {
24287 type Error = String;
24288
24289 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigRootfs>) -> std::result::Result<Self, Self::Error> {
24290 let hdr_value = hdr_value.to_string();
24291 match HeaderValue::from_str(&hdr_value) {
24292 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24293 std::result::Result::Err(e) => std::result::Result::Err(
24294 format!("Invalid header value for PluginConfigRootfs - value: {} is invalid {}",
24295 hdr_value, e))
24296 }
24297 }
24298}
24299
24300#[cfg(feature = "server")]
24301impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigRootfs> {
24302 type Error = String;
24303
24304 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24305 match hdr_value.to_str() {
24306 std::result::Result::Ok(value) => {
24307 match <PluginConfigRootfs as std::str::FromStr>::from_str(value) {
24308 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24309 std::result::Result::Err(err) => std::result::Result::Err(
24310 format!("Unable to convert header value '{}' into PluginConfigRootfs - {}",
24311 value, err))
24312 }
24313 },
24314 std::result::Result::Err(e) => std::result::Result::Err(
24315 format!("Unable to convert header: {:?} to string: {}",
24316 hdr_value, e))
24317 }
24318 }
24319}
24320
24321
24322
24323
24324#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24329#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24330pub struct PluginConfigUser {
24331#[serde(rename = "GID")]
24333 #[serde(skip_serializing_if="Option::is_none")]
24334 pub gid: Option<i32>,
24335
24336#[serde(rename = "UID")]
24338 #[serde(skip_serializing_if="Option::is_none")]
24339 pub uid: Option<i32>,
24340
24341}
24342
24343
24344impl PluginConfigUser {
24345 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24346 pub fn new() -> PluginConfigUser {
24347 PluginConfigUser {
24348 gid: None,
24349 uid: None,
24350 }
24351 }
24352}
24353
24354impl std::string::ToString for PluginConfigUser {
24358 fn to_string(&self) -> String {
24359 let params: Vec<Option<String>> = vec![
24360
24361 self.gid.as_ref().map(|gid| {
24362 [
24363 "GID".to_string(),
24364 gid.to_string(),
24365 ].join(",")
24366 }),
24367
24368
24369 self.uid.as_ref().map(|uid| {
24370 [
24371 "UID".to_string(),
24372 uid.to_string(),
24373 ].join(",")
24374 }),
24375
24376 ];
24377
24378 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24379 }
24380}
24381
24382impl std::str::FromStr for PluginConfigUser {
24386 type Err = String;
24387
24388 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24389 #[derive(Default)]
24391 #[allow(dead_code)]
24392 struct IntermediateRep {
24393 pub gid: Vec<i32>,
24394 pub uid: Vec<i32>,
24395 }
24396
24397 let mut intermediate_rep = IntermediateRep::default();
24398
24399 let mut string_iter = s.split(',');
24401 let mut key_result = string_iter.next();
24402
24403 while key_result.is_some() {
24404 let val = match string_iter.next() {
24405 Some(x) => x,
24406 None => return std::result::Result::Err("Missing value while parsing PluginConfigUser".to_string())
24407 };
24408
24409 if let Some(key) = key_result {
24410 #[allow(clippy::match_single_binding)]
24411 match key {
24412 #[allow(clippy::redundant_clone)]
24413 "GID" => intermediate_rep.gid.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24414 #[allow(clippy::redundant_clone)]
24415 "UID" => intermediate_rep.uid.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24416 _ => return std::result::Result::Err("Unexpected key while parsing PluginConfigUser".to_string())
24417 }
24418 }
24419
24420 key_result = string_iter.next();
24422 }
24423
24424 std::result::Result::Ok(PluginConfigUser {
24426 gid: intermediate_rep.gid.into_iter().next(),
24427 uid: intermediate_rep.uid.into_iter().next(),
24428 })
24429 }
24430}
24431
24432#[cfg(feature = "server")]
24435impl std::convert::TryFrom<header::IntoHeaderValue<PluginConfigUser>> for HeaderValue {
24436 type Error = String;
24437
24438 fn try_from(hdr_value: header::IntoHeaderValue<PluginConfigUser>) -> std::result::Result<Self, Self::Error> {
24439 let hdr_value = hdr_value.to_string();
24440 match HeaderValue::from_str(&hdr_value) {
24441 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24442 std::result::Result::Err(e) => std::result::Result::Err(
24443 format!("Invalid header value for PluginConfigUser - value: {} is invalid {}",
24444 hdr_value, e))
24445 }
24446 }
24447}
24448
24449#[cfg(feature = "server")]
24450impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginConfigUser> {
24451 type Error = String;
24452
24453 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24454 match hdr_value.to_str() {
24455 std::result::Result::Ok(value) => {
24456 match <PluginConfigUser as std::str::FromStr>::from_str(value) {
24457 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24458 std::result::Result::Err(err) => std::result::Result::Err(
24459 format!("Unable to convert header value '{}' into PluginConfigUser - {}",
24460 value, err))
24461 }
24462 },
24463 std::result::Result::Err(e) => std::result::Result::Err(
24464 format!("Unable to convert header: {:?} to string: {}",
24465 hdr_value, e))
24466 }
24467 }
24468}
24469
24470
24471
24472
24473#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24478#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24479pub struct PluginDevice {
24480#[serde(rename = "Description")]
24482 pub description: String,
24483
24484#[serde(rename = "Name")]
24486 pub name: String,
24487
24488#[serde(rename = "Path")]
24490 pub path: String,
24491
24492#[serde(rename = "Settable")]
24494 pub settable: Vec<String>,
24495
24496}
24497
24498
24499impl PluginDevice {
24500 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24501 pub fn new(description: String, name: String, path: String, settable: Vec<String>, ) -> PluginDevice {
24502 PluginDevice {
24503 description,
24504 name,
24505 path,
24506 settable,
24507 }
24508 }
24509}
24510
24511impl std::string::ToString for PluginDevice {
24515 fn to_string(&self) -> String {
24516 let params: Vec<Option<String>> = vec![
24517
24518 Some("Description".to_string()),
24519 Some(self.description.to_string()),
24520
24521
24522 Some("Name".to_string()),
24523 Some(self.name.to_string()),
24524
24525
24526 Some("Path".to_string()),
24527 Some(self.path.to_string()),
24528
24529
24530 Some("Settable".to_string()),
24531 Some(self.settable.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
24532
24533 ];
24534
24535 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24536 }
24537}
24538
24539impl std::str::FromStr for PluginDevice {
24543 type Err = String;
24544
24545 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24546 #[derive(Default)]
24548 #[allow(dead_code)]
24549 struct IntermediateRep {
24550 pub description: Vec<String>,
24551 pub name: Vec<String>,
24552 pub path: Vec<String>,
24553 pub settable: Vec<Vec<String>>,
24554 }
24555
24556 let mut intermediate_rep = IntermediateRep::default();
24557
24558 let mut string_iter = s.split(',');
24560 let mut key_result = string_iter.next();
24561
24562 while key_result.is_some() {
24563 let val = match string_iter.next() {
24564 Some(x) => x,
24565 None => return std::result::Result::Err("Missing value while parsing PluginDevice".to_string())
24566 };
24567
24568 if let Some(key) = key_result {
24569 #[allow(clippy::match_single_binding)]
24570 match key {
24571 #[allow(clippy::redundant_clone)]
24572 "Description" => intermediate_rep.description.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24573 #[allow(clippy::redundant_clone)]
24574 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24575 #[allow(clippy::redundant_clone)]
24576 "Path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24577 "Settable" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginDevice".to_string()),
24578 _ => return std::result::Result::Err("Unexpected key while parsing PluginDevice".to_string())
24579 }
24580 }
24581
24582 key_result = string_iter.next();
24584 }
24585
24586 std::result::Result::Ok(PluginDevice {
24588 description: intermediate_rep.description.into_iter().next().ok_or_else(|| "Description missing in PluginDevice".to_string())?,
24589 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in PluginDevice".to_string())?,
24590 path: intermediate_rep.path.into_iter().next().ok_or_else(|| "Path missing in PluginDevice".to_string())?,
24591 settable: intermediate_rep.settable.into_iter().next().ok_or_else(|| "Settable missing in PluginDevice".to_string())?,
24592 })
24593 }
24594}
24595
24596#[cfg(feature = "server")]
24599impl std::convert::TryFrom<header::IntoHeaderValue<PluginDevice>> for HeaderValue {
24600 type Error = String;
24601
24602 fn try_from(hdr_value: header::IntoHeaderValue<PluginDevice>) -> std::result::Result<Self, Self::Error> {
24603 let hdr_value = hdr_value.to_string();
24604 match HeaderValue::from_str(&hdr_value) {
24605 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24606 std::result::Result::Err(e) => std::result::Result::Err(
24607 format!("Invalid header value for PluginDevice - value: {} is invalid {}",
24608 hdr_value, e))
24609 }
24610 }
24611}
24612
24613#[cfg(feature = "server")]
24614impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginDevice> {
24615 type Error = String;
24616
24617 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24618 match hdr_value.to_str() {
24619 std::result::Result::Ok(value) => {
24620 match <PluginDevice as std::str::FromStr>::from_str(value) {
24621 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24622 std::result::Result::Err(err) => std::result::Result::Err(
24623 format!("Unable to convert header value '{}' into PluginDevice - {}",
24624 value, err))
24625 }
24626 },
24627 std::result::Result::Err(e) => std::result::Result::Err(
24628 format!("Unable to convert header: {:?} to string: {}",
24629 hdr_value, e))
24630 }
24631 }
24632}
24633
24634
24635
24636
24637#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24642#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24643pub struct PluginEnv {
24644#[serde(rename = "Description")]
24646 pub description: String,
24647
24648#[serde(rename = "Name")]
24650 pub name: String,
24651
24652#[serde(rename = "Settable")]
24654 pub settable: Vec<String>,
24655
24656#[serde(rename = "Value")]
24658 pub value: String,
24659
24660}
24661
24662
24663impl PluginEnv {
24664 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24665 pub fn new(description: String, name: String, settable: Vec<String>, value: String, ) -> PluginEnv {
24666 PluginEnv {
24667 description,
24668 name,
24669 settable,
24670 value,
24671 }
24672 }
24673}
24674
24675impl std::string::ToString for PluginEnv {
24679 fn to_string(&self) -> String {
24680 let params: Vec<Option<String>> = vec![
24681
24682 Some("Description".to_string()),
24683 Some(self.description.to_string()),
24684
24685
24686 Some("Name".to_string()),
24687 Some(self.name.to_string()),
24688
24689
24690 Some("Settable".to_string()),
24691 Some(self.settable.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
24692
24693
24694 Some("Value".to_string()),
24695 Some(self.value.to_string()),
24696
24697 ];
24698
24699 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24700 }
24701}
24702
24703impl std::str::FromStr for PluginEnv {
24707 type Err = String;
24708
24709 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24710 #[derive(Default)]
24712 #[allow(dead_code)]
24713 struct IntermediateRep {
24714 pub description: Vec<String>,
24715 pub name: Vec<String>,
24716 pub settable: Vec<Vec<String>>,
24717 pub value: Vec<String>,
24718 }
24719
24720 let mut intermediate_rep = IntermediateRep::default();
24721
24722 let mut string_iter = s.split(',');
24724 let mut key_result = string_iter.next();
24725
24726 while key_result.is_some() {
24727 let val = match string_iter.next() {
24728 Some(x) => x,
24729 None => return std::result::Result::Err("Missing value while parsing PluginEnv".to_string())
24730 };
24731
24732 if let Some(key) = key_result {
24733 #[allow(clippy::match_single_binding)]
24734 match key {
24735 #[allow(clippy::redundant_clone)]
24736 "Description" => intermediate_rep.description.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24737 #[allow(clippy::redundant_clone)]
24738 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24739 "Settable" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginEnv".to_string()),
24740 #[allow(clippy::redundant_clone)]
24741 "Value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24742 _ => return std::result::Result::Err("Unexpected key while parsing PluginEnv".to_string())
24743 }
24744 }
24745
24746 key_result = string_iter.next();
24748 }
24749
24750 std::result::Result::Ok(PluginEnv {
24752 description: intermediate_rep.description.into_iter().next().ok_or_else(|| "Description missing in PluginEnv".to_string())?,
24753 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in PluginEnv".to_string())?,
24754 settable: intermediate_rep.settable.into_iter().next().ok_or_else(|| "Settable missing in PluginEnv".to_string())?,
24755 value: intermediate_rep.value.into_iter().next().ok_or_else(|| "Value missing in PluginEnv".to_string())?,
24756 })
24757 }
24758}
24759
24760#[cfg(feature = "server")]
24763impl std::convert::TryFrom<header::IntoHeaderValue<PluginEnv>> for HeaderValue {
24764 type Error = String;
24765
24766 fn try_from(hdr_value: header::IntoHeaderValue<PluginEnv>) -> std::result::Result<Self, Self::Error> {
24767 let hdr_value = hdr_value.to_string();
24768 match HeaderValue::from_str(&hdr_value) {
24769 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24770 std::result::Result::Err(e) => std::result::Result::Err(
24771 format!("Invalid header value for PluginEnv - value: {} is invalid {}",
24772 hdr_value, e))
24773 }
24774 }
24775}
24776
24777#[cfg(feature = "server")]
24778impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginEnv> {
24779 type Error = String;
24780
24781 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24782 match hdr_value.to_str() {
24783 std::result::Result::Ok(value) => {
24784 match <PluginEnv as std::str::FromStr>::from_str(value) {
24785 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24786 std::result::Result::Err(err) => std::result::Result::Err(
24787 format!("Unable to convert header value '{}' into PluginEnv - {}",
24788 value, err))
24789 }
24790 },
24791 std::result::Result::Err(e) => std::result::Result::Err(
24792 format!("Unable to convert header: {:?} to string: {}",
24793 hdr_value, e))
24794 }
24795 }
24796}
24797
24798
24799
24800
24801#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24806#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24807pub struct PluginInterfaceType {
24808#[serde(rename = "Capability")]
24810 pub capability: String,
24811
24812#[serde(rename = "Prefix")]
24814 pub prefix: String,
24815
24816#[serde(rename = "Version")]
24818 pub version: String,
24819
24820}
24821
24822
24823impl PluginInterfaceType {
24824 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24825 pub fn new(capability: String, prefix: String, version: String, ) -> PluginInterfaceType {
24826 PluginInterfaceType {
24827 capability,
24828 prefix,
24829 version,
24830 }
24831 }
24832}
24833
24834impl std::string::ToString for PluginInterfaceType {
24838 fn to_string(&self) -> String {
24839 let params: Vec<Option<String>> = vec![
24840
24841 Some("Capability".to_string()),
24842 Some(self.capability.to_string()),
24843
24844
24845 Some("Prefix".to_string()),
24846 Some(self.prefix.to_string()),
24847
24848
24849 Some("Version".to_string()),
24850 Some(self.version.to_string()),
24851
24852 ];
24853
24854 params.into_iter().flatten().collect::<Vec<_>>().join(",")
24855 }
24856}
24857
24858impl std::str::FromStr for PluginInterfaceType {
24862 type Err = String;
24863
24864 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
24865 #[derive(Default)]
24867 #[allow(dead_code)]
24868 struct IntermediateRep {
24869 pub capability: Vec<String>,
24870 pub prefix: Vec<String>,
24871 pub version: Vec<String>,
24872 }
24873
24874 let mut intermediate_rep = IntermediateRep::default();
24875
24876 let mut string_iter = s.split(',');
24878 let mut key_result = string_iter.next();
24879
24880 while key_result.is_some() {
24881 let val = match string_iter.next() {
24882 Some(x) => x,
24883 None => return std::result::Result::Err("Missing value while parsing PluginInterfaceType".to_string())
24884 };
24885
24886 if let Some(key) = key_result {
24887 #[allow(clippy::match_single_binding)]
24888 match key {
24889 #[allow(clippy::redundant_clone)]
24890 "Capability" => intermediate_rep.capability.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24891 #[allow(clippy::redundant_clone)]
24892 "Prefix" => intermediate_rep.prefix.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24893 #[allow(clippy::redundant_clone)]
24894 "Version" => intermediate_rep.version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
24895 _ => return std::result::Result::Err("Unexpected key while parsing PluginInterfaceType".to_string())
24896 }
24897 }
24898
24899 key_result = string_iter.next();
24901 }
24902
24903 std::result::Result::Ok(PluginInterfaceType {
24905 capability: intermediate_rep.capability.into_iter().next().ok_or_else(|| "Capability missing in PluginInterfaceType".to_string())?,
24906 prefix: intermediate_rep.prefix.into_iter().next().ok_or_else(|| "Prefix missing in PluginInterfaceType".to_string())?,
24907 version: intermediate_rep.version.into_iter().next().ok_or_else(|| "Version missing in PluginInterfaceType".to_string())?,
24908 })
24909 }
24910}
24911
24912#[cfg(feature = "server")]
24915impl std::convert::TryFrom<header::IntoHeaderValue<PluginInterfaceType>> for HeaderValue {
24916 type Error = String;
24917
24918 fn try_from(hdr_value: header::IntoHeaderValue<PluginInterfaceType>) -> std::result::Result<Self, Self::Error> {
24919 let hdr_value = hdr_value.to_string();
24920 match HeaderValue::from_str(&hdr_value) {
24921 std::result::Result::Ok(value) => std::result::Result::Ok(value),
24922 std::result::Result::Err(e) => std::result::Result::Err(
24923 format!("Invalid header value for PluginInterfaceType - value: {} is invalid {}",
24924 hdr_value, e))
24925 }
24926 }
24927}
24928
24929#[cfg(feature = "server")]
24930impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginInterfaceType> {
24931 type Error = String;
24932
24933 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
24934 match hdr_value.to_str() {
24935 std::result::Result::Ok(value) => {
24936 match <PluginInterfaceType as std::str::FromStr>::from_str(value) {
24937 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
24938 std::result::Result::Err(err) => std::result::Result::Err(
24939 format!("Unable to convert header value '{}' into PluginInterfaceType - {}",
24940 value, err))
24941 }
24942 },
24943 std::result::Result::Err(e) => std::result::Result::Err(
24944 format!("Unable to convert header: {:?} to string: {}",
24945 hdr_value, e))
24946 }
24947 }
24948}
24949
24950
24951
24952
24953#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
24958#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
24959pub struct PluginMount {
24960#[serde(rename = "Description")]
24962 pub description: String,
24963
24964#[serde(rename = "Destination")]
24966 pub destination: String,
24967
24968#[serde(rename = "Name")]
24970 pub name: String,
24971
24972#[serde(rename = "Options")]
24974 pub options: Vec<String>,
24975
24976#[serde(rename = "Settable")]
24978 pub settable: Vec<String>,
24979
24980#[serde(rename = "Source")]
24982 pub source: String,
24983
24984#[serde(rename = "Type")]
24986 pub r#type: String,
24987
24988}
24989
24990
24991impl PluginMount {
24992 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
24993 pub fn new(description: String, destination: String, name: String, options: Vec<String>, settable: Vec<String>, source: String, r#type: String, ) -> PluginMount {
24994 PluginMount {
24995 description,
24996 destination,
24997 name,
24998 options,
24999 settable,
25000 source,
25001 r#type,
25002 }
25003 }
25004}
25005
25006impl std::string::ToString for PluginMount {
25010 fn to_string(&self) -> String {
25011 let params: Vec<Option<String>> = vec![
25012
25013 Some("Description".to_string()),
25014 Some(self.description.to_string()),
25015
25016
25017 Some("Destination".to_string()),
25018 Some(self.destination.to_string()),
25019
25020
25021 Some("Name".to_string()),
25022 Some(self.name.to_string()),
25023
25024
25025 Some("Options".to_string()),
25026 Some(self.options.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
25027
25028
25029 Some("Settable".to_string()),
25030 Some(self.settable.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
25031
25032
25033 Some("Source".to_string()),
25034 Some(self.source.to_string()),
25035
25036
25037 Some("Type".to_string()),
25038 Some(self.r#type.to_string()),
25039
25040 ];
25041
25042 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25043 }
25044}
25045
25046impl std::str::FromStr for PluginMount {
25050 type Err = String;
25051
25052 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25053 #[derive(Default)]
25055 #[allow(dead_code)]
25056 struct IntermediateRep {
25057 pub description: Vec<String>,
25058 pub destination: Vec<String>,
25059 pub name: Vec<String>,
25060 pub options: Vec<Vec<String>>,
25061 pub settable: Vec<Vec<String>>,
25062 pub source: Vec<String>,
25063 pub r#type: Vec<String>,
25064 }
25065
25066 let mut intermediate_rep = IntermediateRep::default();
25067
25068 let mut string_iter = s.split(',');
25070 let mut key_result = string_iter.next();
25071
25072 while key_result.is_some() {
25073 let val = match string_iter.next() {
25074 Some(x) => x,
25075 None => return std::result::Result::Err("Missing value while parsing PluginMount".to_string())
25076 };
25077
25078 if let Some(key) = key_result {
25079 #[allow(clippy::match_single_binding)]
25080 match key {
25081 #[allow(clippy::redundant_clone)]
25082 "Description" => intermediate_rep.description.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25083 #[allow(clippy::redundant_clone)]
25084 "Destination" => intermediate_rep.destination.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25085 #[allow(clippy::redundant_clone)]
25086 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25087 "Options" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginMount".to_string()),
25088 "Settable" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginMount".to_string()),
25089 #[allow(clippy::redundant_clone)]
25090 "Source" => intermediate_rep.source.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25091 #[allow(clippy::redundant_clone)]
25092 "Type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25093 _ => return std::result::Result::Err("Unexpected key while parsing PluginMount".to_string())
25094 }
25095 }
25096
25097 key_result = string_iter.next();
25099 }
25100
25101 std::result::Result::Ok(PluginMount {
25103 description: intermediate_rep.description.into_iter().next().ok_or_else(|| "Description missing in PluginMount".to_string())?,
25104 destination: intermediate_rep.destination.into_iter().next().ok_or_else(|| "Destination missing in PluginMount".to_string())?,
25105 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in PluginMount".to_string())?,
25106 options: intermediate_rep.options.into_iter().next().ok_or_else(|| "Options missing in PluginMount".to_string())?,
25107 settable: intermediate_rep.settable.into_iter().next().ok_or_else(|| "Settable missing in PluginMount".to_string())?,
25108 source: intermediate_rep.source.into_iter().next().ok_or_else(|| "Source missing in PluginMount".to_string())?,
25109 r#type: intermediate_rep.r#type.into_iter().next().ok_or_else(|| "Type missing in PluginMount".to_string())?,
25110 })
25111 }
25112}
25113
25114#[cfg(feature = "server")]
25117impl std::convert::TryFrom<header::IntoHeaderValue<PluginMount>> for HeaderValue {
25118 type Error = String;
25119
25120 fn try_from(hdr_value: header::IntoHeaderValue<PluginMount>) -> std::result::Result<Self, Self::Error> {
25121 let hdr_value = hdr_value.to_string();
25122 match HeaderValue::from_str(&hdr_value) {
25123 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25124 std::result::Result::Err(e) => std::result::Result::Err(
25125 format!("Invalid header value for PluginMount - value: {} is invalid {}",
25126 hdr_value, e))
25127 }
25128 }
25129}
25130
25131#[cfg(feature = "server")]
25132impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginMount> {
25133 type Error = String;
25134
25135 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25136 match hdr_value.to_str() {
25137 std::result::Result::Ok(value) => {
25138 match <PluginMount as std::str::FromStr>::from_str(value) {
25139 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25140 std::result::Result::Err(err) => std::result::Result::Err(
25141 format!("Unable to convert header value '{}' into PluginMount - {}",
25142 value, err))
25143 }
25144 },
25145 std::result::Result::Err(e) => std::result::Result::Err(
25146 format!("Unable to convert header: {:?} to string: {}",
25147 hdr_value, e))
25148 }
25149 }
25150}
25151
25152
25153
25154
25155
25156
25157
25158#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25159#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25160pub struct PluginSettings {
25161#[serde(rename = "Args")]
25163 pub args: Vec<String>,
25164
25165#[serde(rename = "Devices")]
25167 pub devices: Vec<models::PluginDevice>,
25168
25169#[serde(rename = "Env")]
25171 pub env: Vec<String>,
25172
25173#[serde(rename = "Mounts")]
25175 pub mounts: Vec<models::PluginMount>,
25176
25177}
25178
25179
25180impl PluginSettings {
25181 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25182 pub fn new(args: Vec<String>, devices: Vec<models::PluginDevice>, env: Vec<String>, mounts: Vec<models::PluginMount>, ) -> PluginSettings {
25183 PluginSettings {
25184 args,
25185 devices,
25186 env,
25187 mounts,
25188 }
25189 }
25190}
25191
25192impl std::string::ToString for PluginSettings {
25196 fn to_string(&self) -> String {
25197 let params: Vec<Option<String>> = vec![
25198
25199 Some("Args".to_string()),
25200 Some(self.args.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
25201
25202 Some("Env".to_string()),
25206 Some(self.env.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
25207
25208 ];
25211
25212 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25213 }
25214}
25215
25216impl std::str::FromStr for PluginSettings {
25220 type Err = String;
25221
25222 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25223 #[derive(Default)]
25225 #[allow(dead_code)]
25226 struct IntermediateRep {
25227 pub args: Vec<Vec<String>>,
25228 pub devices: Vec<Vec<models::PluginDevice>>,
25229 pub env: Vec<Vec<String>>,
25230 pub mounts: Vec<Vec<models::PluginMount>>,
25231 }
25232
25233 let mut intermediate_rep = IntermediateRep::default();
25234
25235 let mut string_iter = s.split(',');
25237 let mut key_result = string_iter.next();
25238
25239 while key_result.is_some() {
25240 let val = match string_iter.next() {
25241 Some(x) => x,
25242 None => return std::result::Result::Err("Missing value while parsing PluginSettings".to_string())
25243 };
25244
25245 if let Some(key) = key_result {
25246 #[allow(clippy::match_single_binding)]
25247 match key {
25248 "Args" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginSettings".to_string()),
25249 "Devices" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginSettings".to_string()),
25250 "Env" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginSettings".to_string()),
25251 "Mounts" => return std::result::Result::Err("Parsing a container in this style is not supported in PluginSettings".to_string()),
25252 _ => return std::result::Result::Err("Unexpected key while parsing PluginSettings".to_string())
25253 }
25254 }
25255
25256 key_result = string_iter.next();
25258 }
25259
25260 std::result::Result::Ok(PluginSettings {
25262 args: intermediate_rep.args.into_iter().next().ok_or_else(|| "Args missing in PluginSettings".to_string())?,
25263 devices: intermediate_rep.devices.into_iter().next().ok_or_else(|| "Devices missing in PluginSettings".to_string())?,
25264 env: intermediate_rep.env.into_iter().next().ok_or_else(|| "Env missing in PluginSettings".to_string())?,
25265 mounts: intermediate_rep.mounts.into_iter().next().ok_or_else(|| "Mounts missing in PluginSettings".to_string())?,
25266 })
25267 }
25268}
25269
25270#[cfg(feature = "server")]
25273impl std::convert::TryFrom<header::IntoHeaderValue<PluginSettings>> for HeaderValue {
25274 type Error = String;
25275
25276 fn try_from(hdr_value: header::IntoHeaderValue<PluginSettings>) -> std::result::Result<Self, Self::Error> {
25277 let hdr_value = hdr_value.to_string();
25278 match HeaderValue::from_str(&hdr_value) {
25279 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25280 std::result::Result::Err(e) => std::result::Result::Err(
25281 format!("Invalid header value for PluginSettings - value: {} is invalid {}",
25282 hdr_value, e))
25283 }
25284 }
25285}
25286
25287#[cfg(feature = "server")]
25288impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PluginSettings> {
25289 type Error = String;
25290
25291 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25292 match hdr_value.to_str() {
25293 std::result::Result::Ok(value) => {
25294 match <PluginSettings as std::str::FromStr>::from_str(value) {
25295 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25296 std::result::Result::Err(err) => std::result::Result::Err(
25297 format!("Unable to convert header value '{}' into PluginSettings - {}",
25298 value, err))
25299 }
25300 },
25301 std::result::Result::Err(e) => std::result::Result::Err(
25302 format!("Unable to convert header: {:?} to string: {}",
25303 hdr_value, e))
25304 }
25305 }
25306}
25307
25308
25309
25310
25311
25312
25313
25314#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25315#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25316pub struct PodAffinity {
25317#[serde(rename = "preferredDuringSchedulingIgnoredDuringExecution")]
25319 #[serde(skip_serializing_if="Option::is_none")]
25320 pub preferred_during_scheduling_ignored_during_execution: Option<Vec<models::WeightedPodAffinityTerm>>,
25321
25322#[serde(rename = "requiredDuringSchedulingIgnoredDuringExecution")]
25324 #[serde(skip_serializing_if="Option::is_none")]
25325 pub required_during_scheduling_ignored_during_execution: Option<Vec<models::PodAffinityTerm>>,
25326
25327}
25328
25329
25330impl PodAffinity {
25331 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25332 pub fn new() -> PodAffinity {
25333 PodAffinity {
25334 preferred_during_scheduling_ignored_during_execution: None,
25335 required_during_scheduling_ignored_during_execution: None,
25336 }
25337 }
25338}
25339
25340impl std::string::ToString for PodAffinity {
25344 fn to_string(&self) -> String {
25345 let params: Vec<Option<String>> = vec![
25346 ];
25351
25352 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25353 }
25354}
25355
25356impl std::str::FromStr for PodAffinity {
25360 type Err = String;
25361
25362 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25363 #[derive(Default)]
25365 #[allow(dead_code)]
25366 struct IntermediateRep {
25367 pub preferred_during_scheduling_ignored_during_execution: Vec<Vec<models::WeightedPodAffinityTerm>>,
25368 pub required_during_scheduling_ignored_during_execution: Vec<Vec<models::PodAffinityTerm>>,
25369 }
25370
25371 let mut intermediate_rep = IntermediateRep::default();
25372
25373 let mut string_iter = s.split(',');
25375 let mut key_result = string_iter.next();
25376
25377 while key_result.is_some() {
25378 let val = match string_iter.next() {
25379 Some(x) => x,
25380 None => return std::result::Result::Err("Missing value while parsing PodAffinity".to_string())
25381 };
25382
25383 if let Some(key) = key_result {
25384 #[allow(clippy::match_single_binding)]
25385 match key {
25386 "preferredDuringSchedulingIgnoredDuringExecution" => return std::result::Result::Err("Parsing a container in this style is not supported in PodAffinity".to_string()),
25387 "requiredDuringSchedulingIgnoredDuringExecution" => return std::result::Result::Err("Parsing a container in this style is not supported in PodAffinity".to_string()),
25388 _ => return std::result::Result::Err("Unexpected key while parsing PodAffinity".to_string())
25389 }
25390 }
25391
25392 key_result = string_iter.next();
25394 }
25395
25396 std::result::Result::Ok(PodAffinity {
25398 preferred_during_scheduling_ignored_during_execution: intermediate_rep.preferred_during_scheduling_ignored_during_execution.into_iter().next(),
25399 required_during_scheduling_ignored_during_execution: intermediate_rep.required_during_scheduling_ignored_during_execution.into_iter().next(),
25400 })
25401 }
25402}
25403
25404#[cfg(feature = "server")]
25407impl std::convert::TryFrom<header::IntoHeaderValue<PodAffinity>> for HeaderValue {
25408 type Error = String;
25409
25410 fn try_from(hdr_value: header::IntoHeaderValue<PodAffinity>) -> std::result::Result<Self, Self::Error> {
25411 let hdr_value = hdr_value.to_string();
25412 match HeaderValue::from_str(&hdr_value) {
25413 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25414 std::result::Result::Err(e) => std::result::Result::Err(
25415 format!("Invalid header value for PodAffinity - value: {} is invalid {}",
25416 hdr_value, e))
25417 }
25418 }
25419}
25420
25421#[cfg(feature = "server")]
25422impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodAffinity> {
25423 type Error = String;
25424
25425 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25426 match hdr_value.to_str() {
25427 std::result::Result::Ok(value) => {
25428 match <PodAffinity as std::str::FromStr>::from_str(value) {
25429 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25430 std::result::Result::Err(err) => std::result::Result::Err(
25431 format!("Unable to convert header value '{}' into PodAffinity - {}",
25432 value, err))
25433 }
25434 },
25435 std::result::Result::Err(e) => std::result::Result::Err(
25436 format!("Unable to convert header: {:?} to string: {}",
25437 hdr_value, e))
25438 }
25439 }
25440}
25441
25442
25443
25444
25445#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25450#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25451pub struct PodAffinityTerm {
25452 #[serde(rename = "labelSelector")]
25453 #[serde(skip_serializing_if="Option::is_none")]
25454 pub label_selector: Option<models::LabelSelector>,
25455
25456 #[serde(rename = "namespaceSelector")]
25457 #[serde(skip_serializing_if="Option::is_none")]
25458 pub namespace_selector: Option<models::LabelSelector>,
25459
25460#[serde(rename = "namespaces")]
25462 #[serde(skip_serializing_if="Option::is_none")]
25463 pub namespaces: Option<Vec<String>>,
25464
25465#[serde(rename = "topologyKey")]
25467 #[serde(skip_serializing_if="Option::is_none")]
25468 pub topology_key: Option<String>,
25469
25470}
25471
25472
25473impl PodAffinityTerm {
25474 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25475 pub fn new() -> PodAffinityTerm {
25476 PodAffinityTerm {
25477 label_selector: None,
25478 namespace_selector: None,
25479 namespaces: None,
25480 topology_key: None,
25481 }
25482 }
25483}
25484
25485impl std::string::ToString for PodAffinityTerm {
25489 fn to_string(&self) -> String {
25490 let params: Vec<Option<String>> = vec![
25491 self.namespaces.as_ref().map(|namespaces| {
25497 [
25498 "namespaces".to_string(),
25499 namespaces.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
25500 ].join(",")
25501 }),
25502
25503
25504 self.topology_key.as_ref().map(|topology_key| {
25505 [
25506 "topologyKey".to_string(),
25507 topology_key.to_string(),
25508 ].join(",")
25509 }),
25510
25511 ];
25512
25513 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25514 }
25515}
25516
25517impl std::str::FromStr for PodAffinityTerm {
25521 type Err = String;
25522
25523 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25524 #[derive(Default)]
25526 #[allow(dead_code)]
25527 struct IntermediateRep {
25528 pub label_selector: Vec<models::LabelSelector>,
25529 pub namespace_selector: Vec<models::LabelSelector>,
25530 pub namespaces: Vec<Vec<String>>,
25531 pub topology_key: Vec<String>,
25532 }
25533
25534 let mut intermediate_rep = IntermediateRep::default();
25535
25536 let mut string_iter = s.split(',');
25538 let mut key_result = string_iter.next();
25539
25540 while key_result.is_some() {
25541 let val = match string_iter.next() {
25542 Some(x) => x,
25543 None => return std::result::Result::Err("Missing value while parsing PodAffinityTerm".to_string())
25544 };
25545
25546 if let Some(key) = key_result {
25547 #[allow(clippy::match_single_binding)]
25548 match key {
25549 #[allow(clippy::redundant_clone)]
25550 "labelSelector" => intermediate_rep.label_selector.push(<models::LabelSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25551 #[allow(clippy::redundant_clone)]
25552 "namespaceSelector" => intermediate_rep.namespace_selector.push(<models::LabelSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25553 "namespaces" => return std::result::Result::Err("Parsing a container in this style is not supported in PodAffinityTerm".to_string()),
25554 #[allow(clippy::redundant_clone)]
25555 "topologyKey" => intermediate_rep.topology_key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
25556 _ => return std::result::Result::Err("Unexpected key while parsing PodAffinityTerm".to_string())
25557 }
25558 }
25559
25560 key_result = string_iter.next();
25562 }
25563
25564 std::result::Result::Ok(PodAffinityTerm {
25566 label_selector: intermediate_rep.label_selector.into_iter().next(),
25567 namespace_selector: intermediate_rep.namespace_selector.into_iter().next(),
25568 namespaces: intermediate_rep.namespaces.into_iter().next(),
25569 topology_key: intermediate_rep.topology_key.into_iter().next(),
25570 })
25571 }
25572}
25573
25574#[cfg(feature = "server")]
25577impl std::convert::TryFrom<header::IntoHeaderValue<PodAffinityTerm>> for HeaderValue {
25578 type Error = String;
25579
25580 fn try_from(hdr_value: header::IntoHeaderValue<PodAffinityTerm>) -> std::result::Result<Self, Self::Error> {
25581 let hdr_value = hdr_value.to_string();
25582 match HeaderValue::from_str(&hdr_value) {
25583 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25584 std::result::Result::Err(e) => std::result::Result::Err(
25585 format!("Invalid header value for PodAffinityTerm - value: {} is invalid {}",
25586 hdr_value, e))
25587 }
25588 }
25589}
25590
25591#[cfg(feature = "server")]
25592impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodAffinityTerm> {
25593 type Error = String;
25594
25595 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25596 match hdr_value.to_str() {
25597 std::result::Result::Ok(value) => {
25598 match <PodAffinityTerm as std::str::FromStr>::from_str(value) {
25599 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25600 std::result::Result::Err(err) => std::result::Result::Err(
25601 format!("Unable to convert header value '{}' into PodAffinityTerm - {}",
25602 value, err))
25603 }
25604 },
25605 std::result::Result::Err(e) => std::result::Result::Err(
25606 format!("Unable to convert header: {:?} to string: {}",
25607 hdr_value, e))
25608 }
25609 }
25610}
25611
25612
25613
25614
25615
25616
25617
25618#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25619#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25620pub struct PodAntiAffinity {
25621#[serde(rename = "preferredDuringSchedulingIgnoredDuringExecution")]
25623 #[serde(skip_serializing_if="Option::is_none")]
25624 pub preferred_during_scheduling_ignored_during_execution: Option<Vec<models::WeightedPodAffinityTerm>>,
25625
25626#[serde(rename = "requiredDuringSchedulingIgnoredDuringExecution")]
25628 #[serde(skip_serializing_if="Option::is_none")]
25629 pub required_during_scheduling_ignored_during_execution: Option<Vec<models::PodAffinityTerm>>,
25630
25631}
25632
25633
25634impl PodAntiAffinity {
25635 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25636 pub fn new() -> PodAntiAffinity {
25637 PodAntiAffinity {
25638 preferred_during_scheduling_ignored_during_execution: None,
25639 required_during_scheduling_ignored_during_execution: None,
25640 }
25641 }
25642}
25643
25644impl std::string::ToString for PodAntiAffinity {
25648 fn to_string(&self) -> String {
25649 let params: Vec<Option<String>> = vec![
25650 ];
25655
25656 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25657 }
25658}
25659
25660impl std::str::FromStr for PodAntiAffinity {
25664 type Err = String;
25665
25666 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25667 #[derive(Default)]
25669 #[allow(dead_code)]
25670 struct IntermediateRep {
25671 pub preferred_during_scheduling_ignored_during_execution: Vec<Vec<models::WeightedPodAffinityTerm>>,
25672 pub required_during_scheduling_ignored_during_execution: Vec<Vec<models::PodAffinityTerm>>,
25673 }
25674
25675 let mut intermediate_rep = IntermediateRep::default();
25676
25677 let mut string_iter = s.split(',');
25679 let mut key_result = string_iter.next();
25680
25681 while key_result.is_some() {
25682 let val = match string_iter.next() {
25683 Some(x) => x,
25684 None => return std::result::Result::Err("Missing value while parsing PodAntiAffinity".to_string())
25685 };
25686
25687 if let Some(key) = key_result {
25688 #[allow(clippy::match_single_binding)]
25689 match key {
25690 "preferredDuringSchedulingIgnoredDuringExecution" => return std::result::Result::Err("Parsing a container in this style is not supported in PodAntiAffinity".to_string()),
25691 "requiredDuringSchedulingIgnoredDuringExecution" => return std::result::Result::Err("Parsing a container in this style is not supported in PodAntiAffinity".to_string()),
25692 _ => return std::result::Result::Err("Unexpected key while parsing PodAntiAffinity".to_string())
25693 }
25694 }
25695
25696 key_result = string_iter.next();
25698 }
25699
25700 std::result::Result::Ok(PodAntiAffinity {
25702 preferred_during_scheduling_ignored_during_execution: intermediate_rep.preferred_during_scheduling_ignored_during_execution.into_iter().next(),
25703 required_during_scheduling_ignored_during_execution: intermediate_rep.required_during_scheduling_ignored_during_execution.into_iter().next(),
25704 })
25705 }
25706}
25707
25708#[cfg(feature = "server")]
25711impl std::convert::TryFrom<header::IntoHeaderValue<PodAntiAffinity>> for HeaderValue {
25712 type Error = String;
25713
25714 fn try_from(hdr_value: header::IntoHeaderValue<PodAntiAffinity>) -> std::result::Result<Self, Self::Error> {
25715 let hdr_value = hdr_value.to_string();
25716 match HeaderValue::from_str(&hdr_value) {
25717 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25718 std::result::Result::Err(e) => std::result::Result::Err(
25719 format!("Invalid header value for PodAntiAffinity - value: {} is invalid {}",
25720 hdr_value, e))
25721 }
25722 }
25723}
25724
25725#[cfg(feature = "server")]
25726impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodAntiAffinity> {
25727 type Error = String;
25728
25729 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25730 match hdr_value.to_str() {
25731 std::result::Result::Ok(value) => {
25732 match <PodAntiAffinity as std::str::FromStr>::from_str(value) {
25733 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25734 std::result::Result::Err(err) => std::result::Result::Err(
25735 format!("Unable to convert header value '{}' into PodAntiAffinity - {}",
25736 value, err))
25737 }
25738 },
25739 std::result::Result::Err(e) => std::result::Result::Err(
25740 format!("Unable to convert header: {:?} to string: {}",
25741 hdr_value, e))
25742 }
25743 }
25744}
25745
25746
25747
25748
25749#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
25751#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25752pub struct PodConditionType(String);
25753
25754impl validator::Validate for PodConditionType {
25755 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
25756 std::result::Result::Ok(())
25757 }
25758}
25759
25760impl std::convert::From<String> for PodConditionType {
25761 fn from(x: String) -> Self {
25762 PodConditionType(x)
25763 }
25764}
25765
25766impl std::string::ToString for PodConditionType {
25767 fn to_string(&self) -> String {
25768 self.0.to_string()
25769 }
25770}
25771
25772impl std::str::FromStr for PodConditionType {
25773 type Err = std::string::ParseError;
25774 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
25775 std::result::Result::Ok(PodConditionType(x.to_string()))
25776 }
25777}
25778
25779impl std::convert::From<PodConditionType> for String {
25780 fn from(x: PodConditionType) -> Self {
25781 x.0
25782 }
25783}
25784
25785impl std::ops::Deref for PodConditionType {
25786 type Target = String;
25787 fn deref(&self) -> &String {
25788 &self.0
25789 }
25790}
25791
25792impl std::ops::DerefMut for PodConditionType {
25793 fn deref_mut(&mut self) -> &mut String {
25794 &mut self.0
25795 }
25796}
25797
25798
25799
25800#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25805#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25806pub struct PodDnsConfig {
25807#[serde(rename = "nameservers")]
25809 #[serde(skip_serializing_if="Option::is_none")]
25810 pub nameservers: Option<Vec<String>>,
25811
25812#[serde(rename = "options")]
25814 #[serde(skip_serializing_if="Option::is_none")]
25815 pub options: Option<Vec<models::PodDnsConfigOption>>,
25816
25817#[serde(rename = "searches")]
25819 #[serde(skip_serializing_if="Option::is_none")]
25820 pub searches: Option<Vec<String>>,
25821
25822}
25823
25824
25825impl PodDnsConfig {
25826 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25827 pub fn new() -> PodDnsConfig {
25828 PodDnsConfig {
25829 nameservers: None,
25830 options: None,
25831 searches: None,
25832 }
25833 }
25834}
25835
25836impl std::string::ToString for PodDnsConfig {
25840 fn to_string(&self) -> String {
25841 let params: Vec<Option<String>> = vec![
25842
25843 self.nameservers.as_ref().map(|nameservers| {
25844 [
25845 "nameservers".to_string(),
25846 nameservers.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
25847 ].join(",")
25848 }),
25849
25850 self.searches.as_ref().map(|searches| {
25854 [
25855 "searches".to_string(),
25856 searches.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
25857 ].join(",")
25858 }),
25859
25860 ];
25861
25862 params.into_iter().flatten().collect::<Vec<_>>().join(",")
25863 }
25864}
25865
25866impl std::str::FromStr for PodDnsConfig {
25870 type Err = String;
25871
25872 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
25873 #[derive(Default)]
25875 #[allow(dead_code)]
25876 struct IntermediateRep {
25877 pub nameservers: Vec<Vec<String>>,
25878 pub options: Vec<Vec<models::PodDnsConfigOption>>,
25879 pub searches: Vec<Vec<String>>,
25880 }
25881
25882 let mut intermediate_rep = IntermediateRep::default();
25883
25884 let mut string_iter = s.split(',');
25886 let mut key_result = string_iter.next();
25887
25888 while key_result.is_some() {
25889 let val = match string_iter.next() {
25890 Some(x) => x,
25891 None => return std::result::Result::Err("Missing value while parsing PodDnsConfig".to_string())
25892 };
25893
25894 if let Some(key) = key_result {
25895 #[allow(clippy::match_single_binding)]
25896 match key {
25897 "nameservers" => return std::result::Result::Err("Parsing a container in this style is not supported in PodDnsConfig".to_string()),
25898 "options" => return std::result::Result::Err("Parsing a container in this style is not supported in PodDnsConfig".to_string()),
25899 "searches" => return std::result::Result::Err("Parsing a container in this style is not supported in PodDnsConfig".to_string()),
25900 _ => return std::result::Result::Err("Unexpected key while parsing PodDnsConfig".to_string())
25901 }
25902 }
25903
25904 key_result = string_iter.next();
25906 }
25907
25908 std::result::Result::Ok(PodDnsConfig {
25910 nameservers: intermediate_rep.nameservers.into_iter().next(),
25911 options: intermediate_rep.options.into_iter().next(),
25912 searches: intermediate_rep.searches.into_iter().next(),
25913 })
25914 }
25915}
25916
25917#[cfg(feature = "server")]
25920impl std::convert::TryFrom<header::IntoHeaderValue<PodDnsConfig>> for HeaderValue {
25921 type Error = String;
25922
25923 fn try_from(hdr_value: header::IntoHeaderValue<PodDnsConfig>) -> std::result::Result<Self, Self::Error> {
25924 let hdr_value = hdr_value.to_string();
25925 match HeaderValue::from_str(&hdr_value) {
25926 std::result::Result::Ok(value) => std::result::Result::Ok(value),
25927 std::result::Result::Err(e) => std::result::Result::Err(
25928 format!("Invalid header value for PodDnsConfig - value: {} is invalid {}",
25929 hdr_value, e))
25930 }
25931 }
25932}
25933
25934#[cfg(feature = "server")]
25935impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodDnsConfig> {
25936 type Error = String;
25937
25938 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
25939 match hdr_value.to_str() {
25940 std::result::Result::Ok(value) => {
25941 match <PodDnsConfig as std::str::FromStr>::from_str(value) {
25942 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
25943 std::result::Result::Err(err) => std::result::Result::Err(
25944 format!("Unable to convert header value '{}' into PodDnsConfig - {}",
25945 value, err))
25946 }
25947 },
25948 std::result::Result::Err(e) => std::result::Result::Err(
25949 format!("Unable to convert header: {:?} to string: {}",
25950 hdr_value, e))
25951 }
25952 }
25953}
25954
25955
25956
25957
25958
25959
25960
25961#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
25962#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
25963pub struct PodDnsConfigOption {
25964#[serde(rename = "name")]
25966 #[serde(skip_serializing_if="Option::is_none")]
25967 pub name: Option<String>,
25968
25969#[serde(rename = "value")]
25971 #[serde(skip_serializing_if="Option::is_none")]
25972 pub value: Option<String>,
25973
25974}
25975
25976
25977impl PodDnsConfigOption {
25978 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
25979 pub fn new() -> PodDnsConfigOption {
25980 PodDnsConfigOption {
25981 name: None,
25982 value: None,
25983 }
25984 }
25985}
25986
25987impl std::string::ToString for PodDnsConfigOption {
25991 fn to_string(&self) -> String {
25992 let params: Vec<Option<String>> = vec![
25993
25994 self.name.as_ref().map(|name| {
25995 [
25996 "name".to_string(),
25997 name.to_string(),
25998 ].join(",")
25999 }),
26000
26001
26002 self.value.as_ref().map(|value| {
26003 [
26004 "value".to_string(),
26005 value.to_string(),
26006 ].join(",")
26007 }),
26008
26009 ];
26010
26011 params.into_iter().flatten().collect::<Vec<_>>().join(",")
26012 }
26013}
26014
26015impl std::str::FromStr for PodDnsConfigOption {
26019 type Err = String;
26020
26021 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
26022 #[derive(Default)]
26024 #[allow(dead_code)]
26025 struct IntermediateRep {
26026 pub name: Vec<String>,
26027 pub value: Vec<String>,
26028 }
26029
26030 let mut intermediate_rep = IntermediateRep::default();
26031
26032 let mut string_iter = s.split(',');
26034 let mut key_result = string_iter.next();
26035
26036 while key_result.is_some() {
26037 let val = match string_iter.next() {
26038 Some(x) => x,
26039 None => return std::result::Result::Err("Missing value while parsing PodDnsConfigOption".to_string())
26040 };
26041
26042 if let Some(key) = key_result {
26043 #[allow(clippy::match_single_binding)]
26044 match key {
26045 #[allow(clippy::redundant_clone)]
26046 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26047 #[allow(clippy::redundant_clone)]
26048 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26049 _ => return std::result::Result::Err("Unexpected key while parsing PodDnsConfigOption".to_string())
26050 }
26051 }
26052
26053 key_result = string_iter.next();
26055 }
26056
26057 std::result::Result::Ok(PodDnsConfigOption {
26059 name: intermediate_rep.name.into_iter().next(),
26060 value: intermediate_rep.value.into_iter().next(),
26061 })
26062 }
26063}
26064
26065#[cfg(feature = "server")]
26068impl std::convert::TryFrom<header::IntoHeaderValue<PodDnsConfigOption>> for HeaderValue {
26069 type Error = String;
26070
26071 fn try_from(hdr_value: header::IntoHeaderValue<PodDnsConfigOption>) -> std::result::Result<Self, Self::Error> {
26072 let hdr_value = hdr_value.to_string();
26073 match HeaderValue::from_str(&hdr_value) {
26074 std::result::Result::Ok(value) => std::result::Result::Ok(value),
26075 std::result::Result::Err(e) => std::result::Result::Err(
26076 format!("Invalid header value for PodDnsConfigOption - value: {} is invalid {}",
26077 hdr_value, e))
26078 }
26079 }
26080}
26081
26082#[cfg(feature = "server")]
26083impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodDnsConfigOption> {
26084 type Error = String;
26085
26086 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
26087 match hdr_value.to_str() {
26088 std::result::Result::Ok(value) => {
26089 match <PodDnsConfigOption as std::str::FromStr>::from_str(value) {
26090 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
26091 std::result::Result::Err(err) => std::result::Result::Err(
26092 format!("Unable to convert header value '{}' into PodDnsConfigOption - {}",
26093 value, err))
26094 }
26095 },
26096 std::result::Result::Err(e) => std::result::Result::Err(
26097 format!("Unable to convert header: {:?} to string: {}",
26098 hdr_value, e))
26099 }
26100 }
26101}
26102
26103
26104
26105
26106#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
26108#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
26109pub struct PodFsGroupChangePolicy(String);
26110
26111impl validator::Validate for PodFsGroupChangePolicy {
26112 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
26113 std::result::Result::Ok(())
26114 }
26115}
26116
26117impl std::convert::From<String> for PodFsGroupChangePolicy {
26118 fn from(x: String) -> Self {
26119 PodFsGroupChangePolicy(x)
26120 }
26121}
26122
26123impl std::string::ToString for PodFsGroupChangePolicy {
26124 fn to_string(&self) -> String {
26125 self.0.to_string()
26126 }
26127}
26128
26129impl std::str::FromStr for PodFsGroupChangePolicy {
26130 type Err = std::string::ParseError;
26131 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
26132 std::result::Result::Ok(PodFsGroupChangePolicy(x.to_string()))
26133 }
26134}
26135
26136impl std::convert::From<PodFsGroupChangePolicy> for String {
26137 fn from(x: PodFsGroupChangePolicy) -> Self {
26138 x.0
26139 }
26140}
26141
26142impl std::ops::Deref for PodFsGroupChangePolicy {
26143 type Target = String;
26144 fn deref(&self) -> &String {
26145 &self.0
26146 }
26147}
26148
26149impl std::ops::DerefMut for PodFsGroupChangePolicy {
26150 fn deref_mut(&mut self) -> &mut String {
26151 &mut self.0
26152 }
26153}
26154
26155
26156
26157
26158
26159
26160#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
26161#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
26162pub struct PodOs {
26163 #[serde(rename = "name")]
26164 #[serde(skip_serializing_if="Option::is_none")]
26165 pub name: Option<String>,
26166
26167}
26168
26169
26170impl PodOs {
26171 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
26172 pub fn new() -> PodOs {
26173 PodOs {
26174 name: None,
26175 }
26176 }
26177}
26178
26179impl std::string::ToString for PodOs {
26183 fn to_string(&self) -> String {
26184 let params: Vec<Option<String>> = vec![
26185
26186 self.name.as_ref().map(|name| {
26187 [
26188 "name".to_string(),
26189 name.to_string(),
26190 ].join(",")
26191 }),
26192
26193 ];
26194
26195 params.into_iter().flatten().collect::<Vec<_>>().join(",")
26196 }
26197}
26198
26199impl std::str::FromStr for PodOs {
26203 type Err = String;
26204
26205 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
26206 #[derive(Default)]
26208 #[allow(dead_code)]
26209 struct IntermediateRep {
26210 pub name: Vec<String>,
26211 }
26212
26213 let mut intermediate_rep = IntermediateRep::default();
26214
26215 let mut string_iter = s.split(',');
26217 let mut key_result = string_iter.next();
26218
26219 while key_result.is_some() {
26220 let val = match string_iter.next() {
26221 Some(x) => x,
26222 None => return std::result::Result::Err("Missing value while parsing PodOs".to_string())
26223 };
26224
26225 if let Some(key) = key_result {
26226 #[allow(clippy::match_single_binding)]
26227 match key {
26228 #[allow(clippy::redundant_clone)]
26229 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26230 _ => return std::result::Result::Err("Unexpected key while parsing PodOs".to_string())
26231 }
26232 }
26233
26234 key_result = string_iter.next();
26236 }
26237
26238 std::result::Result::Ok(PodOs {
26240 name: intermediate_rep.name.into_iter().next(),
26241 })
26242 }
26243}
26244
26245#[cfg(feature = "server")]
26248impl std::convert::TryFrom<header::IntoHeaderValue<PodOs>> for HeaderValue {
26249 type Error = String;
26250
26251 fn try_from(hdr_value: header::IntoHeaderValue<PodOs>) -> std::result::Result<Self, Self::Error> {
26252 let hdr_value = hdr_value.to_string();
26253 match HeaderValue::from_str(&hdr_value) {
26254 std::result::Result::Ok(value) => std::result::Result::Ok(value),
26255 std::result::Result::Err(e) => std::result::Result::Err(
26256 format!("Invalid header value for PodOs - value: {} is invalid {}",
26257 hdr_value, e))
26258 }
26259 }
26260}
26261
26262#[cfg(feature = "server")]
26263impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodOs> {
26264 type Error = String;
26265
26266 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
26267 match hdr_value.to_str() {
26268 std::result::Result::Ok(value) => {
26269 match <PodOs as std::str::FromStr>::from_str(value) {
26270 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
26271 std::result::Result::Err(err) => std::result::Result::Err(
26272 format!("Unable to convert header value '{}' into PodOs - {}",
26273 value, err))
26274 }
26275 },
26276 std::result::Result::Err(e) => std::result::Result::Err(
26277 format!("Unable to convert header: {:?} to string: {}",
26278 hdr_value, e))
26279 }
26280 }
26281}
26282
26283
26284
26285
26286#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
26291#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
26292pub struct PodReadinessGate {
26293#[serde(rename = "conditionType")]
26295 #[serde(skip_serializing_if="Option::is_none")]
26296 pub condition_type: Option<String>,
26297
26298}
26299
26300
26301impl PodReadinessGate {
26302 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
26303 pub fn new() -> PodReadinessGate {
26304 PodReadinessGate {
26305 condition_type: None,
26306 }
26307 }
26308}
26309
26310impl std::string::ToString for PodReadinessGate {
26314 fn to_string(&self) -> String {
26315 let params: Vec<Option<String>> = vec![
26316
26317 self.condition_type.as_ref().map(|condition_type| {
26318 [
26319 "conditionType".to_string(),
26320 condition_type.to_string(),
26321 ].join(",")
26322 }),
26323
26324 ];
26325
26326 params.into_iter().flatten().collect::<Vec<_>>().join(",")
26327 }
26328}
26329
26330impl std::str::FromStr for PodReadinessGate {
26334 type Err = String;
26335
26336 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
26337 #[derive(Default)]
26339 #[allow(dead_code)]
26340 struct IntermediateRep {
26341 pub condition_type: Vec<String>,
26342 }
26343
26344 let mut intermediate_rep = IntermediateRep::default();
26345
26346 let mut string_iter = s.split(',');
26348 let mut key_result = string_iter.next();
26349
26350 while key_result.is_some() {
26351 let val = match string_iter.next() {
26352 Some(x) => x,
26353 None => return std::result::Result::Err("Missing value while parsing PodReadinessGate".to_string())
26354 };
26355
26356 if let Some(key) = key_result {
26357 #[allow(clippy::match_single_binding)]
26358 match key {
26359 #[allow(clippy::redundant_clone)]
26360 "conditionType" => intermediate_rep.condition_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26361 _ => return std::result::Result::Err("Unexpected key while parsing PodReadinessGate".to_string())
26362 }
26363 }
26364
26365 key_result = string_iter.next();
26367 }
26368
26369 std::result::Result::Ok(PodReadinessGate {
26371 condition_type: intermediate_rep.condition_type.into_iter().next(),
26372 })
26373 }
26374}
26375
26376#[cfg(feature = "server")]
26379impl std::convert::TryFrom<header::IntoHeaderValue<PodReadinessGate>> for HeaderValue {
26380 type Error = String;
26381
26382 fn try_from(hdr_value: header::IntoHeaderValue<PodReadinessGate>) -> std::result::Result<Self, Self::Error> {
26383 let hdr_value = hdr_value.to_string();
26384 match HeaderValue::from_str(&hdr_value) {
26385 std::result::Result::Ok(value) => std::result::Result::Ok(value),
26386 std::result::Result::Err(e) => std::result::Result::Err(
26387 format!("Invalid header value for PodReadinessGate - value: {} is invalid {}",
26388 hdr_value, e))
26389 }
26390 }
26391}
26392
26393#[cfg(feature = "server")]
26394impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodReadinessGate> {
26395 type Error = String;
26396
26397 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
26398 match hdr_value.to_str() {
26399 std::result::Result::Ok(value) => {
26400 match <PodReadinessGate as std::str::FromStr>::from_str(value) {
26401 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
26402 std::result::Result::Err(err) => std::result::Result::Err(
26403 format!("Unable to convert header value '{}' into PodReadinessGate - {}",
26404 value, err))
26405 }
26406 },
26407 std::result::Result::Err(e) => std::result::Result::Err(
26408 format!("Unable to convert header: {:?} to string: {}",
26409 hdr_value, e))
26410 }
26411 }
26412}
26413
26414
26415
26416
26417#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
26422#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
26423pub struct PodSecurityContext {
26424#[serde(rename = "fsGroup")]
26426 #[serde(skip_serializing_if="Option::is_none")]
26427 pub fs_group: Option<i64>,
26428
26429#[serde(rename = "fsGroupChangePolicy")]
26431 #[serde(skip_serializing_if="Option::is_none")]
26432 pub fs_group_change_policy: Option<String>,
26433
26434#[serde(rename = "runAsGroup")]
26436 #[serde(skip_serializing_if="Option::is_none")]
26437 pub run_as_group: Option<i64>,
26438
26439#[serde(rename = "runAsNonRoot")]
26441 #[serde(skip_serializing_if="Option::is_none")]
26442 pub run_as_non_root: Option<bool>,
26443
26444#[serde(rename = "runAsUser")]
26446 #[serde(skip_serializing_if="Option::is_none")]
26447 pub run_as_user: Option<i64>,
26448
26449 #[serde(rename = "seLinuxOptions")]
26450 #[serde(skip_serializing_if="Option::is_none")]
26451 pub se_linux_options: Option<models::SeLinuxOptions>,
26452
26453 #[serde(rename = "seccompProfile")]
26454 #[serde(skip_serializing_if="Option::is_none")]
26455 pub seccomp_profile: Option<models::SeccompProfile>,
26456
26457#[serde(rename = "supplementalGroups")]
26459 #[serde(skip_serializing_if="Option::is_none")]
26460 pub supplemental_groups: Option<Vec<i64>>,
26461
26462#[serde(rename = "sysctls")]
26464 #[serde(skip_serializing_if="Option::is_none")]
26465 pub sysctls: Option<Vec<models::Sysctl>>,
26466
26467 #[serde(rename = "windowsOptions")]
26468 #[serde(skip_serializing_if="Option::is_none")]
26469 pub windows_options: Option<models::WindowsSecurityContextOptions>,
26470
26471}
26472
26473
26474impl PodSecurityContext {
26475 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
26476 pub fn new() -> PodSecurityContext {
26477 PodSecurityContext {
26478 fs_group: None,
26479 fs_group_change_policy: None,
26480 run_as_group: None,
26481 run_as_non_root: None,
26482 run_as_user: None,
26483 se_linux_options: None,
26484 seccomp_profile: None,
26485 supplemental_groups: None,
26486 sysctls: None,
26487 windows_options: None,
26488 }
26489 }
26490}
26491
26492impl std::string::ToString for PodSecurityContext {
26496 fn to_string(&self) -> String {
26497 let params: Vec<Option<String>> = vec![
26498
26499 self.fs_group.as_ref().map(|fs_group| {
26500 [
26501 "fsGroup".to_string(),
26502 fs_group.to_string(),
26503 ].join(",")
26504 }),
26505
26506
26507 self.fs_group_change_policy.as_ref().map(|fs_group_change_policy| {
26508 [
26509 "fsGroupChangePolicy".to_string(),
26510 fs_group_change_policy.to_string(),
26511 ].join(",")
26512 }),
26513
26514
26515 self.run_as_group.as_ref().map(|run_as_group| {
26516 [
26517 "runAsGroup".to_string(),
26518 run_as_group.to_string(),
26519 ].join(",")
26520 }),
26521
26522
26523 self.run_as_non_root.as_ref().map(|run_as_non_root| {
26524 [
26525 "runAsNonRoot".to_string(),
26526 run_as_non_root.to_string(),
26527 ].join(",")
26528 }),
26529
26530
26531 self.run_as_user.as_ref().map(|run_as_user| {
26532 [
26533 "runAsUser".to_string(),
26534 run_as_user.to_string(),
26535 ].join(",")
26536 }),
26537
26538 self.supplemental_groups.as_ref().map(|supplemental_groups| {
26544 [
26545 "supplementalGroups".to_string(),
26546 supplemental_groups.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
26547 ].join(",")
26548 }),
26549
26550 ];
26555
26556 params.into_iter().flatten().collect::<Vec<_>>().join(",")
26557 }
26558}
26559
26560impl std::str::FromStr for PodSecurityContext {
26564 type Err = String;
26565
26566 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
26567 #[derive(Default)]
26569 #[allow(dead_code)]
26570 struct IntermediateRep {
26571 pub fs_group: Vec<i64>,
26572 pub fs_group_change_policy: Vec<String>,
26573 pub run_as_group: Vec<i64>,
26574 pub run_as_non_root: Vec<bool>,
26575 pub run_as_user: Vec<i64>,
26576 pub se_linux_options: Vec<models::SeLinuxOptions>,
26577 pub seccomp_profile: Vec<models::SeccompProfile>,
26578 pub supplemental_groups: Vec<Vec<i64>>,
26579 pub sysctls: Vec<Vec<models::Sysctl>>,
26580 pub windows_options: Vec<models::WindowsSecurityContextOptions>,
26581 }
26582
26583 let mut intermediate_rep = IntermediateRep::default();
26584
26585 let mut string_iter = s.split(',');
26587 let mut key_result = string_iter.next();
26588
26589 while key_result.is_some() {
26590 let val = match string_iter.next() {
26591 Some(x) => x,
26592 None => return std::result::Result::Err("Missing value while parsing PodSecurityContext".to_string())
26593 };
26594
26595 if let Some(key) = key_result {
26596 #[allow(clippy::match_single_binding)]
26597 match key {
26598 #[allow(clippy::redundant_clone)]
26599 "fsGroup" => intermediate_rep.fs_group.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26600 #[allow(clippy::redundant_clone)]
26601 "fsGroupChangePolicy" => intermediate_rep.fs_group_change_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26602 #[allow(clippy::redundant_clone)]
26603 "runAsGroup" => intermediate_rep.run_as_group.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26604 #[allow(clippy::redundant_clone)]
26605 "runAsNonRoot" => intermediate_rep.run_as_non_root.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26606 #[allow(clippy::redundant_clone)]
26607 "runAsUser" => intermediate_rep.run_as_user.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26608 #[allow(clippy::redundant_clone)]
26609 "seLinuxOptions" => intermediate_rep.se_linux_options.push(<models::SeLinuxOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26610 #[allow(clippy::redundant_clone)]
26611 "seccompProfile" => intermediate_rep.seccomp_profile.push(<models::SeccompProfile as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26612 "supplementalGroups" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSecurityContext".to_string()),
26613 "sysctls" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSecurityContext".to_string()),
26614 #[allow(clippy::redundant_clone)]
26615 "windowsOptions" => intermediate_rep.windows_options.push(<models::WindowsSecurityContextOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
26616 _ => return std::result::Result::Err("Unexpected key while parsing PodSecurityContext".to_string())
26617 }
26618 }
26619
26620 key_result = string_iter.next();
26622 }
26623
26624 std::result::Result::Ok(PodSecurityContext {
26626 fs_group: intermediate_rep.fs_group.into_iter().next(),
26627 fs_group_change_policy: intermediate_rep.fs_group_change_policy.into_iter().next(),
26628 run_as_group: intermediate_rep.run_as_group.into_iter().next(),
26629 run_as_non_root: intermediate_rep.run_as_non_root.into_iter().next(),
26630 run_as_user: intermediate_rep.run_as_user.into_iter().next(),
26631 se_linux_options: intermediate_rep.se_linux_options.into_iter().next(),
26632 seccomp_profile: intermediate_rep.seccomp_profile.into_iter().next(),
26633 supplemental_groups: intermediate_rep.supplemental_groups.into_iter().next(),
26634 sysctls: intermediate_rep.sysctls.into_iter().next(),
26635 windows_options: intermediate_rep.windows_options.into_iter().next(),
26636 })
26637 }
26638}
26639
26640#[cfg(feature = "server")]
26643impl std::convert::TryFrom<header::IntoHeaderValue<PodSecurityContext>> for HeaderValue {
26644 type Error = String;
26645
26646 fn try_from(hdr_value: header::IntoHeaderValue<PodSecurityContext>) -> std::result::Result<Self, Self::Error> {
26647 let hdr_value = hdr_value.to_string();
26648 match HeaderValue::from_str(&hdr_value) {
26649 std::result::Result::Ok(value) => std::result::Result::Ok(value),
26650 std::result::Result::Err(e) => std::result::Result::Err(
26651 format!("Invalid header value for PodSecurityContext - value: {} is invalid {}",
26652 hdr_value, e))
26653 }
26654 }
26655}
26656
26657#[cfg(feature = "server")]
26658impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodSecurityContext> {
26659 type Error = String;
26660
26661 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
26662 match hdr_value.to_str() {
26663 std::result::Result::Ok(value) => {
26664 match <PodSecurityContext as std::str::FromStr>::from_str(value) {
26665 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
26666 std::result::Result::Err(err) => std::result::Result::Err(
26667 format!("Unable to convert header value '{}' into PodSecurityContext - {}",
26668 value, err))
26669 }
26670 },
26671 std::result::Result::Err(e) => std::result::Result::Err(
26672 format!("Unable to convert header: {:?} to string: {}",
26673 hdr_value, e))
26674 }
26675 }
26676}
26677
26678
26679
26680
26681
26682
26683
26684#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
26685#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
26686pub struct PodSpec {
26687#[serde(rename = "activeDeadlineSeconds")]
26689 #[serde(skip_serializing_if="Option::is_none")]
26690 pub active_deadline_seconds: Option<i64>,
26691
26692 #[serde(rename = "affinity")]
26693 #[serde(skip_serializing_if="Option::is_none")]
26694 pub affinity: Option<models::Affinity>,
26695
26696#[serde(rename = "automountServiceAccountToken")]
26698 #[serde(skip_serializing_if="Option::is_none")]
26699 pub automount_service_account_token: Option<bool>,
26700
26701#[serde(rename = "containers")]
26703 #[serde(skip_serializing_if="Option::is_none")]
26704 pub containers: Option<Vec<models::Container>>,
26705
26706 #[serde(rename = "dnsConfig")]
26707 #[serde(skip_serializing_if="Option::is_none")]
26708 pub dns_config: Option<models::PodDnsConfig>,
26709
26710#[serde(rename = "dnsPolicy")]
26712 #[serde(skip_serializing_if="Option::is_none")]
26713 pub dns_policy: Option<String>,
26714
26715#[serde(rename = "enableServiceLinks")]
26717 #[serde(skip_serializing_if="Option::is_none")]
26718 pub enable_service_links: Option<bool>,
26719
26720#[serde(rename = "ephemeralContainers")]
26722 #[serde(skip_serializing_if="Option::is_none")]
26723 pub ephemeral_containers: Option<Vec<models::EphemeralContainer>>,
26724
26725#[serde(rename = "hostAliases")]
26727 #[serde(skip_serializing_if="Option::is_none")]
26728 pub host_aliases: Option<Vec<models::HostAlias>>,
26729
26730#[serde(rename = "hostIPC")]
26732 #[serde(skip_serializing_if="Option::is_none")]
26733 pub host_ipc: Option<bool>,
26734
26735#[serde(rename = "hostNetwork")]
26737 #[serde(skip_serializing_if="Option::is_none")]
26738 pub host_network: Option<bool>,
26739
26740#[serde(rename = "hostPID")]
26742 #[serde(skip_serializing_if="Option::is_none")]
26743 pub host_pid: Option<bool>,
26744
26745#[serde(rename = "hostname")]
26747 #[serde(skip_serializing_if="Option::is_none")]
26748 pub hostname: Option<String>,
26749
26750#[serde(rename = "imagePullSecrets")]
26752 #[serde(skip_serializing_if="Option::is_none")]
26753 pub image_pull_secrets: Option<Vec<models::LocalObjectReference>>,
26754
26755#[serde(rename = "initContainers")]
26757 #[serde(skip_serializing_if="Option::is_none")]
26758 pub init_containers: Option<Vec<models::Container>>,
26759
26760#[serde(rename = "nodeName")]
26762 #[serde(skip_serializing_if="Option::is_none")]
26763 pub node_name: Option<String>,
26764
26765#[serde(rename = "nodeSelector")]
26767 #[serde(skip_serializing_if="Option::is_none")]
26768 pub node_selector: Option<std::collections::HashMap<String, String>>,
26769
26770 #[serde(rename = "os")]
26771 #[serde(skip_serializing_if="Option::is_none")]
26772 pub os: Option<models::PodOs>,
26773
26774 #[serde(rename = "overhead")]
26775 #[serde(skip_serializing_if="Option::is_none")]
26776 pub overhead: Option<std::collections::HashMap<String, models::Quantity>>,
26777
26778#[serde(rename = "preemptionPolicy")]
26780 #[serde(skip_serializing_if="Option::is_none")]
26781 pub preemption_policy: Option<String>,
26782
26783#[serde(rename = "priority")]
26785 #[serde(skip_serializing_if="Option::is_none")]
26786 pub priority: Option<i32>,
26787
26788#[serde(rename = "priorityClassName")]
26790 #[serde(skip_serializing_if="Option::is_none")]
26791 pub priority_class_name: Option<String>,
26792
26793#[serde(rename = "readinessGates")]
26795 #[serde(skip_serializing_if="Option::is_none")]
26796 pub readiness_gates: Option<Vec<models::PodReadinessGate>>,
26797
26798#[serde(rename = "restartPolicy")]
26800 #[serde(skip_serializing_if="Option::is_none")]
26801 pub restart_policy: Option<String>,
26802
26803#[serde(rename = "runtimeClassName")]
26805 #[serde(skip_serializing_if="Option::is_none")]
26806 pub runtime_class_name: Option<String>,
26807
26808#[serde(rename = "schedulerName")]
26810 #[serde(skip_serializing_if="Option::is_none")]
26811 pub scheduler_name: Option<String>,
26812
26813 #[serde(rename = "securityContext")]
26814 #[serde(skip_serializing_if="Option::is_none")]
26815 pub security_context: Option<models::PodSecurityContext>,
26816
26817#[serde(rename = "serviceAccount")]
26819 #[serde(skip_serializing_if="Option::is_none")]
26820 pub service_account: Option<String>,
26821
26822#[serde(rename = "serviceAccountName")]
26824 #[serde(skip_serializing_if="Option::is_none")]
26825 pub service_account_name: Option<String>,
26826
26827#[serde(rename = "setHostnameAsFQDN")]
26829 #[serde(skip_serializing_if="Option::is_none")]
26830 pub set_hostname_as_fqdn: Option<bool>,
26831
26832#[serde(rename = "shareProcessNamespace")]
26834 #[serde(skip_serializing_if="Option::is_none")]
26835 pub share_process_namespace: Option<bool>,
26836
26837#[serde(rename = "subdomain")]
26839 #[serde(skip_serializing_if="Option::is_none")]
26840 pub subdomain: Option<String>,
26841
26842#[serde(rename = "terminationGracePeriodSeconds")]
26844 #[serde(skip_serializing_if="Option::is_none")]
26845 pub termination_grace_period_seconds: Option<i64>,
26846
26847#[serde(rename = "tolerations")]
26849 #[serde(skip_serializing_if="Option::is_none")]
26850 pub tolerations: Option<Vec<models::Toleration>>,
26851
26852#[serde(rename = "topologySpreadConstraints")]
26854 #[serde(skip_serializing_if="Option::is_none")]
26855 pub topology_spread_constraints: Option<Vec<models::TopologySpreadConstraint>>,
26856
26857#[serde(rename = "volumes")]
26859 #[serde(skip_serializing_if="Option::is_none")]
26860 pub volumes: Option<Vec<models::Volume>>,
26861
26862}
26863
26864
26865impl PodSpec {
26866 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
26867 pub fn new() -> PodSpec {
26868 PodSpec {
26869 active_deadline_seconds: None,
26870 affinity: None,
26871 automount_service_account_token: None,
26872 containers: None,
26873 dns_config: None,
26874 dns_policy: None,
26875 enable_service_links: None,
26876 ephemeral_containers: None,
26877 host_aliases: None,
26878 host_ipc: None,
26879 host_network: None,
26880 host_pid: None,
26881 hostname: None,
26882 image_pull_secrets: None,
26883 init_containers: None,
26884 node_name: None,
26885 node_selector: None,
26886 os: None,
26887 overhead: None,
26888 preemption_policy: None,
26889 priority: None,
26890 priority_class_name: None,
26891 readiness_gates: None,
26892 restart_policy: None,
26893 runtime_class_name: None,
26894 scheduler_name: None,
26895 security_context: None,
26896 service_account: None,
26897 service_account_name: None,
26898 set_hostname_as_fqdn: None,
26899 share_process_namespace: None,
26900 subdomain: None,
26901 termination_grace_period_seconds: None,
26902 tolerations: None,
26903 topology_spread_constraints: None,
26904 volumes: None,
26905 }
26906 }
26907}
26908
26909impl std::string::ToString for PodSpec {
26913 fn to_string(&self) -> String {
26914 let params: Vec<Option<String>> = vec![
26915
26916 self.active_deadline_seconds.as_ref().map(|active_deadline_seconds| {
26917 [
26918 "activeDeadlineSeconds".to_string(),
26919 active_deadline_seconds.to_string(),
26920 ].join(",")
26921 }),
26922
26923 self.automount_service_account_token.as_ref().map(|automount_service_account_token| {
26927 [
26928 "automountServiceAccountToken".to_string(),
26929 automount_service_account_token.to_string(),
26930 ].join(",")
26931 }),
26932
26933 self.dns_policy.as_ref().map(|dns_policy| {
26939 [
26940 "dnsPolicy".to_string(),
26941 dns_policy.to_string(),
26942 ].join(",")
26943 }),
26944
26945
26946 self.enable_service_links.as_ref().map(|enable_service_links| {
26947 [
26948 "enableServiceLinks".to_string(),
26949 enable_service_links.to_string(),
26950 ].join(",")
26951 }),
26952
26953 self.host_ipc.as_ref().map(|host_ipc| {
26959 [
26960 "hostIPC".to_string(),
26961 host_ipc.to_string(),
26962 ].join(",")
26963 }),
26964
26965
26966 self.host_network.as_ref().map(|host_network| {
26967 [
26968 "hostNetwork".to_string(),
26969 host_network.to_string(),
26970 ].join(",")
26971 }),
26972
26973
26974 self.host_pid.as_ref().map(|host_pid| {
26975 [
26976 "hostPID".to_string(),
26977 host_pid.to_string(),
26978 ].join(",")
26979 }),
26980
26981
26982 self.hostname.as_ref().map(|hostname| {
26983 [
26984 "hostname".to_string(),
26985 hostname.to_string(),
26986 ].join(",")
26987 }),
26988
26989 self.node_name.as_ref().map(|node_name| {
26995 [
26996 "nodeName".to_string(),
26997 node_name.to_string(),
26998 ].join(",")
26999 }),
27000
27001 self.preemption_policy.as_ref().map(|preemption_policy| {
27010 [
27011 "preemptionPolicy".to_string(),
27012 preemption_policy.to_string(),
27013 ].join(",")
27014 }),
27015
27016
27017 self.priority.as_ref().map(|priority| {
27018 [
27019 "priority".to_string(),
27020 priority.to_string(),
27021 ].join(",")
27022 }),
27023
27024
27025 self.priority_class_name.as_ref().map(|priority_class_name| {
27026 [
27027 "priorityClassName".to_string(),
27028 priority_class_name.to_string(),
27029 ].join(",")
27030 }),
27031
27032 self.restart_policy.as_ref().map(|restart_policy| {
27036 [
27037 "restartPolicy".to_string(),
27038 restart_policy.to_string(),
27039 ].join(",")
27040 }),
27041
27042
27043 self.runtime_class_name.as_ref().map(|runtime_class_name| {
27044 [
27045 "runtimeClassName".to_string(),
27046 runtime_class_name.to_string(),
27047 ].join(",")
27048 }),
27049
27050
27051 self.scheduler_name.as_ref().map(|scheduler_name| {
27052 [
27053 "schedulerName".to_string(),
27054 scheduler_name.to_string(),
27055 ].join(",")
27056 }),
27057
27058 self.service_account.as_ref().map(|service_account| {
27062 [
27063 "serviceAccount".to_string(),
27064 service_account.to_string(),
27065 ].join(",")
27066 }),
27067
27068
27069 self.service_account_name.as_ref().map(|service_account_name| {
27070 [
27071 "serviceAccountName".to_string(),
27072 service_account_name.to_string(),
27073 ].join(",")
27074 }),
27075
27076
27077 self.set_hostname_as_fqdn.as_ref().map(|set_hostname_as_fqdn| {
27078 [
27079 "setHostnameAsFQDN".to_string(),
27080 set_hostname_as_fqdn.to_string(),
27081 ].join(",")
27082 }),
27083
27084
27085 self.share_process_namespace.as_ref().map(|share_process_namespace| {
27086 [
27087 "shareProcessNamespace".to_string(),
27088 share_process_namespace.to_string(),
27089 ].join(",")
27090 }),
27091
27092
27093 self.subdomain.as_ref().map(|subdomain| {
27094 [
27095 "subdomain".to_string(),
27096 subdomain.to_string(),
27097 ].join(",")
27098 }),
27099
27100
27101 self.termination_grace_period_seconds.as_ref().map(|termination_grace_period_seconds| {
27102 [
27103 "terminationGracePeriodSeconds".to_string(),
27104 termination_grace_period_seconds.to_string(),
27105 ].join(",")
27106 }),
27107
27108 ];
27115
27116 params.into_iter().flatten().collect::<Vec<_>>().join(",")
27117 }
27118}
27119
27120impl std::str::FromStr for PodSpec {
27124 type Err = String;
27125
27126 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
27127 #[derive(Default)]
27129 #[allow(dead_code)]
27130 struct IntermediateRep {
27131 pub active_deadline_seconds: Vec<i64>,
27132 pub affinity: Vec<models::Affinity>,
27133 pub automount_service_account_token: Vec<bool>,
27134 pub containers: Vec<Vec<models::Container>>,
27135 pub dns_config: Vec<models::PodDnsConfig>,
27136 pub dns_policy: Vec<String>,
27137 pub enable_service_links: Vec<bool>,
27138 pub ephemeral_containers: Vec<Vec<models::EphemeralContainer>>,
27139 pub host_aliases: Vec<Vec<models::HostAlias>>,
27140 pub host_ipc: Vec<bool>,
27141 pub host_network: Vec<bool>,
27142 pub host_pid: Vec<bool>,
27143 pub hostname: Vec<String>,
27144 pub image_pull_secrets: Vec<Vec<models::LocalObjectReference>>,
27145 pub init_containers: Vec<Vec<models::Container>>,
27146 pub node_name: Vec<String>,
27147 pub node_selector: Vec<std::collections::HashMap<String, String>>,
27148 pub os: Vec<models::PodOs>,
27149 pub overhead: Vec<std::collections::HashMap<String, models::Quantity>>,
27150 pub preemption_policy: Vec<String>,
27151 pub priority: Vec<i32>,
27152 pub priority_class_name: Vec<String>,
27153 pub readiness_gates: Vec<Vec<models::PodReadinessGate>>,
27154 pub restart_policy: Vec<String>,
27155 pub runtime_class_name: Vec<String>,
27156 pub scheduler_name: Vec<String>,
27157 pub security_context: Vec<models::PodSecurityContext>,
27158 pub service_account: Vec<String>,
27159 pub service_account_name: Vec<String>,
27160 pub set_hostname_as_fqdn: Vec<bool>,
27161 pub share_process_namespace: Vec<bool>,
27162 pub subdomain: Vec<String>,
27163 pub termination_grace_period_seconds: Vec<i64>,
27164 pub tolerations: Vec<Vec<models::Toleration>>,
27165 pub topology_spread_constraints: Vec<Vec<models::TopologySpreadConstraint>>,
27166 pub volumes: Vec<Vec<models::Volume>>,
27167 }
27168
27169 let mut intermediate_rep = IntermediateRep::default();
27170
27171 let mut string_iter = s.split(',');
27173 let mut key_result = string_iter.next();
27174
27175 while key_result.is_some() {
27176 let val = match string_iter.next() {
27177 Some(x) => x,
27178 None => return std::result::Result::Err("Missing value while parsing PodSpec".to_string())
27179 };
27180
27181 if let Some(key) = key_result {
27182 #[allow(clippy::match_single_binding)]
27183 match key {
27184 #[allow(clippy::redundant_clone)]
27185 "activeDeadlineSeconds" => intermediate_rep.active_deadline_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27186 #[allow(clippy::redundant_clone)]
27187 "affinity" => intermediate_rep.affinity.push(<models::Affinity as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27188 #[allow(clippy::redundant_clone)]
27189 "automountServiceAccountToken" => intermediate_rep.automount_service_account_token.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27190 "containers" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27191 #[allow(clippy::redundant_clone)]
27192 "dnsConfig" => intermediate_rep.dns_config.push(<models::PodDnsConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27193 #[allow(clippy::redundant_clone)]
27194 "dnsPolicy" => intermediate_rep.dns_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27195 #[allow(clippy::redundant_clone)]
27196 "enableServiceLinks" => intermediate_rep.enable_service_links.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27197 "ephemeralContainers" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27198 "hostAliases" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27199 #[allow(clippy::redundant_clone)]
27200 "hostIPC" => intermediate_rep.host_ipc.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27201 #[allow(clippy::redundant_clone)]
27202 "hostNetwork" => intermediate_rep.host_network.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27203 #[allow(clippy::redundant_clone)]
27204 "hostPID" => intermediate_rep.host_pid.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27205 #[allow(clippy::redundant_clone)]
27206 "hostname" => intermediate_rep.hostname.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27207 "imagePullSecrets" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27208 "initContainers" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27209 #[allow(clippy::redundant_clone)]
27210 "nodeName" => intermediate_rep.node_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27211 "nodeSelector" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27212 #[allow(clippy::redundant_clone)]
27213 "os" => intermediate_rep.os.push(<models::PodOs as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27214 "overhead" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27215 #[allow(clippy::redundant_clone)]
27216 "preemptionPolicy" => intermediate_rep.preemption_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27217 #[allow(clippy::redundant_clone)]
27218 "priority" => intermediate_rep.priority.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27219 #[allow(clippy::redundant_clone)]
27220 "priorityClassName" => intermediate_rep.priority_class_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27221 "readinessGates" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27222 #[allow(clippy::redundant_clone)]
27223 "restartPolicy" => intermediate_rep.restart_policy.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27224 #[allow(clippy::redundant_clone)]
27225 "runtimeClassName" => intermediate_rep.runtime_class_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27226 #[allow(clippy::redundant_clone)]
27227 "schedulerName" => intermediate_rep.scheduler_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27228 #[allow(clippy::redundant_clone)]
27229 "securityContext" => intermediate_rep.security_context.push(<models::PodSecurityContext as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27230 #[allow(clippy::redundant_clone)]
27231 "serviceAccount" => intermediate_rep.service_account.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27232 #[allow(clippy::redundant_clone)]
27233 "serviceAccountName" => intermediate_rep.service_account_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27234 #[allow(clippy::redundant_clone)]
27235 "setHostnameAsFQDN" => intermediate_rep.set_hostname_as_fqdn.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27236 #[allow(clippy::redundant_clone)]
27237 "shareProcessNamespace" => intermediate_rep.share_process_namespace.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27238 #[allow(clippy::redundant_clone)]
27239 "subdomain" => intermediate_rep.subdomain.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27240 #[allow(clippy::redundant_clone)]
27241 "terminationGracePeriodSeconds" => intermediate_rep.termination_grace_period_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27242 "tolerations" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27243 "topologySpreadConstraints" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27244 "volumes" => return std::result::Result::Err("Parsing a container in this style is not supported in PodSpec".to_string()),
27245 _ => return std::result::Result::Err("Unexpected key while parsing PodSpec".to_string())
27246 }
27247 }
27248
27249 key_result = string_iter.next();
27251 }
27252
27253 std::result::Result::Ok(PodSpec {
27255 active_deadline_seconds: intermediate_rep.active_deadline_seconds.into_iter().next(),
27256 affinity: intermediate_rep.affinity.into_iter().next(),
27257 automount_service_account_token: intermediate_rep.automount_service_account_token.into_iter().next(),
27258 containers: intermediate_rep.containers.into_iter().next(),
27259 dns_config: intermediate_rep.dns_config.into_iter().next(),
27260 dns_policy: intermediate_rep.dns_policy.into_iter().next(),
27261 enable_service_links: intermediate_rep.enable_service_links.into_iter().next(),
27262 ephemeral_containers: intermediate_rep.ephemeral_containers.into_iter().next(),
27263 host_aliases: intermediate_rep.host_aliases.into_iter().next(),
27264 host_ipc: intermediate_rep.host_ipc.into_iter().next(),
27265 host_network: intermediate_rep.host_network.into_iter().next(),
27266 host_pid: intermediate_rep.host_pid.into_iter().next(),
27267 hostname: intermediate_rep.hostname.into_iter().next(),
27268 image_pull_secrets: intermediate_rep.image_pull_secrets.into_iter().next(),
27269 init_containers: intermediate_rep.init_containers.into_iter().next(),
27270 node_name: intermediate_rep.node_name.into_iter().next(),
27271 node_selector: intermediate_rep.node_selector.into_iter().next(),
27272 os: intermediate_rep.os.into_iter().next(),
27273 overhead: intermediate_rep.overhead.into_iter().next(),
27274 preemption_policy: intermediate_rep.preemption_policy.into_iter().next(),
27275 priority: intermediate_rep.priority.into_iter().next(),
27276 priority_class_name: intermediate_rep.priority_class_name.into_iter().next(),
27277 readiness_gates: intermediate_rep.readiness_gates.into_iter().next(),
27278 restart_policy: intermediate_rep.restart_policy.into_iter().next(),
27279 runtime_class_name: intermediate_rep.runtime_class_name.into_iter().next(),
27280 scheduler_name: intermediate_rep.scheduler_name.into_iter().next(),
27281 security_context: intermediate_rep.security_context.into_iter().next(),
27282 service_account: intermediate_rep.service_account.into_iter().next(),
27283 service_account_name: intermediate_rep.service_account_name.into_iter().next(),
27284 set_hostname_as_fqdn: intermediate_rep.set_hostname_as_fqdn.into_iter().next(),
27285 share_process_namespace: intermediate_rep.share_process_namespace.into_iter().next(),
27286 subdomain: intermediate_rep.subdomain.into_iter().next(),
27287 termination_grace_period_seconds: intermediate_rep.termination_grace_period_seconds.into_iter().next(),
27288 tolerations: intermediate_rep.tolerations.into_iter().next(),
27289 topology_spread_constraints: intermediate_rep.topology_spread_constraints.into_iter().next(),
27290 volumes: intermediate_rep.volumes.into_iter().next(),
27291 })
27292 }
27293}
27294
27295#[cfg(feature = "server")]
27298impl std::convert::TryFrom<header::IntoHeaderValue<PodSpec>> for HeaderValue {
27299 type Error = String;
27300
27301 fn try_from(hdr_value: header::IntoHeaderValue<PodSpec>) -> std::result::Result<Self, Self::Error> {
27302 let hdr_value = hdr_value.to_string();
27303 match HeaderValue::from_str(&hdr_value) {
27304 std::result::Result::Ok(value) => std::result::Result::Ok(value),
27305 std::result::Result::Err(e) => std::result::Result::Err(
27306 format!("Invalid header value for PodSpec - value: {} is invalid {}",
27307 hdr_value, e))
27308 }
27309 }
27310}
27311
27312#[cfg(feature = "server")]
27313impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PodSpec> {
27314 type Error = String;
27315
27316 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
27317 match hdr_value.to_str() {
27318 std::result::Result::Ok(value) => {
27319 match <PodSpec as std::str::FromStr>::from_str(value) {
27320 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
27321 std::result::Result::Err(err) => std::result::Result::Err(
27322 format!("Unable to convert header value '{}' into PodSpec - {}",
27323 value, err))
27324 }
27325 },
27326 std::result::Result::Err(e) => std::result::Result::Err(
27327 format!("Unable to convert header: {:?} to string: {}",
27328 hdr_value, e))
27329 }
27330 }
27331}
27332
27333
27334
27335
27336#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
27341#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
27342pub struct Port {
27343#[serde(rename = "IP")]
27345 #[serde(skip_serializing_if="Option::is_none")]
27346 pub ip: Option<String>,
27347
27348#[serde(rename = "PrivatePort")]
27350 pub private_port: i32,
27351
27352#[serde(rename = "PublicPort")]
27354 #[serde(skip_serializing_if="Option::is_none")]
27355 pub public_port: Option<i32>,
27356
27357#[serde(rename = "Type")]
27359 pub r#type: String,
27360
27361}
27362
27363
27364impl Port {
27365 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
27366 pub fn new(private_port: i32, r#type: String, ) -> Port {
27367 Port {
27368 ip: None,
27369 private_port,
27370 public_port: None,
27371 r#type,
27372 }
27373 }
27374}
27375
27376impl std::string::ToString for Port {
27380 fn to_string(&self) -> String {
27381 let params: Vec<Option<String>> = vec![
27382
27383 self.ip.as_ref().map(|ip| {
27384 [
27385 "IP".to_string(),
27386 ip.to_string(),
27387 ].join(",")
27388 }),
27389
27390
27391 Some("PrivatePort".to_string()),
27392 Some(self.private_port.to_string()),
27393
27394
27395 self.public_port.as_ref().map(|public_port| {
27396 [
27397 "PublicPort".to_string(),
27398 public_port.to_string(),
27399 ].join(",")
27400 }),
27401
27402
27403 Some("Type".to_string()),
27404 Some(self.r#type.to_string()),
27405
27406 ];
27407
27408 params.into_iter().flatten().collect::<Vec<_>>().join(",")
27409 }
27410}
27411
27412impl std::str::FromStr for Port {
27416 type Err = String;
27417
27418 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
27419 #[derive(Default)]
27421 #[allow(dead_code)]
27422 struct IntermediateRep {
27423 pub ip: Vec<String>,
27424 pub private_port: Vec<i32>,
27425 pub public_port: Vec<i32>,
27426 pub r#type: Vec<String>,
27427 }
27428
27429 let mut intermediate_rep = IntermediateRep::default();
27430
27431 let mut string_iter = s.split(',');
27433 let mut key_result = string_iter.next();
27434
27435 while key_result.is_some() {
27436 let val = match string_iter.next() {
27437 Some(x) => x,
27438 None => return std::result::Result::Err("Missing value while parsing Port".to_string())
27439 };
27440
27441 if let Some(key) = key_result {
27442 #[allow(clippy::match_single_binding)]
27443 match key {
27444 #[allow(clippy::redundant_clone)]
27445 "IP" => intermediate_rep.ip.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27446 #[allow(clippy::redundant_clone)]
27447 "PrivatePort" => intermediate_rep.private_port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27448 #[allow(clippy::redundant_clone)]
27449 "PublicPort" => intermediate_rep.public_port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27450 #[allow(clippy::redundant_clone)]
27451 "Type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27452 _ => return std::result::Result::Err("Unexpected key while parsing Port".to_string())
27453 }
27454 }
27455
27456 key_result = string_iter.next();
27458 }
27459
27460 std::result::Result::Ok(Port {
27462 ip: intermediate_rep.ip.into_iter().next(),
27463 private_port: intermediate_rep.private_port.into_iter().next().ok_or_else(|| "PrivatePort missing in Port".to_string())?,
27464 public_port: intermediate_rep.public_port.into_iter().next(),
27465 r#type: intermediate_rep.r#type.into_iter().next().ok_or_else(|| "Type missing in Port".to_string())?,
27466 })
27467 }
27468}
27469
27470#[cfg(feature = "server")]
27473impl std::convert::TryFrom<header::IntoHeaderValue<Port>> for HeaderValue {
27474 type Error = String;
27475
27476 fn try_from(hdr_value: header::IntoHeaderValue<Port>) -> std::result::Result<Self, Self::Error> {
27477 let hdr_value = hdr_value.to_string();
27478 match HeaderValue::from_str(&hdr_value) {
27479 std::result::Result::Ok(value) => std::result::Result::Ok(value),
27480 std::result::Result::Err(e) => std::result::Result::Err(
27481 format!("Invalid header value for Port - value: {} is invalid {}",
27482 hdr_value, e))
27483 }
27484 }
27485}
27486
27487#[cfg(feature = "server")]
27488impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Port> {
27489 type Error = String;
27490
27491 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
27492 match hdr_value.to_str() {
27493 std::result::Result::Ok(value) => {
27494 match <Port as std::str::FromStr>::from_str(value) {
27495 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
27496 std::result::Result::Err(err) => std::result::Result::Err(
27497 format!("Unable to convert header value '{}' into Port - {}",
27498 value, err))
27499 }
27500 },
27501 std::result::Result::Err(e) => std::result::Result::Err(
27502 format!("Unable to convert header: {:?} to string: {}",
27503 hdr_value, e))
27504 }
27505 }
27506}
27507
27508
27509
27510
27511#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
27516#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
27517pub struct PortBinding {
27518#[serde(rename = "HostIp")]
27520 #[serde(skip_serializing_if="Option::is_none")]
27521 pub host_ip: Option<String>,
27522
27523#[serde(rename = "HostPort")]
27525 #[serde(skip_serializing_if="Option::is_none")]
27526 pub host_port: Option<String>,
27527
27528}
27529
27530
27531impl PortBinding {
27532 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
27533 pub fn new() -> PortBinding {
27534 PortBinding {
27535 host_ip: None,
27536 host_port: None,
27537 }
27538 }
27539}
27540
27541impl std::string::ToString for PortBinding {
27545 fn to_string(&self) -> String {
27546 let params: Vec<Option<String>> = vec![
27547
27548 self.host_ip.as_ref().map(|host_ip| {
27549 [
27550 "HostIp".to_string(),
27551 host_ip.to_string(),
27552 ].join(",")
27553 }),
27554
27555
27556 self.host_port.as_ref().map(|host_port| {
27557 [
27558 "HostPort".to_string(),
27559 host_port.to_string(),
27560 ].join(",")
27561 }),
27562
27563 ];
27564
27565 params.into_iter().flatten().collect::<Vec<_>>().join(",")
27566 }
27567}
27568
27569impl std::str::FromStr for PortBinding {
27573 type Err = String;
27574
27575 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
27576 #[derive(Default)]
27578 #[allow(dead_code)]
27579 struct IntermediateRep {
27580 pub host_ip: Vec<String>,
27581 pub host_port: Vec<String>,
27582 }
27583
27584 let mut intermediate_rep = IntermediateRep::default();
27585
27586 let mut string_iter = s.split(',');
27588 let mut key_result = string_iter.next();
27589
27590 while key_result.is_some() {
27591 let val = match string_iter.next() {
27592 Some(x) => x,
27593 None => return std::result::Result::Err("Missing value while parsing PortBinding".to_string())
27594 };
27595
27596 if let Some(key) = key_result {
27597 #[allow(clippy::match_single_binding)]
27598 match key {
27599 #[allow(clippy::redundant_clone)]
27600 "HostIp" => intermediate_rep.host_ip.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27601 #[allow(clippy::redundant_clone)]
27602 "HostPort" => intermediate_rep.host_port.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27603 _ => return std::result::Result::Err("Unexpected key while parsing PortBinding".to_string())
27604 }
27605 }
27606
27607 key_result = string_iter.next();
27609 }
27610
27611 std::result::Result::Ok(PortBinding {
27613 host_ip: intermediate_rep.host_ip.into_iter().next(),
27614 host_port: intermediate_rep.host_port.into_iter().next(),
27615 })
27616 }
27617}
27618
27619#[cfg(feature = "server")]
27622impl std::convert::TryFrom<header::IntoHeaderValue<PortBinding>> for HeaderValue {
27623 type Error = String;
27624
27625 fn try_from(hdr_value: header::IntoHeaderValue<PortBinding>) -> std::result::Result<Self, Self::Error> {
27626 let hdr_value = hdr_value.to_string();
27627 match HeaderValue::from_str(&hdr_value) {
27628 std::result::Result::Ok(value) => std::result::Result::Ok(value),
27629 std::result::Result::Err(e) => std::result::Result::Err(
27630 format!("Invalid header value for PortBinding - value: {} is invalid {}",
27631 hdr_value, e))
27632 }
27633 }
27634}
27635
27636#[cfg(feature = "server")]
27637impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PortBinding> {
27638 type Error = String;
27639
27640 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
27641 match hdr_value.to_str() {
27642 std::result::Result::Ok(value) => {
27643 match <PortBinding as std::str::FromStr>::from_str(value) {
27644 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
27645 std::result::Result::Err(err) => std::result::Result::Err(
27646 format!("Unable to convert header value '{}' into PortBinding - {}",
27647 value, err))
27648 }
27649 },
27650 std::result::Result::Err(e) => std::result::Result::Err(
27651 format!("Unable to convert header: {:?} to string: {}",
27652 hdr_value, e))
27653 }
27654 }
27655}
27656
27657
27658
27659
27660
27661
27662
27663#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
27664#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
27665pub struct PortworxVolumeSource {
27666#[serde(rename = "fsType")]
27668 #[serde(skip_serializing_if="Option::is_none")]
27669 pub fs_type: Option<String>,
27670
27671#[serde(rename = "readOnly")]
27673 #[serde(skip_serializing_if="Option::is_none")]
27674 pub read_only: Option<bool>,
27675
27676#[serde(rename = "volumeID")]
27678 #[serde(skip_serializing_if="Option::is_none")]
27679 pub volume_id: Option<String>,
27680
27681}
27682
27683
27684impl PortworxVolumeSource {
27685 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
27686 pub fn new() -> PortworxVolumeSource {
27687 PortworxVolumeSource {
27688 fs_type: None,
27689 read_only: None,
27690 volume_id: None,
27691 }
27692 }
27693}
27694
27695impl std::string::ToString for PortworxVolumeSource {
27699 fn to_string(&self) -> String {
27700 let params: Vec<Option<String>> = vec![
27701
27702 self.fs_type.as_ref().map(|fs_type| {
27703 [
27704 "fsType".to_string(),
27705 fs_type.to_string(),
27706 ].join(",")
27707 }),
27708
27709
27710 self.read_only.as_ref().map(|read_only| {
27711 [
27712 "readOnly".to_string(),
27713 read_only.to_string(),
27714 ].join(",")
27715 }),
27716
27717
27718 self.volume_id.as_ref().map(|volume_id| {
27719 [
27720 "volumeID".to_string(),
27721 volume_id.to_string(),
27722 ].join(",")
27723 }),
27724
27725 ];
27726
27727 params.into_iter().flatten().collect::<Vec<_>>().join(",")
27728 }
27729}
27730
27731impl std::str::FromStr for PortworxVolumeSource {
27735 type Err = String;
27736
27737 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
27738 #[derive(Default)]
27740 #[allow(dead_code)]
27741 struct IntermediateRep {
27742 pub fs_type: Vec<String>,
27743 pub read_only: Vec<bool>,
27744 pub volume_id: Vec<String>,
27745 }
27746
27747 let mut intermediate_rep = IntermediateRep::default();
27748
27749 let mut string_iter = s.split(',');
27751 let mut key_result = string_iter.next();
27752
27753 while key_result.is_some() {
27754 let val = match string_iter.next() {
27755 Some(x) => x,
27756 None => return std::result::Result::Err("Missing value while parsing PortworxVolumeSource".to_string())
27757 };
27758
27759 if let Some(key) = key_result {
27760 #[allow(clippy::match_single_binding)]
27761 match key {
27762 #[allow(clippy::redundant_clone)]
27763 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27764 #[allow(clippy::redundant_clone)]
27765 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27766 #[allow(clippy::redundant_clone)]
27767 "volumeID" => intermediate_rep.volume_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27768 _ => return std::result::Result::Err("Unexpected key while parsing PortworxVolumeSource".to_string())
27769 }
27770 }
27771
27772 key_result = string_iter.next();
27774 }
27775
27776 std::result::Result::Ok(PortworxVolumeSource {
27778 fs_type: intermediate_rep.fs_type.into_iter().next(),
27779 read_only: intermediate_rep.read_only.into_iter().next(),
27780 volume_id: intermediate_rep.volume_id.into_iter().next(),
27781 })
27782 }
27783}
27784
27785#[cfg(feature = "server")]
27788impl std::convert::TryFrom<header::IntoHeaderValue<PortworxVolumeSource>> for HeaderValue {
27789 type Error = String;
27790
27791 fn try_from(hdr_value: header::IntoHeaderValue<PortworxVolumeSource>) -> std::result::Result<Self, Self::Error> {
27792 let hdr_value = hdr_value.to_string();
27793 match HeaderValue::from_str(&hdr_value) {
27794 std::result::Result::Ok(value) => std::result::Result::Ok(value),
27795 std::result::Result::Err(e) => std::result::Result::Err(
27796 format!("Invalid header value for PortworxVolumeSource - value: {} is invalid {}",
27797 hdr_value, e))
27798 }
27799 }
27800}
27801
27802#[cfg(feature = "server")]
27803impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PortworxVolumeSource> {
27804 type Error = String;
27805
27806 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
27807 match hdr_value.to_str() {
27808 std::result::Result::Ok(value) => {
27809 match <PortworxVolumeSource as std::str::FromStr>::from_str(value) {
27810 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
27811 std::result::Result::Err(err) => std::result::Result::Err(
27812 format!("Unable to convert header value '{}' into PortworxVolumeSource - {}",
27813 value, err))
27814 }
27815 },
27816 std::result::Result::Err(e) => std::result::Result::Err(
27817 format!("Unable to convert header: {:?} to string: {}",
27818 hdr_value, e))
27819 }
27820 }
27821}
27822
27823
27824
27825
27826#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
27828#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
27829pub struct PreemptionPolicy(String);
27830
27831impl validator::Validate for PreemptionPolicy {
27832 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
27833 std::result::Result::Ok(())
27834 }
27835}
27836
27837impl std::convert::From<String> for PreemptionPolicy {
27838 fn from(x: String) -> Self {
27839 PreemptionPolicy(x)
27840 }
27841}
27842
27843impl std::string::ToString for PreemptionPolicy {
27844 fn to_string(&self) -> String {
27845 self.0.to_string()
27846 }
27847}
27848
27849impl std::str::FromStr for PreemptionPolicy {
27850 type Err = std::string::ParseError;
27851 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
27852 std::result::Result::Ok(PreemptionPolicy(x.to_string()))
27853 }
27854}
27855
27856impl std::convert::From<PreemptionPolicy> for String {
27857 fn from(x: PreemptionPolicy) -> Self {
27858 x.0
27859 }
27860}
27861
27862impl std::ops::Deref for PreemptionPolicy {
27863 type Target = String;
27864 fn deref(&self) -> &String {
27865 &self.0
27866 }
27867}
27868
27869impl std::ops::DerefMut for PreemptionPolicy {
27870 fn deref_mut(&mut self) -> &mut String {
27871 &mut self.0
27872 }
27873}
27874
27875
27876
27877#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
27882#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
27883pub struct PreferredSchedulingTerm {
27884 #[serde(rename = "preference")]
27885 #[serde(skip_serializing_if="Option::is_none")]
27886 pub preference: Option<models::NodeSelectorTerm>,
27887
27888#[serde(rename = "weight")]
27890 #[serde(skip_serializing_if="Option::is_none")]
27891 pub weight: Option<i32>,
27892
27893}
27894
27895
27896impl PreferredSchedulingTerm {
27897 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
27898 pub fn new() -> PreferredSchedulingTerm {
27899 PreferredSchedulingTerm {
27900 preference: None,
27901 weight: None,
27902 }
27903 }
27904}
27905
27906impl std::string::ToString for PreferredSchedulingTerm {
27910 fn to_string(&self) -> String {
27911 let params: Vec<Option<String>> = vec![
27912 self.weight.as_ref().map(|weight| {
27916 [
27917 "weight".to_string(),
27918 weight.to_string(),
27919 ].join(",")
27920 }),
27921
27922 ];
27923
27924 params.into_iter().flatten().collect::<Vec<_>>().join(",")
27925 }
27926}
27927
27928impl std::str::FromStr for PreferredSchedulingTerm {
27932 type Err = String;
27933
27934 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
27935 #[derive(Default)]
27937 #[allow(dead_code)]
27938 struct IntermediateRep {
27939 pub preference: Vec<models::NodeSelectorTerm>,
27940 pub weight: Vec<i32>,
27941 }
27942
27943 let mut intermediate_rep = IntermediateRep::default();
27944
27945 let mut string_iter = s.split(',');
27947 let mut key_result = string_iter.next();
27948
27949 while key_result.is_some() {
27950 let val = match string_iter.next() {
27951 Some(x) => x,
27952 None => return std::result::Result::Err("Missing value while parsing PreferredSchedulingTerm".to_string())
27953 };
27954
27955 if let Some(key) = key_result {
27956 #[allow(clippy::match_single_binding)]
27957 match key {
27958 #[allow(clippy::redundant_clone)]
27959 "preference" => intermediate_rep.preference.push(<models::NodeSelectorTerm as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27960 #[allow(clippy::redundant_clone)]
27961 "weight" => intermediate_rep.weight.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
27962 _ => return std::result::Result::Err("Unexpected key while parsing PreferredSchedulingTerm".to_string())
27963 }
27964 }
27965
27966 key_result = string_iter.next();
27968 }
27969
27970 std::result::Result::Ok(PreferredSchedulingTerm {
27972 preference: intermediate_rep.preference.into_iter().next(),
27973 weight: intermediate_rep.weight.into_iter().next(),
27974 })
27975 }
27976}
27977
27978#[cfg(feature = "server")]
27981impl std::convert::TryFrom<header::IntoHeaderValue<PreferredSchedulingTerm>> for HeaderValue {
27982 type Error = String;
27983
27984 fn try_from(hdr_value: header::IntoHeaderValue<PreferredSchedulingTerm>) -> std::result::Result<Self, Self::Error> {
27985 let hdr_value = hdr_value.to_string();
27986 match HeaderValue::from_str(&hdr_value) {
27987 std::result::Result::Ok(value) => std::result::Result::Ok(value),
27988 std::result::Result::Err(e) => std::result::Result::Err(
27989 format!("Invalid header value for PreferredSchedulingTerm - value: {} is invalid {}",
27990 hdr_value, e))
27991 }
27992 }
27993}
27994
27995#[cfg(feature = "server")]
27996impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PreferredSchedulingTerm> {
27997 type Error = String;
27998
27999 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
28000 match hdr_value.to_str() {
28001 std::result::Result::Ok(value) => {
28002 match <PreferredSchedulingTerm as std::str::FromStr>::from_str(value) {
28003 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
28004 std::result::Result::Err(err) => std::result::Result::Err(
28005 format!("Unable to convert header value '{}' into PreferredSchedulingTerm - {}",
28006 value, err))
28007 }
28008 },
28009 std::result::Result::Err(e) => std::result::Result::Err(
28010 format!("Unable to convert header: {:?} to string: {}",
28011 hdr_value, e))
28012 }
28013 }
28014}
28015
28016
28017
28018
28019#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
28024#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28025pub struct Probe {
28026 #[serde(rename = "exec")]
28027 #[serde(skip_serializing_if="Option::is_none")]
28028 pub exec: Option<models::ExecAction>,
28029
28030#[serde(rename = "failureThreshold")]
28032 #[serde(skip_serializing_if="Option::is_none")]
28033 pub failure_threshold: Option<i32>,
28034
28035 #[serde(rename = "grpc")]
28036 #[serde(skip_serializing_if="Option::is_none")]
28037 pub grpc: Option<models::GrpcAction>,
28038
28039 #[serde(rename = "httpGet")]
28040 #[serde(skip_serializing_if="Option::is_none")]
28041 pub http_get: Option<models::HttpGetAction>,
28042
28043#[serde(rename = "initialDelaySeconds")]
28045 #[serde(skip_serializing_if="Option::is_none")]
28046 pub initial_delay_seconds: Option<i32>,
28047
28048#[serde(rename = "periodSeconds")]
28050 #[serde(skip_serializing_if="Option::is_none")]
28051 pub period_seconds: Option<i32>,
28052
28053#[serde(rename = "successThreshold")]
28055 #[serde(skip_serializing_if="Option::is_none")]
28056 pub success_threshold: Option<i32>,
28057
28058 #[serde(rename = "tcpSocket")]
28059 #[serde(skip_serializing_if="Option::is_none")]
28060 pub tcp_socket: Option<models::TcpSocketAction>,
28061
28062#[serde(rename = "terminationGracePeriodSeconds")]
28064 #[serde(skip_serializing_if="Option::is_none")]
28065 pub termination_grace_period_seconds: Option<i64>,
28066
28067#[serde(rename = "timeoutSeconds")]
28069 #[serde(skip_serializing_if="Option::is_none")]
28070 pub timeout_seconds: Option<i32>,
28071
28072}
28073
28074
28075impl Probe {
28076 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
28077 pub fn new() -> Probe {
28078 Probe {
28079 exec: None,
28080 failure_threshold: None,
28081 grpc: None,
28082 http_get: None,
28083 initial_delay_seconds: None,
28084 period_seconds: None,
28085 success_threshold: None,
28086 tcp_socket: None,
28087 termination_grace_period_seconds: None,
28088 timeout_seconds: None,
28089 }
28090 }
28091}
28092
28093impl std::string::ToString for Probe {
28097 fn to_string(&self) -> String {
28098 let params: Vec<Option<String>> = vec![
28099 self.failure_threshold.as_ref().map(|failure_threshold| {
28103 [
28104 "failureThreshold".to_string(),
28105 failure_threshold.to_string(),
28106 ].join(",")
28107 }),
28108
28109 self.initial_delay_seconds.as_ref().map(|initial_delay_seconds| {
28115 [
28116 "initialDelaySeconds".to_string(),
28117 initial_delay_seconds.to_string(),
28118 ].join(",")
28119 }),
28120
28121
28122 self.period_seconds.as_ref().map(|period_seconds| {
28123 [
28124 "periodSeconds".to_string(),
28125 period_seconds.to_string(),
28126 ].join(",")
28127 }),
28128
28129
28130 self.success_threshold.as_ref().map(|success_threshold| {
28131 [
28132 "successThreshold".to_string(),
28133 success_threshold.to_string(),
28134 ].join(",")
28135 }),
28136
28137 self.termination_grace_period_seconds.as_ref().map(|termination_grace_period_seconds| {
28141 [
28142 "terminationGracePeriodSeconds".to_string(),
28143 termination_grace_period_seconds.to_string(),
28144 ].join(",")
28145 }),
28146
28147
28148 self.timeout_seconds.as_ref().map(|timeout_seconds| {
28149 [
28150 "timeoutSeconds".to_string(),
28151 timeout_seconds.to_string(),
28152 ].join(",")
28153 }),
28154
28155 ];
28156
28157 params.into_iter().flatten().collect::<Vec<_>>().join(",")
28158 }
28159}
28160
28161impl std::str::FromStr for Probe {
28165 type Err = String;
28166
28167 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
28168 #[derive(Default)]
28170 #[allow(dead_code)]
28171 struct IntermediateRep {
28172 pub exec: Vec<models::ExecAction>,
28173 pub failure_threshold: Vec<i32>,
28174 pub grpc: Vec<models::GrpcAction>,
28175 pub http_get: Vec<models::HttpGetAction>,
28176 pub initial_delay_seconds: Vec<i32>,
28177 pub period_seconds: Vec<i32>,
28178 pub success_threshold: Vec<i32>,
28179 pub tcp_socket: Vec<models::TcpSocketAction>,
28180 pub termination_grace_period_seconds: Vec<i64>,
28181 pub timeout_seconds: Vec<i32>,
28182 }
28183
28184 let mut intermediate_rep = IntermediateRep::default();
28185
28186 let mut string_iter = s.split(',');
28188 let mut key_result = string_iter.next();
28189
28190 while key_result.is_some() {
28191 let val = match string_iter.next() {
28192 Some(x) => x,
28193 None => return std::result::Result::Err("Missing value while parsing Probe".to_string())
28194 };
28195
28196 if let Some(key) = key_result {
28197 #[allow(clippy::match_single_binding)]
28198 match key {
28199 #[allow(clippy::redundant_clone)]
28200 "exec" => intermediate_rep.exec.push(<models::ExecAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28201 #[allow(clippy::redundant_clone)]
28202 "failureThreshold" => intermediate_rep.failure_threshold.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28203 #[allow(clippy::redundant_clone)]
28204 "grpc" => intermediate_rep.grpc.push(<models::GrpcAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28205 #[allow(clippy::redundant_clone)]
28206 "httpGet" => intermediate_rep.http_get.push(<models::HttpGetAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28207 #[allow(clippy::redundant_clone)]
28208 "initialDelaySeconds" => intermediate_rep.initial_delay_seconds.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28209 #[allow(clippy::redundant_clone)]
28210 "periodSeconds" => intermediate_rep.period_seconds.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28211 #[allow(clippy::redundant_clone)]
28212 "successThreshold" => intermediate_rep.success_threshold.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28213 #[allow(clippy::redundant_clone)]
28214 "tcpSocket" => intermediate_rep.tcp_socket.push(<models::TcpSocketAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28215 #[allow(clippy::redundant_clone)]
28216 "terminationGracePeriodSeconds" => intermediate_rep.termination_grace_period_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28217 #[allow(clippy::redundant_clone)]
28218 "timeoutSeconds" => intermediate_rep.timeout_seconds.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28219 _ => return std::result::Result::Err("Unexpected key while parsing Probe".to_string())
28220 }
28221 }
28222
28223 key_result = string_iter.next();
28225 }
28226
28227 std::result::Result::Ok(Probe {
28229 exec: intermediate_rep.exec.into_iter().next(),
28230 failure_threshold: intermediate_rep.failure_threshold.into_iter().next(),
28231 grpc: intermediate_rep.grpc.into_iter().next(),
28232 http_get: intermediate_rep.http_get.into_iter().next(),
28233 initial_delay_seconds: intermediate_rep.initial_delay_seconds.into_iter().next(),
28234 period_seconds: intermediate_rep.period_seconds.into_iter().next(),
28235 success_threshold: intermediate_rep.success_threshold.into_iter().next(),
28236 tcp_socket: intermediate_rep.tcp_socket.into_iter().next(),
28237 termination_grace_period_seconds: intermediate_rep.termination_grace_period_seconds.into_iter().next(),
28238 timeout_seconds: intermediate_rep.timeout_seconds.into_iter().next(),
28239 })
28240 }
28241}
28242
28243#[cfg(feature = "server")]
28246impl std::convert::TryFrom<header::IntoHeaderValue<Probe>> for HeaderValue {
28247 type Error = String;
28248
28249 fn try_from(hdr_value: header::IntoHeaderValue<Probe>) -> std::result::Result<Self, Self::Error> {
28250 let hdr_value = hdr_value.to_string();
28251 match HeaderValue::from_str(&hdr_value) {
28252 std::result::Result::Ok(value) => std::result::Result::Ok(value),
28253 std::result::Result::Err(e) => std::result::Result::Err(
28254 format!("Invalid header value for Probe - value: {} is invalid {}",
28255 hdr_value, e))
28256 }
28257 }
28258}
28259
28260#[cfg(feature = "server")]
28261impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Probe> {
28262 type Error = String;
28263
28264 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
28265 match hdr_value.to_str() {
28266 std::result::Result::Ok(value) => {
28267 match <Probe as std::str::FromStr>::from_str(value) {
28268 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
28269 std::result::Result::Err(err) => std::result::Result::Err(
28270 format!("Unable to convert header value '{}' into Probe - {}",
28271 value, err))
28272 }
28273 },
28274 std::result::Result::Err(e) => std::result::Result::Err(
28275 format!("Unable to convert header: {:?} to string: {}",
28276 hdr_value, e))
28277 }
28278 }
28279}
28280
28281
28282
28283
28284#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
28289#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28290pub struct ProbeHandler {
28291 #[serde(rename = "exec")]
28292 #[serde(skip_serializing_if="Option::is_none")]
28293 pub exec: Option<models::ExecAction>,
28294
28295 #[serde(rename = "grpc")]
28296 #[serde(skip_serializing_if="Option::is_none")]
28297 pub grpc: Option<models::GrpcAction>,
28298
28299 #[serde(rename = "httpGet")]
28300 #[serde(skip_serializing_if="Option::is_none")]
28301 pub http_get: Option<models::HttpGetAction>,
28302
28303 #[serde(rename = "tcpSocket")]
28304 #[serde(skip_serializing_if="Option::is_none")]
28305 pub tcp_socket: Option<models::TcpSocketAction>,
28306
28307}
28308
28309
28310impl ProbeHandler {
28311 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
28312 pub fn new() -> ProbeHandler {
28313 ProbeHandler {
28314 exec: None,
28315 grpc: None,
28316 http_get: None,
28317 tcp_socket: None,
28318 }
28319 }
28320}
28321
28322impl std::string::ToString for ProbeHandler {
28326 fn to_string(&self) -> String {
28327 let params: Vec<Option<String>> = vec![
28328 ];
28337
28338 params.into_iter().flatten().collect::<Vec<_>>().join(",")
28339 }
28340}
28341
28342impl std::str::FromStr for ProbeHandler {
28346 type Err = String;
28347
28348 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
28349 #[derive(Default)]
28351 #[allow(dead_code)]
28352 struct IntermediateRep {
28353 pub exec: Vec<models::ExecAction>,
28354 pub grpc: Vec<models::GrpcAction>,
28355 pub http_get: Vec<models::HttpGetAction>,
28356 pub tcp_socket: Vec<models::TcpSocketAction>,
28357 }
28358
28359 let mut intermediate_rep = IntermediateRep::default();
28360
28361 let mut string_iter = s.split(',');
28363 let mut key_result = string_iter.next();
28364
28365 while key_result.is_some() {
28366 let val = match string_iter.next() {
28367 Some(x) => x,
28368 None => return std::result::Result::Err("Missing value while parsing ProbeHandler".to_string())
28369 };
28370
28371 if let Some(key) = key_result {
28372 #[allow(clippy::match_single_binding)]
28373 match key {
28374 #[allow(clippy::redundant_clone)]
28375 "exec" => intermediate_rep.exec.push(<models::ExecAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28376 #[allow(clippy::redundant_clone)]
28377 "grpc" => intermediate_rep.grpc.push(<models::GrpcAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28378 #[allow(clippy::redundant_clone)]
28379 "httpGet" => intermediate_rep.http_get.push(<models::HttpGetAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28380 #[allow(clippy::redundant_clone)]
28381 "tcpSocket" => intermediate_rep.tcp_socket.push(<models::TcpSocketAction as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28382 _ => return std::result::Result::Err("Unexpected key while parsing ProbeHandler".to_string())
28383 }
28384 }
28385
28386 key_result = string_iter.next();
28388 }
28389
28390 std::result::Result::Ok(ProbeHandler {
28392 exec: intermediate_rep.exec.into_iter().next(),
28393 grpc: intermediate_rep.grpc.into_iter().next(),
28394 http_get: intermediate_rep.http_get.into_iter().next(),
28395 tcp_socket: intermediate_rep.tcp_socket.into_iter().next(),
28396 })
28397 }
28398}
28399
28400#[cfg(feature = "server")]
28403impl std::convert::TryFrom<header::IntoHeaderValue<ProbeHandler>> for HeaderValue {
28404 type Error = String;
28405
28406 fn try_from(hdr_value: header::IntoHeaderValue<ProbeHandler>) -> std::result::Result<Self, Self::Error> {
28407 let hdr_value = hdr_value.to_string();
28408 match HeaderValue::from_str(&hdr_value) {
28409 std::result::Result::Ok(value) => std::result::Result::Ok(value),
28410 std::result::Result::Err(e) => std::result::Result::Err(
28411 format!("Invalid header value for ProbeHandler - value: {} is invalid {}",
28412 hdr_value, e))
28413 }
28414 }
28415}
28416
28417#[cfg(feature = "server")]
28418impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ProbeHandler> {
28419 type Error = String;
28420
28421 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
28422 match hdr_value.to_str() {
28423 std::result::Result::Ok(value) => {
28424 match <ProbeHandler as std::str::FromStr>::from_str(value) {
28425 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
28426 std::result::Result::Err(err) => std::result::Result::Err(
28427 format!("Unable to convert header value '{}' into ProbeHandler - {}",
28428 value, err))
28429 }
28430 },
28431 std::result::Result::Err(e) => std::result::Result::Err(
28432 format!("Unable to convert header: {:?} to string: {}",
28433 hdr_value, e))
28434 }
28435 }
28436}
28437
28438
28439
28440
28441#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
28443#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28444pub struct ProcMountType(String);
28445
28446impl validator::Validate for ProcMountType {
28447 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
28448 std::result::Result::Ok(())
28449 }
28450}
28451
28452impl std::convert::From<String> for ProcMountType {
28453 fn from(x: String) -> Self {
28454 ProcMountType(x)
28455 }
28456}
28457
28458impl std::string::ToString for ProcMountType {
28459 fn to_string(&self) -> String {
28460 self.0.to_string()
28461 }
28462}
28463
28464impl std::str::FromStr for ProcMountType {
28465 type Err = std::string::ParseError;
28466 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
28467 std::result::Result::Ok(ProcMountType(x.to_string()))
28468 }
28469}
28470
28471impl std::convert::From<ProcMountType> for String {
28472 fn from(x: ProcMountType) -> Self {
28473 x.0
28474 }
28475}
28476
28477impl std::ops::Deref for ProcMountType {
28478 type Target = String;
28479 fn deref(&self) -> &String {
28480 &self.0
28481 }
28482}
28483
28484impl std::ops::DerefMut for ProcMountType {
28485 fn deref_mut(&mut self) -> &mut String {
28486 &mut self.0
28487 }
28488}
28489
28490
28491
28492#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
28497#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28498pub struct ProjectedVolumeSource {
28499#[serde(rename = "defaultMode")]
28501 #[serde(skip_serializing_if="Option::is_none")]
28502 pub default_mode: Option<i32>,
28503
28504#[serde(rename = "sources")]
28506 #[serde(skip_serializing_if="Option::is_none")]
28507 pub sources: Option<Vec<models::VolumeProjection>>,
28508
28509}
28510
28511
28512impl ProjectedVolumeSource {
28513 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
28514 pub fn new() -> ProjectedVolumeSource {
28515 ProjectedVolumeSource {
28516 default_mode: None,
28517 sources: None,
28518 }
28519 }
28520}
28521
28522impl std::string::ToString for ProjectedVolumeSource {
28526 fn to_string(&self) -> String {
28527 let params: Vec<Option<String>> = vec![
28528
28529 self.default_mode.as_ref().map(|default_mode| {
28530 [
28531 "defaultMode".to_string(),
28532 default_mode.to_string(),
28533 ].join(",")
28534 }),
28535
28536 ];
28539
28540 params.into_iter().flatten().collect::<Vec<_>>().join(",")
28541 }
28542}
28543
28544impl std::str::FromStr for ProjectedVolumeSource {
28548 type Err = String;
28549
28550 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
28551 #[derive(Default)]
28553 #[allow(dead_code)]
28554 struct IntermediateRep {
28555 pub default_mode: Vec<i32>,
28556 pub sources: Vec<Vec<models::VolumeProjection>>,
28557 }
28558
28559 let mut intermediate_rep = IntermediateRep::default();
28560
28561 let mut string_iter = s.split(',');
28563 let mut key_result = string_iter.next();
28564
28565 while key_result.is_some() {
28566 let val = match string_iter.next() {
28567 Some(x) => x,
28568 None => return std::result::Result::Err("Missing value while parsing ProjectedVolumeSource".to_string())
28569 };
28570
28571 if let Some(key) = key_result {
28572 #[allow(clippy::match_single_binding)]
28573 match key {
28574 #[allow(clippy::redundant_clone)]
28575 "defaultMode" => intermediate_rep.default_mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28576 "sources" => return std::result::Result::Err("Parsing a container in this style is not supported in ProjectedVolumeSource".to_string()),
28577 _ => return std::result::Result::Err("Unexpected key while parsing ProjectedVolumeSource".to_string())
28578 }
28579 }
28580
28581 key_result = string_iter.next();
28583 }
28584
28585 std::result::Result::Ok(ProjectedVolumeSource {
28587 default_mode: intermediate_rep.default_mode.into_iter().next(),
28588 sources: intermediate_rep.sources.into_iter().next(),
28589 })
28590 }
28591}
28592
28593#[cfg(feature = "server")]
28596impl std::convert::TryFrom<header::IntoHeaderValue<ProjectedVolumeSource>> for HeaderValue {
28597 type Error = String;
28598
28599 fn try_from(hdr_value: header::IntoHeaderValue<ProjectedVolumeSource>) -> std::result::Result<Self, Self::Error> {
28600 let hdr_value = hdr_value.to_string();
28601 match HeaderValue::from_str(&hdr_value) {
28602 std::result::Result::Ok(value) => std::result::Result::Ok(value),
28603 std::result::Result::Err(e) => std::result::Result::Err(
28604 format!("Invalid header value for ProjectedVolumeSource - value: {} is invalid {}",
28605 hdr_value, e))
28606 }
28607 }
28608}
28609
28610#[cfg(feature = "server")]
28611impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ProjectedVolumeSource> {
28612 type Error = String;
28613
28614 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
28615 match hdr_value.to_str() {
28616 std::result::Result::Ok(value) => {
28617 match <ProjectedVolumeSource as std::str::FromStr>::from_str(value) {
28618 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
28619 std::result::Result::Err(err) => std::result::Result::Err(
28620 format!("Unable to convert header value '{}' into ProjectedVolumeSource - {}",
28621 value, err))
28622 }
28623 },
28624 std::result::Result::Err(e) => std::result::Result::Err(
28625 format!("Unable to convert header: {:?} to string: {}",
28626 hdr_value, e))
28627 }
28628 }
28629}
28630
28631
28632
28633
28634#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
28635#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28636pub struct Propagation(String);
28637
28638impl validator::Validate for Propagation {
28639 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
28640 std::result::Result::Ok(())
28641 }
28642}
28643
28644impl std::convert::From<String> for Propagation {
28645 fn from(x: String) -> Self {
28646 Propagation(x)
28647 }
28648}
28649
28650impl std::string::ToString for Propagation {
28651 fn to_string(&self) -> String {
28652 self.0.to_string()
28653 }
28654}
28655
28656impl std::str::FromStr for Propagation {
28657 type Err = std::string::ParseError;
28658 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
28659 std::result::Result::Ok(Propagation(x.to_string()))
28660 }
28661}
28662
28663impl std::convert::From<Propagation> for String {
28664 fn from(x: Propagation) -> Self {
28665 x.0
28666 }
28667}
28668
28669impl std::ops::Deref for Propagation {
28670 type Target = String;
28671 fn deref(&self) -> &String {
28672 &self.0
28673 }
28674}
28675
28676impl std::ops::DerefMut for Propagation {
28677 fn deref_mut(&mut self) -> &mut String {
28678 &mut self.0
28679 }
28680}
28681
28682
28683
28684#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
28686#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28687pub struct Protocol(String);
28688
28689impl validator::Validate for Protocol {
28690 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
28691 std::result::Result::Ok(())
28692 }
28693}
28694
28695impl std::convert::From<String> for Protocol {
28696 fn from(x: String) -> Self {
28697 Protocol(x)
28698 }
28699}
28700
28701impl std::string::ToString for Protocol {
28702 fn to_string(&self) -> String {
28703 self.0.to_string()
28704 }
28705}
28706
28707impl std::str::FromStr for Protocol {
28708 type Err = std::string::ParseError;
28709 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
28710 std::result::Result::Ok(Protocol(x.to_string()))
28711 }
28712}
28713
28714impl std::convert::From<Protocol> for String {
28715 fn from(x: Protocol) -> Self {
28716 x.0
28717 }
28718}
28719
28720impl std::ops::Deref for Protocol {
28721 type Target = String;
28722 fn deref(&self) -> &String {
28723 &self.0
28724 }
28725}
28726
28727impl std::ops::DerefMut for Protocol {
28728 fn deref_mut(&mut self) -> &mut String {
28729 &mut self.0
28730 }
28731}
28732
28733
28734
28735
28736
28737
28738#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
28739#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28740pub struct PublicKey {
28741#[serde(rename = "publicKey")]
28743 pub public_key: String,
28744
28745}
28746
28747
28748impl PublicKey {
28749 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
28750 pub fn new(public_key: String, ) -> PublicKey {
28751 PublicKey {
28752 public_key,
28753 }
28754 }
28755}
28756
28757impl std::string::ToString for PublicKey {
28761 fn to_string(&self) -> String {
28762 let params: Vec<Option<String>> = vec![
28763
28764 Some("publicKey".to_string()),
28765 Some(self.public_key.to_string()),
28766
28767 ];
28768
28769 params.into_iter().flatten().collect::<Vec<_>>().join(",")
28770 }
28771}
28772
28773impl std::str::FromStr for PublicKey {
28777 type Err = String;
28778
28779 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
28780 #[derive(Default)]
28782 #[allow(dead_code)]
28783 struct IntermediateRep {
28784 pub public_key: Vec<String>,
28785 }
28786
28787 let mut intermediate_rep = IntermediateRep::default();
28788
28789 let mut string_iter = s.split(',');
28791 let mut key_result = string_iter.next();
28792
28793 while key_result.is_some() {
28794 let val = match string_iter.next() {
28795 Some(x) => x,
28796 None => return std::result::Result::Err("Missing value while parsing PublicKey".to_string())
28797 };
28798
28799 if let Some(key) = key_result {
28800 #[allow(clippy::match_single_binding)]
28801 match key {
28802 #[allow(clippy::redundant_clone)]
28803 "publicKey" => intermediate_rep.public_key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
28804 _ => return std::result::Result::Err("Unexpected key while parsing PublicKey".to_string())
28805 }
28806 }
28807
28808 key_result = string_iter.next();
28810 }
28811
28812 std::result::Result::Ok(PublicKey {
28814 public_key: intermediate_rep.public_key.into_iter().next().ok_or_else(|| "publicKey missing in PublicKey".to_string())?,
28815 })
28816 }
28817}
28818
28819#[cfg(feature = "server")]
28822impl std::convert::TryFrom<header::IntoHeaderValue<PublicKey>> for HeaderValue {
28823 type Error = String;
28824
28825 fn try_from(hdr_value: header::IntoHeaderValue<PublicKey>) -> std::result::Result<Self, Self::Error> {
28826 let hdr_value = hdr_value.to_string();
28827 match HeaderValue::from_str(&hdr_value) {
28828 std::result::Result::Ok(value) => std::result::Result::Ok(value),
28829 std::result::Result::Err(e) => std::result::Result::Err(
28830 format!("Invalid header value for PublicKey - value: {} is invalid {}",
28831 hdr_value, e))
28832 }
28833 }
28834}
28835
28836#[cfg(feature = "server")]
28837impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PublicKey> {
28838 type Error = String;
28839
28840 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
28841 match hdr_value.to_str() {
28842 std::result::Result::Ok(value) => {
28843 match <PublicKey as std::str::FromStr>::from_str(value) {
28844 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
28845 std::result::Result::Err(err) => std::result::Result::Err(
28846 format!("Unable to convert header value '{}' into PublicKey - {}",
28847 value, err))
28848 }
28849 },
28850 std::result::Result::Err(e) => std::result::Result::Err(
28851 format!("Unable to convert header: {:?} to string: {}",
28852 hdr_value, e))
28853 }
28854 }
28855}
28856
28857
28858
28859
28860
28861
28862
28863#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
28864#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
28865pub struct PublicKeyAuthRequest {
28866#[serde(rename = "clientVersion")]
28868 #[serde(skip_serializing_if="Option::is_none")]
28869 pub client_version: Option<String>,
28870
28871#[serde(rename = "connectionId")]
28873 pub connection_id: String,
28874
28875#[serde(rename = "environment")]
28877 #[serde(skip_serializing_if="Option::is_none")]
28878 pub environment: Option<std::collections::HashMap<String, models::MetadataValue>>,
28879
28880#[serde(rename = "files")]
28882 #[serde(skip_serializing_if="Option::is_none")]
28883 pub files: Option<std::collections::HashMap<String, models::BinaryMetadataValue>>,
28884
28885#[serde(rename = "metadata")]
28887 #[serde(skip_serializing_if="Option::is_none")]
28888 pub metadata: Option<std::collections::HashMap<String, models::MetadataValue>>,
28889
28890#[serde(rename = "publicKey")]
28892 pub public_key: String,
28893
28894#[serde(rename = "remoteAddress")]
28896 pub remote_address: String,
28897
28898#[serde(rename = "username")]
28900 pub username: String,
28901
28902}
28903
28904
28905impl PublicKeyAuthRequest {
28906 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
28907 pub fn new(connection_id: String, public_key: String, remote_address: String, username: String, ) -> PublicKeyAuthRequest {
28908 PublicKeyAuthRequest {
28909 client_version: None,
28910 connection_id,
28911 environment: None,
28912 files: None,
28913 metadata: None,
28914 public_key,
28915 remote_address,
28916 username,
28917 }
28918 }
28919}
28920
28921impl std::string::ToString for PublicKeyAuthRequest {
28925 fn to_string(&self) -> String {
28926 let params: Vec<Option<String>> = vec![
28927
28928 self.client_version.as_ref().map(|client_version| {
28929 [
28930 "clientVersion".to_string(),
28931 client_version.to_string(),
28932 ].join(",")
28933 }),
28934
28935
28936 Some("connectionId".to_string()),
28937 Some(self.connection_id.to_string()),
28938
28939 Some("publicKey".to_string()),
28950 Some(self.public_key.to_string()),
28951
28952
28953 Some("remoteAddress".to_string()),
28954 Some(self.remote_address.to_string()),
28955
28956
28957 Some("username".to_string()),
28958 Some(self.username.to_string()),
28959
28960 ];
28961
28962 params.into_iter().flatten().collect::<Vec<_>>().join(",")
28963 }
28964}
28965
28966impl std::str::FromStr for PublicKeyAuthRequest {
28970 type Err = String;
28971
28972 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
28973 #[derive(Default)]
28975 #[allow(dead_code)]
28976 struct IntermediateRep {
28977 pub client_version: Vec<String>,
28978 pub connection_id: Vec<String>,
28979 pub environment: Vec<std::collections::HashMap<String, models::MetadataValue>>,
28980 pub files: Vec<std::collections::HashMap<String, models::BinaryMetadataValue>>,
28981 pub metadata: Vec<std::collections::HashMap<String, models::MetadataValue>>,
28982 pub public_key: Vec<String>,
28983 pub remote_address: Vec<String>,
28984 pub username: Vec<String>,
28985 }
28986
28987 let mut intermediate_rep = IntermediateRep::default();
28988
28989 let mut string_iter = s.split(',');
28991 let mut key_result = string_iter.next();
28992
28993 while key_result.is_some() {
28994 let val = match string_iter.next() {
28995 Some(x) => x,
28996 None => return std::result::Result::Err("Missing value while parsing PublicKeyAuthRequest".to_string())
28997 };
28998
28999 if let Some(key) = key_result {
29000 #[allow(clippy::match_single_binding)]
29001 match key {
29002 #[allow(clippy::redundant_clone)]
29003 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29004 #[allow(clippy::redundant_clone)]
29005 "connectionId" => intermediate_rep.connection_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29006 "environment" => return std::result::Result::Err("Parsing a container in this style is not supported in PublicKeyAuthRequest".to_string()),
29007 "files" => return std::result::Result::Err("Parsing a container in this style is not supported in PublicKeyAuthRequest".to_string()),
29008 "metadata" => return std::result::Result::Err("Parsing a container in this style is not supported in PublicKeyAuthRequest".to_string()),
29009 #[allow(clippy::redundant_clone)]
29010 "publicKey" => intermediate_rep.public_key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29011 #[allow(clippy::redundant_clone)]
29012 "remoteAddress" => intermediate_rep.remote_address.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29013 #[allow(clippy::redundant_clone)]
29014 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29015 _ => return std::result::Result::Err("Unexpected key while parsing PublicKeyAuthRequest".to_string())
29016 }
29017 }
29018
29019 key_result = string_iter.next();
29021 }
29022
29023 std::result::Result::Ok(PublicKeyAuthRequest {
29025 client_version: intermediate_rep.client_version.into_iter().next(),
29026 connection_id: intermediate_rep.connection_id.into_iter().next().ok_or_else(|| "connectionId missing in PublicKeyAuthRequest".to_string())?,
29027 environment: intermediate_rep.environment.into_iter().next(),
29028 files: intermediate_rep.files.into_iter().next(),
29029 metadata: intermediate_rep.metadata.into_iter().next(),
29030 public_key: intermediate_rep.public_key.into_iter().next().ok_or_else(|| "publicKey missing in PublicKeyAuthRequest".to_string())?,
29031 remote_address: intermediate_rep.remote_address.into_iter().next().ok_or_else(|| "remoteAddress missing in PublicKeyAuthRequest".to_string())?,
29032 username: intermediate_rep.username.into_iter().next().ok_or_else(|| "username missing in PublicKeyAuthRequest".to_string())?,
29033 })
29034 }
29035}
29036
29037#[cfg(feature = "server")]
29040impl std::convert::TryFrom<header::IntoHeaderValue<PublicKeyAuthRequest>> for HeaderValue {
29041 type Error = String;
29042
29043 fn try_from(hdr_value: header::IntoHeaderValue<PublicKeyAuthRequest>) -> std::result::Result<Self, Self::Error> {
29044 let hdr_value = hdr_value.to_string();
29045 match HeaderValue::from_str(&hdr_value) {
29046 std::result::Result::Ok(value) => std::result::Result::Ok(value),
29047 std::result::Result::Err(e) => std::result::Result::Err(
29048 format!("Invalid header value for PublicKeyAuthRequest - value: {} is invalid {}",
29049 hdr_value, e))
29050 }
29051 }
29052}
29053
29054#[cfg(feature = "server")]
29055impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<PublicKeyAuthRequest> {
29056 type Error = String;
29057
29058 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
29059 match hdr_value.to_str() {
29060 std::result::Result::Ok(value) => {
29061 match <PublicKeyAuthRequest as std::str::FromStr>::from_str(value) {
29062 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
29063 std::result::Result::Err(err) => std::result::Result::Err(
29064 format!("Unable to convert header value '{}' into PublicKeyAuthRequest - {}",
29065 value, err))
29066 }
29067 },
29068 std::result::Result::Err(e) => std::result::Result::Err(
29069 format!("Unable to convert header: {:?} to string: {}",
29070 hdr_value, e))
29071 }
29072 }
29073}
29074
29075
29076
29077
29078#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
29080#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29081pub struct PullPolicy(String);
29082
29083impl validator::Validate for PullPolicy {
29084 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
29085 std::result::Result::Ok(())
29086 }
29087}
29088
29089impl std::convert::From<String> for PullPolicy {
29090 fn from(x: String) -> Self {
29091 PullPolicy(x)
29092 }
29093}
29094
29095impl std::string::ToString for PullPolicy {
29096 fn to_string(&self) -> String {
29097 self.0.to_string()
29098 }
29099}
29100
29101impl std::str::FromStr for PullPolicy {
29102 type Err = std::string::ParseError;
29103 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
29104 std::result::Result::Ok(PullPolicy(x.to_string()))
29105 }
29106}
29107
29108impl std::convert::From<PullPolicy> for String {
29109 fn from(x: PullPolicy) -> Self {
29110 x.0
29111 }
29112}
29113
29114impl std::ops::Deref for PullPolicy {
29115 type Target = String;
29116 fn deref(&self) -> &String {
29117 &self.0
29118 }
29119}
29120
29121impl std::ops::DerefMut for PullPolicy {
29122 fn deref_mut(&mut self) -> &mut String {
29123 &mut self.0
29124 }
29125}
29126
29127#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
29128#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29129pub struct Quantity(String);
29130
29131#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
29136#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29137pub struct QuobyteVolumeSource {
29138#[serde(rename = "group")]
29140 #[serde(skip_serializing_if="Option::is_none")]
29141 pub group: Option<String>,
29142
29143#[serde(rename = "readOnly")]
29145 #[serde(skip_serializing_if="Option::is_none")]
29146 pub read_only: Option<bool>,
29147
29148#[serde(rename = "registry")]
29150 #[serde(skip_serializing_if="Option::is_none")]
29151 pub registry: Option<String>,
29152
29153#[serde(rename = "tenant")]
29155 #[serde(skip_serializing_if="Option::is_none")]
29156 pub tenant: Option<String>,
29157
29158#[serde(rename = "user")]
29160 #[serde(skip_serializing_if="Option::is_none")]
29161 pub user: Option<String>,
29162
29163#[serde(rename = "volume")]
29165 #[serde(skip_serializing_if="Option::is_none")]
29166 pub volume: Option<String>,
29167
29168}
29169
29170
29171impl QuobyteVolumeSource {
29172 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
29173 pub fn new() -> QuobyteVolumeSource {
29174 QuobyteVolumeSource {
29175 group: None,
29176 read_only: None,
29177 registry: None,
29178 tenant: None,
29179 user: None,
29180 volume: None,
29181 }
29182 }
29183}
29184
29185impl std::string::ToString for QuobyteVolumeSource {
29189 fn to_string(&self) -> String {
29190 let params: Vec<Option<String>> = vec![
29191
29192 self.group.as_ref().map(|group| {
29193 [
29194 "group".to_string(),
29195 group.to_string(),
29196 ].join(",")
29197 }),
29198
29199
29200 self.read_only.as_ref().map(|read_only| {
29201 [
29202 "readOnly".to_string(),
29203 read_only.to_string(),
29204 ].join(",")
29205 }),
29206
29207
29208 self.registry.as_ref().map(|registry| {
29209 [
29210 "registry".to_string(),
29211 registry.to_string(),
29212 ].join(",")
29213 }),
29214
29215
29216 self.tenant.as_ref().map(|tenant| {
29217 [
29218 "tenant".to_string(),
29219 tenant.to_string(),
29220 ].join(",")
29221 }),
29222
29223
29224 self.user.as_ref().map(|user| {
29225 [
29226 "user".to_string(),
29227 user.to_string(),
29228 ].join(",")
29229 }),
29230
29231
29232 self.volume.as_ref().map(|volume| {
29233 [
29234 "volume".to_string(),
29235 volume.to_string(),
29236 ].join(",")
29237 }),
29238
29239 ];
29240
29241 params.into_iter().flatten().collect::<Vec<_>>().join(",")
29242 }
29243}
29244
29245impl std::str::FromStr for QuobyteVolumeSource {
29249 type Err = String;
29250
29251 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
29252 #[derive(Default)]
29254 #[allow(dead_code)]
29255 struct IntermediateRep {
29256 pub group: Vec<String>,
29257 pub read_only: Vec<bool>,
29258 pub registry: Vec<String>,
29259 pub tenant: Vec<String>,
29260 pub user: Vec<String>,
29261 pub volume: Vec<String>,
29262 }
29263
29264 let mut intermediate_rep = IntermediateRep::default();
29265
29266 let mut string_iter = s.split(',');
29268 let mut key_result = string_iter.next();
29269
29270 while key_result.is_some() {
29271 let val = match string_iter.next() {
29272 Some(x) => x,
29273 None => return std::result::Result::Err("Missing value while parsing QuobyteVolumeSource".to_string())
29274 };
29275
29276 if let Some(key) = key_result {
29277 #[allow(clippy::match_single_binding)]
29278 match key {
29279 #[allow(clippy::redundant_clone)]
29280 "group" => intermediate_rep.group.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29281 #[allow(clippy::redundant_clone)]
29282 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29283 #[allow(clippy::redundant_clone)]
29284 "registry" => intermediate_rep.registry.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29285 #[allow(clippy::redundant_clone)]
29286 "tenant" => intermediate_rep.tenant.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29287 #[allow(clippy::redundant_clone)]
29288 "user" => intermediate_rep.user.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29289 #[allow(clippy::redundant_clone)]
29290 "volume" => intermediate_rep.volume.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29291 _ => return std::result::Result::Err("Unexpected key while parsing QuobyteVolumeSource".to_string())
29292 }
29293 }
29294
29295 key_result = string_iter.next();
29297 }
29298
29299 std::result::Result::Ok(QuobyteVolumeSource {
29301 group: intermediate_rep.group.into_iter().next(),
29302 read_only: intermediate_rep.read_only.into_iter().next(),
29303 registry: intermediate_rep.registry.into_iter().next(),
29304 tenant: intermediate_rep.tenant.into_iter().next(),
29305 user: intermediate_rep.user.into_iter().next(),
29306 volume: intermediate_rep.volume.into_iter().next(),
29307 })
29308 }
29309}
29310
29311#[cfg(feature = "server")]
29314impl std::convert::TryFrom<header::IntoHeaderValue<QuobyteVolumeSource>> for HeaderValue {
29315 type Error = String;
29316
29317 fn try_from(hdr_value: header::IntoHeaderValue<QuobyteVolumeSource>) -> std::result::Result<Self, Self::Error> {
29318 let hdr_value = hdr_value.to_string();
29319 match HeaderValue::from_str(&hdr_value) {
29320 std::result::Result::Ok(value) => std::result::Result::Ok(value),
29321 std::result::Result::Err(e) => std::result::Result::Err(
29322 format!("Invalid header value for QuobyteVolumeSource - value: {} is invalid {}",
29323 hdr_value, e))
29324 }
29325 }
29326}
29327
29328#[cfg(feature = "server")]
29329impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<QuobyteVolumeSource> {
29330 type Error = String;
29331
29332 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
29333 match hdr_value.to_str() {
29334 std::result::Result::Ok(value) => {
29335 match <QuobyteVolumeSource as std::str::FromStr>::from_str(value) {
29336 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
29337 std::result::Result::Err(err) => std::result::Result::Err(
29338 format!("Unable to convert header value '{}' into QuobyteVolumeSource - {}",
29339 value, err))
29340 }
29341 },
29342 std::result::Result::Err(e) => std::result::Result::Err(
29343 format!("Unable to convert header: {:?} to string: {}",
29344 hdr_value, e))
29345 }
29346 }
29347}
29348
29349
29350
29351
29352#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
29357#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29358pub struct RbdVolumeSource {
29359#[serde(rename = "fsType")]
29361 #[serde(skip_serializing_if="Option::is_none")]
29362 pub fs_type: Option<String>,
29363
29364#[serde(rename = "image")]
29366 #[serde(skip_serializing_if="Option::is_none")]
29367 pub image: Option<String>,
29368
29369#[serde(rename = "keyring")]
29371 #[serde(skip_serializing_if="Option::is_none")]
29372 pub keyring: Option<String>,
29373
29374#[serde(rename = "monitors")]
29376 #[serde(skip_serializing_if="Option::is_none")]
29377 pub monitors: Option<Vec<String>>,
29378
29379#[serde(rename = "pool")]
29381 #[serde(skip_serializing_if="Option::is_none")]
29382 pub pool: Option<String>,
29383
29384#[serde(rename = "readOnly")]
29386 #[serde(skip_serializing_if="Option::is_none")]
29387 pub read_only: Option<bool>,
29388
29389 #[serde(rename = "secretRef")]
29390 #[serde(skip_serializing_if="Option::is_none")]
29391 pub secret_ref: Option<models::LocalObjectReference>,
29392
29393#[serde(rename = "user")]
29395 #[serde(skip_serializing_if="Option::is_none")]
29396 pub user: Option<String>,
29397
29398}
29399
29400
29401impl RbdVolumeSource {
29402 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
29403 pub fn new() -> RbdVolumeSource {
29404 RbdVolumeSource {
29405 fs_type: None,
29406 image: None,
29407 keyring: None,
29408 monitors: None,
29409 pool: None,
29410 read_only: None,
29411 secret_ref: None,
29412 user: None,
29413 }
29414 }
29415}
29416
29417impl std::string::ToString for RbdVolumeSource {
29421 fn to_string(&self) -> String {
29422 let params: Vec<Option<String>> = vec![
29423
29424 self.fs_type.as_ref().map(|fs_type| {
29425 [
29426 "fsType".to_string(),
29427 fs_type.to_string(),
29428 ].join(",")
29429 }),
29430
29431
29432 self.image.as_ref().map(|image| {
29433 [
29434 "image".to_string(),
29435 image.to_string(),
29436 ].join(",")
29437 }),
29438
29439
29440 self.keyring.as_ref().map(|keyring| {
29441 [
29442 "keyring".to_string(),
29443 keyring.to_string(),
29444 ].join(",")
29445 }),
29446
29447
29448 self.monitors.as_ref().map(|monitors| {
29449 [
29450 "monitors".to_string(),
29451 monitors.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
29452 ].join(",")
29453 }),
29454
29455
29456 self.pool.as_ref().map(|pool| {
29457 [
29458 "pool".to_string(),
29459 pool.to_string(),
29460 ].join(",")
29461 }),
29462
29463
29464 self.read_only.as_ref().map(|read_only| {
29465 [
29466 "readOnly".to_string(),
29467 read_only.to_string(),
29468 ].join(",")
29469 }),
29470
29471 self.user.as_ref().map(|user| {
29475 [
29476 "user".to_string(),
29477 user.to_string(),
29478 ].join(",")
29479 }),
29480
29481 ];
29482
29483 params.into_iter().flatten().collect::<Vec<_>>().join(",")
29484 }
29485}
29486
29487impl std::str::FromStr for RbdVolumeSource {
29491 type Err = String;
29492
29493 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
29494 #[derive(Default)]
29496 #[allow(dead_code)]
29497 struct IntermediateRep {
29498 pub fs_type: Vec<String>,
29499 pub image: Vec<String>,
29500 pub keyring: Vec<String>,
29501 pub monitors: Vec<Vec<String>>,
29502 pub pool: Vec<String>,
29503 pub read_only: Vec<bool>,
29504 pub secret_ref: Vec<models::LocalObjectReference>,
29505 pub user: Vec<String>,
29506 }
29507
29508 let mut intermediate_rep = IntermediateRep::default();
29509
29510 let mut string_iter = s.split(',');
29512 let mut key_result = string_iter.next();
29513
29514 while key_result.is_some() {
29515 let val = match string_iter.next() {
29516 Some(x) => x,
29517 None => return std::result::Result::Err("Missing value while parsing RbdVolumeSource".to_string())
29518 };
29519
29520 if let Some(key) = key_result {
29521 #[allow(clippy::match_single_binding)]
29522 match key {
29523 #[allow(clippy::redundant_clone)]
29524 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29525 #[allow(clippy::redundant_clone)]
29526 "image" => intermediate_rep.image.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29527 #[allow(clippy::redundant_clone)]
29528 "keyring" => intermediate_rep.keyring.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29529 "monitors" => return std::result::Result::Err("Parsing a container in this style is not supported in RbdVolumeSource".to_string()),
29530 #[allow(clippy::redundant_clone)]
29531 "pool" => intermediate_rep.pool.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29532 #[allow(clippy::redundant_clone)]
29533 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29534 #[allow(clippy::redundant_clone)]
29535 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29536 #[allow(clippy::redundant_clone)]
29537 "user" => intermediate_rep.user.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29538 _ => return std::result::Result::Err("Unexpected key while parsing RbdVolumeSource".to_string())
29539 }
29540 }
29541
29542 key_result = string_iter.next();
29544 }
29545
29546 std::result::Result::Ok(RbdVolumeSource {
29548 fs_type: intermediate_rep.fs_type.into_iter().next(),
29549 image: intermediate_rep.image.into_iter().next(),
29550 keyring: intermediate_rep.keyring.into_iter().next(),
29551 monitors: intermediate_rep.monitors.into_iter().next(),
29552 pool: intermediate_rep.pool.into_iter().next(),
29553 read_only: intermediate_rep.read_only.into_iter().next(),
29554 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
29555 user: intermediate_rep.user.into_iter().next(),
29556 })
29557 }
29558}
29559
29560#[cfg(feature = "server")]
29563impl std::convert::TryFrom<header::IntoHeaderValue<RbdVolumeSource>> for HeaderValue {
29564 type Error = String;
29565
29566 fn try_from(hdr_value: header::IntoHeaderValue<RbdVolumeSource>) -> std::result::Result<Self, Self::Error> {
29567 let hdr_value = hdr_value.to_string();
29568 match HeaderValue::from_str(&hdr_value) {
29569 std::result::Result::Ok(value) => std::result::Result::Ok(value),
29570 std::result::Result::Err(e) => std::result::Result::Err(
29571 format!("Invalid header value for RbdVolumeSource - value: {} is invalid {}",
29572 hdr_value, e))
29573 }
29574 }
29575}
29576
29577#[cfg(feature = "server")]
29578impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<RbdVolumeSource> {
29579 type Error = String;
29580
29581 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
29582 match hdr_value.to_str() {
29583 std::result::Result::Ok(value) => {
29584 match <RbdVolumeSource as std::str::FromStr>::from_str(value) {
29585 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
29586 std::result::Result::Err(err) => std::result::Result::Err(
29587 format!("Unable to convert header value '{}' into RbdVolumeSource - {}",
29588 value, err))
29589 }
29590 },
29591 std::result::Result::Err(e) => std::result::Result::Err(
29592 format!("Unable to convert header: {:?} to string: {}",
29593 hdr_value, e))
29594 }
29595 }
29596}
29597
29598
29599
29600
29601#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
29606#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29607pub struct ResourceFieldSelector {
29608#[serde(rename = "containerName")]
29610 #[serde(skip_serializing_if="Option::is_none")]
29611 pub container_name: Option<String>,
29612
29613#[serde(rename = "divisor")]
29615 #[serde(skip_serializing_if="Option::is_none")]
29616 pub divisor: Option<crate::types::Object>,
29617
29618#[serde(rename = "resource")]
29620 #[serde(skip_serializing_if="Option::is_none")]
29621 pub resource: Option<String>,
29622
29623}
29624
29625
29626impl ResourceFieldSelector {
29627 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
29628 pub fn new() -> ResourceFieldSelector {
29629 ResourceFieldSelector {
29630 container_name: None,
29631 divisor: None,
29632 resource: None,
29633 }
29634 }
29635}
29636
29637impl std::string::ToString for ResourceFieldSelector {
29641 fn to_string(&self) -> String {
29642 let params: Vec<Option<String>> = vec![
29643
29644 self.container_name.as_ref().map(|container_name| {
29645 [
29646 "containerName".to_string(),
29647 container_name.to_string(),
29648 ].join(",")
29649 }),
29650
29651 self.resource.as_ref().map(|resource| {
29655 [
29656 "resource".to_string(),
29657 resource.to_string(),
29658 ].join(",")
29659 }),
29660
29661 ];
29662
29663 params.into_iter().flatten().collect::<Vec<_>>().join(",")
29664 }
29665}
29666
29667impl std::str::FromStr for ResourceFieldSelector {
29671 type Err = String;
29672
29673 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
29674 #[derive(Default)]
29676 #[allow(dead_code)]
29677 struct IntermediateRep {
29678 pub container_name: Vec<String>,
29679 pub divisor: Vec<crate::types::Object>,
29680 pub resource: Vec<String>,
29681 }
29682
29683 let mut intermediate_rep = IntermediateRep::default();
29684
29685 let mut string_iter = s.split(',');
29687 let mut key_result = string_iter.next();
29688
29689 while key_result.is_some() {
29690 let val = match string_iter.next() {
29691 Some(x) => x,
29692 None => return std::result::Result::Err("Missing value while parsing ResourceFieldSelector".to_string())
29693 };
29694
29695 if let Some(key) = key_result {
29696 #[allow(clippy::match_single_binding)]
29697 match key {
29698 #[allow(clippy::redundant_clone)]
29699 "containerName" => intermediate_rep.container_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29700 #[allow(clippy::redundant_clone)]
29701 "divisor" => intermediate_rep.divisor.push(<crate::types::Object as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29702 #[allow(clippy::redundant_clone)]
29703 "resource" => intermediate_rep.resource.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
29704 _ => return std::result::Result::Err("Unexpected key while parsing ResourceFieldSelector".to_string())
29705 }
29706 }
29707
29708 key_result = string_iter.next();
29710 }
29711
29712 std::result::Result::Ok(ResourceFieldSelector {
29714 container_name: intermediate_rep.container_name.into_iter().next(),
29715 divisor: intermediate_rep.divisor.into_iter().next(),
29716 resource: intermediate_rep.resource.into_iter().next(),
29717 })
29718 }
29719}
29720
29721#[cfg(feature = "server")]
29724impl std::convert::TryFrom<header::IntoHeaderValue<ResourceFieldSelector>> for HeaderValue {
29725 type Error = String;
29726
29727 fn try_from(hdr_value: header::IntoHeaderValue<ResourceFieldSelector>) -> std::result::Result<Self, Self::Error> {
29728 let hdr_value = hdr_value.to_string();
29729 match HeaderValue::from_str(&hdr_value) {
29730 std::result::Result::Ok(value) => std::result::Result::Ok(value),
29731 std::result::Result::Err(e) => std::result::Result::Err(
29732 format!("Invalid header value for ResourceFieldSelector - value: {} is invalid {}",
29733 hdr_value, e))
29734 }
29735 }
29736}
29737
29738#[cfg(feature = "server")]
29739impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ResourceFieldSelector> {
29740 type Error = String;
29741
29742 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
29743 match hdr_value.to_str() {
29744 std::result::Result::Ok(value) => {
29745 match <ResourceFieldSelector as std::str::FromStr>::from_str(value) {
29746 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
29747 std::result::Result::Err(err) => std::result::Result::Err(
29748 format!("Unable to convert header value '{}' into ResourceFieldSelector - {}",
29749 value, err))
29750 }
29751 },
29752 std::result::Result::Err(e) => std::result::Result::Err(
29753 format!("Unable to convert header: {:?} to string: {}",
29754 hdr_value, e))
29755 }
29756 }
29757}
29758
29759
29760
29761
29762
29763
29764
29765#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
29766#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29767pub struct ResourceRequirements {
29768 #[serde(rename = "limits")]
29769 #[serde(skip_serializing_if="Option::is_none")]
29770 pub limits: Option<std::collections::HashMap<String, models::Quantity>>,
29771
29772 #[serde(rename = "requests")]
29773 #[serde(skip_serializing_if="Option::is_none")]
29774 pub requests: Option<std::collections::HashMap<String, models::Quantity>>,
29775
29776}
29777
29778
29779impl ResourceRequirements {
29780 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
29781 pub fn new() -> ResourceRequirements {
29782 ResourceRequirements {
29783 limits: None,
29784 requests: None,
29785 }
29786 }
29787}
29788
29789impl std::string::ToString for ResourceRequirements {
29793 fn to_string(&self) -> String {
29794 let params: Vec<Option<String>> = vec![
29795 ];
29802
29803 params.into_iter().flatten().collect::<Vec<_>>().join(",")
29804 }
29805}
29806
29807impl std::str::FromStr for ResourceRequirements {
29811 type Err = String;
29812
29813 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
29814 #[derive(Default)]
29816 #[allow(dead_code)]
29817 struct IntermediateRep {
29818 pub limits: Vec<std::collections::HashMap<String, models::Quantity>>,
29819 pub requests: Vec<std::collections::HashMap<String, models::Quantity>>,
29820 }
29821
29822 let mut intermediate_rep = IntermediateRep::default();
29823
29824 let mut string_iter = s.split(',');
29826 let mut key_result = string_iter.next();
29827
29828 while key_result.is_some() {
29829 let val = match string_iter.next() {
29830 Some(x) => x,
29831 None => return std::result::Result::Err("Missing value while parsing ResourceRequirements".to_string())
29832 };
29833
29834 if let Some(key) = key_result {
29835 #[allow(clippy::match_single_binding)]
29836 match key {
29837 "limits" => return std::result::Result::Err("Parsing a container in this style is not supported in ResourceRequirements".to_string()),
29838 "requests" => return std::result::Result::Err("Parsing a container in this style is not supported in ResourceRequirements".to_string()),
29839 _ => return std::result::Result::Err("Unexpected key while parsing ResourceRequirements".to_string())
29840 }
29841 }
29842
29843 key_result = string_iter.next();
29845 }
29846
29847 std::result::Result::Ok(ResourceRequirements {
29849 limits: intermediate_rep.limits.into_iter().next(),
29850 requests: intermediate_rep.requests.into_iter().next(),
29851 })
29852 }
29853}
29854
29855#[cfg(feature = "server")]
29858impl std::convert::TryFrom<header::IntoHeaderValue<ResourceRequirements>> for HeaderValue {
29859 type Error = String;
29860
29861 fn try_from(hdr_value: header::IntoHeaderValue<ResourceRequirements>) -> std::result::Result<Self, Self::Error> {
29862 let hdr_value = hdr_value.to_string();
29863 match HeaderValue::from_str(&hdr_value) {
29864 std::result::Result::Ok(value) => std::result::Result::Ok(value),
29865 std::result::Result::Err(e) => std::result::Result::Err(
29866 format!("Invalid header value for ResourceRequirements - value: {} is invalid {}",
29867 hdr_value, e))
29868 }
29869 }
29870}
29871
29872#[cfg(feature = "server")]
29873impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ResourceRequirements> {
29874 type Error = String;
29875
29876 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
29877 match hdr_value.to_str() {
29878 std::result::Result::Ok(value) => {
29879 match <ResourceRequirements as std::str::FromStr>::from_str(value) {
29880 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
29881 std::result::Result::Err(err) => std::result::Result::Err(
29882 format!("Unable to convert header value '{}' into ResourceRequirements - {}",
29883 value, err))
29884 }
29885 },
29886 std::result::Result::Err(e) => std::result::Result::Err(
29887 format!("Unable to convert header: {:?} to string: {}",
29888 hdr_value, e))
29889 }
29890 }
29891}
29892
29893
29894
29895
29896#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
29901#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
29902pub struct Resources {
29903 #[serde(rename = "BlkioDeviceReadBps")]
29904 #[serde(skip_serializing_if="Option::is_none")]
29905 pub blkio_device_read_bps: Option<Vec<models::ThrottleDevice>>,
29906
29907 #[serde(rename = "BlkioDeviceReadIOps")]
29908 #[serde(skip_serializing_if="Option::is_none")]
29909 pub blkio_device_read_i_ops: Option<Vec<models::ThrottleDevice>>,
29910
29911 #[serde(rename = "BlkioDeviceWriteBps")]
29912 #[serde(skip_serializing_if="Option::is_none")]
29913 pub blkio_device_write_bps: Option<Vec<models::ThrottleDevice>>,
29914
29915 #[serde(rename = "BlkioDeviceWriteIOps")]
29916 #[serde(skip_serializing_if="Option::is_none")]
29917 pub blkio_device_write_i_ops: Option<Vec<models::ThrottleDevice>>,
29918
29919 #[serde(rename = "BlkioWeight")]
29920 #[serde(skip_serializing_if="Option::is_none")]
29921 pub blkio_weight: Option<i32>,
29922
29923 #[serde(rename = "BlkioWeightDevice")]
29924 #[serde(skip_serializing_if="Option::is_none")]
29925 pub blkio_weight_device: Option<Vec<models::WeightDevice>>,
29926
29927#[serde(rename = "CgroupParent")]
29929 #[serde(skip_serializing_if="Option::is_none")]
29930 pub cgroup_parent: Option<String>,
29931
29932#[serde(rename = "CpuCount")]
29934 #[serde(skip_serializing_if="Option::is_none")]
29935 pub cpu_count: Option<i64>,
29936
29937 #[serde(rename = "CpuPercent")]
29938 #[serde(skip_serializing_if="Option::is_none")]
29939 pub cpu_percent: Option<i64>,
29940
29941 #[serde(rename = "CpuPeriod")]
29942 #[serde(skip_serializing_if="Option::is_none")]
29943 pub cpu_period: Option<i64>,
29944
29945 #[serde(rename = "CpuQuota")]
29946 #[serde(skip_serializing_if="Option::is_none")]
29947 pub cpu_quota: Option<i64>,
29948
29949 #[serde(rename = "CpuRealtimePeriod")]
29950 #[serde(skip_serializing_if="Option::is_none")]
29951 pub cpu_realtime_period: Option<i64>,
29952
29953 #[serde(rename = "CpuRealtimeRuntime")]
29954 #[serde(skip_serializing_if="Option::is_none")]
29955 pub cpu_realtime_runtime: Option<i64>,
29956
29957#[serde(rename = "CpuShares")]
29959 #[serde(skip_serializing_if="Option::is_none")]
29960 pub cpu_shares: Option<i64>,
29961
29962 #[serde(rename = "CpusetCpus")]
29963 #[serde(skip_serializing_if="Option::is_none")]
29964 pub cpuset_cpus: Option<String>,
29965
29966 #[serde(rename = "CpusetMems")]
29967 #[serde(skip_serializing_if="Option::is_none")]
29968 pub cpuset_mems: Option<String>,
29969
29970 #[serde(rename = "DeviceCgroupRules")]
29971 #[serde(skip_serializing_if="Option::is_none")]
29972 pub device_cgroup_rules: Option<Vec<String>>,
29973
29974 #[serde(rename = "DeviceRequests")]
29975 #[serde(skip_serializing_if="Option::is_none")]
29976 pub device_requests: Option<Vec<models::DeviceRequest>>,
29977
29978 #[serde(rename = "Devices")]
29979 #[serde(skip_serializing_if="Option::is_none")]
29980 pub devices: Option<Vec<models::DeviceMapping>>,
29981
29982 #[serde(rename = "IOMaximumBandwidth")]
29983 #[serde(skip_serializing_if="Option::is_none")]
29984 pub io_maximum_bandwidth: Option<i32>,
29985
29986 #[serde(rename = "IOMaximumIOps")]
29987 #[serde(skip_serializing_if="Option::is_none")]
29988 pub io_maximum_i_ops: Option<i32>,
29989
29990 #[serde(rename = "KernelMemory")]
29991 #[serde(skip_serializing_if="Option::is_none")]
29992 pub kernel_memory: Option<i64>,
29993
29994 #[serde(rename = "KernelMemoryTCP")]
29995 #[serde(skip_serializing_if="Option::is_none")]
29996 pub kernel_memory_tcp: Option<i64>,
29997
29998 #[serde(rename = "Memory")]
29999 #[serde(skip_serializing_if="Option::is_none")]
30000 pub memory: Option<i64>,
30001
30002 #[serde(rename = "MemoryReservation")]
30003 #[serde(skip_serializing_if="Option::is_none")]
30004 pub memory_reservation: Option<i64>,
30005
30006 #[serde(rename = "MemorySwap")]
30007 #[serde(skip_serializing_if="Option::is_none")]
30008 pub memory_swap: Option<i64>,
30009
30010 #[serde(rename = "MemorySwappiness")]
30011 #[serde(skip_serializing_if="Option::is_none")]
30012 pub memory_swappiness: Option<i64>,
30013
30014 #[serde(rename = "NanoCpus")]
30015 #[serde(skip_serializing_if="Option::is_none")]
30016 pub nano_cpus: Option<i64>,
30017
30018 #[serde(rename = "OomKillDisable")]
30019 #[serde(skip_serializing_if="Option::is_none")]
30020 pub oom_kill_disable: Option<bool>,
30021
30022 #[serde(rename = "PidsLimit")]
30023 #[serde(skip_serializing_if="Option::is_none")]
30024 pub pids_limit: Option<i64>,
30025
30026 #[serde(rename = "Ulimits")]
30027 #[serde(skip_serializing_if="Option::is_none")]
30028 pub ulimits: Option<Vec<models::Ulimit>>,
30029
30030}
30031
30032
30033impl Resources {
30034 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
30035 pub fn new() -> Resources {
30036 Resources {
30037 blkio_device_read_bps: None,
30038 blkio_device_read_i_ops: None,
30039 blkio_device_write_bps: None,
30040 blkio_device_write_i_ops: None,
30041 blkio_weight: None,
30042 blkio_weight_device: None,
30043 cgroup_parent: None,
30044 cpu_count: None,
30045 cpu_percent: None,
30046 cpu_period: None,
30047 cpu_quota: None,
30048 cpu_realtime_period: None,
30049 cpu_realtime_runtime: None,
30050 cpu_shares: None,
30051 cpuset_cpus: None,
30052 cpuset_mems: None,
30053 device_cgroup_rules: None,
30054 device_requests: None,
30055 devices: None,
30056 io_maximum_bandwidth: None,
30057 io_maximum_i_ops: None,
30058 kernel_memory: None,
30059 kernel_memory_tcp: None,
30060 memory: None,
30061 memory_reservation: None,
30062 memory_swap: None,
30063 memory_swappiness: None,
30064 nano_cpus: None,
30065 oom_kill_disable: None,
30066 pids_limit: None,
30067 ulimits: None,
30068 }
30069 }
30070}
30071
30072impl std::string::ToString for Resources {
30076 fn to_string(&self) -> String {
30077 let params: Vec<Option<String>> = vec![
30078 self.blkio_weight.as_ref().map(|blkio_weight| {
30088 [
30089 "BlkioWeight".to_string(),
30090 blkio_weight.to_string(),
30091 ].join(",")
30092 }),
30093
30094 self.cgroup_parent.as_ref().map(|cgroup_parent| {
30098 [
30099 "CgroupParent".to_string(),
30100 cgroup_parent.to_string(),
30101 ].join(",")
30102 }),
30103
30104
30105 self.cpu_count.as_ref().map(|cpu_count| {
30106 [
30107 "CpuCount".to_string(),
30108 cpu_count.to_string(),
30109 ].join(",")
30110 }),
30111
30112
30113 self.cpu_percent.as_ref().map(|cpu_percent| {
30114 [
30115 "CpuPercent".to_string(),
30116 cpu_percent.to_string(),
30117 ].join(",")
30118 }),
30119
30120
30121 self.cpu_period.as_ref().map(|cpu_period| {
30122 [
30123 "CpuPeriod".to_string(),
30124 cpu_period.to_string(),
30125 ].join(",")
30126 }),
30127
30128
30129 self.cpu_quota.as_ref().map(|cpu_quota| {
30130 [
30131 "CpuQuota".to_string(),
30132 cpu_quota.to_string(),
30133 ].join(",")
30134 }),
30135
30136
30137 self.cpu_realtime_period.as_ref().map(|cpu_realtime_period| {
30138 [
30139 "CpuRealtimePeriod".to_string(),
30140 cpu_realtime_period.to_string(),
30141 ].join(",")
30142 }),
30143
30144
30145 self.cpu_realtime_runtime.as_ref().map(|cpu_realtime_runtime| {
30146 [
30147 "CpuRealtimeRuntime".to_string(),
30148 cpu_realtime_runtime.to_string(),
30149 ].join(",")
30150 }),
30151
30152
30153 self.cpu_shares.as_ref().map(|cpu_shares| {
30154 [
30155 "CpuShares".to_string(),
30156 cpu_shares.to_string(),
30157 ].join(",")
30158 }),
30159
30160
30161 self.cpuset_cpus.as_ref().map(|cpuset_cpus| {
30162 [
30163 "CpusetCpus".to_string(),
30164 cpuset_cpus.to_string(),
30165 ].join(",")
30166 }),
30167
30168
30169 self.cpuset_mems.as_ref().map(|cpuset_mems| {
30170 [
30171 "CpusetMems".to_string(),
30172 cpuset_mems.to_string(),
30173 ].join(",")
30174 }),
30175
30176
30177 self.device_cgroup_rules.as_ref().map(|device_cgroup_rules| {
30178 [
30179 "DeviceCgroupRules".to_string(),
30180 device_cgroup_rules.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
30181 ].join(",")
30182 }),
30183
30184 self.io_maximum_bandwidth.as_ref().map(|io_maximum_bandwidth| {
30190 [
30191 "IOMaximumBandwidth".to_string(),
30192 io_maximum_bandwidth.to_string(),
30193 ].join(",")
30194 }),
30195
30196
30197 self.io_maximum_i_ops.as_ref().map(|io_maximum_i_ops| {
30198 [
30199 "IOMaximumIOps".to_string(),
30200 io_maximum_i_ops.to_string(),
30201 ].join(",")
30202 }),
30203
30204
30205 self.kernel_memory.as_ref().map(|kernel_memory| {
30206 [
30207 "KernelMemory".to_string(),
30208 kernel_memory.to_string(),
30209 ].join(",")
30210 }),
30211
30212
30213 self.kernel_memory_tcp.as_ref().map(|kernel_memory_tcp| {
30214 [
30215 "KernelMemoryTCP".to_string(),
30216 kernel_memory_tcp.to_string(),
30217 ].join(",")
30218 }),
30219
30220
30221 self.memory.as_ref().map(|memory| {
30222 [
30223 "Memory".to_string(),
30224 memory.to_string(),
30225 ].join(",")
30226 }),
30227
30228
30229 self.memory_reservation.as_ref().map(|memory_reservation| {
30230 [
30231 "MemoryReservation".to_string(),
30232 memory_reservation.to_string(),
30233 ].join(",")
30234 }),
30235
30236
30237 self.memory_swap.as_ref().map(|memory_swap| {
30238 [
30239 "MemorySwap".to_string(),
30240 memory_swap.to_string(),
30241 ].join(",")
30242 }),
30243
30244
30245 self.memory_swappiness.as_ref().map(|memory_swappiness| {
30246 [
30247 "MemorySwappiness".to_string(),
30248 memory_swappiness.to_string(),
30249 ].join(",")
30250 }),
30251
30252
30253 self.nano_cpus.as_ref().map(|nano_cpus| {
30254 [
30255 "NanoCpus".to_string(),
30256 nano_cpus.to_string(),
30257 ].join(",")
30258 }),
30259
30260
30261 self.oom_kill_disable.as_ref().map(|oom_kill_disable| {
30262 [
30263 "OomKillDisable".to_string(),
30264 oom_kill_disable.to_string(),
30265 ].join(",")
30266 }),
30267
30268
30269 self.pids_limit.as_ref().map(|pids_limit| {
30270 [
30271 "PidsLimit".to_string(),
30272 pids_limit.to_string(),
30273 ].join(",")
30274 }),
30275
30276 ];
30279
30280 params.into_iter().flatten().collect::<Vec<_>>().join(",")
30281 }
30282}
30283
30284impl std::str::FromStr for Resources {
30288 type Err = String;
30289
30290 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
30291 #[derive(Default)]
30293 #[allow(dead_code)]
30294 struct IntermediateRep {
30295 pub blkio_device_read_bps: Vec<Vec<models::ThrottleDevice>>,
30296 pub blkio_device_read_i_ops: Vec<Vec<models::ThrottleDevice>>,
30297 pub blkio_device_write_bps: Vec<Vec<models::ThrottleDevice>>,
30298 pub blkio_device_write_i_ops: Vec<Vec<models::ThrottleDevice>>,
30299 pub blkio_weight: Vec<i32>,
30300 pub blkio_weight_device: Vec<Vec<models::WeightDevice>>,
30301 pub cgroup_parent: Vec<String>,
30302 pub cpu_count: Vec<i64>,
30303 pub cpu_percent: Vec<i64>,
30304 pub cpu_period: Vec<i64>,
30305 pub cpu_quota: Vec<i64>,
30306 pub cpu_realtime_period: Vec<i64>,
30307 pub cpu_realtime_runtime: Vec<i64>,
30308 pub cpu_shares: Vec<i64>,
30309 pub cpuset_cpus: Vec<String>,
30310 pub cpuset_mems: Vec<String>,
30311 pub device_cgroup_rules: Vec<Vec<String>>,
30312 pub device_requests: Vec<Vec<models::DeviceRequest>>,
30313 pub devices: Vec<Vec<models::DeviceMapping>>,
30314 pub io_maximum_bandwidth: Vec<i32>,
30315 pub io_maximum_i_ops: Vec<i32>,
30316 pub kernel_memory: Vec<i64>,
30317 pub kernel_memory_tcp: Vec<i64>,
30318 pub memory: Vec<i64>,
30319 pub memory_reservation: Vec<i64>,
30320 pub memory_swap: Vec<i64>,
30321 pub memory_swappiness: Vec<i64>,
30322 pub nano_cpus: Vec<i64>,
30323 pub oom_kill_disable: Vec<bool>,
30324 pub pids_limit: Vec<i64>,
30325 pub ulimits: Vec<Vec<models::Ulimit>>,
30326 }
30327
30328 let mut intermediate_rep = IntermediateRep::default();
30329
30330 let mut string_iter = s.split(',');
30332 let mut key_result = string_iter.next();
30333
30334 while key_result.is_some() {
30335 let val = match string_iter.next() {
30336 Some(x) => x,
30337 None => return std::result::Result::Err("Missing value while parsing Resources".to_string())
30338 };
30339
30340 if let Some(key) = key_result {
30341 #[allow(clippy::match_single_binding)]
30342 match key {
30343 "BlkioDeviceReadBps" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30344 "BlkioDeviceReadIOps" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30345 "BlkioDeviceWriteBps" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30346 "BlkioDeviceWriteIOps" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30347 #[allow(clippy::redundant_clone)]
30348 "BlkioWeight" => intermediate_rep.blkio_weight.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30349 "BlkioWeightDevice" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30350 #[allow(clippy::redundant_clone)]
30351 "CgroupParent" => intermediate_rep.cgroup_parent.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30352 #[allow(clippy::redundant_clone)]
30353 "CpuCount" => intermediate_rep.cpu_count.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30354 #[allow(clippy::redundant_clone)]
30355 "CpuPercent" => intermediate_rep.cpu_percent.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30356 #[allow(clippy::redundant_clone)]
30357 "CpuPeriod" => intermediate_rep.cpu_period.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30358 #[allow(clippy::redundant_clone)]
30359 "CpuQuota" => intermediate_rep.cpu_quota.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30360 #[allow(clippy::redundant_clone)]
30361 "CpuRealtimePeriod" => intermediate_rep.cpu_realtime_period.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30362 #[allow(clippy::redundant_clone)]
30363 "CpuRealtimeRuntime" => intermediate_rep.cpu_realtime_runtime.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30364 #[allow(clippy::redundant_clone)]
30365 "CpuShares" => intermediate_rep.cpu_shares.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30366 #[allow(clippy::redundant_clone)]
30367 "CpusetCpus" => intermediate_rep.cpuset_cpus.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30368 #[allow(clippy::redundant_clone)]
30369 "CpusetMems" => intermediate_rep.cpuset_mems.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30370 "DeviceCgroupRules" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30371 "DeviceRequests" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30372 "Devices" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30373 #[allow(clippy::redundant_clone)]
30374 "IOMaximumBandwidth" => intermediate_rep.io_maximum_bandwidth.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30375 #[allow(clippy::redundant_clone)]
30376 "IOMaximumIOps" => intermediate_rep.io_maximum_i_ops.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30377 #[allow(clippy::redundant_clone)]
30378 "KernelMemory" => intermediate_rep.kernel_memory.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30379 #[allow(clippy::redundant_clone)]
30380 "KernelMemoryTCP" => intermediate_rep.kernel_memory_tcp.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30381 #[allow(clippy::redundant_clone)]
30382 "Memory" => intermediate_rep.memory.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30383 #[allow(clippy::redundant_clone)]
30384 "MemoryReservation" => intermediate_rep.memory_reservation.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30385 #[allow(clippy::redundant_clone)]
30386 "MemorySwap" => intermediate_rep.memory_swap.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30387 #[allow(clippy::redundant_clone)]
30388 "MemorySwappiness" => intermediate_rep.memory_swappiness.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30389 #[allow(clippy::redundant_clone)]
30390 "NanoCpus" => intermediate_rep.nano_cpus.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30391 #[allow(clippy::redundant_clone)]
30392 "OomKillDisable" => intermediate_rep.oom_kill_disable.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30393 #[allow(clippy::redundant_clone)]
30394 "PidsLimit" => intermediate_rep.pids_limit.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30395 "Ulimits" => return std::result::Result::Err("Parsing a container in this style is not supported in Resources".to_string()),
30396 _ => return std::result::Result::Err("Unexpected key while parsing Resources".to_string())
30397 }
30398 }
30399
30400 key_result = string_iter.next();
30402 }
30403
30404 std::result::Result::Ok(Resources {
30406 blkio_device_read_bps: intermediate_rep.blkio_device_read_bps.into_iter().next(),
30407 blkio_device_read_i_ops: intermediate_rep.blkio_device_read_i_ops.into_iter().next(),
30408 blkio_device_write_bps: intermediate_rep.blkio_device_write_bps.into_iter().next(),
30409 blkio_device_write_i_ops: intermediate_rep.blkio_device_write_i_ops.into_iter().next(),
30410 blkio_weight: intermediate_rep.blkio_weight.into_iter().next(),
30411 blkio_weight_device: intermediate_rep.blkio_weight_device.into_iter().next(),
30412 cgroup_parent: intermediate_rep.cgroup_parent.into_iter().next(),
30413 cpu_count: intermediate_rep.cpu_count.into_iter().next(),
30414 cpu_percent: intermediate_rep.cpu_percent.into_iter().next(),
30415 cpu_period: intermediate_rep.cpu_period.into_iter().next(),
30416 cpu_quota: intermediate_rep.cpu_quota.into_iter().next(),
30417 cpu_realtime_period: intermediate_rep.cpu_realtime_period.into_iter().next(),
30418 cpu_realtime_runtime: intermediate_rep.cpu_realtime_runtime.into_iter().next(),
30419 cpu_shares: intermediate_rep.cpu_shares.into_iter().next(),
30420 cpuset_cpus: intermediate_rep.cpuset_cpus.into_iter().next(),
30421 cpuset_mems: intermediate_rep.cpuset_mems.into_iter().next(),
30422 device_cgroup_rules: intermediate_rep.device_cgroup_rules.into_iter().next(),
30423 device_requests: intermediate_rep.device_requests.into_iter().next(),
30424 devices: intermediate_rep.devices.into_iter().next(),
30425 io_maximum_bandwidth: intermediate_rep.io_maximum_bandwidth.into_iter().next(),
30426 io_maximum_i_ops: intermediate_rep.io_maximum_i_ops.into_iter().next(),
30427 kernel_memory: intermediate_rep.kernel_memory.into_iter().next(),
30428 kernel_memory_tcp: intermediate_rep.kernel_memory_tcp.into_iter().next(),
30429 memory: intermediate_rep.memory.into_iter().next(),
30430 memory_reservation: intermediate_rep.memory_reservation.into_iter().next(),
30431 memory_swap: intermediate_rep.memory_swap.into_iter().next(),
30432 memory_swappiness: intermediate_rep.memory_swappiness.into_iter().next(),
30433 nano_cpus: intermediate_rep.nano_cpus.into_iter().next(),
30434 oom_kill_disable: intermediate_rep.oom_kill_disable.into_iter().next(),
30435 pids_limit: intermediate_rep.pids_limit.into_iter().next(),
30436 ulimits: intermediate_rep.ulimits.into_iter().next(),
30437 })
30438 }
30439}
30440
30441#[cfg(feature = "server")]
30444impl std::convert::TryFrom<header::IntoHeaderValue<Resources>> for HeaderValue {
30445 type Error = String;
30446
30447 fn try_from(hdr_value: header::IntoHeaderValue<Resources>) -> std::result::Result<Self, Self::Error> {
30448 let hdr_value = hdr_value.to_string();
30449 match HeaderValue::from_str(&hdr_value) {
30450 std::result::Result::Ok(value) => std::result::Result::Ok(value),
30451 std::result::Result::Err(e) => std::result::Result::Err(
30452 format!("Invalid header value for Resources - value: {} is invalid {}",
30453 hdr_value, e))
30454 }
30455 }
30456}
30457
30458#[cfg(feature = "server")]
30459impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Resources> {
30460 type Error = String;
30461
30462 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
30463 match hdr_value.to_str() {
30464 std::result::Result::Ok(value) => {
30465 match <Resources as std::str::FromStr>::from_str(value) {
30466 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
30467 std::result::Result::Err(err) => std::result::Result::Err(
30468 format!("Unable to convert header value '{}' into Resources - {}",
30469 value, err))
30470 }
30471 },
30472 std::result::Result::Err(e) => std::result::Result::Err(
30473 format!("Unable to convert header: {:?} to string: {}",
30474 hdr_value, e))
30475 }
30476 }
30477}
30478
30479
30480
30481
30482#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
30484#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
30485pub struct RestartPolicy(String);
30486
30487impl validator::Validate for RestartPolicy {
30488 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
30489 std::result::Result::Ok(())
30490 }
30491}
30492
30493impl std::convert::From<String> for RestartPolicy {
30494 fn from(x: String) -> Self {
30495 RestartPolicy(x)
30496 }
30497}
30498
30499impl std::string::ToString for RestartPolicy {
30500 fn to_string(&self) -> String {
30501 self.0.to_string()
30502 }
30503}
30504
30505impl std::str::FromStr for RestartPolicy {
30506 type Err = std::string::ParseError;
30507 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
30508 std::result::Result::Ok(RestartPolicy(x.to_string()))
30509 }
30510}
30511
30512impl std::convert::From<RestartPolicy> for String {
30513 fn from(x: RestartPolicy) -> Self {
30514 x.0
30515 }
30516}
30517
30518impl std::ops::Deref for RestartPolicy {
30519 type Target = String;
30520 fn deref(&self) -> &String {
30521 &self.0
30522 }
30523}
30524
30525impl std::ops::DerefMut for RestartPolicy {
30526 fn deref_mut(&mut self) -> &mut String {
30527 &mut self.0
30528 }
30529}
30530
30531
30532
30533#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
30538#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
30539pub struct ScaleIoVolumeSource {
30540#[serde(rename = "fsType")]
30542 #[serde(skip_serializing_if="Option::is_none")]
30543 pub fs_type: Option<String>,
30544
30545#[serde(rename = "gateway")]
30547 #[serde(skip_serializing_if="Option::is_none")]
30548 pub gateway: Option<String>,
30549
30550#[serde(rename = "protectionDomain")]
30552 #[serde(skip_serializing_if="Option::is_none")]
30553 pub protection_domain: Option<String>,
30554
30555#[serde(rename = "readOnly")]
30557 #[serde(skip_serializing_if="Option::is_none")]
30558 pub read_only: Option<bool>,
30559
30560 #[serde(rename = "secretRef")]
30561 #[serde(skip_serializing_if="Option::is_none")]
30562 pub secret_ref: Option<models::LocalObjectReference>,
30563
30564#[serde(rename = "sslEnabled")]
30566 #[serde(skip_serializing_if="Option::is_none")]
30567 pub ssl_enabled: Option<bool>,
30568
30569#[serde(rename = "storageMode")]
30571 #[serde(skip_serializing_if="Option::is_none")]
30572 pub storage_mode: Option<String>,
30573
30574#[serde(rename = "storagePool")]
30576 #[serde(skip_serializing_if="Option::is_none")]
30577 pub storage_pool: Option<String>,
30578
30579#[serde(rename = "system")]
30581 #[serde(skip_serializing_if="Option::is_none")]
30582 pub system: Option<String>,
30583
30584#[serde(rename = "volumeName")]
30586 #[serde(skip_serializing_if="Option::is_none")]
30587 pub volume_name: Option<String>,
30588
30589}
30590
30591
30592impl ScaleIoVolumeSource {
30593 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
30594 pub fn new() -> ScaleIoVolumeSource {
30595 ScaleIoVolumeSource {
30596 fs_type: None,
30597 gateway: None,
30598 protection_domain: None,
30599 read_only: None,
30600 secret_ref: None,
30601 ssl_enabled: None,
30602 storage_mode: None,
30603 storage_pool: None,
30604 system: None,
30605 volume_name: None,
30606 }
30607 }
30608}
30609
30610impl std::string::ToString for ScaleIoVolumeSource {
30614 fn to_string(&self) -> String {
30615 let params: Vec<Option<String>> = vec![
30616
30617 self.fs_type.as_ref().map(|fs_type| {
30618 [
30619 "fsType".to_string(),
30620 fs_type.to_string(),
30621 ].join(",")
30622 }),
30623
30624
30625 self.gateway.as_ref().map(|gateway| {
30626 [
30627 "gateway".to_string(),
30628 gateway.to_string(),
30629 ].join(",")
30630 }),
30631
30632
30633 self.protection_domain.as_ref().map(|protection_domain| {
30634 [
30635 "protectionDomain".to_string(),
30636 protection_domain.to_string(),
30637 ].join(",")
30638 }),
30639
30640
30641 self.read_only.as_ref().map(|read_only| {
30642 [
30643 "readOnly".to_string(),
30644 read_only.to_string(),
30645 ].join(",")
30646 }),
30647
30648 self.ssl_enabled.as_ref().map(|ssl_enabled| {
30652 [
30653 "sslEnabled".to_string(),
30654 ssl_enabled.to_string(),
30655 ].join(",")
30656 }),
30657
30658
30659 self.storage_mode.as_ref().map(|storage_mode| {
30660 [
30661 "storageMode".to_string(),
30662 storage_mode.to_string(),
30663 ].join(",")
30664 }),
30665
30666
30667 self.storage_pool.as_ref().map(|storage_pool| {
30668 [
30669 "storagePool".to_string(),
30670 storage_pool.to_string(),
30671 ].join(",")
30672 }),
30673
30674
30675 self.system.as_ref().map(|system| {
30676 [
30677 "system".to_string(),
30678 system.to_string(),
30679 ].join(",")
30680 }),
30681
30682
30683 self.volume_name.as_ref().map(|volume_name| {
30684 [
30685 "volumeName".to_string(),
30686 volume_name.to_string(),
30687 ].join(",")
30688 }),
30689
30690 ];
30691
30692 params.into_iter().flatten().collect::<Vec<_>>().join(",")
30693 }
30694}
30695
30696impl std::str::FromStr for ScaleIoVolumeSource {
30700 type Err = String;
30701
30702 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
30703 #[derive(Default)]
30705 #[allow(dead_code)]
30706 struct IntermediateRep {
30707 pub fs_type: Vec<String>,
30708 pub gateway: Vec<String>,
30709 pub protection_domain: Vec<String>,
30710 pub read_only: Vec<bool>,
30711 pub secret_ref: Vec<models::LocalObjectReference>,
30712 pub ssl_enabled: Vec<bool>,
30713 pub storage_mode: Vec<String>,
30714 pub storage_pool: Vec<String>,
30715 pub system: Vec<String>,
30716 pub volume_name: Vec<String>,
30717 }
30718
30719 let mut intermediate_rep = IntermediateRep::default();
30720
30721 let mut string_iter = s.split(',');
30723 let mut key_result = string_iter.next();
30724
30725 while key_result.is_some() {
30726 let val = match string_iter.next() {
30727 Some(x) => x,
30728 None => return std::result::Result::Err("Missing value while parsing ScaleIoVolumeSource".to_string())
30729 };
30730
30731 if let Some(key) = key_result {
30732 #[allow(clippy::match_single_binding)]
30733 match key {
30734 #[allow(clippy::redundant_clone)]
30735 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30736 #[allow(clippy::redundant_clone)]
30737 "gateway" => intermediate_rep.gateway.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30738 #[allow(clippy::redundant_clone)]
30739 "protectionDomain" => intermediate_rep.protection_domain.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30740 #[allow(clippy::redundant_clone)]
30741 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30742 #[allow(clippy::redundant_clone)]
30743 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30744 #[allow(clippy::redundant_clone)]
30745 "sslEnabled" => intermediate_rep.ssl_enabled.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30746 #[allow(clippy::redundant_clone)]
30747 "storageMode" => intermediate_rep.storage_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30748 #[allow(clippy::redundant_clone)]
30749 "storagePool" => intermediate_rep.storage_pool.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30750 #[allow(clippy::redundant_clone)]
30751 "system" => intermediate_rep.system.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30752 #[allow(clippy::redundant_clone)]
30753 "volumeName" => intermediate_rep.volume_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30754 _ => return std::result::Result::Err("Unexpected key while parsing ScaleIoVolumeSource".to_string())
30755 }
30756 }
30757
30758 key_result = string_iter.next();
30760 }
30761
30762 std::result::Result::Ok(ScaleIoVolumeSource {
30764 fs_type: intermediate_rep.fs_type.into_iter().next(),
30765 gateway: intermediate_rep.gateway.into_iter().next(),
30766 protection_domain: intermediate_rep.protection_domain.into_iter().next(),
30767 read_only: intermediate_rep.read_only.into_iter().next(),
30768 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
30769 ssl_enabled: intermediate_rep.ssl_enabled.into_iter().next(),
30770 storage_mode: intermediate_rep.storage_mode.into_iter().next(),
30771 storage_pool: intermediate_rep.storage_pool.into_iter().next(),
30772 system: intermediate_rep.system.into_iter().next(),
30773 volume_name: intermediate_rep.volume_name.into_iter().next(),
30774 })
30775 }
30776}
30777
30778#[cfg(feature = "server")]
30781impl std::convert::TryFrom<header::IntoHeaderValue<ScaleIoVolumeSource>> for HeaderValue {
30782 type Error = String;
30783
30784 fn try_from(hdr_value: header::IntoHeaderValue<ScaleIoVolumeSource>) -> std::result::Result<Self, Self::Error> {
30785 let hdr_value = hdr_value.to_string();
30786 match HeaderValue::from_str(&hdr_value) {
30787 std::result::Result::Ok(value) => std::result::Result::Ok(value),
30788 std::result::Result::Err(e) => std::result::Result::Err(
30789 format!("Invalid header value for ScaleIoVolumeSource - value: {} is invalid {}",
30790 hdr_value, e))
30791 }
30792 }
30793}
30794
30795#[cfg(feature = "server")]
30796impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ScaleIoVolumeSource> {
30797 type Error = String;
30798
30799 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
30800 match hdr_value.to_str() {
30801 std::result::Result::Ok(value) => {
30802 match <ScaleIoVolumeSource as std::str::FromStr>::from_str(value) {
30803 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
30804 std::result::Result::Err(err) => std::result::Result::Err(
30805 format!("Unable to convert header value '{}' into ScaleIoVolumeSource - {}",
30806 value, err))
30807 }
30808 },
30809 std::result::Result::Err(e) => std::result::Result::Err(
30810 format!("Unable to convert header: {:?} to string: {}",
30811 hdr_value, e))
30812 }
30813 }
30814}
30815
30816
30817
30818
30819#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
30824#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
30825pub struct SeLinuxOptions {
30826#[serde(rename = "level")]
30828 #[serde(skip_serializing_if="Option::is_none")]
30829 pub level: Option<String>,
30830
30831#[serde(rename = "role")]
30833 #[serde(skip_serializing_if="Option::is_none")]
30834 pub role: Option<String>,
30835
30836#[serde(rename = "type")]
30838 #[serde(skip_serializing_if="Option::is_none")]
30839 pub r#type: Option<String>,
30840
30841#[serde(rename = "user")]
30843 #[serde(skip_serializing_if="Option::is_none")]
30844 pub user: Option<String>,
30845
30846}
30847
30848
30849impl SeLinuxOptions {
30850 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
30851 pub fn new() -> SeLinuxOptions {
30852 SeLinuxOptions {
30853 level: None,
30854 role: None,
30855 r#type: None,
30856 user: None,
30857 }
30858 }
30859}
30860
30861impl std::string::ToString for SeLinuxOptions {
30865 fn to_string(&self) -> String {
30866 let params: Vec<Option<String>> = vec![
30867
30868 self.level.as_ref().map(|level| {
30869 [
30870 "level".to_string(),
30871 level.to_string(),
30872 ].join(",")
30873 }),
30874
30875
30876 self.role.as_ref().map(|role| {
30877 [
30878 "role".to_string(),
30879 role.to_string(),
30880 ].join(",")
30881 }),
30882
30883
30884 self.r#type.as_ref().map(|r#type| {
30885 [
30886 "type".to_string(),
30887 r#type.to_string(),
30888 ].join(",")
30889 }),
30890
30891
30892 self.user.as_ref().map(|user| {
30893 [
30894 "user".to_string(),
30895 user.to_string(),
30896 ].join(",")
30897 }),
30898
30899 ];
30900
30901 params.into_iter().flatten().collect::<Vec<_>>().join(",")
30902 }
30903}
30904
30905impl std::str::FromStr for SeLinuxOptions {
30909 type Err = String;
30910
30911 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
30912 #[derive(Default)]
30914 #[allow(dead_code)]
30915 struct IntermediateRep {
30916 pub level: Vec<String>,
30917 pub role: Vec<String>,
30918 pub r#type: Vec<String>,
30919 pub user: Vec<String>,
30920 }
30921
30922 let mut intermediate_rep = IntermediateRep::default();
30923
30924 let mut string_iter = s.split(',');
30926 let mut key_result = string_iter.next();
30927
30928 while key_result.is_some() {
30929 let val = match string_iter.next() {
30930 Some(x) => x,
30931 None => return std::result::Result::Err("Missing value while parsing SeLinuxOptions".to_string())
30932 };
30933
30934 if let Some(key) = key_result {
30935 #[allow(clippy::match_single_binding)]
30936 match key {
30937 #[allow(clippy::redundant_clone)]
30938 "level" => intermediate_rep.level.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30939 #[allow(clippy::redundant_clone)]
30940 "role" => intermediate_rep.role.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30941 #[allow(clippy::redundant_clone)]
30942 "type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30943 #[allow(clippy::redundant_clone)]
30944 "user" => intermediate_rep.user.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
30945 _ => return std::result::Result::Err("Unexpected key while parsing SeLinuxOptions".to_string())
30946 }
30947 }
30948
30949 key_result = string_iter.next();
30951 }
30952
30953 std::result::Result::Ok(SeLinuxOptions {
30955 level: intermediate_rep.level.into_iter().next(),
30956 role: intermediate_rep.role.into_iter().next(),
30957 r#type: intermediate_rep.r#type.into_iter().next(),
30958 user: intermediate_rep.user.into_iter().next(),
30959 })
30960 }
30961}
30962
30963#[cfg(feature = "server")]
30966impl std::convert::TryFrom<header::IntoHeaderValue<SeLinuxOptions>> for HeaderValue {
30967 type Error = String;
30968
30969 fn try_from(hdr_value: header::IntoHeaderValue<SeLinuxOptions>) -> std::result::Result<Self, Self::Error> {
30970 let hdr_value = hdr_value.to_string();
30971 match HeaderValue::from_str(&hdr_value) {
30972 std::result::Result::Ok(value) => std::result::Result::Ok(value),
30973 std::result::Result::Err(e) => std::result::Result::Err(
30974 format!("Invalid header value for SeLinuxOptions - value: {} is invalid {}",
30975 hdr_value, e))
30976 }
30977 }
30978}
30979
30980#[cfg(feature = "server")]
30981impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SeLinuxOptions> {
30982 type Error = String;
30983
30984 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
30985 match hdr_value.to_str() {
30986 std::result::Result::Ok(value) => {
30987 match <SeLinuxOptions as std::str::FromStr>::from_str(value) {
30988 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
30989 std::result::Result::Err(err) => std::result::Result::Err(
30990 format!("Unable to convert header value '{}' into SeLinuxOptions - {}",
30991 value, err))
30992 }
30993 },
30994 std::result::Result::Err(e) => std::result::Result::Err(
30995 format!("Unable to convert header: {:?} to string: {}",
30996 hdr_value, e))
30997 }
30998 }
30999}
31000
31001
31002
31003
31004#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31009#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31010pub struct SeccompProfile {
31011#[serde(rename = "localhostProfile")]
31013 #[serde(skip_serializing_if="Option::is_none")]
31014 pub localhost_profile: Option<String>,
31015
31016#[serde(rename = "type")]
31018 #[serde(skip_serializing_if="Option::is_none")]
31019 pub r#type: Option<String>,
31020
31021}
31022
31023
31024impl SeccompProfile {
31025 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31026 pub fn new() -> SeccompProfile {
31027 SeccompProfile {
31028 localhost_profile: None,
31029 r#type: None,
31030 }
31031 }
31032}
31033
31034impl std::string::ToString for SeccompProfile {
31038 fn to_string(&self) -> String {
31039 let params: Vec<Option<String>> = vec![
31040
31041 self.localhost_profile.as_ref().map(|localhost_profile| {
31042 [
31043 "localhostProfile".to_string(),
31044 localhost_profile.to_string(),
31045 ].join(",")
31046 }),
31047
31048
31049 self.r#type.as_ref().map(|r#type| {
31050 [
31051 "type".to_string(),
31052 r#type.to_string(),
31053 ].join(",")
31054 }),
31055
31056 ];
31057
31058 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31059 }
31060}
31061
31062impl std::str::FromStr for SeccompProfile {
31066 type Err = String;
31067
31068 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31069 #[derive(Default)]
31071 #[allow(dead_code)]
31072 struct IntermediateRep {
31073 pub localhost_profile: Vec<String>,
31074 pub r#type: Vec<String>,
31075 }
31076
31077 let mut intermediate_rep = IntermediateRep::default();
31078
31079 let mut string_iter = s.split(',');
31081 let mut key_result = string_iter.next();
31082
31083 while key_result.is_some() {
31084 let val = match string_iter.next() {
31085 Some(x) => x,
31086 None => return std::result::Result::Err("Missing value while parsing SeccompProfile".to_string())
31087 };
31088
31089 if let Some(key) = key_result {
31090 #[allow(clippy::match_single_binding)]
31091 match key {
31092 #[allow(clippy::redundant_clone)]
31093 "localhostProfile" => intermediate_rep.localhost_profile.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31094 #[allow(clippy::redundant_clone)]
31095 "type" => intermediate_rep.r#type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31096 _ => return std::result::Result::Err("Unexpected key while parsing SeccompProfile".to_string())
31097 }
31098 }
31099
31100 key_result = string_iter.next();
31102 }
31103
31104 std::result::Result::Ok(SeccompProfile {
31106 localhost_profile: intermediate_rep.localhost_profile.into_iter().next(),
31107 r#type: intermediate_rep.r#type.into_iter().next(),
31108 })
31109 }
31110}
31111
31112#[cfg(feature = "server")]
31115impl std::convert::TryFrom<header::IntoHeaderValue<SeccompProfile>> for HeaderValue {
31116 type Error = String;
31117
31118 fn try_from(hdr_value: header::IntoHeaderValue<SeccompProfile>) -> std::result::Result<Self, Self::Error> {
31119 let hdr_value = hdr_value.to_string();
31120 match HeaderValue::from_str(&hdr_value) {
31121 std::result::Result::Ok(value) => std::result::Result::Ok(value),
31122 std::result::Result::Err(e) => std::result::Result::Err(
31123 format!("Invalid header value for SeccompProfile - value: {} is invalid {}",
31124 hdr_value, e))
31125 }
31126 }
31127}
31128
31129#[cfg(feature = "server")]
31130impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SeccompProfile> {
31131 type Error = String;
31132
31133 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
31134 match hdr_value.to_str() {
31135 std::result::Result::Ok(value) => {
31136 match <SeccompProfile as std::str::FromStr>::from_str(value) {
31137 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
31138 std::result::Result::Err(err) => std::result::Result::Err(
31139 format!("Unable to convert header value '{}' into SeccompProfile - {}",
31140 value, err))
31141 }
31142 },
31143 std::result::Result::Err(e) => std::result::Result::Err(
31144 format!("Unable to convert header: {:?} to string: {}",
31145 hdr_value, e))
31146 }
31147 }
31148}
31149
31150
31151
31152
31153#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
31155#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31156pub struct SeccompProfileType(String);
31157
31158impl validator::Validate for SeccompProfileType {
31159 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
31160 std::result::Result::Ok(())
31161 }
31162}
31163
31164impl std::convert::From<String> for SeccompProfileType {
31165 fn from(x: String) -> Self {
31166 SeccompProfileType(x)
31167 }
31168}
31169
31170impl std::string::ToString for SeccompProfileType {
31171 fn to_string(&self) -> String {
31172 self.0.to_string()
31173 }
31174}
31175
31176impl std::str::FromStr for SeccompProfileType {
31177 type Err = std::string::ParseError;
31178 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
31179 std::result::Result::Ok(SeccompProfileType(x.to_string()))
31180 }
31181}
31182
31183impl std::convert::From<SeccompProfileType> for String {
31184 fn from(x: SeccompProfileType) -> Self {
31185 x.0
31186 }
31187}
31188
31189impl std::ops::Deref for SeccompProfileType {
31190 type Target = String;
31191 fn deref(&self) -> &String {
31192 &self.0
31193 }
31194}
31195
31196impl std::ops::DerefMut for SeccompProfileType {
31197 fn deref_mut(&mut self) -> &mut String {
31198 &mut self.0
31199 }
31200}
31201
31202
31203
31204#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31209#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31210pub struct SecretEnvSource {
31211#[serde(rename = "name")]
31213 #[serde(skip_serializing_if="Option::is_none")]
31214 pub name: Option<String>,
31215
31216#[serde(rename = "optional")]
31218 #[serde(skip_serializing_if="Option::is_none")]
31219 pub optional: Option<bool>,
31220
31221}
31222
31223
31224impl SecretEnvSource {
31225 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31226 pub fn new() -> SecretEnvSource {
31227 SecretEnvSource {
31228 name: None,
31229 optional: None,
31230 }
31231 }
31232}
31233
31234impl std::string::ToString for SecretEnvSource {
31238 fn to_string(&self) -> String {
31239 let params: Vec<Option<String>> = vec![
31240
31241 self.name.as_ref().map(|name| {
31242 [
31243 "name".to_string(),
31244 name.to_string(),
31245 ].join(",")
31246 }),
31247
31248
31249 self.optional.as_ref().map(|optional| {
31250 [
31251 "optional".to_string(),
31252 optional.to_string(),
31253 ].join(",")
31254 }),
31255
31256 ];
31257
31258 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31259 }
31260}
31261
31262impl std::str::FromStr for SecretEnvSource {
31266 type Err = String;
31267
31268 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31269 #[derive(Default)]
31271 #[allow(dead_code)]
31272 struct IntermediateRep {
31273 pub name: Vec<String>,
31274 pub optional: Vec<bool>,
31275 }
31276
31277 let mut intermediate_rep = IntermediateRep::default();
31278
31279 let mut string_iter = s.split(',');
31281 let mut key_result = string_iter.next();
31282
31283 while key_result.is_some() {
31284 let val = match string_iter.next() {
31285 Some(x) => x,
31286 None => return std::result::Result::Err("Missing value while parsing SecretEnvSource".to_string())
31287 };
31288
31289 if let Some(key) = key_result {
31290 #[allow(clippy::match_single_binding)]
31291 match key {
31292 #[allow(clippy::redundant_clone)]
31293 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31294 #[allow(clippy::redundant_clone)]
31295 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31296 _ => return std::result::Result::Err("Unexpected key while parsing SecretEnvSource".to_string())
31297 }
31298 }
31299
31300 key_result = string_iter.next();
31302 }
31303
31304 std::result::Result::Ok(SecretEnvSource {
31306 name: intermediate_rep.name.into_iter().next(),
31307 optional: intermediate_rep.optional.into_iter().next(),
31308 })
31309 }
31310}
31311
31312#[cfg(feature = "server")]
31315impl std::convert::TryFrom<header::IntoHeaderValue<SecretEnvSource>> for HeaderValue {
31316 type Error = String;
31317
31318 fn try_from(hdr_value: header::IntoHeaderValue<SecretEnvSource>) -> std::result::Result<Self, Self::Error> {
31319 let hdr_value = hdr_value.to_string();
31320 match HeaderValue::from_str(&hdr_value) {
31321 std::result::Result::Ok(value) => std::result::Result::Ok(value),
31322 std::result::Result::Err(e) => std::result::Result::Err(
31323 format!("Invalid header value for SecretEnvSource - value: {} is invalid {}",
31324 hdr_value, e))
31325 }
31326 }
31327}
31328
31329#[cfg(feature = "server")]
31330impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecretEnvSource> {
31331 type Error = String;
31332
31333 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
31334 match hdr_value.to_str() {
31335 std::result::Result::Ok(value) => {
31336 match <SecretEnvSource as std::str::FromStr>::from_str(value) {
31337 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
31338 std::result::Result::Err(err) => std::result::Result::Err(
31339 format!("Unable to convert header value '{}' into SecretEnvSource - {}",
31340 value, err))
31341 }
31342 },
31343 std::result::Result::Err(e) => std::result::Result::Err(
31344 format!("Unable to convert header: {:?} to string: {}",
31345 hdr_value, e))
31346 }
31347 }
31348}
31349
31350
31351
31352
31353#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31358#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31359pub struct SecretKeySelector {
31360#[serde(rename = "key")]
31362 #[serde(skip_serializing_if="Option::is_none")]
31363 pub key: Option<String>,
31364
31365#[serde(rename = "name")]
31367 #[serde(skip_serializing_if="Option::is_none")]
31368 pub name: Option<String>,
31369
31370#[serde(rename = "optional")]
31372 #[serde(skip_serializing_if="Option::is_none")]
31373 pub optional: Option<bool>,
31374
31375}
31376
31377
31378impl SecretKeySelector {
31379 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31380 pub fn new() -> SecretKeySelector {
31381 SecretKeySelector {
31382 key: None,
31383 name: None,
31384 optional: None,
31385 }
31386 }
31387}
31388
31389impl std::string::ToString for SecretKeySelector {
31393 fn to_string(&self) -> String {
31394 let params: Vec<Option<String>> = vec![
31395
31396 self.key.as_ref().map(|key| {
31397 [
31398 "key".to_string(),
31399 key.to_string(),
31400 ].join(",")
31401 }),
31402
31403
31404 self.name.as_ref().map(|name| {
31405 [
31406 "name".to_string(),
31407 name.to_string(),
31408 ].join(",")
31409 }),
31410
31411
31412 self.optional.as_ref().map(|optional| {
31413 [
31414 "optional".to_string(),
31415 optional.to_string(),
31416 ].join(",")
31417 }),
31418
31419 ];
31420
31421 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31422 }
31423}
31424
31425impl std::str::FromStr for SecretKeySelector {
31429 type Err = String;
31430
31431 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31432 #[derive(Default)]
31434 #[allow(dead_code)]
31435 struct IntermediateRep {
31436 pub key: Vec<String>,
31437 pub name: Vec<String>,
31438 pub optional: Vec<bool>,
31439 }
31440
31441 let mut intermediate_rep = IntermediateRep::default();
31442
31443 let mut string_iter = s.split(',');
31445 let mut key_result = string_iter.next();
31446
31447 while key_result.is_some() {
31448 let val = match string_iter.next() {
31449 Some(x) => x,
31450 None => return std::result::Result::Err("Missing value while parsing SecretKeySelector".to_string())
31451 };
31452
31453 if let Some(key) = key_result {
31454 #[allow(clippy::match_single_binding)]
31455 match key {
31456 #[allow(clippy::redundant_clone)]
31457 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31458 #[allow(clippy::redundant_clone)]
31459 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31460 #[allow(clippy::redundant_clone)]
31461 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31462 _ => return std::result::Result::Err("Unexpected key while parsing SecretKeySelector".to_string())
31463 }
31464 }
31465
31466 key_result = string_iter.next();
31468 }
31469
31470 std::result::Result::Ok(SecretKeySelector {
31472 key: intermediate_rep.key.into_iter().next(),
31473 name: intermediate_rep.name.into_iter().next(),
31474 optional: intermediate_rep.optional.into_iter().next(),
31475 })
31476 }
31477}
31478
31479#[cfg(feature = "server")]
31482impl std::convert::TryFrom<header::IntoHeaderValue<SecretKeySelector>> for HeaderValue {
31483 type Error = String;
31484
31485 fn try_from(hdr_value: header::IntoHeaderValue<SecretKeySelector>) -> std::result::Result<Self, Self::Error> {
31486 let hdr_value = hdr_value.to_string();
31487 match HeaderValue::from_str(&hdr_value) {
31488 std::result::Result::Ok(value) => std::result::Result::Ok(value),
31489 std::result::Result::Err(e) => std::result::Result::Err(
31490 format!("Invalid header value for SecretKeySelector - value: {} is invalid {}",
31491 hdr_value, e))
31492 }
31493 }
31494}
31495
31496#[cfg(feature = "server")]
31497impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecretKeySelector> {
31498 type Error = String;
31499
31500 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
31501 match hdr_value.to_str() {
31502 std::result::Result::Ok(value) => {
31503 match <SecretKeySelector as std::str::FromStr>::from_str(value) {
31504 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
31505 std::result::Result::Err(err) => std::result::Result::Err(
31506 format!("Unable to convert header value '{}' into SecretKeySelector - {}",
31507 value, err))
31508 }
31509 },
31510 std::result::Result::Err(e) => std::result::Result::Err(
31511 format!("Unable to convert header: {:?} to string: {}",
31512 hdr_value, e))
31513 }
31514 }
31515}
31516
31517
31518
31519
31520#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31525#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31526pub struct SecretProjection {
31527#[serde(rename = "items")]
31529 #[serde(skip_serializing_if="Option::is_none")]
31530 pub items: Option<Vec<models::KeyToPath>>,
31531
31532#[serde(rename = "name")]
31534 #[serde(skip_serializing_if="Option::is_none")]
31535 pub name: Option<String>,
31536
31537#[serde(rename = "optional")]
31539 #[serde(skip_serializing_if="Option::is_none")]
31540 pub optional: Option<bool>,
31541
31542}
31543
31544
31545impl SecretProjection {
31546 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31547 pub fn new() -> SecretProjection {
31548 SecretProjection {
31549 items: None,
31550 name: None,
31551 optional: None,
31552 }
31553 }
31554}
31555
31556impl std::string::ToString for SecretProjection {
31560 fn to_string(&self) -> String {
31561 let params: Vec<Option<String>> = vec![
31562 self.name.as_ref().map(|name| {
31566 [
31567 "name".to_string(),
31568 name.to_string(),
31569 ].join(",")
31570 }),
31571
31572
31573 self.optional.as_ref().map(|optional| {
31574 [
31575 "optional".to_string(),
31576 optional.to_string(),
31577 ].join(",")
31578 }),
31579
31580 ];
31581
31582 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31583 }
31584}
31585
31586impl std::str::FromStr for SecretProjection {
31590 type Err = String;
31591
31592 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31593 #[derive(Default)]
31595 #[allow(dead_code)]
31596 struct IntermediateRep {
31597 pub items: Vec<Vec<models::KeyToPath>>,
31598 pub name: Vec<String>,
31599 pub optional: Vec<bool>,
31600 }
31601
31602 let mut intermediate_rep = IntermediateRep::default();
31603
31604 let mut string_iter = s.split(',');
31606 let mut key_result = string_iter.next();
31607
31608 while key_result.is_some() {
31609 let val = match string_iter.next() {
31610 Some(x) => x,
31611 None => return std::result::Result::Err("Missing value while parsing SecretProjection".to_string())
31612 };
31613
31614 if let Some(key) = key_result {
31615 #[allow(clippy::match_single_binding)]
31616 match key {
31617 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in SecretProjection".to_string()),
31618 #[allow(clippy::redundant_clone)]
31619 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31620 #[allow(clippy::redundant_clone)]
31621 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31622 _ => return std::result::Result::Err("Unexpected key while parsing SecretProjection".to_string())
31623 }
31624 }
31625
31626 key_result = string_iter.next();
31628 }
31629
31630 std::result::Result::Ok(SecretProjection {
31632 items: intermediate_rep.items.into_iter().next(),
31633 name: intermediate_rep.name.into_iter().next(),
31634 optional: intermediate_rep.optional.into_iter().next(),
31635 })
31636 }
31637}
31638
31639#[cfg(feature = "server")]
31642impl std::convert::TryFrom<header::IntoHeaderValue<SecretProjection>> for HeaderValue {
31643 type Error = String;
31644
31645 fn try_from(hdr_value: header::IntoHeaderValue<SecretProjection>) -> std::result::Result<Self, Self::Error> {
31646 let hdr_value = hdr_value.to_string();
31647 match HeaderValue::from_str(&hdr_value) {
31648 std::result::Result::Ok(value) => std::result::Result::Ok(value),
31649 std::result::Result::Err(e) => std::result::Result::Err(
31650 format!("Invalid header value for SecretProjection - value: {} is invalid {}",
31651 hdr_value, e))
31652 }
31653 }
31654}
31655
31656#[cfg(feature = "server")]
31657impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecretProjection> {
31658 type Error = String;
31659
31660 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
31661 match hdr_value.to_str() {
31662 std::result::Result::Ok(value) => {
31663 match <SecretProjection as std::str::FromStr>::from_str(value) {
31664 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
31665 std::result::Result::Err(err) => std::result::Result::Err(
31666 format!("Unable to convert header value '{}' into SecretProjection - {}",
31667 value, err))
31668 }
31669 },
31670 std::result::Result::Err(e) => std::result::Result::Err(
31671 format!("Unable to convert header: {:?} to string: {}",
31672 hdr_value, e))
31673 }
31674 }
31675}
31676
31677
31678
31679
31680#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31685#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31686pub struct SecretVolumeSource {
31687#[serde(rename = "defaultMode")]
31689 #[serde(skip_serializing_if="Option::is_none")]
31690 pub default_mode: Option<i32>,
31691
31692#[serde(rename = "items")]
31694 #[serde(skip_serializing_if="Option::is_none")]
31695 pub items: Option<Vec<models::KeyToPath>>,
31696
31697#[serde(rename = "optional")]
31699 #[serde(skip_serializing_if="Option::is_none")]
31700 pub optional: Option<bool>,
31701
31702#[serde(rename = "secretName")]
31704 #[serde(skip_serializing_if="Option::is_none")]
31705 pub secret_name: Option<String>,
31706
31707}
31708
31709
31710impl SecretVolumeSource {
31711 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31712 pub fn new() -> SecretVolumeSource {
31713 SecretVolumeSource {
31714 default_mode: None,
31715 items: None,
31716 optional: None,
31717 secret_name: None,
31718 }
31719 }
31720}
31721
31722impl std::string::ToString for SecretVolumeSource {
31726 fn to_string(&self) -> String {
31727 let params: Vec<Option<String>> = vec![
31728
31729 self.default_mode.as_ref().map(|default_mode| {
31730 [
31731 "defaultMode".to_string(),
31732 default_mode.to_string(),
31733 ].join(",")
31734 }),
31735
31736 self.optional.as_ref().map(|optional| {
31740 [
31741 "optional".to_string(),
31742 optional.to_string(),
31743 ].join(",")
31744 }),
31745
31746
31747 self.secret_name.as_ref().map(|secret_name| {
31748 [
31749 "secretName".to_string(),
31750 secret_name.to_string(),
31751 ].join(",")
31752 }),
31753
31754 ];
31755
31756 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31757 }
31758}
31759
31760impl std::str::FromStr for SecretVolumeSource {
31764 type Err = String;
31765
31766 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31767 #[derive(Default)]
31769 #[allow(dead_code)]
31770 struct IntermediateRep {
31771 pub default_mode: Vec<i32>,
31772 pub items: Vec<Vec<models::KeyToPath>>,
31773 pub optional: Vec<bool>,
31774 pub secret_name: Vec<String>,
31775 }
31776
31777 let mut intermediate_rep = IntermediateRep::default();
31778
31779 let mut string_iter = s.split(',');
31781 let mut key_result = string_iter.next();
31782
31783 while key_result.is_some() {
31784 let val = match string_iter.next() {
31785 Some(x) => x,
31786 None => return std::result::Result::Err("Missing value while parsing SecretVolumeSource".to_string())
31787 };
31788
31789 if let Some(key) = key_result {
31790 #[allow(clippy::match_single_binding)]
31791 match key {
31792 #[allow(clippy::redundant_clone)]
31793 "defaultMode" => intermediate_rep.default_mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31794 "items" => return std::result::Result::Err("Parsing a container in this style is not supported in SecretVolumeSource".to_string()),
31795 #[allow(clippy::redundant_clone)]
31796 "optional" => intermediate_rep.optional.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31797 #[allow(clippy::redundant_clone)]
31798 "secretName" => intermediate_rep.secret_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
31799 _ => return std::result::Result::Err("Unexpected key while parsing SecretVolumeSource".to_string())
31800 }
31801 }
31802
31803 key_result = string_iter.next();
31805 }
31806
31807 std::result::Result::Ok(SecretVolumeSource {
31809 default_mode: intermediate_rep.default_mode.into_iter().next(),
31810 items: intermediate_rep.items.into_iter().next(),
31811 optional: intermediate_rep.optional.into_iter().next(),
31812 secret_name: intermediate_rep.secret_name.into_iter().next(),
31813 })
31814 }
31815}
31816
31817#[cfg(feature = "server")]
31820impl std::convert::TryFrom<header::IntoHeaderValue<SecretVolumeSource>> for HeaderValue {
31821 type Error = String;
31822
31823 fn try_from(hdr_value: header::IntoHeaderValue<SecretVolumeSource>) -> std::result::Result<Self, Self::Error> {
31824 let hdr_value = hdr_value.to_string();
31825 match HeaderValue::from_str(&hdr_value) {
31826 std::result::Result::Ok(value) => std::result::Result::Ok(value),
31827 std::result::Result::Err(e) => std::result::Result::Err(
31828 format!("Invalid header value for SecretVolumeSource - value: {} is invalid {}",
31829 hdr_value, e))
31830 }
31831 }
31832}
31833
31834#[cfg(feature = "server")]
31835impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecretVolumeSource> {
31836 type Error = String;
31837
31838 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
31839 match hdr_value.to_str() {
31840 std::result::Result::Ok(value) => {
31841 match <SecretVolumeSource as std::str::FromStr>::from_str(value) {
31842 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
31843 std::result::Result::Err(err) => std::result::Result::Err(
31844 format!("Unable to convert header value '{}' into SecretVolumeSource - {}",
31845 value, err))
31846 }
31847 },
31848 std::result::Result::Err(e) => std::result::Result::Err(
31849 format!("Unable to convert header: {:?} to string: {}",
31850 hdr_value, e))
31851 }
31852 }
31853}
31854
31855
31856
31857
31858
31859
31860
31861#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
31862#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
31863pub struct SecurityConfig {
31864 #[serde(rename = "command")]
31865 #[serde(skip_serializing_if="Option::is_none")]
31866 pub command: Option<models::CommandConfig>,
31867
31868 #[serde(rename = "defaultMode")]
31869 #[serde(skip_serializing_if="Option::is_none")]
31870 pub default_mode: Option<String>,
31871
31872 #[serde(rename = "env")]
31873 #[serde(skip_serializing_if="Option::is_none")]
31874 pub env: Option<models::SecurityEnvConfig>,
31875
31876#[serde(rename = "forceCommand")]
31878 #[serde(skip_serializing_if="Option::is_none")]
31879 pub force_command: Option<String>,
31880
31881 #[serde(rename = "forwarding")]
31882 #[serde(skip_serializing_if="Option::is_none")]
31883 pub forwarding: Option<models::ForwardingConfig>,
31884
31885#[serde(rename = "maxSessions")]
31887 #[serde(skip_serializing_if="Option::is_none")]
31888 pub max_sessions: Option<i64>,
31889
31890 #[serde(rename = "shell")]
31891 #[serde(skip_serializing_if="Option::is_none")]
31892 pub shell: Option<models::SecurityShellConfig>,
31893
31894 #[serde(rename = "signal")]
31895 #[serde(skip_serializing_if="Option::is_none")]
31896 pub signal: Option<models::SecuritySignalConfig>,
31897
31898 #[serde(rename = "subsystem")]
31899 #[serde(skip_serializing_if="Option::is_none")]
31900 pub subsystem: Option<models::SubsystemConfig>,
31901
31902 #[serde(rename = "tty")]
31903 #[serde(skip_serializing_if="Option::is_none")]
31904 pub tty: Option<models::SecurityTtyConfig>,
31905
31906}
31907
31908
31909impl SecurityConfig {
31910 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
31911 pub fn new() -> SecurityConfig {
31912 SecurityConfig {
31913 command: None,
31914 default_mode: None,
31915 env: None,
31916 force_command: None,
31917 forwarding: None,
31918 max_sessions: None,
31919 shell: None,
31920 signal: None,
31921 subsystem: None,
31922 tty: None,
31923 }
31924 }
31925}
31926
31927impl std::string::ToString for SecurityConfig {
31931 fn to_string(&self) -> String {
31932 let params: Vec<Option<String>> = vec![
31933 self.default_mode.as_ref().map(|default_mode| {
31937 [
31938 "defaultMode".to_string(),
31939 default_mode.to_string(),
31940 ].join(",")
31941 }),
31942
31943 self.force_command.as_ref().map(|force_command| {
31947 [
31948 "forceCommand".to_string(),
31949 force_command.to_string(),
31950 ].join(",")
31951 }),
31952
31953 self.max_sessions.as_ref().map(|max_sessions| {
31957 [
31958 "maxSessions".to_string(),
31959 max_sessions.to_string(),
31960 ].join(",")
31961 }),
31962
31963 ];
31972
31973 params.into_iter().flatten().collect::<Vec<_>>().join(",")
31974 }
31975}
31976
31977impl std::str::FromStr for SecurityConfig {
31981 type Err = String;
31982
31983 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
31984 #[derive(Default)]
31986 #[allow(dead_code)]
31987 struct IntermediateRep {
31988 pub command: Vec<models::CommandConfig>,
31989 pub default_mode: Vec<String>,
31990 pub env: Vec<models::SecurityEnvConfig>,
31991 pub force_command: Vec<String>,
31992 pub forwarding: Vec<models::ForwardingConfig>,
31993 pub max_sessions: Vec<i64>,
31994 pub shell: Vec<models::SecurityShellConfig>,
31995 pub signal: Vec<models::SecuritySignalConfig>,
31996 pub subsystem: Vec<models::SubsystemConfig>,
31997 pub tty: Vec<models::SecurityTtyConfig>,
31998 }
31999
32000 let mut intermediate_rep = IntermediateRep::default();
32001
32002 let mut string_iter = s.split(',');
32004 let mut key_result = string_iter.next();
32005
32006 while key_result.is_some() {
32007 let val = match string_iter.next() {
32008 Some(x) => x,
32009 None => return std::result::Result::Err("Missing value while parsing SecurityConfig".to_string())
32010 };
32011
32012 if let Some(key) = key_result {
32013 #[allow(clippy::match_single_binding)]
32014 match key {
32015 #[allow(clippy::redundant_clone)]
32016 "command" => intermediate_rep.command.push(<models::CommandConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32017 #[allow(clippy::redundant_clone)]
32018 "defaultMode" => intermediate_rep.default_mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32019 #[allow(clippy::redundant_clone)]
32020 "env" => intermediate_rep.env.push(<models::SecurityEnvConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32021 #[allow(clippy::redundant_clone)]
32022 "forceCommand" => intermediate_rep.force_command.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32023 #[allow(clippy::redundant_clone)]
32024 "forwarding" => intermediate_rep.forwarding.push(<models::ForwardingConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32025 #[allow(clippy::redundant_clone)]
32026 "maxSessions" => intermediate_rep.max_sessions.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32027 #[allow(clippy::redundant_clone)]
32028 "shell" => intermediate_rep.shell.push(<models::SecurityShellConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32029 #[allow(clippy::redundant_clone)]
32030 "signal" => intermediate_rep.signal.push(<models::SecuritySignalConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32031 #[allow(clippy::redundant_clone)]
32032 "subsystem" => intermediate_rep.subsystem.push(<models::SubsystemConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32033 #[allow(clippy::redundant_clone)]
32034 "tty" => intermediate_rep.tty.push(<models::SecurityTtyConfig as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32035 _ => return std::result::Result::Err("Unexpected key while parsing SecurityConfig".to_string())
32036 }
32037 }
32038
32039 key_result = string_iter.next();
32041 }
32042
32043 std::result::Result::Ok(SecurityConfig {
32045 command: intermediate_rep.command.into_iter().next(),
32046 default_mode: intermediate_rep.default_mode.into_iter().next(),
32047 env: intermediate_rep.env.into_iter().next(),
32048 force_command: intermediate_rep.force_command.into_iter().next(),
32049 forwarding: intermediate_rep.forwarding.into_iter().next(),
32050 max_sessions: intermediate_rep.max_sessions.into_iter().next(),
32051 shell: intermediate_rep.shell.into_iter().next(),
32052 signal: intermediate_rep.signal.into_iter().next(),
32053 subsystem: intermediate_rep.subsystem.into_iter().next(),
32054 tty: intermediate_rep.tty.into_iter().next(),
32055 })
32056 }
32057}
32058
32059#[cfg(feature = "server")]
32062impl std::convert::TryFrom<header::IntoHeaderValue<SecurityConfig>> for HeaderValue {
32063 type Error = String;
32064
32065 fn try_from(hdr_value: header::IntoHeaderValue<SecurityConfig>) -> std::result::Result<Self, Self::Error> {
32066 let hdr_value = hdr_value.to_string();
32067 match HeaderValue::from_str(&hdr_value) {
32068 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32069 std::result::Result::Err(e) => std::result::Result::Err(
32070 format!("Invalid header value for SecurityConfig - value: {} is invalid {}",
32071 hdr_value, e))
32072 }
32073 }
32074}
32075
32076#[cfg(feature = "server")]
32077impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecurityConfig> {
32078 type Error = String;
32079
32080 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32081 match hdr_value.to_str() {
32082 std::result::Result::Ok(value) => {
32083 match <SecurityConfig as std::str::FromStr>::from_str(value) {
32084 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
32085 std::result::Result::Err(err) => std::result::Result::Err(
32086 format!("Unable to convert header value '{}' into SecurityConfig - {}",
32087 value, err))
32088 }
32089 },
32090 std::result::Result::Err(e) => std::result::Result::Err(
32091 format!("Unable to convert header: {:?} to string: {}",
32092 hdr_value, e))
32093 }
32094 }
32095}
32096
32097
32098
32099
32100#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
32105#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32106pub struct SecurityContext {
32107#[serde(rename = "allowPrivilegeEscalation")]
32109 #[serde(skip_serializing_if="Option::is_none")]
32110 pub allow_privilege_escalation: Option<bool>,
32111
32112 #[serde(rename = "capabilities")]
32113 #[serde(skip_serializing_if="Option::is_none")]
32114 pub capabilities: Option<models::Capabilities>,
32115
32116#[serde(rename = "privileged")]
32118 #[serde(skip_serializing_if="Option::is_none")]
32119 pub privileged: Option<bool>,
32120
32121#[serde(rename = "procMount")]
32123 #[serde(skip_serializing_if="Option::is_none")]
32124 pub proc_mount: Option<String>,
32125
32126#[serde(rename = "readOnlyRootFilesystem")]
32128 #[serde(skip_serializing_if="Option::is_none")]
32129 pub read_only_root_filesystem: Option<bool>,
32130
32131#[serde(rename = "runAsGroup")]
32133 #[serde(skip_serializing_if="Option::is_none")]
32134 pub run_as_group: Option<i64>,
32135
32136#[serde(rename = "runAsNonRoot")]
32138 #[serde(skip_serializing_if="Option::is_none")]
32139 pub run_as_non_root: Option<bool>,
32140
32141#[serde(rename = "runAsUser")]
32143 #[serde(skip_serializing_if="Option::is_none")]
32144 pub run_as_user: Option<i64>,
32145
32146 #[serde(rename = "seLinuxOptions")]
32147 #[serde(skip_serializing_if="Option::is_none")]
32148 pub se_linux_options: Option<models::SeLinuxOptions>,
32149
32150 #[serde(rename = "seccompProfile")]
32151 #[serde(skip_serializing_if="Option::is_none")]
32152 pub seccomp_profile: Option<models::SeccompProfile>,
32153
32154 #[serde(rename = "windowsOptions")]
32155 #[serde(skip_serializing_if="Option::is_none")]
32156 pub windows_options: Option<models::WindowsSecurityContextOptions>,
32157
32158}
32159
32160
32161impl SecurityContext {
32162 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
32163 pub fn new() -> SecurityContext {
32164 SecurityContext {
32165 allow_privilege_escalation: None,
32166 capabilities: None,
32167 privileged: None,
32168 proc_mount: None,
32169 read_only_root_filesystem: None,
32170 run_as_group: None,
32171 run_as_non_root: None,
32172 run_as_user: None,
32173 se_linux_options: None,
32174 seccomp_profile: None,
32175 windows_options: None,
32176 }
32177 }
32178}
32179
32180impl std::string::ToString for SecurityContext {
32184 fn to_string(&self) -> String {
32185 let params: Vec<Option<String>> = vec![
32186
32187 self.allow_privilege_escalation.as_ref().map(|allow_privilege_escalation| {
32188 [
32189 "allowPrivilegeEscalation".to_string(),
32190 allow_privilege_escalation.to_string(),
32191 ].join(",")
32192 }),
32193
32194 self.privileged.as_ref().map(|privileged| {
32198 [
32199 "privileged".to_string(),
32200 privileged.to_string(),
32201 ].join(",")
32202 }),
32203
32204
32205 self.proc_mount.as_ref().map(|proc_mount| {
32206 [
32207 "procMount".to_string(),
32208 proc_mount.to_string(),
32209 ].join(",")
32210 }),
32211
32212
32213 self.read_only_root_filesystem.as_ref().map(|read_only_root_filesystem| {
32214 [
32215 "readOnlyRootFilesystem".to_string(),
32216 read_only_root_filesystem.to_string(),
32217 ].join(",")
32218 }),
32219
32220
32221 self.run_as_group.as_ref().map(|run_as_group| {
32222 [
32223 "runAsGroup".to_string(),
32224 run_as_group.to_string(),
32225 ].join(",")
32226 }),
32227
32228
32229 self.run_as_non_root.as_ref().map(|run_as_non_root| {
32230 [
32231 "runAsNonRoot".to_string(),
32232 run_as_non_root.to_string(),
32233 ].join(",")
32234 }),
32235
32236
32237 self.run_as_user.as_ref().map(|run_as_user| {
32238 [
32239 "runAsUser".to_string(),
32240 run_as_user.to_string(),
32241 ].join(",")
32242 }),
32243
32244 ];
32251
32252 params.into_iter().flatten().collect::<Vec<_>>().join(",")
32253 }
32254}
32255
32256impl std::str::FromStr for SecurityContext {
32260 type Err = String;
32261
32262 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
32263 #[derive(Default)]
32265 #[allow(dead_code)]
32266 struct IntermediateRep {
32267 pub allow_privilege_escalation: Vec<bool>,
32268 pub capabilities: Vec<models::Capabilities>,
32269 pub privileged: Vec<bool>,
32270 pub proc_mount: Vec<String>,
32271 pub read_only_root_filesystem: Vec<bool>,
32272 pub run_as_group: Vec<i64>,
32273 pub run_as_non_root: Vec<bool>,
32274 pub run_as_user: Vec<i64>,
32275 pub se_linux_options: Vec<models::SeLinuxOptions>,
32276 pub seccomp_profile: Vec<models::SeccompProfile>,
32277 pub windows_options: Vec<models::WindowsSecurityContextOptions>,
32278 }
32279
32280 let mut intermediate_rep = IntermediateRep::default();
32281
32282 let mut string_iter = s.split(',');
32284 let mut key_result = string_iter.next();
32285
32286 while key_result.is_some() {
32287 let val = match string_iter.next() {
32288 Some(x) => x,
32289 None => return std::result::Result::Err("Missing value while parsing SecurityContext".to_string())
32290 };
32291
32292 if let Some(key) = key_result {
32293 #[allow(clippy::match_single_binding)]
32294 match key {
32295 #[allow(clippy::redundant_clone)]
32296 "allowPrivilegeEscalation" => intermediate_rep.allow_privilege_escalation.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32297 #[allow(clippy::redundant_clone)]
32298 "capabilities" => intermediate_rep.capabilities.push(<models::Capabilities as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32299 #[allow(clippy::redundant_clone)]
32300 "privileged" => intermediate_rep.privileged.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32301 #[allow(clippy::redundant_clone)]
32302 "procMount" => intermediate_rep.proc_mount.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32303 #[allow(clippy::redundant_clone)]
32304 "readOnlyRootFilesystem" => intermediate_rep.read_only_root_filesystem.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32305 #[allow(clippy::redundant_clone)]
32306 "runAsGroup" => intermediate_rep.run_as_group.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32307 #[allow(clippy::redundant_clone)]
32308 "runAsNonRoot" => intermediate_rep.run_as_non_root.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32309 #[allow(clippy::redundant_clone)]
32310 "runAsUser" => intermediate_rep.run_as_user.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32311 #[allow(clippy::redundant_clone)]
32312 "seLinuxOptions" => intermediate_rep.se_linux_options.push(<models::SeLinuxOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32313 #[allow(clippy::redundant_clone)]
32314 "seccompProfile" => intermediate_rep.seccomp_profile.push(<models::SeccompProfile as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32315 #[allow(clippy::redundant_clone)]
32316 "windowsOptions" => intermediate_rep.windows_options.push(<models::WindowsSecurityContextOptions as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32317 _ => return std::result::Result::Err("Unexpected key while parsing SecurityContext".to_string())
32318 }
32319 }
32320
32321 key_result = string_iter.next();
32323 }
32324
32325 std::result::Result::Ok(SecurityContext {
32327 allow_privilege_escalation: intermediate_rep.allow_privilege_escalation.into_iter().next(),
32328 capabilities: intermediate_rep.capabilities.into_iter().next(),
32329 privileged: intermediate_rep.privileged.into_iter().next(),
32330 proc_mount: intermediate_rep.proc_mount.into_iter().next(),
32331 read_only_root_filesystem: intermediate_rep.read_only_root_filesystem.into_iter().next(),
32332 run_as_group: intermediate_rep.run_as_group.into_iter().next(),
32333 run_as_non_root: intermediate_rep.run_as_non_root.into_iter().next(),
32334 run_as_user: intermediate_rep.run_as_user.into_iter().next(),
32335 se_linux_options: intermediate_rep.se_linux_options.into_iter().next(),
32336 seccomp_profile: intermediate_rep.seccomp_profile.into_iter().next(),
32337 windows_options: intermediate_rep.windows_options.into_iter().next(),
32338 })
32339 }
32340}
32341
32342#[cfg(feature = "server")]
32345impl std::convert::TryFrom<header::IntoHeaderValue<SecurityContext>> for HeaderValue {
32346 type Error = String;
32347
32348 fn try_from(hdr_value: header::IntoHeaderValue<SecurityContext>) -> std::result::Result<Self, Self::Error> {
32349 let hdr_value = hdr_value.to_string();
32350 match HeaderValue::from_str(&hdr_value) {
32351 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32352 std::result::Result::Err(e) => std::result::Result::Err(
32353 format!("Invalid header value for SecurityContext - value: {} is invalid {}",
32354 hdr_value, e))
32355 }
32356 }
32357}
32358
32359#[cfg(feature = "server")]
32360impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecurityContext> {
32361 type Error = String;
32362
32363 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32364 match hdr_value.to_str() {
32365 std::result::Result::Ok(value) => {
32366 match <SecurityContext as std::str::FromStr>::from_str(value) {
32367 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
32368 std::result::Result::Err(err) => std::result::Result::Err(
32369 format!("Unable to convert header value '{}' into SecurityContext - {}",
32370 value, err))
32371 }
32372 },
32373 std::result::Result::Err(e) => std::result::Result::Err(
32374 format!("Unable to convert header: {:?} to string: {}",
32375 hdr_value, e))
32376 }
32377 }
32378}
32379
32380
32381
32382
32383
32384
32385
32386#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
32387#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32388pub struct SecurityEnvConfig {
32389#[serde(rename = "allow")]
32391 #[serde(skip_serializing_if="Option::is_none")]
32392 pub allow: Option<Vec<String>>,
32393
32394#[serde(rename = "deny")]
32396 #[serde(skip_serializing_if="Option::is_none")]
32397 pub deny: Option<Vec<String>>,
32398
32399 #[serde(rename = "mode")]
32400 #[serde(skip_serializing_if="Option::is_none")]
32401 pub mode: Option<String>,
32402
32403}
32404
32405
32406impl SecurityEnvConfig {
32407 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
32408 pub fn new() -> SecurityEnvConfig {
32409 SecurityEnvConfig {
32410 allow: None,
32411 deny: None,
32412 mode: None,
32413 }
32414 }
32415}
32416
32417impl std::string::ToString for SecurityEnvConfig {
32421 fn to_string(&self) -> String {
32422 let params: Vec<Option<String>> = vec![
32423
32424 self.allow.as_ref().map(|allow| {
32425 [
32426 "allow".to_string(),
32427 allow.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
32428 ].join(",")
32429 }),
32430
32431
32432 self.deny.as_ref().map(|deny| {
32433 [
32434 "deny".to_string(),
32435 deny.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
32436 ].join(",")
32437 }),
32438
32439
32440 self.mode.as_ref().map(|mode| {
32441 [
32442 "mode".to_string(),
32443 mode.to_string(),
32444 ].join(",")
32445 }),
32446
32447 ];
32448
32449 params.into_iter().flatten().collect::<Vec<_>>().join(",")
32450 }
32451}
32452
32453impl std::str::FromStr for SecurityEnvConfig {
32457 type Err = String;
32458
32459 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
32460 #[derive(Default)]
32462 #[allow(dead_code)]
32463 struct IntermediateRep {
32464 pub allow: Vec<Vec<String>>,
32465 pub deny: Vec<Vec<String>>,
32466 pub mode: Vec<String>,
32467 }
32468
32469 let mut intermediate_rep = IntermediateRep::default();
32470
32471 let mut string_iter = s.split(',');
32473 let mut key_result = string_iter.next();
32474
32475 while key_result.is_some() {
32476 let val = match string_iter.next() {
32477 Some(x) => x,
32478 None => return std::result::Result::Err("Missing value while parsing SecurityEnvConfig".to_string())
32479 };
32480
32481 if let Some(key) = key_result {
32482 #[allow(clippy::match_single_binding)]
32483 match key {
32484 "allow" => return std::result::Result::Err("Parsing a container in this style is not supported in SecurityEnvConfig".to_string()),
32485 "deny" => return std::result::Result::Err("Parsing a container in this style is not supported in SecurityEnvConfig".to_string()),
32486 #[allow(clippy::redundant_clone)]
32487 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32488 _ => return std::result::Result::Err("Unexpected key while parsing SecurityEnvConfig".to_string())
32489 }
32490 }
32491
32492 key_result = string_iter.next();
32494 }
32495
32496 std::result::Result::Ok(SecurityEnvConfig {
32498 allow: intermediate_rep.allow.into_iter().next(),
32499 deny: intermediate_rep.deny.into_iter().next(),
32500 mode: intermediate_rep.mode.into_iter().next(),
32501 })
32502 }
32503}
32504
32505#[cfg(feature = "server")]
32508impl std::convert::TryFrom<header::IntoHeaderValue<SecurityEnvConfig>> for HeaderValue {
32509 type Error = String;
32510
32511 fn try_from(hdr_value: header::IntoHeaderValue<SecurityEnvConfig>) -> std::result::Result<Self, Self::Error> {
32512 let hdr_value = hdr_value.to_string();
32513 match HeaderValue::from_str(&hdr_value) {
32514 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32515 std::result::Result::Err(e) => std::result::Result::Err(
32516 format!("Invalid header value for SecurityEnvConfig - value: {} is invalid {}",
32517 hdr_value, e))
32518 }
32519 }
32520}
32521
32522#[cfg(feature = "server")]
32523impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecurityEnvConfig> {
32524 type Error = String;
32525
32526 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32527 match hdr_value.to_str() {
32528 std::result::Result::Ok(value) => {
32529 match <SecurityEnvConfig as std::str::FromStr>::from_str(value) {
32530 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
32531 std::result::Result::Err(err) => std::result::Result::Err(
32532 format!("Unable to convert header value '{}' into SecurityEnvConfig - {}",
32533 value, err))
32534 }
32535 },
32536 std::result::Result::Err(e) => std::result::Result::Err(
32537 format!("Unable to convert header: {:?} to string: {}",
32538 hdr_value, e))
32539 }
32540 }
32541}
32542
32543
32544
32545
32546#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
32547#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32548pub struct SecurityExecutionPolicy(String);
32549
32550impl validator::Validate for SecurityExecutionPolicy {
32551 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
32552 std::result::Result::Ok(())
32553 }
32554}
32555
32556impl std::convert::From<String> for SecurityExecutionPolicy {
32557 fn from(x: String) -> Self {
32558 SecurityExecutionPolicy(x)
32559 }
32560}
32561
32562impl std::string::ToString for SecurityExecutionPolicy {
32563 fn to_string(&self) -> String {
32564 self.0.to_string()
32565 }
32566}
32567
32568impl std::str::FromStr for SecurityExecutionPolicy {
32569 type Err = std::string::ParseError;
32570 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
32571 std::result::Result::Ok(SecurityExecutionPolicy(x.to_string()))
32572 }
32573}
32574
32575impl std::convert::From<SecurityExecutionPolicy> for String {
32576 fn from(x: SecurityExecutionPolicy) -> Self {
32577 x.0
32578 }
32579}
32580
32581impl std::ops::Deref for SecurityExecutionPolicy {
32582 type Target = String;
32583 fn deref(&self) -> &String {
32584 &self.0
32585 }
32586}
32587
32588impl std::ops::DerefMut for SecurityExecutionPolicy {
32589 fn deref_mut(&mut self) -> &mut String {
32590 &mut self.0
32591 }
32592}
32593
32594
32595
32596
32597
32598
32599#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
32600#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32601pub struct SecurityShellConfig {
32602 #[serde(rename = "mode")]
32603 #[serde(skip_serializing_if="Option::is_none")]
32604 pub mode: Option<String>,
32605
32606}
32607
32608
32609impl SecurityShellConfig {
32610 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
32611 pub fn new() -> SecurityShellConfig {
32612 SecurityShellConfig {
32613 mode: None,
32614 }
32615 }
32616}
32617
32618impl std::string::ToString for SecurityShellConfig {
32622 fn to_string(&self) -> String {
32623 let params: Vec<Option<String>> = vec![
32624
32625 self.mode.as_ref().map(|mode| {
32626 [
32627 "mode".to_string(),
32628 mode.to_string(),
32629 ].join(",")
32630 }),
32631
32632 ];
32633
32634 params.into_iter().flatten().collect::<Vec<_>>().join(",")
32635 }
32636}
32637
32638impl std::str::FromStr for SecurityShellConfig {
32642 type Err = String;
32643
32644 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
32645 #[derive(Default)]
32647 #[allow(dead_code)]
32648 struct IntermediateRep {
32649 pub mode: Vec<String>,
32650 }
32651
32652 let mut intermediate_rep = IntermediateRep::default();
32653
32654 let mut string_iter = s.split(',');
32656 let mut key_result = string_iter.next();
32657
32658 while key_result.is_some() {
32659 let val = match string_iter.next() {
32660 Some(x) => x,
32661 None => return std::result::Result::Err("Missing value while parsing SecurityShellConfig".to_string())
32662 };
32663
32664 if let Some(key) = key_result {
32665 #[allow(clippy::match_single_binding)]
32666 match key {
32667 #[allow(clippy::redundant_clone)]
32668 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32669 _ => return std::result::Result::Err("Unexpected key while parsing SecurityShellConfig".to_string())
32670 }
32671 }
32672
32673 key_result = string_iter.next();
32675 }
32676
32677 std::result::Result::Ok(SecurityShellConfig {
32679 mode: intermediate_rep.mode.into_iter().next(),
32680 })
32681 }
32682}
32683
32684#[cfg(feature = "server")]
32687impl std::convert::TryFrom<header::IntoHeaderValue<SecurityShellConfig>> for HeaderValue {
32688 type Error = String;
32689
32690 fn try_from(hdr_value: header::IntoHeaderValue<SecurityShellConfig>) -> std::result::Result<Self, Self::Error> {
32691 let hdr_value = hdr_value.to_string();
32692 match HeaderValue::from_str(&hdr_value) {
32693 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32694 std::result::Result::Err(e) => std::result::Result::Err(
32695 format!("Invalid header value for SecurityShellConfig - value: {} is invalid {}",
32696 hdr_value, e))
32697 }
32698 }
32699}
32700
32701#[cfg(feature = "server")]
32702impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecurityShellConfig> {
32703 type Error = String;
32704
32705 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32706 match hdr_value.to_str() {
32707 std::result::Result::Ok(value) => {
32708 match <SecurityShellConfig as std::str::FromStr>::from_str(value) {
32709 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
32710 std::result::Result::Err(err) => std::result::Result::Err(
32711 format!("Unable to convert header value '{}' into SecurityShellConfig - {}",
32712 value, err))
32713 }
32714 },
32715 std::result::Result::Err(e) => std::result::Result::Err(
32716 format!("Unable to convert header: {:?} to string: {}",
32717 hdr_value, e))
32718 }
32719 }
32720}
32721
32722
32723
32724
32725
32726
32727
32728#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
32729#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32730pub struct SecuritySignalConfig {
32731#[serde(rename = "allow")]
32733 #[serde(skip_serializing_if="Option::is_none")]
32734 pub allow: Option<Vec<String>>,
32735
32736#[serde(rename = "deny")]
32738 #[serde(skip_serializing_if="Option::is_none")]
32739 pub deny: Option<Vec<String>>,
32740
32741 #[serde(rename = "mode")]
32742 #[serde(skip_serializing_if="Option::is_none")]
32743 pub mode: Option<String>,
32744
32745}
32746
32747
32748impl SecuritySignalConfig {
32749 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
32750 pub fn new() -> SecuritySignalConfig {
32751 SecuritySignalConfig {
32752 allow: None,
32753 deny: None,
32754 mode: None,
32755 }
32756 }
32757}
32758
32759impl std::string::ToString for SecuritySignalConfig {
32763 fn to_string(&self) -> String {
32764 let params: Vec<Option<String>> = vec![
32765
32766 self.allow.as_ref().map(|allow| {
32767 [
32768 "allow".to_string(),
32769 allow.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
32770 ].join(",")
32771 }),
32772
32773
32774 self.deny.as_ref().map(|deny| {
32775 [
32776 "deny".to_string(),
32777 deny.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
32778 ].join(",")
32779 }),
32780
32781
32782 self.mode.as_ref().map(|mode| {
32783 [
32784 "mode".to_string(),
32785 mode.to_string(),
32786 ].join(",")
32787 }),
32788
32789 ];
32790
32791 params.into_iter().flatten().collect::<Vec<_>>().join(",")
32792 }
32793}
32794
32795impl std::str::FromStr for SecuritySignalConfig {
32799 type Err = String;
32800
32801 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
32802 #[derive(Default)]
32804 #[allow(dead_code)]
32805 struct IntermediateRep {
32806 pub allow: Vec<Vec<String>>,
32807 pub deny: Vec<Vec<String>>,
32808 pub mode: Vec<String>,
32809 }
32810
32811 let mut intermediate_rep = IntermediateRep::default();
32812
32813 let mut string_iter = s.split(',');
32815 let mut key_result = string_iter.next();
32816
32817 while key_result.is_some() {
32818 let val = match string_iter.next() {
32819 Some(x) => x,
32820 None => return std::result::Result::Err("Missing value while parsing SecuritySignalConfig".to_string())
32821 };
32822
32823 if let Some(key) = key_result {
32824 #[allow(clippy::match_single_binding)]
32825 match key {
32826 "allow" => return std::result::Result::Err("Parsing a container in this style is not supported in SecuritySignalConfig".to_string()),
32827 "deny" => return std::result::Result::Err("Parsing a container in this style is not supported in SecuritySignalConfig".to_string()),
32828 #[allow(clippy::redundant_clone)]
32829 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32830 _ => return std::result::Result::Err("Unexpected key while parsing SecuritySignalConfig".to_string())
32831 }
32832 }
32833
32834 key_result = string_iter.next();
32836 }
32837
32838 std::result::Result::Ok(SecuritySignalConfig {
32840 allow: intermediate_rep.allow.into_iter().next(),
32841 deny: intermediate_rep.deny.into_iter().next(),
32842 mode: intermediate_rep.mode.into_iter().next(),
32843 })
32844 }
32845}
32846
32847#[cfg(feature = "server")]
32850impl std::convert::TryFrom<header::IntoHeaderValue<SecuritySignalConfig>> for HeaderValue {
32851 type Error = String;
32852
32853 fn try_from(hdr_value: header::IntoHeaderValue<SecuritySignalConfig>) -> std::result::Result<Self, Self::Error> {
32854 let hdr_value = hdr_value.to_string();
32855 match HeaderValue::from_str(&hdr_value) {
32856 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32857 std::result::Result::Err(e) => std::result::Result::Err(
32858 format!("Invalid header value for SecuritySignalConfig - value: {} is invalid {}",
32859 hdr_value, e))
32860 }
32861 }
32862}
32863
32864#[cfg(feature = "server")]
32865impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecuritySignalConfig> {
32866 type Error = String;
32867
32868 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32869 match hdr_value.to_str() {
32870 std::result::Result::Ok(value) => {
32871 match <SecuritySignalConfig as std::str::FromStr>::from_str(value) {
32872 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
32873 std::result::Result::Err(err) => std::result::Result::Err(
32874 format!("Unable to convert header value '{}' into SecuritySignalConfig - {}",
32875 value, err))
32876 }
32877 },
32878 std::result::Result::Err(e) => std::result::Result::Err(
32879 format!("Unable to convert header: {:?} to string: {}",
32880 hdr_value, e))
32881 }
32882 }
32883}
32884
32885
32886
32887
32888
32889
32890
32891#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
32892#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
32893pub struct SecurityTtyConfig {
32894 #[serde(rename = "mode")]
32895 #[serde(skip_serializing_if="Option::is_none")]
32896 pub mode: Option<String>,
32897
32898}
32899
32900
32901impl SecurityTtyConfig {
32902 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
32903 pub fn new() -> SecurityTtyConfig {
32904 SecurityTtyConfig {
32905 mode: None,
32906 }
32907 }
32908}
32909
32910impl std::string::ToString for SecurityTtyConfig {
32914 fn to_string(&self) -> String {
32915 let params: Vec<Option<String>> = vec![
32916
32917 self.mode.as_ref().map(|mode| {
32918 [
32919 "mode".to_string(),
32920 mode.to_string(),
32921 ].join(",")
32922 }),
32923
32924 ];
32925
32926 params.into_iter().flatten().collect::<Vec<_>>().join(",")
32927 }
32928}
32929
32930impl std::str::FromStr for SecurityTtyConfig {
32934 type Err = String;
32935
32936 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
32937 #[derive(Default)]
32939 #[allow(dead_code)]
32940 struct IntermediateRep {
32941 pub mode: Vec<String>,
32942 }
32943
32944 let mut intermediate_rep = IntermediateRep::default();
32945
32946 let mut string_iter = s.split(',');
32948 let mut key_result = string_iter.next();
32949
32950 while key_result.is_some() {
32951 let val = match string_iter.next() {
32952 Some(x) => x,
32953 None => return std::result::Result::Err("Missing value while parsing SecurityTtyConfig".to_string())
32954 };
32955
32956 if let Some(key) = key_result {
32957 #[allow(clippy::match_single_binding)]
32958 match key {
32959 #[allow(clippy::redundant_clone)]
32960 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
32961 _ => return std::result::Result::Err("Unexpected key while parsing SecurityTtyConfig".to_string())
32962 }
32963 }
32964
32965 key_result = string_iter.next();
32967 }
32968
32969 std::result::Result::Ok(SecurityTtyConfig {
32971 mode: intermediate_rep.mode.into_iter().next(),
32972 })
32973 }
32974}
32975
32976#[cfg(feature = "server")]
32979impl std::convert::TryFrom<header::IntoHeaderValue<SecurityTtyConfig>> for HeaderValue {
32980 type Error = String;
32981
32982 fn try_from(hdr_value: header::IntoHeaderValue<SecurityTtyConfig>) -> std::result::Result<Self, Self::Error> {
32983 let hdr_value = hdr_value.to_string();
32984 match HeaderValue::from_str(&hdr_value) {
32985 std::result::Result::Ok(value) => std::result::Result::Ok(value),
32986 std::result::Result::Err(e) => std::result::Result::Err(
32987 format!("Invalid header value for SecurityTtyConfig - value: {} is invalid {}",
32988 hdr_value, e))
32989 }
32990 }
32991}
32992
32993#[cfg(feature = "server")]
32994impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SecurityTtyConfig> {
32995 type Error = String;
32996
32997 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
32998 match hdr_value.to_str() {
32999 std::result::Result::Ok(value) => {
33000 match <SecurityTtyConfig as std::str::FromStr>::from_str(value) {
33001 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
33002 std::result::Result::Err(err) => std::result::Result::Err(
33003 format!("Unable to convert header value '{}' into SecurityTtyConfig - {}",
33004 value, err))
33005 }
33006 },
33007 std::result::Result::Err(e) => std::result::Result::Err(
33008 format!("Unable to convert header: {:?} to string: {}",
33009 hdr_value, e))
33010 }
33011 }
33012}
33013
33014
33015
33016
33017#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
33022#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33023pub struct ServiceAccountTokenProjection {
33024#[serde(rename = "audience")]
33026 #[serde(skip_serializing_if="Option::is_none")]
33027 pub audience: Option<String>,
33028
33029#[serde(rename = "expirationSeconds")]
33031 #[serde(skip_serializing_if="Option::is_none")]
33032 pub expiration_seconds: Option<i64>,
33033
33034#[serde(rename = "path")]
33036 #[serde(skip_serializing_if="Option::is_none")]
33037 pub path: Option<String>,
33038
33039}
33040
33041
33042impl ServiceAccountTokenProjection {
33043 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
33044 pub fn new() -> ServiceAccountTokenProjection {
33045 ServiceAccountTokenProjection {
33046 audience: None,
33047 expiration_seconds: None,
33048 path: None,
33049 }
33050 }
33051}
33052
33053impl std::string::ToString for ServiceAccountTokenProjection {
33057 fn to_string(&self) -> String {
33058 let params: Vec<Option<String>> = vec![
33059
33060 self.audience.as_ref().map(|audience| {
33061 [
33062 "audience".to_string(),
33063 audience.to_string(),
33064 ].join(",")
33065 }),
33066
33067
33068 self.expiration_seconds.as_ref().map(|expiration_seconds| {
33069 [
33070 "expirationSeconds".to_string(),
33071 expiration_seconds.to_string(),
33072 ].join(",")
33073 }),
33074
33075
33076 self.path.as_ref().map(|path| {
33077 [
33078 "path".to_string(),
33079 path.to_string(),
33080 ].join(",")
33081 }),
33082
33083 ];
33084
33085 params.into_iter().flatten().collect::<Vec<_>>().join(",")
33086 }
33087}
33088
33089impl std::str::FromStr for ServiceAccountTokenProjection {
33093 type Err = String;
33094
33095 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
33096 #[derive(Default)]
33098 #[allow(dead_code)]
33099 struct IntermediateRep {
33100 pub audience: Vec<String>,
33101 pub expiration_seconds: Vec<i64>,
33102 pub path: Vec<String>,
33103 }
33104
33105 let mut intermediate_rep = IntermediateRep::default();
33106
33107 let mut string_iter = s.split(',');
33109 let mut key_result = string_iter.next();
33110
33111 while key_result.is_some() {
33112 let val = match string_iter.next() {
33113 Some(x) => x,
33114 None => return std::result::Result::Err("Missing value while parsing ServiceAccountTokenProjection".to_string())
33115 };
33116
33117 if let Some(key) = key_result {
33118 #[allow(clippy::match_single_binding)]
33119 match key {
33120 #[allow(clippy::redundant_clone)]
33121 "audience" => intermediate_rep.audience.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33122 #[allow(clippy::redundant_clone)]
33123 "expirationSeconds" => intermediate_rep.expiration_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33124 #[allow(clippy::redundant_clone)]
33125 "path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33126 _ => return std::result::Result::Err("Unexpected key while parsing ServiceAccountTokenProjection".to_string())
33127 }
33128 }
33129
33130 key_result = string_iter.next();
33132 }
33133
33134 std::result::Result::Ok(ServiceAccountTokenProjection {
33136 audience: intermediate_rep.audience.into_iter().next(),
33137 expiration_seconds: intermediate_rep.expiration_seconds.into_iter().next(),
33138 path: intermediate_rep.path.into_iter().next(),
33139 })
33140 }
33141}
33142
33143#[cfg(feature = "server")]
33146impl std::convert::TryFrom<header::IntoHeaderValue<ServiceAccountTokenProjection>> for HeaderValue {
33147 type Error = String;
33148
33149 fn try_from(hdr_value: header::IntoHeaderValue<ServiceAccountTokenProjection>) -> std::result::Result<Self, Self::Error> {
33150 let hdr_value = hdr_value.to_string();
33151 match HeaderValue::from_str(&hdr_value) {
33152 std::result::Result::Ok(value) => std::result::Result::Ok(value),
33153 std::result::Result::Err(e) => std::result::Result::Err(
33154 format!("Invalid header value for ServiceAccountTokenProjection - value: {} is invalid {}",
33155 hdr_value, e))
33156 }
33157 }
33158}
33159
33160#[cfg(feature = "server")]
33161impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ServiceAccountTokenProjection> {
33162 type Error = String;
33163
33164 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
33165 match hdr_value.to_str() {
33166 std::result::Result::Ok(value) => {
33167 match <ServiceAccountTokenProjection as std::str::FromStr>::from_str(value) {
33168 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
33169 std::result::Result::Err(err) => std::result::Result::Err(
33170 format!("Unable to convert header value '{}' into ServiceAccountTokenProjection - {}",
33171 value, err))
33172 }
33173 },
33174 std::result::Result::Err(e) => std::result::Result::Err(
33175 format!("Unable to convert header: {:?} to string: {}",
33176 hdr_value, e))
33177 }
33178 }
33179}
33180
33181
33182
33183
33184#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
33189#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33190pub struct ServiceUpdateResponse {
33191#[serde(rename = "Warnings")]
33193 #[serde(skip_serializing_if="Option::is_none")]
33194 pub warnings: Option<Vec<String>>,
33195
33196}
33197
33198
33199impl ServiceUpdateResponse {
33200 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
33201 pub fn new() -> ServiceUpdateResponse {
33202 ServiceUpdateResponse {
33203 warnings: None,
33204 }
33205 }
33206}
33207
33208impl std::string::ToString for ServiceUpdateResponse {
33212 fn to_string(&self) -> String {
33213 let params: Vec<Option<String>> = vec![
33214
33215 self.warnings.as_ref().map(|warnings| {
33216 [
33217 "Warnings".to_string(),
33218 warnings.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33219 ].join(",")
33220 }),
33221
33222 ];
33223
33224 params.into_iter().flatten().collect::<Vec<_>>().join(",")
33225 }
33226}
33227
33228impl std::str::FromStr for ServiceUpdateResponse {
33232 type Err = String;
33233
33234 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
33235 #[derive(Default)]
33237 #[allow(dead_code)]
33238 struct IntermediateRep {
33239 pub warnings: Vec<Vec<String>>,
33240 }
33241
33242 let mut intermediate_rep = IntermediateRep::default();
33243
33244 let mut string_iter = s.split(',');
33246 let mut key_result = string_iter.next();
33247
33248 while key_result.is_some() {
33249 let val = match string_iter.next() {
33250 Some(x) => x,
33251 None => return std::result::Result::Err("Missing value while parsing ServiceUpdateResponse".to_string())
33252 };
33253
33254 if let Some(key) = key_result {
33255 #[allow(clippy::match_single_binding)]
33256 match key {
33257 "Warnings" => return std::result::Result::Err("Parsing a container in this style is not supported in ServiceUpdateResponse".to_string()),
33258 _ => return std::result::Result::Err("Unexpected key while parsing ServiceUpdateResponse".to_string())
33259 }
33260 }
33261
33262 key_result = string_iter.next();
33264 }
33265
33266 std::result::Result::Ok(ServiceUpdateResponse {
33268 warnings: intermediate_rep.warnings.into_iter().next(),
33269 })
33270 }
33271}
33272
33273#[cfg(feature = "server")]
33276impl std::convert::TryFrom<header::IntoHeaderValue<ServiceUpdateResponse>> for HeaderValue {
33277 type Error = String;
33278
33279 fn try_from(hdr_value: header::IntoHeaderValue<ServiceUpdateResponse>) -> std::result::Result<Self, Self::Error> {
33280 let hdr_value = hdr_value.to_string();
33281 match HeaderValue::from_str(&hdr_value) {
33282 std::result::Result::Ok(value) => std::result::Result::Ok(value),
33283 std::result::Result::Err(e) => std::result::Result::Err(
33284 format!("Invalid header value for ServiceUpdateResponse - value: {} is invalid {}",
33285 hdr_value, e))
33286 }
33287 }
33288}
33289
33290#[cfg(feature = "server")]
33291impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ServiceUpdateResponse> {
33292 type Error = String;
33293
33294 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
33295 match hdr_value.to_str() {
33296 std::result::Result::Ok(value) => {
33297 match <ServiceUpdateResponse as std::str::FromStr>::from_str(value) {
33298 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
33299 std::result::Result::Err(err) => std::result::Result::Err(
33300 format!("Unable to convert header value '{}' into ServiceUpdateResponse - {}",
33301 value, err))
33302 }
33303 },
33304 std::result::Result::Err(e) => std::result::Result::Err(
33305 format!("Unable to convert header: {:?} to string: {}",
33306 hdr_value, e))
33307 }
33308 }
33309}
33310
33311
33312
33313
33314#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33316#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33317pub struct SshCipher(String);
33318
33319impl validator::Validate for SshCipher {
33320 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33321 std::result::Result::Ok(())
33322 }
33323}
33324
33325impl std::convert::From<String> for SshCipher {
33326 fn from(x: String) -> Self {
33327 SshCipher(x)
33328 }
33329}
33330
33331impl std::string::ToString for SshCipher {
33332 fn to_string(&self) -> String {
33333 self.0.to_string()
33334 }
33335}
33336
33337impl std::str::FromStr for SshCipher {
33338 type Err = std::string::ParseError;
33339 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33340 std::result::Result::Ok(SshCipher(x.to_string()))
33341 }
33342}
33343
33344impl std::convert::From<SshCipher> for String {
33345 fn from(x: SshCipher) -> Self {
33346 x.0
33347 }
33348}
33349
33350impl std::ops::Deref for SshCipher {
33351 type Target = String;
33352 fn deref(&self) -> &String {
33353 &self.0
33354 }
33355}
33356
33357impl std::ops::DerefMut for SshCipher {
33358 fn deref_mut(&mut self) -> &mut String {
33359 &mut self.0
33360 }
33361}
33362
33363
33364
33365#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33367#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33368pub struct SshKex(String);
33369
33370impl validator::Validate for SshKex {
33371 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33372 std::result::Result::Ok(())
33373 }
33374}
33375
33376impl std::convert::From<String> for SshKex {
33377 fn from(x: String) -> Self {
33378 SshKex(x)
33379 }
33380}
33381
33382impl std::string::ToString for SshKex {
33383 fn to_string(&self) -> String {
33384 self.0.to_string()
33385 }
33386}
33387
33388impl std::str::FromStr for SshKex {
33389 type Err = std::string::ParseError;
33390 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33391 std::result::Result::Ok(SshKex(x.to_string()))
33392 }
33393}
33394
33395impl std::convert::From<SshKex> for String {
33396 fn from(x: SshKex) -> Self {
33397 x.0
33398 }
33399}
33400
33401impl std::ops::Deref for SshKex {
33402 type Target = String;
33403 fn deref(&self) -> &String {
33404 &self.0
33405 }
33406}
33407
33408impl std::ops::DerefMut for SshKex {
33409 fn deref_mut(&mut self) -> &mut String {
33410 &mut self.0
33411 }
33412}
33413
33414
33415
33416#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33417#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33418pub struct SshKeyAlgo(String);
33419
33420impl validator::Validate for SshKeyAlgo {
33421 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33422 std::result::Result::Ok(())
33423 }
33424}
33425
33426impl std::convert::From<String> for SshKeyAlgo {
33427 fn from(x: String) -> Self {
33428 SshKeyAlgo(x)
33429 }
33430}
33431
33432impl std::string::ToString for SshKeyAlgo {
33433 fn to_string(&self) -> String {
33434 self.0.to_string()
33435 }
33436}
33437
33438impl std::str::FromStr for SshKeyAlgo {
33439 type Err = std::string::ParseError;
33440 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33441 std::result::Result::Ok(SshKeyAlgo(x.to_string()))
33442 }
33443}
33444
33445impl std::convert::From<SshKeyAlgo> for String {
33446 fn from(x: SshKeyAlgo) -> Self {
33447 x.0
33448 }
33449}
33450
33451impl std::ops::Deref for SshKeyAlgo {
33452 type Target = String;
33453 fn deref(&self) -> &String {
33454 &self.0
33455 }
33456}
33457
33458impl std::ops::DerefMut for SshKeyAlgo {
33459 fn deref_mut(&mut self) -> &mut String {
33460 &mut self.0
33461 }
33462}
33463
33464
33465
33466#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33467#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33468pub struct SshProxyClientVersion(String);
33469
33470impl validator::Validate for SshProxyClientVersion {
33471 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33472 std::result::Result::Ok(())
33473 }
33474}
33475
33476impl std::convert::From<String> for SshProxyClientVersion {
33477 fn from(x: String) -> Self {
33478 SshProxyClientVersion(x)
33479 }
33480}
33481
33482impl std::string::ToString for SshProxyClientVersion {
33483 fn to_string(&self) -> String {
33484 self.0.to_string()
33485 }
33486}
33487
33488impl std::str::FromStr for SshProxyClientVersion {
33489 type Err = std::string::ParseError;
33490 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33491 std::result::Result::Ok(SshProxyClientVersion(x.to_string()))
33492 }
33493}
33494
33495impl std::convert::From<SshProxyClientVersion> for String {
33496 fn from(x: SshProxyClientVersion) -> Self {
33497 x.0
33498 }
33499}
33500
33501impl std::ops::Deref for SshProxyClientVersion {
33502 type Target = String;
33503 fn deref(&self) -> &String {
33504 &self.0
33505 }
33506}
33507
33508impl std::ops::DerefMut for SshProxyClientVersion {
33509 fn deref_mut(&mut self) -> &mut String {
33510 &mut self.0
33511 }
33512}
33513
33514
33515
33516
33517
33518
33519#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
33520#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33521pub struct SshProxyConfig {
33522 #[serde(rename = "allowedHostKeyFingerprints")]
33523 #[serde(skip_serializing_if="Option::is_none")]
33524 pub allowed_host_key_fingerprints: Option<Vec<String>>,
33525
33526#[serde(rename = "ciphers")]
33528 #[serde(skip_serializing_if="Option::is_none")]
33529 pub ciphers: Option<Vec<models::SshCipher>>,
33530
33531 #[serde(rename = "clientVersion")]
33532 #[serde(skip_serializing_if="Option::is_none")]
33533 pub client_version: Option<String>,
33534
33535 #[serde(rename = "hostKeyAlgos")]
33536 #[serde(skip_serializing_if="Option::is_none")]
33537 pub host_key_algos: Option<Vec<models::SshKeyAlgo>>,
33538
33539 #[serde(rename = "kex")]
33540 #[serde(skip_serializing_if="Option::is_none")]
33541 pub kex: Option<Vec<models::SshKex>>,
33542
33543#[serde(rename = "macs")]
33545 #[serde(skip_serializing_if="Option::is_none")]
33546 pub macs: Option<Vec<models::Sshmac>>,
33547
33548#[serde(rename = "password")]
33550 #[serde(skip_serializing_if="Option::is_none")]
33551 pub password: Option<String>,
33552
33553#[serde(rename = "port")]
33555 #[serde(skip_serializing_if="Option::is_none")]
33556 pub port: Option<i32>,
33557
33558#[serde(rename = "privateKey")]
33560 #[serde(skip_serializing_if="Option::is_none")]
33561 pub private_key: Option<String>,
33562
33563#[serde(rename = "server")]
33565 #[serde(skip_serializing_if="Option::is_none")]
33566 pub server: Option<String>,
33567
33568#[serde(rename = "timeout")]
33570 #[serde(skip_serializing_if="Option::is_none")]
33571 pub timeout: Option<i64>,
33572
33573#[serde(rename = "username")]
33575 #[serde(skip_serializing_if="Option::is_none")]
33576 pub username: Option<String>,
33577
33578#[serde(rename = "usernamePassThrough")]
33580 #[serde(skip_serializing_if="Option::is_none")]
33581 pub username_pass_through: Option<bool>,
33582
33583}
33584
33585
33586impl SshProxyConfig {
33587 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
33588 pub fn new() -> SshProxyConfig {
33589 SshProxyConfig {
33590 allowed_host_key_fingerprints: None,
33591 ciphers: None,
33592 client_version: None,
33593 host_key_algos: None,
33594 kex: None,
33595 macs: None,
33596 password: None,
33597 port: None,
33598 private_key: None,
33599 server: None,
33600 timeout: None,
33601 username: None,
33602 username_pass_through: None,
33603 }
33604 }
33605}
33606
33607impl std::string::ToString for SshProxyConfig {
33611 fn to_string(&self) -> String {
33612 let params: Vec<Option<String>> = vec![
33613
33614 self.allowed_host_key_fingerprints.as_ref().map(|allowed_host_key_fingerprints| {
33615 [
33616 "allowedHostKeyFingerprints".to_string(),
33617 allowed_host_key_fingerprints.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33618 ].join(",")
33619 }),
33620
33621
33622 self.ciphers.as_ref().map(|ciphers| {
33623 [
33624 "ciphers".to_string(),
33625 ciphers.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33626 ].join(",")
33627 }),
33628
33629
33630 self.client_version.as_ref().map(|client_version| {
33631 [
33632 "clientVersion".to_string(),
33633 client_version.to_string(),
33634 ].join(",")
33635 }),
33636
33637
33638 self.host_key_algos.as_ref().map(|host_key_algos| {
33639 [
33640 "hostKeyAlgos".to_string(),
33641 host_key_algos.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33642 ].join(",")
33643 }),
33644
33645
33646 self.kex.as_ref().map(|kex| {
33647 [
33648 "kex".to_string(),
33649 kex.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33650 ].join(",")
33651 }),
33652
33653
33654 self.macs.as_ref().map(|macs| {
33655 [
33656 "macs".to_string(),
33657 macs.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
33658 ].join(",")
33659 }),
33660
33661
33662 self.password.as_ref().map(|password| {
33663 [
33664 "password".to_string(),
33665 password.to_string(),
33666 ].join(",")
33667 }),
33668
33669
33670 self.port.as_ref().map(|port| {
33671 [
33672 "port".to_string(),
33673 port.to_string(),
33674 ].join(",")
33675 }),
33676
33677
33678 self.private_key.as_ref().map(|private_key| {
33679 [
33680 "privateKey".to_string(),
33681 private_key.to_string(),
33682 ].join(",")
33683 }),
33684
33685
33686 self.server.as_ref().map(|server| {
33687 [
33688 "server".to_string(),
33689 server.to_string(),
33690 ].join(",")
33691 }),
33692
33693
33694 self.timeout.as_ref().map(|timeout| {
33695 [
33696 "timeout".to_string(),
33697 timeout.to_string(),
33698 ].join(",")
33699 }),
33700
33701
33702 self.username.as_ref().map(|username| {
33703 [
33704 "username".to_string(),
33705 username.to_string(),
33706 ].join(",")
33707 }),
33708
33709
33710 self.username_pass_through.as_ref().map(|username_pass_through| {
33711 [
33712 "usernamePassThrough".to_string(),
33713 username_pass_through.to_string(),
33714 ].join(",")
33715 }),
33716
33717 ];
33718
33719 params.into_iter().flatten().collect::<Vec<_>>().join(",")
33720 }
33721}
33722
33723impl std::str::FromStr for SshProxyConfig {
33727 type Err = String;
33728
33729 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
33730 #[derive(Default)]
33732 #[allow(dead_code)]
33733 struct IntermediateRep {
33734 pub allowed_host_key_fingerprints: Vec<Vec<String>>,
33735 pub ciphers: Vec<Vec<models::SshCipher>>,
33736 pub client_version: Vec<String>,
33737 pub host_key_algos: Vec<Vec<models::SshKeyAlgo>>,
33738 pub kex: Vec<Vec<models::SshKex>>,
33739 pub macs: Vec<Vec<models::Sshmac>>,
33740 pub password: Vec<String>,
33741 pub port: Vec<i32>,
33742 pub private_key: Vec<String>,
33743 pub server: Vec<String>,
33744 pub timeout: Vec<i64>,
33745 pub username: Vec<String>,
33746 pub username_pass_through: Vec<bool>,
33747 }
33748
33749 let mut intermediate_rep = IntermediateRep::default();
33750
33751 let mut string_iter = s.split(',');
33753 let mut key_result = string_iter.next();
33754
33755 while key_result.is_some() {
33756 let val = match string_iter.next() {
33757 Some(x) => x,
33758 None => return std::result::Result::Err("Missing value while parsing SshProxyConfig".to_string())
33759 };
33760
33761 if let Some(key) = key_result {
33762 #[allow(clippy::match_single_binding)]
33763 match key {
33764 "allowedHostKeyFingerprints" => return std::result::Result::Err("Parsing a container in this style is not supported in SshProxyConfig".to_string()),
33765 "ciphers" => return std::result::Result::Err("Parsing a container in this style is not supported in SshProxyConfig".to_string()),
33766 #[allow(clippy::redundant_clone)]
33767 "clientVersion" => intermediate_rep.client_version.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33768 "hostKeyAlgos" => return std::result::Result::Err("Parsing a container in this style is not supported in SshProxyConfig".to_string()),
33769 "kex" => return std::result::Result::Err("Parsing a container in this style is not supported in SshProxyConfig".to_string()),
33770 "macs" => return std::result::Result::Err("Parsing a container in this style is not supported in SshProxyConfig".to_string()),
33771 #[allow(clippy::redundant_clone)]
33772 "password" => intermediate_rep.password.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33773 #[allow(clippy::redundant_clone)]
33774 "port" => intermediate_rep.port.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33775 #[allow(clippy::redundant_clone)]
33776 "privateKey" => intermediate_rep.private_key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33777 #[allow(clippy::redundant_clone)]
33778 "server" => intermediate_rep.server.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33779 #[allow(clippy::redundant_clone)]
33780 "timeout" => intermediate_rep.timeout.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33781 #[allow(clippy::redundant_clone)]
33782 "username" => intermediate_rep.username.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33783 #[allow(clippy::redundant_clone)]
33784 "usernamePassThrough" => intermediate_rep.username_pass_through.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
33785 _ => return std::result::Result::Err("Unexpected key while parsing SshProxyConfig".to_string())
33786 }
33787 }
33788
33789 key_result = string_iter.next();
33791 }
33792
33793 std::result::Result::Ok(SshProxyConfig {
33795 allowed_host_key_fingerprints: intermediate_rep.allowed_host_key_fingerprints.into_iter().next(),
33796 ciphers: intermediate_rep.ciphers.into_iter().next(),
33797 client_version: intermediate_rep.client_version.into_iter().next(),
33798 host_key_algos: intermediate_rep.host_key_algos.into_iter().next(),
33799 kex: intermediate_rep.kex.into_iter().next(),
33800 macs: intermediate_rep.macs.into_iter().next(),
33801 password: intermediate_rep.password.into_iter().next(),
33802 port: intermediate_rep.port.into_iter().next(),
33803 private_key: intermediate_rep.private_key.into_iter().next(),
33804 server: intermediate_rep.server.into_iter().next(),
33805 timeout: intermediate_rep.timeout.into_iter().next(),
33806 username: intermediate_rep.username.into_iter().next(),
33807 username_pass_through: intermediate_rep.username_pass_through.into_iter().next(),
33808 })
33809 }
33810}
33811
33812#[cfg(feature = "server")]
33815impl std::convert::TryFrom<header::IntoHeaderValue<SshProxyConfig>> for HeaderValue {
33816 type Error = String;
33817
33818 fn try_from(hdr_value: header::IntoHeaderValue<SshProxyConfig>) -> std::result::Result<Self, Self::Error> {
33819 let hdr_value = hdr_value.to_string();
33820 match HeaderValue::from_str(&hdr_value) {
33821 std::result::Result::Ok(value) => std::result::Result::Ok(value),
33822 std::result::Result::Err(e) => std::result::Result::Err(
33823 format!("Invalid header value for SshProxyConfig - value: {} is invalid {}",
33824 hdr_value, e))
33825 }
33826 }
33827}
33828
33829#[cfg(feature = "server")]
33830impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SshProxyConfig> {
33831 type Error = String;
33832
33833 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
33834 match hdr_value.to_str() {
33835 std::result::Result::Ok(value) => {
33836 match <SshProxyConfig as std::str::FromStr>::from_str(value) {
33837 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
33838 std::result::Result::Err(err) => std::result::Result::Err(
33839 format!("Unable to convert header value '{}' into SshProxyConfig - {}",
33840 value, err))
33841 }
33842 },
33843 std::result::Result::Err(e) => std::result::Result::Err(
33844 format!("Unable to convert header: {:?} to string: {}",
33845 hdr_value, e))
33846 }
33847 }
33848}
33849
33850
33851
33852
33853#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33854#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33855pub struct Sshmac(String);
33856
33857impl validator::Validate for Sshmac {
33858 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33859 std::result::Result::Ok(())
33860 }
33861}
33862
33863impl std::convert::From<String> for Sshmac {
33864 fn from(x: String) -> Self {
33865 Sshmac(x)
33866 }
33867}
33868
33869impl std::string::ToString for Sshmac {
33870 fn to_string(&self) -> String {
33871 self.0.to_string()
33872 }
33873}
33874
33875impl std::str::FromStr for Sshmac {
33876 type Err = std::string::ParseError;
33877 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33878 std::result::Result::Ok(Sshmac(x.to_string()))
33879 }
33880}
33881
33882impl std::convert::From<Sshmac> for String {
33883 fn from(x: Sshmac) -> Self {
33884 x.0
33885 }
33886}
33887
33888impl std::ops::Deref for Sshmac {
33889 type Target = String;
33890 fn deref(&self) -> &String {
33891 &self.0
33892 }
33893}
33894
33895impl std::ops::DerefMut for Sshmac {
33896 fn deref_mut(&mut self) -> &mut String {
33897 &mut self.0
33898 }
33899}
33900
33901
33902
33903#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
33904#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33905pub struct StorageMedium(String);
33906
33907impl validator::Validate for StorageMedium {
33908 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
33909 std::result::Result::Ok(())
33910 }
33911}
33912
33913impl std::convert::From<String> for StorageMedium {
33914 fn from(x: String) -> Self {
33915 StorageMedium(x)
33916 }
33917}
33918
33919impl std::string::ToString for StorageMedium {
33920 fn to_string(&self) -> String {
33921 self.0.to_string()
33922 }
33923}
33924
33925impl std::str::FromStr for StorageMedium {
33926 type Err = std::string::ParseError;
33927 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
33928 std::result::Result::Ok(StorageMedium(x.to_string()))
33929 }
33930}
33931
33932impl std::convert::From<StorageMedium> for String {
33933 fn from(x: StorageMedium) -> Self {
33934 x.0
33935 }
33936}
33937
33938impl std::ops::Deref for StorageMedium {
33939 type Target = String;
33940 fn deref(&self) -> &String {
33941 &self.0
33942 }
33943}
33944
33945impl std::ops::DerefMut for StorageMedium {
33946 fn deref_mut(&mut self) -> &mut String {
33947 &mut self.0
33948 }
33949}
33950
33951
33952
33953
33954
33955
33956#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
33957#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
33958pub struct StorageOsVolumeSource {
33959#[serde(rename = "fsType")]
33961 #[serde(skip_serializing_if="Option::is_none")]
33962 pub fs_type: Option<String>,
33963
33964#[serde(rename = "readOnly")]
33966 #[serde(skip_serializing_if="Option::is_none")]
33967 pub read_only: Option<bool>,
33968
33969 #[serde(rename = "secretRef")]
33970 #[serde(skip_serializing_if="Option::is_none")]
33971 pub secret_ref: Option<models::LocalObjectReference>,
33972
33973#[serde(rename = "volumeName")]
33975 #[serde(skip_serializing_if="Option::is_none")]
33976 pub volume_name: Option<String>,
33977
33978#[serde(rename = "volumeNamespace")]
33980 #[serde(skip_serializing_if="Option::is_none")]
33981 pub volume_namespace: Option<String>,
33982
33983}
33984
33985
33986impl StorageOsVolumeSource {
33987 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
33988 pub fn new() -> StorageOsVolumeSource {
33989 StorageOsVolumeSource {
33990 fs_type: None,
33991 read_only: None,
33992 secret_ref: None,
33993 volume_name: None,
33994 volume_namespace: None,
33995 }
33996 }
33997}
33998
33999impl std::string::ToString for StorageOsVolumeSource {
34003 fn to_string(&self) -> String {
34004 let params: Vec<Option<String>> = vec![
34005
34006 self.fs_type.as_ref().map(|fs_type| {
34007 [
34008 "fsType".to_string(),
34009 fs_type.to_string(),
34010 ].join(",")
34011 }),
34012
34013
34014 self.read_only.as_ref().map(|read_only| {
34015 [
34016 "readOnly".to_string(),
34017 read_only.to_string(),
34018 ].join(",")
34019 }),
34020
34021 self.volume_name.as_ref().map(|volume_name| {
34025 [
34026 "volumeName".to_string(),
34027 volume_name.to_string(),
34028 ].join(",")
34029 }),
34030
34031
34032 self.volume_namespace.as_ref().map(|volume_namespace| {
34033 [
34034 "volumeNamespace".to_string(),
34035 volume_namespace.to_string(),
34036 ].join(",")
34037 }),
34038
34039 ];
34040
34041 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34042 }
34043}
34044
34045impl std::str::FromStr for StorageOsVolumeSource {
34049 type Err = String;
34050
34051 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34052 #[derive(Default)]
34054 #[allow(dead_code)]
34055 struct IntermediateRep {
34056 pub fs_type: Vec<String>,
34057 pub read_only: Vec<bool>,
34058 pub secret_ref: Vec<models::LocalObjectReference>,
34059 pub volume_name: Vec<String>,
34060 pub volume_namespace: Vec<String>,
34061 }
34062
34063 let mut intermediate_rep = IntermediateRep::default();
34064
34065 let mut string_iter = s.split(',');
34067 let mut key_result = string_iter.next();
34068
34069 while key_result.is_some() {
34070 let val = match string_iter.next() {
34071 Some(x) => x,
34072 None => return std::result::Result::Err("Missing value while parsing StorageOsVolumeSource".to_string())
34073 };
34074
34075 if let Some(key) = key_result {
34076 #[allow(clippy::match_single_binding)]
34077 match key {
34078 #[allow(clippy::redundant_clone)]
34079 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34080 #[allow(clippy::redundant_clone)]
34081 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34082 #[allow(clippy::redundant_clone)]
34083 "secretRef" => intermediate_rep.secret_ref.push(<models::LocalObjectReference as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34084 #[allow(clippy::redundant_clone)]
34085 "volumeName" => intermediate_rep.volume_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34086 #[allow(clippy::redundant_clone)]
34087 "volumeNamespace" => intermediate_rep.volume_namespace.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34088 _ => return std::result::Result::Err("Unexpected key while parsing StorageOsVolumeSource".to_string())
34089 }
34090 }
34091
34092 key_result = string_iter.next();
34094 }
34095
34096 std::result::Result::Ok(StorageOsVolumeSource {
34098 fs_type: intermediate_rep.fs_type.into_iter().next(),
34099 read_only: intermediate_rep.read_only.into_iter().next(),
34100 secret_ref: intermediate_rep.secret_ref.into_iter().next(),
34101 volume_name: intermediate_rep.volume_name.into_iter().next(),
34102 volume_namespace: intermediate_rep.volume_namespace.into_iter().next(),
34103 })
34104 }
34105}
34106
34107#[cfg(feature = "server")]
34110impl std::convert::TryFrom<header::IntoHeaderValue<StorageOsVolumeSource>> for HeaderValue {
34111 type Error = String;
34112
34113 fn try_from(hdr_value: header::IntoHeaderValue<StorageOsVolumeSource>) -> std::result::Result<Self, Self::Error> {
34114 let hdr_value = hdr_value.to_string();
34115 match HeaderValue::from_str(&hdr_value) {
34116 std::result::Result::Ok(value) => std::result::Result::Ok(value),
34117 std::result::Result::Err(e) => std::result::Result::Err(
34118 format!("Invalid header value for StorageOsVolumeSource - value: {} is invalid {}",
34119 hdr_value, e))
34120 }
34121 }
34122}
34123
34124#[cfg(feature = "server")]
34125impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<StorageOsVolumeSource> {
34126 type Error = String;
34127
34128 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
34129 match hdr_value.to_str() {
34130 std::result::Result::Ok(value) => {
34131 match <StorageOsVolumeSource as std::str::FromStr>::from_str(value) {
34132 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
34133 std::result::Result::Err(err) => std::result::Result::Err(
34134 format!("Unable to convert header value '{}' into StorageOsVolumeSource - {}",
34135 value, err))
34136 }
34137 },
34138 std::result::Result::Err(e) => std::result::Result::Err(
34139 format!("Unable to convert header: {:?} to string: {}",
34140 hdr_value, e))
34141 }
34142 }
34143}
34144
34145
34146
34147
34148
34149
34150
34151#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
34152#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34153pub struct SubsystemConfig {
34154#[serde(rename = "allow")]
34156 #[serde(skip_serializing_if="Option::is_none")]
34157 pub allow: Option<Vec<String>>,
34158
34159#[serde(rename = "deny")]
34161 #[serde(skip_serializing_if="Option::is_none")]
34162 pub deny: Option<Vec<String>>,
34163
34164 #[serde(rename = "mode")]
34165 #[serde(skip_serializing_if="Option::is_none")]
34166 pub mode: Option<String>,
34167
34168}
34169
34170
34171impl SubsystemConfig {
34172 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
34173 pub fn new() -> SubsystemConfig {
34174 SubsystemConfig {
34175 allow: None,
34176 deny: None,
34177 mode: None,
34178 }
34179 }
34180}
34181
34182impl std::string::ToString for SubsystemConfig {
34186 fn to_string(&self) -> String {
34187 let params: Vec<Option<String>> = vec![
34188
34189 self.allow.as_ref().map(|allow| {
34190 [
34191 "allow".to_string(),
34192 allow.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
34193 ].join(",")
34194 }),
34195
34196
34197 self.deny.as_ref().map(|deny| {
34198 [
34199 "deny".to_string(),
34200 deny.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(","),
34201 ].join(",")
34202 }),
34203
34204
34205 self.mode.as_ref().map(|mode| {
34206 [
34207 "mode".to_string(),
34208 mode.to_string(),
34209 ].join(",")
34210 }),
34211
34212 ];
34213
34214 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34215 }
34216}
34217
34218impl std::str::FromStr for SubsystemConfig {
34222 type Err = String;
34223
34224 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34225 #[derive(Default)]
34227 #[allow(dead_code)]
34228 struct IntermediateRep {
34229 pub allow: Vec<Vec<String>>,
34230 pub deny: Vec<Vec<String>>,
34231 pub mode: Vec<String>,
34232 }
34233
34234 let mut intermediate_rep = IntermediateRep::default();
34235
34236 let mut string_iter = s.split(',');
34238 let mut key_result = string_iter.next();
34239
34240 while key_result.is_some() {
34241 let val = match string_iter.next() {
34242 Some(x) => x,
34243 None => return std::result::Result::Err("Missing value while parsing SubsystemConfig".to_string())
34244 };
34245
34246 if let Some(key) = key_result {
34247 #[allow(clippy::match_single_binding)]
34248 match key {
34249 "allow" => return std::result::Result::Err("Parsing a container in this style is not supported in SubsystemConfig".to_string()),
34250 "deny" => return std::result::Result::Err("Parsing a container in this style is not supported in SubsystemConfig".to_string()),
34251 #[allow(clippy::redundant_clone)]
34252 "mode" => intermediate_rep.mode.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34253 _ => return std::result::Result::Err("Unexpected key while parsing SubsystemConfig".to_string())
34254 }
34255 }
34256
34257 key_result = string_iter.next();
34259 }
34260
34261 std::result::Result::Ok(SubsystemConfig {
34263 allow: intermediate_rep.allow.into_iter().next(),
34264 deny: intermediate_rep.deny.into_iter().next(),
34265 mode: intermediate_rep.mode.into_iter().next(),
34266 })
34267 }
34268}
34269
34270#[cfg(feature = "server")]
34273impl std::convert::TryFrom<header::IntoHeaderValue<SubsystemConfig>> for HeaderValue {
34274 type Error = String;
34275
34276 fn try_from(hdr_value: header::IntoHeaderValue<SubsystemConfig>) -> std::result::Result<Self, Self::Error> {
34277 let hdr_value = hdr_value.to_string();
34278 match HeaderValue::from_str(&hdr_value) {
34279 std::result::Result::Ok(value) => std::result::Result::Ok(value),
34280 std::result::Result::Err(e) => std::result::Result::Err(
34281 format!("Invalid header value for SubsystemConfig - value: {} is invalid {}",
34282 hdr_value, e))
34283 }
34284 }
34285}
34286
34287#[cfg(feature = "server")]
34288impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<SubsystemConfig> {
34289 type Error = String;
34290
34291 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
34292 match hdr_value.to_str() {
34293 std::result::Result::Ok(value) => {
34294 match <SubsystemConfig as std::str::FromStr>::from_str(value) {
34295 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
34296 std::result::Result::Err(err) => std::result::Result::Err(
34297 format!("Unable to convert header value '{}' into SubsystemConfig - {}",
34298 value, err))
34299 }
34300 },
34301 std::result::Result::Err(e) => std::result::Result::Err(
34302 format!("Unable to convert header: {:?} to string: {}",
34303 hdr_value, e))
34304 }
34305 }
34306}
34307
34308
34309
34310
34311#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
34316#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34317pub struct Sysctl {
34318#[serde(rename = "name")]
34320 #[serde(skip_serializing_if="Option::is_none")]
34321 pub name: Option<String>,
34322
34323#[serde(rename = "value")]
34325 #[serde(skip_serializing_if="Option::is_none")]
34326 pub value: Option<String>,
34327
34328}
34329
34330
34331impl Sysctl {
34332 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
34333 pub fn new() -> Sysctl {
34334 Sysctl {
34335 name: None,
34336 value: None,
34337 }
34338 }
34339}
34340
34341impl std::string::ToString for Sysctl {
34345 fn to_string(&self) -> String {
34346 let params: Vec<Option<String>> = vec![
34347
34348 self.name.as_ref().map(|name| {
34349 [
34350 "name".to_string(),
34351 name.to_string(),
34352 ].join(",")
34353 }),
34354
34355
34356 self.value.as_ref().map(|value| {
34357 [
34358 "value".to_string(),
34359 value.to_string(),
34360 ].join(",")
34361 }),
34362
34363 ];
34364
34365 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34366 }
34367}
34368
34369impl std::str::FromStr for Sysctl {
34373 type Err = String;
34374
34375 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34376 #[derive(Default)]
34378 #[allow(dead_code)]
34379 struct IntermediateRep {
34380 pub name: Vec<String>,
34381 pub value: Vec<String>,
34382 }
34383
34384 let mut intermediate_rep = IntermediateRep::default();
34385
34386 let mut string_iter = s.split(',');
34388 let mut key_result = string_iter.next();
34389
34390 while key_result.is_some() {
34391 let val = match string_iter.next() {
34392 Some(x) => x,
34393 None => return std::result::Result::Err("Missing value while parsing Sysctl".to_string())
34394 };
34395
34396 if let Some(key) = key_result {
34397 #[allow(clippy::match_single_binding)]
34398 match key {
34399 #[allow(clippy::redundant_clone)]
34400 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34401 #[allow(clippy::redundant_clone)]
34402 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34403 _ => return std::result::Result::Err("Unexpected key while parsing Sysctl".to_string())
34404 }
34405 }
34406
34407 key_result = string_iter.next();
34409 }
34410
34411 std::result::Result::Ok(Sysctl {
34413 name: intermediate_rep.name.into_iter().next(),
34414 value: intermediate_rep.value.into_iter().next(),
34415 })
34416 }
34417}
34418
34419#[cfg(feature = "server")]
34422impl std::convert::TryFrom<header::IntoHeaderValue<Sysctl>> for HeaderValue {
34423 type Error = String;
34424
34425 fn try_from(hdr_value: header::IntoHeaderValue<Sysctl>) -> std::result::Result<Self, Self::Error> {
34426 let hdr_value = hdr_value.to_string();
34427 match HeaderValue::from_str(&hdr_value) {
34428 std::result::Result::Ok(value) => std::result::Result::Ok(value),
34429 std::result::Result::Err(e) => std::result::Result::Err(
34430 format!("Invalid header value for Sysctl - value: {} is invalid {}",
34431 hdr_value, e))
34432 }
34433 }
34434}
34435
34436#[cfg(feature = "server")]
34437impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Sysctl> {
34438 type Error = String;
34439
34440 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
34441 match hdr_value.to_str() {
34442 std::result::Result::Ok(value) => {
34443 match <Sysctl as std::str::FromStr>::from_str(value) {
34444 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
34445 std::result::Result::Err(err) => std::result::Result::Err(
34446 format!("Unable to convert header value '{}' into Sysctl - {}",
34447 value, err))
34448 }
34449 },
34450 std::result::Result::Err(e) => std::result::Result::Err(
34451 format!("Unable to convert header: {:?} to string: {}",
34452 hdr_value, e))
34453 }
34454 }
34455}
34456
34457
34458
34459
34460#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
34462#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34463pub struct TaintEffect(String);
34464
34465impl validator::Validate for TaintEffect {
34466 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
34467 std::result::Result::Ok(())
34468 }
34469}
34470
34471impl std::convert::From<String> for TaintEffect {
34472 fn from(x: String) -> Self {
34473 TaintEffect(x)
34474 }
34475}
34476
34477impl std::string::ToString for TaintEffect {
34478 fn to_string(&self) -> String {
34479 self.0.to_string()
34480 }
34481}
34482
34483impl std::str::FromStr for TaintEffect {
34484 type Err = std::string::ParseError;
34485 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
34486 std::result::Result::Ok(TaintEffect(x.to_string()))
34487 }
34488}
34489
34490impl std::convert::From<TaintEffect> for String {
34491 fn from(x: TaintEffect) -> Self {
34492 x.0
34493 }
34494}
34495
34496impl std::ops::Deref for TaintEffect {
34497 type Target = String;
34498 fn deref(&self) -> &String {
34499 &self.0
34500 }
34501}
34502
34503impl std::ops::DerefMut for TaintEffect {
34504 fn deref_mut(&mut self) -> &mut String {
34505 &mut self.0
34506 }
34507}
34508
34509
34510
34511#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
34516#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34517pub struct TcpSocketAction {
34518#[serde(rename = "host")]
34520 #[serde(skip_serializing_if="Option::is_none")]
34521 pub host: Option<String>,
34522
34523 #[serde(rename = "port")]
34524 #[serde(skip_serializing_if="Option::is_none")]
34525 pub port: Option<models::IntOrString>,
34526
34527}
34528
34529
34530impl TcpSocketAction {
34531 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
34532 pub fn new() -> TcpSocketAction {
34533 TcpSocketAction {
34534 host: None,
34535 port: None,
34536 }
34537 }
34538}
34539
34540impl std::string::ToString for TcpSocketAction {
34544 fn to_string(&self) -> String {
34545 let params: Vec<Option<String>> = vec![
34546
34547 self.host.as_ref().map(|host| {
34548 [
34549 "host".to_string(),
34550 host.to_string(),
34551 ].join(",")
34552 }),
34553
34554 ];
34557
34558 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34559 }
34560}
34561
34562impl std::str::FromStr for TcpSocketAction {
34566 type Err = String;
34567
34568 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34569 #[derive(Default)]
34571 #[allow(dead_code)]
34572 struct IntermediateRep {
34573 pub host: Vec<String>,
34574 pub port: Vec<models::IntOrString>,
34575 }
34576
34577 let mut intermediate_rep = IntermediateRep::default();
34578
34579 let mut string_iter = s.split(',');
34581 let mut key_result = string_iter.next();
34582
34583 while key_result.is_some() {
34584 let val = match string_iter.next() {
34585 Some(x) => x,
34586 None => return std::result::Result::Err("Missing value while parsing TcpSocketAction".to_string())
34587 };
34588
34589 if let Some(key) = key_result {
34590 #[allow(clippy::match_single_binding)]
34591 match key {
34592 #[allow(clippy::redundant_clone)]
34593 "host" => intermediate_rep.host.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34594 #[allow(clippy::redundant_clone)]
34595 "port" => intermediate_rep.port.push(<models::IntOrString as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34596 _ => return std::result::Result::Err("Unexpected key while parsing TcpSocketAction".to_string())
34597 }
34598 }
34599
34600 key_result = string_iter.next();
34602 }
34603
34604 std::result::Result::Ok(TcpSocketAction {
34606 host: intermediate_rep.host.into_iter().next(),
34607 port: intermediate_rep.port.into_iter().next(),
34608 })
34609 }
34610}
34611
34612#[cfg(feature = "server")]
34615impl std::convert::TryFrom<header::IntoHeaderValue<TcpSocketAction>> for HeaderValue {
34616 type Error = String;
34617
34618 fn try_from(hdr_value: header::IntoHeaderValue<TcpSocketAction>) -> std::result::Result<Self, Self::Error> {
34619 let hdr_value = hdr_value.to_string();
34620 match HeaderValue::from_str(&hdr_value) {
34621 std::result::Result::Ok(value) => std::result::Result::Ok(value),
34622 std::result::Result::Err(e) => std::result::Result::Err(
34623 format!("Invalid header value for TcpSocketAction - value: {} is invalid {}",
34624 hdr_value, e))
34625 }
34626 }
34627}
34628
34629#[cfg(feature = "server")]
34630impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<TcpSocketAction> {
34631 type Error = String;
34632
34633 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
34634 match hdr_value.to_str() {
34635 std::result::Result::Ok(value) => {
34636 match <TcpSocketAction as std::str::FromStr>::from_str(value) {
34637 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
34638 std::result::Result::Err(err) => std::result::Result::Err(
34639 format!("Unable to convert header value '{}' into TcpSocketAction - {}",
34640 value, err))
34641 }
34642 },
34643 std::result::Result::Err(e) => std::result::Result::Err(
34644 format!("Unable to convert header: {:?} to string: {}",
34645 hdr_value, e))
34646 }
34647 }
34648}
34649
34650
34651
34652
34653#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
34655#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34656pub struct TerminationMessagePolicy(String);
34657
34658impl validator::Validate for TerminationMessagePolicy {
34659 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
34660 std::result::Result::Ok(())
34661 }
34662}
34663
34664impl std::convert::From<String> for TerminationMessagePolicy {
34665 fn from(x: String) -> Self {
34666 TerminationMessagePolicy(x)
34667 }
34668}
34669
34670impl std::string::ToString for TerminationMessagePolicy {
34671 fn to_string(&self) -> String {
34672 self.0.to_string()
34673 }
34674}
34675
34676impl std::str::FromStr for TerminationMessagePolicy {
34677 type Err = std::string::ParseError;
34678 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
34679 std::result::Result::Ok(TerminationMessagePolicy(x.to_string()))
34680 }
34681}
34682
34683impl std::convert::From<TerminationMessagePolicy> for String {
34684 fn from(x: TerminationMessagePolicy) -> Self {
34685 x.0
34686 }
34687}
34688
34689impl std::ops::Deref for TerminationMessagePolicy {
34690 type Target = String;
34691 fn deref(&self) -> &String {
34692 &self.0
34693 }
34694}
34695
34696impl std::ops::DerefMut for TerminationMessagePolicy {
34697 fn deref_mut(&mut self) -> &mut String {
34698 &mut self.0
34699 }
34700}
34701
34702
34703
34704#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
34709#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34710pub struct ThrottleDevice {
34711 #[serde(rename = "Path")]
34712 #[serde(skip_serializing_if="Option::is_none")]
34713 pub path: Option<String>,
34714
34715 #[serde(rename = "Rate")]
34716 #[serde(skip_serializing_if="Option::is_none")]
34717 pub rate: Option<i32>,
34718
34719}
34720
34721
34722impl ThrottleDevice {
34723 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
34724 pub fn new() -> ThrottleDevice {
34725 ThrottleDevice {
34726 path: None,
34727 rate: None,
34728 }
34729 }
34730}
34731
34732impl std::string::ToString for ThrottleDevice {
34736 fn to_string(&self) -> String {
34737 let params: Vec<Option<String>> = vec![
34738
34739 self.path.as_ref().map(|path| {
34740 [
34741 "Path".to_string(),
34742 path.to_string(),
34743 ].join(",")
34744 }),
34745
34746
34747 self.rate.as_ref().map(|rate| {
34748 [
34749 "Rate".to_string(),
34750 rate.to_string(),
34751 ].join(",")
34752 }),
34753
34754 ];
34755
34756 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34757 }
34758}
34759
34760impl std::str::FromStr for ThrottleDevice {
34764 type Err = String;
34765
34766 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34767 #[derive(Default)]
34769 #[allow(dead_code)]
34770 struct IntermediateRep {
34771 pub path: Vec<String>,
34772 pub rate: Vec<i32>,
34773 }
34774
34775 let mut intermediate_rep = IntermediateRep::default();
34776
34777 let mut string_iter = s.split(',');
34779 let mut key_result = string_iter.next();
34780
34781 while key_result.is_some() {
34782 let val = match string_iter.next() {
34783 Some(x) => x,
34784 None => return std::result::Result::Err("Missing value while parsing ThrottleDevice".to_string())
34785 };
34786
34787 if let Some(key) = key_result {
34788 #[allow(clippy::match_single_binding)]
34789 match key {
34790 #[allow(clippy::redundant_clone)]
34791 "Path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34792 #[allow(clippy::redundant_clone)]
34793 "Rate" => intermediate_rep.rate.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34794 _ => return std::result::Result::Err("Unexpected key while parsing ThrottleDevice".to_string())
34795 }
34796 }
34797
34798 key_result = string_iter.next();
34800 }
34801
34802 std::result::Result::Ok(ThrottleDevice {
34804 path: intermediate_rep.path.into_iter().next(),
34805 rate: intermediate_rep.rate.into_iter().next(),
34806 })
34807 }
34808}
34809
34810#[cfg(feature = "server")]
34813impl std::convert::TryFrom<header::IntoHeaderValue<ThrottleDevice>> for HeaderValue {
34814 type Error = String;
34815
34816 fn try_from(hdr_value: header::IntoHeaderValue<ThrottleDevice>) -> std::result::Result<Self, Self::Error> {
34817 let hdr_value = hdr_value.to_string();
34818 match HeaderValue::from_str(&hdr_value) {
34819 std::result::Result::Ok(value) => std::result::Result::Ok(value),
34820 std::result::Result::Err(e) => std::result::Result::Err(
34821 format!("Invalid header value for ThrottleDevice - value: {} is invalid {}",
34822 hdr_value, e))
34823 }
34824 }
34825}
34826
34827#[cfg(feature = "server")]
34828impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<ThrottleDevice> {
34829 type Error = String;
34830
34831 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
34832 match hdr_value.to_str() {
34833 std::result::Result::Ok(value) => {
34834 match <ThrottleDevice as std::str::FromStr>::from_str(value) {
34835 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
34836 std::result::Result::Err(err) => std::result::Result::Err(
34837 format!("Unable to convert header value '{}' into ThrottleDevice - {}",
34838 value, err))
34839 }
34840 },
34841 std::result::Result::Err(e) => std::result::Result::Err(
34842 format!("Unable to convert header: {:?} to string: {}",
34843 hdr_value, e))
34844 }
34845 }
34846}
34847
34848
34849
34850
34851#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
34852#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34853pub struct TlsVersion(String);
34854
34855impl validator::Validate for TlsVersion {
34856 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
34857 std::result::Result::Ok(())
34858 }
34859}
34860
34861impl std::convert::From<String> for TlsVersion {
34862 fn from(x: String) -> Self {
34863 TlsVersion(x)
34864 }
34865}
34866
34867impl std::string::ToString for TlsVersion {
34868 fn to_string(&self) -> String {
34869 self.0.to_string()
34870 }
34871}
34872
34873impl std::str::FromStr for TlsVersion {
34874 type Err = std::string::ParseError;
34875 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
34876 std::result::Result::Ok(TlsVersion(x.to_string()))
34877 }
34878}
34879
34880impl std::convert::From<TlsVersion> for String {
34881 fn from(x: TlsVersion) -> Self {
34882 x.0
34883 }
34884}
34885
34886impl std::ops::Deref for TlsVersion {
34887 type Target = String;
34888 fn deref(&self) -> &String {
34889 &self.0
34890 }
34891}
34892
34893impl std::ops::DerefMut for TlsVersion {
34894 fn deref_mut(&mut self) -> &mut String {
34895 &mut self.0
34896 }
34897}
34898
34899
34900
34901
34902
34903
34904#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
34905#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
34906pub struct TmpfsOptions {
34907#[serde(rename = "Mode")]
34909 #[serde(skip_serializing_if="Option::is_none")]
34910 pub mode: Option<i32>,
34911
34912#[serde(rename = "SizeBytes")]
34914 #[serde(skip_serializing_if="Option::is_none")]
34915 pub size_bytes: Option<i64>,
34916
34917}
34918
34919
34920impl TmpfsOptions {
34921 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
34922 pub fn new() -> TmpfsOptions {
34923 TmpfsOptions {
34924 mode: None,
34925 size_bytes: None,
34926 }
34927 }
34928}
34929
34930impl std::string::ToString for TmpfsOptions {
34934 fn to_string(&self) -> String {
34935 let params: Vec<Option<String>> = vec![
34936
34937 self.mode.as_ref().map(|mode| {
34938 [
34939 "Mode".to_string(),
34940 mode.to_string(),
34941 ].join(",")
34942 }),
34943
34944
34945 self.size_bytes.as_ref().map(|size_bytes| {
34946 [
34947 "SizeBytes".to_string(),
34948 size_bytes.to_string(),
34949 ].join(",")
34950 }),
34951
34952 ];
34953
34954 params.into_iter().flatten().collect::<Vec<_>>().join(",")
34955 }
34956}
34957
34958impl std::str::FromStr for TmpfsOptions {
34962 type Err = String;
34963
34964 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
34965 #[derive(Default)]
34967 #[allow(dead_code)]
34968 struct IntermediateRep {
34969 pub mode: Vec<i32>,
34970 pub size_bytes: Vec<i64>,
34971 }
34972
34973 let mut intermediate_rep = IntermediateRep::default();
34974
34975 let mut string_iter = s.split(',');
34977 let mut key_result = string_iter.next();
34978
34979 while key_result.is_some() {
34980 let val = match string_iter.next() {
34981 Some(x) => x,
34982 None => return std::result::Result::Err("Missing value while parsing TmpfsOptions".to_string())
34983 };
34984
34985 if let Some(key) = key_result {
34986 #[allow(clippy::match_single_binding)]
34987 match key {
34988 #[allow(clippy::redundant_clone)]
34989 "Mode" => intermediate_rep.mode.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34990 #[allow(clippy::redundant_clone)]
34991 "SizeBytes" => intermediate_rep.size_bytes.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
34992 _ => return std::result::Result::Err("Unexpected key while parsing TmpfsOptions".to_string())
34993 }
34994 }
34995
34996 key_result = string_iter.next();
34998 }
34999
35000 std::result::Result::Ok(TmpfsOptions {
35002 mode: intermediate_rep.mode.into_iter().next(),
35003 size_bytes: intermediate_rep.size_bytes.into_iter().next(),
35004 })
35005 }
35006}
35007
35008#[cfg(feature = "server")]
35011impl std::convert::TryFrom<header::IntoHeaderValue<TmpfsOptions>> for HeaderValue {
35012 type Error = String;
35013
35014 fn try_from(hdr_value: header::IntoHeaderValue<TmpfsOptions>) -> std::result::Result<Self, Self::Error> {
35015 let hdr_value = hdr_value.to_string();
35016 match HeaderValue::from_str(&hdr_value) {
35017 std::result::Result::Ok(value) => std::result::Result::Ok(value),
35018 std::result::Result::Err(e) => std::result::Result::Err(
35019 format!("Invalid header value for TmpfsOptions - value: {} is invalid {}",
35020 hdr_value, e))
35021 }
35022 }
35023}
35024
35025#[cfg(feature = "server")]
35026impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<TmpfsOptions> {
35027 type Error = String;
35028
35029 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
35030 match hdr_value.to_str() {
35031 std::result::Result::Ok(value) => {
35032 match <TmpfsOptions as std::str::FromStr>::from_str(value) {
35033 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
35034 std::result::Result::Err(err) => std::result::Result::Err(
35035 format!("Unable to convert header value '{}' into TmpfsOptions - {}",
35036 value, err))
35037 }
35038 },
35039 std::result::Result::Err(e) => std::result::Result::Err(
35040 format!("Unable to convert header: {:?} to string: {}",
35041 hdr_value, e))
35042 }
35043 }
35044}
35045
35046
35047
35048
35049#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
35054#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35055pub struct Toleration {
35056#[serde(rename = "effect")]
35058 #[serde(skip_serializing_if="Option::is_none")]
35059 pub effect: Option<String>,
35060
35061#[serde(rename = "key")]
35063 #[serde(skip_serializing_if="Option::is_none")]
35064 pub key: Option<String>,
35065
35066#[serde(rename = "operator")]
35068 #[serde(skip_serializing_if="Option::is_none")]
35069 pub operator: Option<String>,
35070
35071#[serde(rename = "tolerationSeconds")]
35073 #[serde(skip_serializing_if="Option::is_none")]
35074 pub toleration_seconds: Option<i64>,
35075
35076#[serde(rename = "value")]
35078 #[serde(skip_serializing_if="Option::is_none")]
35079 pub value: Option<String>,
35080
35081}
35082
35083
35084impl Toleration {
35085 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
35086 pub fn new() -> Toleration {
35087 Toleration {
35088 effect: None,
35089 key: None,
35090 operator: None,
35091 toleration_seconds: None,
35092 value: None,
35093 }
35094 }
35095}
35096
35097impl std::string::ToString for Toleration {
35101 fn to_string(&self) -> String {
35102 let params: Vec<Option<String>> = vec![
35103
35104 self.effect.as_ref().map(|effect| {
35105 [
35106 "effect".to_string(),
35107 effect.to_string(),
35108 ].join(",")
35109 }),
35110
35111
35112 self.key.as_ref().map(|key| {
35113 [
35114 "key".to_string(),
35115 key.to_string(),
35116 ].join(",")
35117 }),
35118
35119
35120 self.operator.as_ref().map(|operator| {
35121 [
35122 "operator".to_string(),
35123 operator.to_string(),
35124 ].join(",")
35125 }),
35126
35127
35128 self.toleration_seconds.as_ref().map(|toleration_seconds| {
35129 [
35130 "tolerationSeconds".to_string(),
35131 toleration_seconds.to_string(),
35132 ].join(",")
35133 }),
35134
35135
35136 self.value.as_ref().map(|value| {
35137 [
35138 "value".to_string(),
35139 value.to_string(),
35140 ].join(",")
35141 }),
35142
35143 ];
35144
35145 params.into_iter().flatten().collect::<Vec<_>>().join(",")
35146 }
35147}
35148
35149impl std::str::FromStr for Toleration {
35153 type Err = String;
35154
35155 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
35156 #[derive(Default)]
35158 #[allow(dead_code)]
35159 struct IntermediateRep {
35160 pub effect: Vec<String>,
35161 pub key: Vec<String>,
35162 pub operator: Vec<String>,
35163 pub toleration_seconds: Vec<i64>,
35164 pub value: Vec<String>,
35165 }
35166
35167 let mut intermediate_rep = IntermediateRep::default();
35168
35169 let mut string_iter = s.split(',');
35171 let mut key_result = string_iter.next();
35172
35173 while key_result.is_some() {
35174 let val = match string_iter.next() {
35175 Some(x) => x,
35176 None => return std::result::Result::Err("Missing value while parsing Toleration".to_string())
35177 };
35178
35179 if let Some(key) = key_result {
35180 #[allow(clippy::match_single_binding)]
35181 match key {
35182 #[allow(clippy::redundant_clone)]
35183 "effect" => intermediate_rep.effect.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35184 #[allow(clippy::redundant_clone)]
35185 "key" => intermediate_rep.key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35186 #[allow(clippy::redundant_clone)]
35187 "operator" => intermediate_rep.operator.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35188 #[allow(clippy::redundant_clone)]
35189 "tolerationSeconds" => intermediate_rep.toleration_seconds.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35190 #[allow(clippy::redundant_clone)]
35191 "value" => intermediate_rep.value.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35192 _ => return std::result::Result::Err("Unexpected key while parsing Toleration".to_string())
35193 }
35194 }
35195
35196 key_result = string_iter.next();
35198 }
35199
35200 std::result::Result::Ok(Toleration {
35202 effect: intermediate_rep.effect.into_iter().next(),
35203 key: intermediate_rep.key.into_iter().next(),
35204 operator: intermediate_rep.operator.into_iter().next(),
35205 toleration_seconds: intermediate_rep.toleration_seconds.into_iter().next(),
35206 value: intermediate_rep.value.into_iter().next(),
35207 })
35208 }
35209}
35210
35211#[cfg(feature = "server")]
35214impl std::convert::TryFrom<header::IntoHeaderValue<Toleration>> for HeaderValue {
35215 type Error = String;
35216
35217 fn try_from(hdr_value: header::IntoHeaderValue<Toleration>) -> std::result::Result<Self, Self::Error> {
35218 let hdr_value = hdr_value.to_string();
35219 match HeaderValue::from_str(&hdr_value) {
35220 std::result::Result::Ok(value) => std::result::Result::Ok(value),
35221 std::result::Result::Err(e) => std::result::Result::Err(
35222 format!("Invalid header value for Toleration - value: {} is invalid {}",
35223 hdr_value, e))
35224 }
35225 }
35226}
35227
35228#[cfg(feature = "server")]
35229impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Toleration> {
35230 type Error = String;
35231
35232 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
35233 match hdr_value.to_str() {
35234 std::result::Result::Ok(value) => {
35235 match <Toleration as std::str::FromStr>::from_str(value) {
35236 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
35237 std::result::Result::Err(err) => std::result::Result::Err(
35238 format!("Unable to convert header value '{}' into Toleration - {}",
35239 value, err))
35240 }
35241 },
35242 std::result::Result::Err(e) => std::result::Result::Err(
35243 format!("Unable to convert header: {:?} to string: {}",
35244 hdr_value, e))
35245 }
35246 }
35247}
35248
35249
35250
35251
35252#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
35254#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35255pub struct TolerationOperator(String);
35256
35257impl validator::Validate for TolerationOperator {
35258 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
35259 std::result::Result::Ok(())
35260 }
35261}
35262
35263impl std::convert::From<String> for TolerationOperator {
35264 fn from(x: String) -> Self {
35265 TolerationOperator(x)
35266 }
35267}
35268
35269impl std::string::ToString for TolerationOperator {
35270 fn to_string(&self) -> String {
35271 self.0.to_string()
35272 }
35273}
35274
35275impl std::str::FromStr for TolerationOperator {
35276 type Err = std::string::ParseError;
35277 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
35278 std::result::Result::Ok(TolerationOperator(x.to_string()))
35279 }
35280}
35281
35282impl std::convert::From<TolerationOperator> for String {
35283 fn from(x: TolerationOperator) -> Self {
35284 x.0
35285 }
35286}
35287
35288impl std::ops::Deref for TolerationOperator {
35289 type Target = String;
35290 fn deref(&self) -> &String {
35291 &self.0
35292 }
35293}
35294
35295impl std::ops::DerefMut for TolerationOperator {
35296 fn deref_mut(&mut self) -> &mut String {
35297 &mut self.0
35298 }
35299}
35300
35301
35302
35303
35304
35305
35306#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
35307#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35308pub struct TopologySpreadConstraint {
35309 #[serde(rename = "labelSelector")]
35310 #[serde(skip_serializing_if="Option::is_none")]
35311 pub label_selector: Option<models::LabelSelector>,
35312
35313#[serde(rename = "maxSkew")]
35315 #[serde(skip_serializing_if="Option::is_none")]
35316 pub max_skew: Option<i32>,
35317
35318#[serde(rename = "topologyKey")]
35320 #[serde(skip_serializing_if="Option::is_none")]
35321 pub topology_key: Option<String>,
35322
35323#[serde(rename = "whenUnsatisfiable")]
35325 #[serde(skip_serializing_if="Option::is_none")]
35326 pub when_unsatisfiable: Option<String>,
35327
35328}
35329
35330
35331impl TopologySpreadConstraint {
35332 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
35333 pub fn new() -> TopologySpreadConstraint {
35334 TopologySpreadConstraint {
35335 label_selector: None,
35336 max_skew: None,
35337 topology_key: None,
35338 when_unsatisfiable: None,
35339 }
35340 }
35341}
35342
35343impl std::string::ToString for TopologySpreadConstraint {
35347 fn to_string(&self) -> String {
35348 let params: Vec<Option<String>> = vec![
35349 self.max_skew.as_ref().map(|max_skew| {
35353 [
35354 "maxSkew".to_string(),
35355 max_skew.to_string(),
35356 ].join(",")
35357 }),
35358
35359
35360 self.topology_key.as_ref().map(|topology_key| {
35361 [
35362 "topologyKey".to_string(),
35363 topology_key.to_string(),
35364 ].join(",")
35365 }),
35366
35367
35368 self.when_unsatisfiable.as_ref().map(|when_unsatisfiable| {
35369 [
35370 "whenUnsatisfiable".to_string(),
35371 when_unsatisfiable.to_string(),
35372 ].join(",")
35373 }),
35374
35375 ];
35376
35377 params.into_iter().flatten().collect::<Vec<_>>().join(",")
35378 }
35379}
35380
35381impl std::str::FromStr for TopologySpreadConstraint {
35385 type Err = String;
35386
35387 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
35388 #[derive(Default)]
35390 #[allow(dead_code)]
35391 struct IntermediateRep {
35392 pub label_selector: Vec<models::LabelSelector>,
35393 pub max_skew: Vec<i32>,
35394 pub topology_key: Vec<String>,
35395 pub when_unsatisfiable: Vec<String>,
35396 }
35397
35398 let mut intermediate_rep = IntermediateRep::default();
35399
35400 let mut string_iter = s.split(',');
35402 let mut key_result = string_iter.next();
35403
35404 while key_result.is_some() {
35405 let val = match string_iter.next() {
35406 Some(x) => x,
35407 None => return std::result::Result::Err("Missing value while parsing TopologySpreadConstraint".to_string())
35408 };
35409
35410 if let Some(key) = key_result {
35411 #[allow(clippy::match_single_binding)]
35412 match key {
35413 #[allow(clippy::redundant_clone)]
35414 "labelSelector" => intermediate_rep.label_selector.push(<models::LabelSelector as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35415 #[allow(clippy::redundant_clone)]
35416 "maxSkew" => intermediate_rep.max_skew.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35417 #[allow(clippy::redundant_clone)]
35418 "topologyKey" => intermediate_rep.topology_key.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35419 #[allow(clippy::redundant_clone)]
35420 "whenUnsatisfiable" => intermediate_rep.when_unsatisfiable.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35421 _ => return std::result::Result::Err("Unexpected key while parsing TopologySpreadConstraint".to_string())
35422 }
35423 }
35424
35425 key_result = string_iter.next();
35427 }
35428
35429 std::result::Result::Ok(TopologySpreadConstraint {
35431 label_selector: intermediate_rep.label_selector.into_iter().next(),
35432 max_skew: intermediate_rep.max_skew.into_iter().next(),
35433 topology_key: intermediate_rep.topology_key.into_iter().next(),
35434 when_unsatisfiable: intermediate_rep.when_unsatisfiable.into_iter().next(),
35435 })
35436 }
35437}
35438
35439#[cfg(feature = "server")]
35442impl std::convert::TryFrom<header::IntoHeaderValue<TopologySpreadConstraint>> for HeaderValue {
35443 type Error = String;
35444
35445 fn try_from(hdr_value: header::IntoHeaderValue<TopologySpreadConstraint>) -> std::result::Result<Self, Self::Error> {
35446 let hdr_value = hdr_value.to_string();
35447 match HeaderValue::from_str(&hdr_value) {
35448 std::result::Result::Ok(value) => std::result::Result::Ok(value),
35449 std::result::Result::Err(e) => std::result::Result::Err(
35450 format!("Invalid header value for TopologySpreadConstraint - value: {} is invalid {}",
35451 hdr_value, e))
35452 }
35453 }
35454}
35455
35456#[cfg(feature = "server")]
35457impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<TopologySpreadConstraint> {
35458 type Error = String;
35459
35460 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
35461 match hdr_value.to_str() {
35462 std::result::Result::Ok(value) => {
35463 match <TopologySpreadConstraint as std::str::FromStr>::from_str(value) {
35464 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
35465 std::result::Result::Err(err) => std::result::Result::Err(
35466 format!("Unable to convert header value '{}' into TopologySpreadConstraint - {}",
35467 value, err))
35468 }
35469 },
35470 std::result::Result::Err(e) => std::result::Result::Err(
35471 format!("Unable to convert header: {:?} to string: {}",
35472 hdr_value, e))
35473 }
35474 }
35475}
35476
35477
35478
35479
35480#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
35481#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35482pub struct Type(i64);
35483
35484impl validator::Validate for Type {
35485 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
35486 std::result::Result::Ok(())
35487 }
35488}
35489
35490impl std::convert::From<i64> for Type {
35491 fn from(x: i64) -> Self {
35492 Type(x)
35493 }
35494}
35495
35496impl std::convert::From<Type> for i64 {
35497 fn from(x: Type) -> Self {
35498 x.0
35499 }
35500}
35501
35502impl std::ops::Deref for Type {
35503 type Target = i64;
35504 fn deref(&self) -> &i64 {
35505 &self.0
35506 }
35507}
35508
35509impl std::ops::DerefMut for Type {
35510 fn deref_mut(&mut self) -> &mut i64 {
35511 &mut self.0
35512 }
35513}
35514
35515
35516
35517#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
35522#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35523pub struct TypedLocalObjectReference {
35524#[serde(rename = "apiGroup")]
35526 #[serde(skip_serializing_if="Option::is_none")]
35527 pub api_group: Option<String>,
35528
35529#[serde(rename = "kind")]
35531 #[serde(skip_serializing_if="Option::is_none")]
35532 pub kind: Option<String>,
35533
35534#[serde(rename = "name")]
35536 #[serde(skip_serializing_if="Option::is_none")]
35537 pub name: Option<String>,
35538
35539}
35540
35541
35542impl TypedLocalObjectReference {
35543 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
35544 pub fn new() -> TypedLocalObjectReference {
35545 TypedLocalObjectReference {
35546 api_group: None,
35547 kind: None,
35548 name: None,
35549 }
35550 }
35551}
35552
35553impl std::string::ToString for TypedLocalObjectReference {
35557 fn to_string(&self) -> String {
35558 let params: Vec<Option<String>> = vec![
35559
35560 self.api_group.as_ref().map(|api_group| {
35561 [
35562 "apiGroup".to_string(),
35563 api_group.to_string(),
35564 ].join(",")
35565 }),
35566
35567
35568 self.kind.as_ref().map(|kind| {
35569 [
35570 "kind".to_string(),
35571 kind.to_string(),
35572 ].join(",")
35573 }),
35574
35575
35576 self.name.as_ref().map(|name| {
35577 [
35578 "name".to_string(),
35579 name.to_string(),
35580 ].join(",")
35581 }),
35582
35583 ];
35584
35585 params.into_iter().flatten().collect::<Vec<_>>().join(",")
35586 }
35587}
35588
35589impl std::str::FromStr for TypedLocalObjectReference {
35593 type Err = String;
35594
35595 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
35596 #[derive(Default)]
35598 #[allow(dead_code)]
35599 struct IntermediateRep {
35600 pub api_group: Vec<String>,
35601 pub kind: Vec<String>,
35602 pub name: Vec<String>,
35603 }
35604
35605 let mut intermediate_rep = IntermediateRep::default();
35606
35607 let mut string_iter = s.split(',');
35609 let mut key_result = string_iter.next();
35610
35611 while key_result.is_some() {
35612 let val = match string_iter.next() {
35613 Some(x) => x,
35614 None => return std::result::Result::Err("Missing value while parsing TypedLocalObjectReference".to_string())
35615 };
35616
35617 if let Some(key) = key_result {
35618 #[allow(clippy::match_single_binding)]
35619 match key {
35620 #[allow(clippy::redundant_clone)]
35621 "apiGroup" => intermediate_rep.api_group.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35622 #[allow(clippy::redundant_clone)]
35623 "kind" => intermediate_rep.kind.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35624 #[allow(clippy::redundant_clone)]
35625 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35626 _ => return std::result::Result::Err("Unexpected key while parsing TypedLocalObjectReference".to_string())
35627 }
35628 }
35629
35630 key_result = string_iter.next();
35632 }
35633
35634 std::result::Result::Ok(TypedLocalObjectReference {
35636 api_group: intermediate_rep.api_group.into_iter().next(),
35637 kind: intermediate_rep.kind.into_iter().next(),
35638 name: intermediate_rep.name.into_iter().next(),
35639 })
35640 }
35641}
35642
35643#[cfg(feature = "server")]
35646impl std::convert::TryFrom<header::IntoHeaderValue<TypedLocalObjectReference>> for HeaderValue {
35647 type Error = String;
35648
35649 fn try_from(hdr_value: header::IntoHeaderValue<TypedLocalObjectReference>) -> std::result::Result<Self, Self::Error> {
35650 let hdr_value = hdr_value.to_string();
35651 match HeaderValue::from_str(&hdr_value) {
35652 std::result::Result::Ok(value) => std::result::Result::Ok(value),
35653 std::result::Result::Err(e) => std::result::Result::Err(
35654 format!("Invalid header value for TypedLocalObjectReference - value: {} is invalid {}",
35655 hdr_value, e))
35656 }
35657 }
35658}
35659
35660#[cfg(feature = "server")]
35661impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<TypedLocalObjectReference> {
35662 type Error = String;
35663
35664 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
35665 match hdr_value.to_str() {
35666 std::result::Result::Ok(value) => {
35667 match <TypedLocalObjectReference as std::str::FromStr>::from_str(value) {
35668 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
35669 std::result::Result::Err(err) => std::result::Result::Err(
35670 format!("Unable to convert header value '{}' into TypedLocalObjectReference - {}",
35671 value, err))
35672 }
35673 },
35674 std::result::Result::Err(e) => std::result::Result::Err(
35675 format!("Unable to convert header: {:?} to string: {}",
35676 hdr_value, e))
35677 }
35678 }
35679}
35680
35681
35682
35683
35684#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
35686#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35687pub struct Uid(String);
35688
35689impl validator::Validate for Uid {
35690 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
35691 std::result::Result::Ok(())
35692 }
35693}
35694
35695impl std::convert::From<String> for Uid {
35696 fn from(x: String) -> Self {
35697 Uid(x)
35698 }
35699}
35700
35701impl std::string::ToString for Uid {
35702 fn to_string(&self) -> String {
35703 self.0.to_string()
35704 }
35705}
35706
35707impl std::str::FromStr for Uid {
35708 type Err = std::string::ParseError;
35709 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
35710 std::result::Result::Ok(Uid(x.to_string()))
35711 }
35712}
35713
35714impl std::convert::From<Uid> for String {
35715 fn from(x: Uid) -> Self {
35716 x.0
35717 }
35718}
35719
35720impl std::ops::Deref for Uid {
35721 type Target = String;
35722 fn deref(&self) -> &String {
35723 &self.0
35724 }
35725}
35726
35727impl std::ops::DerefMut for Uid {
35728 fn deref_mut(&mut self) -> &mut String {
35729 &mut self.0
35730 }
35731}
35732
35733
35734
35735
35736
35737
35738#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
35739#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35740pub struct Ulimit {
35741 #[serde(rename = "Hard")]
35742 #[serde(skip_serializing_if="Option::is_none")]
35743 pub hard: Option<i64>,
35744
35745 #[serde(rename = "Name")]
35746 #[serde(skip_serializing_if="Option::is_none")]
35747 pub name: Option<String>,
35748
35749 #[serde(rename = "Soft")]
35750 #[serde(skip_serializing_if="Option::is_none")]
35751 pub soft: Option<i64>,
35752
35753}
35754
35755
35756impl Ulimit {
35757 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
35758 pub fn new() -> Ulimit {
35759 Ulimit {
35760 hard: None,
35761 name: None,
35762 soft: None,
35763 }
35764 }
35765}
35766
35767impl std::string::ToString for Ulimit {
35771 fn to_string(&self) -> String {
35772 let params: Vec<Option<String>> = vec![
35773
35774 self.hard.as_ref().map(|hard| {
35775 [
35776 "Hard".to_string(),
35777 hard.to_string(),
35778 ].join(",")
35779 }),
35780
35781
35782 self.name.as_ref().map(|name| {
35783 [
35784 "Name".to_string(),
35785 name.to_string(),
35786 ].join(",")
35787 }),
35788
35789
35790 self.soft.as_ref().map(|soft| {
35791 [
35792 "Soft".to_string(),
35793 soft.to_string(),
35794 ].join(",")
35795 }),
35796
35797 ];
35798
35799 params.into_iter().flatten().collect::<Vec<_>>().join(",")
35800 }
35801}
35802
35803impl std::str::FromStr for Ulimit {
35807 type Err = String;
35808
35809 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
35810 #[derive(Default)]
35812 #[allow(dead_code)]
35813 struct IntermediateRep {
35814 pub hard: Vec<i64>,
35815 pub name: Vec<String>,
35816 pub soft: Vec<i64>,
35817 }
35818
35819 let mut intermediate_rep = IntermediateRep::default();
35820
35821 let mut string_iter = s.split(',');
35823 let mut key_result = string_iter.next();
35824
35825 while key_result.is_some() {
35826 let val = match string_iter.next() {
35827 Some(x) => x,
35828 None => return std::result::Result::Err("Missing value while parsing Ulimit".to_string())
35829 };
35830
35831 if let Some(key) = key_result {
35832 #[allow(clippy::match_single_binding)]
35833 match key {
35834 #[allow(clippy::redundant_clone)]
35835 "Hard" => intermediate_rep.hard.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35836 #[allow(clippy::redundant_clone)]
35837 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35838 #[allow(clippy::redundant_clone)]
35839 "Soft" => intermediate_rep.soft.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
35840 _ => return std::result::Result::Err("Unexpected key while parsing Ulimit".to_string())
35841 }
35842 }
35843
35844 key_result = string_iter.next();
35846 }
35847
35848 std::result::Result::Ok(Ulimit {
35850 hard: intermediate_rep.hard.into_iter().next(),
35851 name: intermediate_rep.name.into_iter().next(),
35852 soft: intermediate_rep.soft.into_iter().next(),
35853 })
35854 }
35855}
35856
35857#[cfg(feature = "server")]
35860impl std::convert::TryFrom<header::IntoHeaderValue<Ulimit>> for HeaderValue {
35861 type Error = String;
35862
35863 fn try_from(hdr_value: header::IntoHeaderValue<Ulimit>) -> std::result::Result<Self, Self::Error> {
35864 let hdr_value = hdr_value.to_string();
35865 match HeaderValue::from_str(&hdr_value) {
35866 std::result::Result::Ok(value) => std::result::Result::Ok(value),
35867 std::result::Result::Err(e) => std::result::Result::Err(
35868 format!("Invalid header value for Ulimit - value: {} is invalid {}",
35869 hdr_value, e))
35870 }
35871 }
35872}
35873
35874#[cfg(feature = "server")]
35875impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Ulimit> {
35876 type Error = String;
35877
35878 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
35879 match hdr_value.to_str() {
35880 std::result::Result::Ok(value) => {
35881 match <Ulimit as std::str::FromStr>::from_str(value) {
35882 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
35883 std::result::Result::Err(err) => std::result::Result::Err(
35884 format!("Unable to convert header value '{}' into Ulimit - {}",
35885 value, err))
35886 }
35887 },
35888 std::result::Result::Err(e) => std::result::Result::Err(
35889 format!("Unable to convert header: {:?} to string: {}",
35890 hdr_value, e))
35891 }
35892 }
35893}
35894
35895
35896
35897
35898#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
35900#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35901pub struct UnsatisfiableConstraintAction(String);
35902
35903impl validator::Validate for UnsatisfiableConstraintAction {
35904 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
35905 std::result::Result::Ok(())
35906 }
35907}
35908
35909impl std::convert::From<String> for UnsatisfiableConstraintAction {
35910 fn from(x: String) -> Self {
35911 UnsatisfiableConstraintAction(x)
35912 }
35913}
35914
35915impl std::string::ToString for UnsatisfiableConstraintAction {
35916 fn to_string(&self) -> String {
35917 self.0.to_string()
35918 }
35919}
35920
35921impl std::str::FromStr for UnsatisfiableConstraintAction {
35922 type Err = std::string::ParseError;
35923 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
35924 std::result::Result::Ok(UnsatisfiableConstraintAction(x.to_string()))
35925 }
35926}
35927
35928impl std::convert::From<UnsatisfiableConstraintAction> for String {
35929 fn from(x: UnsatisfiableConstraintAction) -> Self {
35930 x.0
35931 }
35932}
35933
35934impl std::ops::Deref for UnsatisfiableConstraintAction {
35935 type Target = String;
35936 fn deref(&self) -> &String {
35937 &self.0
35938 }
35939}
35940
35941impl std::ops::DerefMut for UnsatisfiableConstraintAction {
35942 fn deref_mut(&mut self) -> &mut String {
35943 &mut self.0
35944 }
35945}
35946
35947
35948
35949#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
35951#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
35952pub struct UriScheme(String);
35953
35954impl validator::Validate for UriScheme {
35955 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
35956 std::result::Result::Ok(())
35957 }
35958}
35959
35960impl std::convert::From<String> for UriScheme {
35961 fn from(x: String) -> Self {
35962 UriScheme(x)
35963 }
35964}
35965
35966impl std::string::ToString for UriScheme {
35967 fn to_string(&self) -> String {
35968 self.0.to_string()
35969 }
35970}
35971
35972impl std::str::FromStr for UriScheme {
35973 type Err = std::string::ParseError;
35974 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
35975 std::result::Result::Ok(UriScheme(x.to_string()))
35976 }
35977}
35978
35979impl std::convert::From<UriScheme> for String {
35980 fn from(x: UriScheme) -> Self {
35981 x.0
35982 }
35983}
35984
35985impl std::ops::Deref for UriScheme {
35986 type Target = String;
35987 fn deref(&self) -> &String {
35988 &self.0
35989 }
35990}
35991
35992impl std::ops::DerefMut for UriScheme {
35993 fn deref_mut(&mut self) -> &mut String {
35994 &mut self.0
35995 }
35996}
35997
35998
35999
36000#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
36001#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36002pub struct UsernsMode(String);
36003
36004impl validator::Validate for UsernsMode {
36005 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
36006 std::result::Result::Ok(())
36007 }
36008}
36009
36010impl std::convert::From<String> for UsernsMode {
36011 fn from(x: String) -> Self {
36012 UsernsMode(x)
36013 }
36014}
36015
36016impl std::string::ToString for UsernsMode {
36017 fn to_string(&self) -> String {
36018 self.0.to_string()
36019 }
36020}
36021
36022impl std::str::FromStr for UsernsMode {
36023 type Err = std::string::ParseError;
36024 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
36025 std::result::Result::Ok(UsernsMode(x.to_string()))
36026 }
36027}
36028
36029impl std::convert::From<UsernsMode> for String {
36030 fn from(x: UsernsMode) -> Self {
36031 x.0
36032 }
36033}
36034
36035impl std::ops::Deref for UsernsMode {
36036 type Target = String;
36037 fn deref(&self) -> &String {
36038 &self.0
36039 }
36040}
36041
36042impl std::ops::DerefMut for UsernsMode {
36043 fn deref_mut(&mut self) -> &mut String {
36044 &mut self.0
36045 }
36046}
36047
36048
36049
36050#[derive(Debug, Clone, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize)]
36051#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36052pub struct UtsMode(String);
36053
36054impl validator::Validate for UtsMode {
36055 fn validate(&self) -> std::result::Result<(), validator::ValidationErrors> {
36056 std::result::Result::Ok(())
36057 }
36058}
36059
36060impl std::convert::From<String> for UtsMode {
36061 fn from(x: String) -> Self {
36062 UtsMode(x)
36063 }
36064}
36065
36066impl std::string::ToString for UtsMode {
36067 fn to_string(&self) -> String {
36068 self.0.to_string()
36069 }
36070}
36071
36072impl std::str::FromStr for UtsMode {
36073 type Err = std::string::ParseError;
36074 fn from_str(x: &str) -> std::result::Result<Self, Self::Err> {
36075 std::result::Result::Ok(UtsMode(x.to_string()))
36076 }
36077}
36078
36079impl std::convert::From<UtsMode> for String {
36080 fn from(x: UtsMode) -> Self {
36081 x.0
36082 }
36083}
36084
36085impl std::ops::Deref for UtsMode {
36086 type Target = String;
36087 fn deref(&self) -> &String {
36088 &self.0
36089 }
36090}
36091
36092impl std::ops::DerefMut for UtsMode {
36093 fn deref_mut(&mut self) -> &mut String {
36094 &mut self.0
36095 }
36096}
36097
36098
36099
36100
36101
36102
36103#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
36104#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36105pub struct Volume {
36106 #[serde(rename = "awsElasticBlockStore")]
36107 #[serde(skip_serializing_if="Option::is_none")]
36108 pub aws_elastic_block_store: Option<models::AwsElasticBlockStoreVolumeSource>,
36109
36110 #[serde(rename = "azureDisk")]
36111 #[serde(skip_serializing_if="Option::is_none")]
36112 pub azure_disk: Option<models::AzureDiskVolumeSource>,
36113
36114 #[serde(rename = "azureFile")]
36115 #[serde(skip_serializing_if="Option::is_none")]
36116 pub azure_file: Option<models::AzureFileVolumeSource>,
36117
36118 #[serde(rename = "cephfs")]
36119 #[serde(skip_serializing_if="Option::is_none")]
36120 pub cephfs: Option<models::CephFsVolumeSource>,
36121
36122 #[serde(rename = "cinder")]
36123 #[serde(skip_serializing_if="Option::is_none")]
36124 pub cinder: Option<models::CinderVolumeSource>,
36125
36126 #[serde(rename = "configMap")]
36127 #[serde(skip_serializing_if="Option::is_none")]
36128 pub config_map: Option<models::ConfigMapVolumeSource>,
36129
36130 #[serde(rename = "csi")]
36131 #[serde(skip_serializing_if="Option::is_none")]
36132 pub csi: Option<models::CsiVolumeSource>,
36133
36134 #[serde(rename = "downwardAPI")]
36135 #[serde(skip_serializing_if="Option::is_none")]
36136 pub downward_api: Option<models::DownwardApiVolumeSource>,
36137
36138 #[serde(rename = "emptyDir")]
36139 #[serde(skip_serializing_if="Option::is_none")]
36140 pub empty_dir: Option<models::EmptyDirVolumeSource>,
36141
36142 #[serde(rename = "ephemeral")]
36143 #[serde(skip_serializing_if="Option::is_none")]
36144 pub ephemeral: Option<models::EphemeralVolumeSource>,
36145
36146 #[serde(rename = "fc")]
36147 #[serde(skip_serializing_if="Option::is_none")]
36148 pub fc: Option<models::FcVolumeSource>,
36149
36150 #[serde(rename = "flexVolume")]
36151 #[serde(skip_serializing_if="Option::is_none")]
36152 pub flex_volume: Option<models::FlexVolumeSource>,
36153
36154 #[serde(rename = "flocker")]
36155 #[serde(skip_serializing_if="Option::is_none")]
36156 pub flocker: Option<models::FlockerVolumeSource>,
36157
36158 #[serde(rename = "gcePersistentDisk")]
36159 #[serde(skip_serializing_if="Option::is_none")]
36160 pub gce_persistent_disk: Option<models::GcePersistentDiskVolumeSource>,
36161
36162 #[serde(rename = "gitRepo")]
36163 #[serde(skip_serializing_if="Option::is_none")]
36164 pub git_repo: Option<models::GitRepoVolumeSource>,
36165
36166 #[serde(rename = "glusterfs")]
36167 #[serde(skip_serializing_if="Option::is_none")]
36168 pub glusterfs: Option<models::GlusterfsVolumeSource>,
36169
36170 #[serde(rename = "hostPath")]
36171 #[serde(skip_serializing_if="Option::is_none")]
36172 pub host_path: Option<models::HostPathVolumeSource>,
36173
36174 #[serde(rename = "iscsi")]
36175 #[serde(skip_serializing_if="Option::is_none")]
36176 pub iscsi: Option<models::IscsiVolumeSource>,
36177
36178#[serde(rename = "name")]
36180 #[serde(skip_serializing_if="Option::is_none")]
36181 pub name: Option<String>,
36182
36183 #[serde(rename = "nfs")]
36184 #[serde(skip_serializing_if="Option::is_none")]
36185 pub nfs: Option<models::NfsVolumeSource>,
36186
36187 #[serde(rename = "persistentVolumeClaim")]
36188 #[serde(skip_serializing_if="Option::is_none")]
36189 pub persistent_volume_claim: Option<models::PersistentVolumeClaimVolumeSource>,
36190
36191 #[serde(rename = "photonPersistentDisk")]
36192 #[serde(skip_serializing_if="Option::is_none")]
36193 pub photon_persistent_disk: Option<models::PhotonPersistentDiskVolumeSource>,
36194
36195 #[serde(rename = "portworxVolume")]
36196 #[serde(skip_serializing_if="Option::is_none")]
36197 pub portworx_volume: Option<models::PortworxVolumeSource>,
36198
36199 #[serde(rename = "projected")]
36200 #[serde(skip_serializing_if="Option::is_none")]
36201 pub projected: Option<models::ProjectedVolumeSource>,
36202
36203 #[serde(rename = "quobyte")]
36204 #[serde(skip_serializing_if="Option::is_none")]
36205 pub quobyte: Option<models::QuobyteVolumeSource>,
36206
36207 #[serde(rename = "rbd")]
36208 #[serde(skip_serializing_if="Option::is_none")]
36209 pub rbd: Option<models::RbdVolumeSource>,
36210
36211 #[serde(rename = "scaleIO")]
36212 #[serde(skip_serializing_if="Option::is_none")]
36213 pub scale_io: Option<models::ScaleIoVolumeSource>,
36214
36215 #[serde(rename = "secret")]
36216 #[serde(skip_serializing_if="Option::is_none")]
36217 pub secret: Option<models::SecretVolumeSource>,
36218
36219 #[serde(rename = "storageos")]
36220 #[serde(skip_serializing_if="Option::is_none")]
36221 pub storageos: Option<models::StorageOsVolumeSource>,
36222
36223 #[serde(rename = "vsphereVolume")]
36224 #[serde(skip_serializing_if="Option::is_none")]
36225 pub vsphere_volume: Option<models::VsphereVirtualDiskVolumeSource>,
36226
36227}
36228
36229
36230impl Volume {
36231 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
36232 pub fn new() -> Volume {
36233 Volume {
36234 aws_elastic_block_store: None,
36235 azure_disk: None,
36236 azure_file: None,
36237 cephfs: None,
36238 cinder: None,
36239 config_map: None,
36240 csi: None,
36241 downward_api: None,
36242 empty_dir: None,
36243 ephemeral: None,
36244 fc: None,
36245 flex_volume: None,
36246 flocker: None,
36247 gce_persistent_disk: None,
36248 git_repo: None,
36249 glusterfs: None,
36250 host_path: None,
36251 iscsi: None,
36252 name: None,
36253 nfs: None,
36254 persistent_volume_claim: None,
36255 photon_persistent_disk: None,
36256 portworx_volume: None,
36257 projected: None,
36258 quobyte: None,
36259 rbd: None,
36260 scale_io: None,
36261 secret: None,
36262 storageos: None,
36263 vsphere_volume: None,
36264 }
36265 }
36266}
36267
36268impl std::string::ToString for Volume {
36272 fn to_string(&self) -> String {
36273 let params: Vec<Option<String>> = vec![
36274 self.name.as_ref().map(|name| {
36312 [
36313 "name".to_string(),
36314 name.to_string(),
36315 ].join(",")
36316 }),
36317
36318 ];
36341
36342 params.into_iter().flatten().collect::<Vec<_>>().join(",")
36343 }
36344}
36345
36346impl std::str::FromStr for Volume {
36350 type Err = String;
36351
36352 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
36353 #[derive(Default)]
36355 #[allow(dead_code)]
36356 struct IntermediateRep {
36357 pub aws_elastic_block_store: Vec<models::AwsElasticBlockStoreVolumeSource>,
36358 pub azure_disk: Vec<models::AzureDiskVolumeSource>,
36359 pub azure_file: Vec<models::AzureFileVolumeSource>,
36360 pub cephfs: Vec<models::CephFsVolumeSource>,
36361 pub cinder: Vec<models::CinderVolumeSource>,
36362 pub config_map: Vec<models::ConfigMapVolumeSource>,
36363 pub csi: Vec<models::CsiVolumeSource>,
36364 pub downward_api: Vec<models::DownwardApiVolumeSource>,
36365 pub empty_dir: Vec<models::EmptyDirVolumeSource>,
36366 pub ephemeral: Vec<models::EphemeralVolumeSource>,
36367 pub fc: Vec<models::FcVolumeSource>,
36368 pub flex_volume: Vec<models::FlexVolumeSource>,
36369 pub flocker: Vec<models::FlockerVolumeSource>,
36370 pub gce_persistent_disk: Vec<models::GcePersistentDiskVolumeSource>,
36371 pub git_repo: Vec<models::GitRepoVolumeSource>,
36372 pub glusterfs: Vec<models::GlusterfsVolumeSource>,
36373 pub host_path: Vec<models::HostPathVolumeSource>,
36374 pub iscsi: Vec<models::IscsiVolumeSource>,
36375 pub name: Vec<String>,
36376 pub nfs: Vec<models::NfsVolumeSource>,
36377 pub persistent_volume_claim: Vec<models::PersistentVolumeClaimVolumeSource>,
36378 pub photon_persistent_disk: Vec<models::PhotonPersistentDiskVolumeSource>,
36379 pub portworx_volume: Vec<models::PortworxVolumeSource>,
36380 pub projected: Vec<models::ProjectedVolumeSource>,
36381 pub quobyte: Vec<models::QuobyteVolumeSource>,
36382 pub rbd: Vec<models::RbdVolumeSource>,
36383 pub scale_io: Vec<models::ScaleIoVolumeSource>,
36384 pub secret: Vec<models::SecretVolumeSource>,
36385 pub storageos: Vec<models::StorageOsVolumeSource>,
36386 pub vsphere_volume: Vec<models::VsphereVirtualDiskVolumeSource>,
36387 }
36388
36389 let mut intermediate_rep = IntermediateRep::default();
36390
36391 let mut string_iter = s.split(',');
36393 let mut key_result = string_iter.next();
36394
36395 while key_result.is_some() {
36396 let val = match string_iter.next() {
36397 Some(x) => x,
36398 None => return std::result::Result::Err("Missing value while parsing Volume".to_string())
36399 };
36400
36401 if let Some(key) = key_result {
36402 #[allow(clippy::match_single_binding)]
36403 match key {
36404 #[allow(clippy::redundant_clone)]
36405 "awsElasticBlockStore" => intermediate_rep.aws_elastic_block_store.push(<models::AwsElasticBlockStoreVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36406 #[allow(clippy::redundant_clone)]
36407 "azureDisk" => intermediate_rep.azure_disk.push(<models::AzureDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36408 #[allow(clippy::redundant_clone)]
36409 "azureFile" => intermediate_rep.azure_file.push(<models::AzureFileVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36410 #[allow(clippy::redundant_clone)]
36411 "cephfs" => intermediate_rep.cephfs.push(<models::CephFsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36412 #[allow(clippy::redundant_clone)]
36413 "cinder" => intermediate_rep.cinder.push(<models::CinderVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36414 #[allow(clippy::redundant_clone)]
36415 "configMap" => intermediate_rep.config_map.push(<models::ConfigMapVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36416 #[allow(clippy::redundant_clone)]
36417 "csi" => intermediate_rep.csi.push(<models::CsiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36418 #[allow(clippy::redundant_clone)]
36419 "downwardAPI" => intermediate_rep.downward_api.push(<models::DownwardApiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36420 #[allow(clippy::redundant_clone)]
36421 "emptyDir" => intermediate_rep.empty_dir.push(<models::EmptyDirVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36422 #[allow(clippy::redundant_clone)]
36423 "ephemeral" => intermediate_rep.ephemeral.push(<models::EphemeralVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36424 #[allow(clippy::redundant_clone)]
36425 "fc" => intermediate_rep.fc.push(<models::FcVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36426 #[allow(clippy::redundant_clone)]
36427 "flexVolume" => intermediate_rep.flex_volume.push(<models::FlexVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36428 #[allow(clippy::redundant_clone)]
36429 "flocker" => intermediate_rep.flocker.push(<models::FlockerVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36430 #[allow(clippy::redundant_clone)]
36431 "gcePersistentDisk" => intermediate_rep.gce_persistent_disk.push(<models::GcePersistentDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36432 #[allow(clippy::redundant_clone)]
36433 "gitRepo" => intermediate_rep.git_repo.push(<models::GitRepoVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36434 #[allow(clippy::redundant_clone)]
36435 "glusterfs" => intermediate_rep.glusterfs.push(<models::GlusterfsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36436 #[allow(clippy::redundant_clone)]
36437 "hostPath" => intermediate_rep.host_path.push(<models::HostPathVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36438 #[allow(clippy::redundant_clone)]
36439 "iscsi" => intermediate_rep.iscsi.push(<models::IscsiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36440 #[allow(clippy::redundant_clone)]
36441 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36442 #[allow(clippy::redundant_clone)]
36443 "nfs" => intermediate_rep.nfs.push(<models::NfsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36444 #[allow(clippy::redundant_clone)]
36445 "persistentVolumeClaim" => intermediate_rep.persistent_volume_claim.push(<models::PersistentVolumeClaimVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36446 #[allow(clippy::redundant_clone)]
36447 "photonPersistentDisk" => intermediate_rep.photon_persistent_disk.push(<models::PhotonPersistentDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36448 #[allow(clippy::redundant_clone)]
36449 "portworxVolume" => intermediate_rep.portworx_volume.push(<models::PortworxVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36450 #[allow(clippy::redundant_clone)]
36451 "projected" => intermediate_rep.projected.push(<models::ProjectedVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36452 #[allow(clippy::redundant_clone)]
36453 "quobyte" => intermediate_rep.quobyte.push(<models::QuobyteVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36454 #[allow(clippy::redundant_clone)]
36455 "rbd" => intermediate_rep.rbd.push(<models::RbdVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36456 #[allow(clippy::redundant_clone)]
36457 "scaleIO" => intermediate_rep.scale_io.push(<models::ScaleIoVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36458 #[allow(clippy::redundant_clone)]
36459 "secret" => intermediate_rep.secret.push(<models::SecretVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36460 #[allow(clippy::redundant_clone)]
36461 "storageos" => intermediate_rep.storageos.push(<models::StorageOsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36462 #[allow(clippy::redundant_clone)]
36463 "vsphereVolume" => intermediate_rep.vsphere_volume.push(<models::VsphereVirtualDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36464 _ => return std::result::Result::Err("Unexpected key while parsing Volume".to_string())
36465 }
36466 }
36467
36468 key_result = string_iter.next();
36470 }
36471
36472 std::result::Result::Ok(Volume {
36474 aws_elastic_block_store: intermediate_rep.aws_elastic_block_store.into_iter().next(),
36475 azure_disk: intermediate_rep.azure_disk.into_iter().next(),
36476 azure_file: intermediate_rep.azure_file.into_iter().next(),
36477 cephfs: intermediate_rep.cephfs.into_iter().next(),
36478 cinder: intermediate_rep.cinder.into_iter().next(),
36479 config_map: intermediate_rep.config_map.into_iter().next(),
36480 csi: intermediate_rep.csi.into_iter().next(),
36481 downward_api: intermediate_rep.downward_api.into_iter().next(),
36482 empty_dir: intermediate_rep.empty_dir.into_iter().next(),
36483 ephemeral: intermediate_rep.ephemeral.into_iter().next(),
36484 fc: intermediate_rep.fc.into_iter().next(),
36485 flex_volume: intermediate_rep.flex_volume.into_iter().next(),
36486 flocker: intermediate_rep.flocker.into_iter().next(),
36487 gce_persistent_disk: intermediate_rep.gce_persistent_disk.into_iter().next(),
36488 git_repo: intermediate_rep.git_repo.into_iter().next(),
36489 glusterfs: intermediate_rep.glusterfs.into_iter().next(),
36490 host_path: intermediate_rep.host_path.into_iter().next(),
36491 iscsi: intermediate_rep.iscsi.into_iter().next(),
36492 name: intermediate_rep.name.into_iter().next(),
36493 nfs: intermediate_rep.nfs.into_iter().next(),
36494 persistent_volume_claim: intermediate_rep.persistent_volume_claim.into_iter().next(),
36495 photon_persistent_disk: intermediate_rep.photon_persistent_disk.into_iter().next(),
36496 portworx_volume: intermediate_rep.portworx_volume.into_iter().next(),
36497 projected: intermediate_rep.projected.into_iter().next(),
36498 quobyte: intermediate_rep.quobyte.into_iter().next(),
36499 rbd: intermediate_rep.rbd.into_iter().next(),
36500 scale_io: intermediate_rep.scale_io.into_iter().next(),
36501 secret: intermediate_rep.secret.into_iter().next(),
36502 storageos: intermediate_rep.storageos.into_iter().next(),
36503 vsphere_volume: intermediate_rep.vsphere_volume.into_iter().next(),
36504 })
36505 }
36506}
36507
36508#[cfg(feature = "server")]
36511impl std::convert::TryFrom<header::IntoHeaderValue<Volume>> for HeaderValue {
36512 type Error = String;
36513
36514 fn try_from(hdr_value: header::IntoHeaderValue<Volume>) -> std::result::Result<Self, Self::Error> {
36515 let hdr_value = hdr_value.to_string();
36516 match HeaderValue::from_str(&hdr_value) {
36517 std::result::Result::Ok(value) => std::result::Result::Ok(value),
36518 std::result::Result::Err(e) => std::result::Result::Err(
36519 format!("Invalid header value for Volume - value: {} is invalid {}",
36520 hdr_value, e))
36521 }
36522 }
36523}
36524
36525#[cfg(feature = "server")]
36526impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<Volume> {
36527 type Error = String;
36528
36529 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
36530 match hdr_value.to_str() {
36531 std::result::Result::Ok(value) => {
36532 match <Volume as std::str::FromStr>::from_str(value) {
36533 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
36534 std::result::Result::Err(err) => std::result::Result::Err(
36535 format!("Unable to convert header value '{}' into Volume - {}",
36536 value, err))
36537 }
36538 },
36539 std::result::Result::Err(e) => std::result::Result::Err(
36540 format!("Unable to convert header: {:?} to string: {}",
36541 hdr_value, e))
36542 }
36543 }
36544}
36545
36546
36547
36548
36549#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
36554#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36555pub struct VolumeCreateBody {
36556#[serde(rename = "Driver")]
36558 pub driver: String,
36559
36560#[serde(rename = "DriverOpts")]
36562 pub driver_opts: std::collections::HashMap<String, String>,
36563
36564#[serde(rename = "Labels")]
36566 pub labels: std::collections::HashMap<String, String>,
36567
36568#[serde(rename = "Name")]
36570 pub name: String,
36571
36572}
36573
36574
36575impl VolumeCreateBody {
36576 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
36577 pub fn new(driver: String, driver_opts: std::collections::HashMap<String, String>, labels: std::collections::HashMap<String, String>, name: String, ) -> VolumeCreateBody {
36578 VolumeCreateBody {
36579 driver,
36580 driver_opts,
36581 labels,
36582 name,
36583 }
36584 }
36585}
36586
36587impl std::string::ToString for VolumeCreateBody {
36591 fn to_string(&self) -> String {
36592 let params: Vec<Option<String>> = vec![
36593
36594 Some("Driver".to_string()),
36595 Some(self.driver.to_string()),
36596
36597 Some("Name".to_string()),
36603 Some(self.name.to_string()),
36604
36605 ];
36606
36607 params.into_iter().flatten().collect::<Vec<_>>().join(",")
36608 }
36609}
36610
36611impl std::str::FromStr for VolumeCreateBody {
36615 type Err = String;
36616
36617 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
36618 #[derive(Default)]
36620 #[allow(dead_code)]
36621 struct IntermediateRep {
36622 pub driver: Vec<String>,
36623 pub driver_opts: Vec<std::collections::HashMap<String, String>>,
36624 pub labels: Vec<std::collections::HashMap<String, String>>,
36625 pub name: Vec<String>,
36626 }
36627
36628 let mut intermediate_rep = IntermediateRep::default();
36629
36630 let mut string_iter = s.split(',');
36632 let mut key_result = string_iter.next();
36633
36634 while key_result.is_some() {
36635 let val = match string_iter.next() {
36636 Some(x) => x,
36637 None => return std::result::Result::Err("Missing value while parsing VolumeCreateBody".to_string())
36638 };
36639
36640 if let Some(key) = key_result {
36641 #[allow(clippy::match_single_binding)]
36642 match key {
36643 #[allow(clippy::redundant_clone)]
36644 "Driver" => intermediate_rep.driver.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36645 "DriverOpts" => return std::result::Result::Err("Parsing a container in this style is not supported in VolumeCreateBody".to_string()),
36646 "Labels" => return std::result::Result::Err("Parsing a container in this style is not supported in VolumeCreateBody".to_string()),
36647 #[allow(clippy::redundant_clone)]
36648 "Name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36649 _ => return std::result::Result::Err("Unexpected key while parsing VolumeCreateBody".to_string())
36650 }
36651 }
36652
36653 key_result = string_iter.next();
36655 }
36656
36657 std::result::Result::Ok(VolumeCreateBody {
36659 driver: intermediate_rep.driver.into_iter().next().ok_or_else(|| "Driver missing in VolumeCreateBody".to_string())?,
36660 driver_opts: intermediate_rep.driver_opts.into_iter().next().ok_or_else(|| "DriverOpts missing in VolumeCreateBody".to_string())?,
36661 labels: intermediate_rep.labels.into_iter().next().ok_or_else(|| "Labels missing in VolumeCreateBody".to_string())?,
36662 name: intermediate_rep.name.into_iter().next().ok_or_else(|| "Name missing in VolumeCreateBody".to_string())?,
36663 })
36664 }
36665}
36666
36667#[cfg(feature = "server")]
36670impl std::convert::TryFrom<header::IntoHeaderValue<VolumeCreateBody>> for HeaderValue {
36671 type Error = String;
36672
36673 fn try_from(hdr_value: header::IntoHeaderValue<VolumeCreateBody>) -> std::result::Result<Self, Self::Error> {
36674 let hdr_value = hdr_value.to_string();
36675 match HeaderValue::from_str(&hdr_value) {
36676 std::result::Result::Ok(value) => std::result::Result::Ok(value),
36677 std::result::Result::Err(e) => std::result::Result::Err(
36678 format!("Invalid header value for VolumeCreateBody - value: {} is invalid {}",
36679 hdr_value, e))
36680 }
36681 }
36682}
36683
36684#[cfg(feature = "server")]
36685impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeCreateBody> {
36686 type Error = String;
36687
36688 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
36689 match hdr_value.to_str() {
36690 std::result::Result::Ok(value) => {
36691 match <VolumeCreateBody as std::str::FromStr>::from_str(value) {
36692 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
36693 std::result::Result::Err(err) => std::result::Result::Err(
36694 format!("Unable to convert header value '{}' into VolumeCreateBody - {}",
36695 value, err))
36696 }
36697 },
36698 std::result::Result::Err(e) => std::result::Result::Err(
36699 format!("Unable to convert header: {:?} to string: {}",
36700 hdr_value, e))
36701 }
36702 }
36703}
36704
36705
36706
36707
36708
36709
36710
36711#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
36712#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36713pub struct VolumeDevice {
36714#[serde(rename = "devicePath")]
36716 #[serde(skip_serializing_if="Option::is_none")]
36717 pub device_path: Option<String>,
36718
36719#[serde(rename = "name")]
36721 #[serde(skip_serializing_if="Option::is_none")]
36722 pub name: Option<String>,
36723
36724}
36725
36726
36727impl VolumeDevice {
36728 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
36729 pub fn new() -> VolumeDevice {
36730 VolumeDevice {
36731 device_path: None,
36732 name: None,
36733 }
36734 }
36735}
36736
36737impl std::string::ToString for VolumeDevice {
36741 fn to_string(&self) -> String {
36742 let params: Vec<Option<String>> = vec![
36743
36744 self.device_path.as_ref().map(|device_path| {
36745 [
36746 "devicePath".to_string(),
36747 device_path.to_string(),
36748 ].join(",")
36749 }),
36750
36751
36752 self.name.as_ref().map(|name| {
36753 [
36754 "name".to_string(),
36755 name.to_string(),
36756 ].join(",")
36757 }),
36758
36759 ];
36760
36761 params.into_iter().flatten().collect::<Vec<_>>().join(",")
36762 }
36763}
36764
36765impl std::str::FromStr for VolumeDevice {
36769 type Err = String;
36770
36771 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
36772 #[derive(Default)]
36774 #[allow(dead_code)]
36775 struct IntermediateRep {
36776 pub device_path: Vec<String>,
36777 pub name: Vec<String>,
36778 }
36779
36780 let mut intermediate_rep = IntermediateRep::default();
36781
36782 let mut string_iter = s.split(',');
36784 let mut key_result = string_iter.next();
36785
36786 while key_result.is_some() {
36787 let val = match string_iter.next() {
36788 Some(x) => x,
36789 None => return std::result::Result::Err("Missing value while parsing VolumeDevice".to_string())
36790 };
36791
36792 if let Some(key) = key_result {
36793 #[allow(clippy::match_single_binding)]
36794 match key {
36795 #[allow(clippy::redundant_clone)]
36796 "devicePath" => intermediate_rep.device_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36797 #[allow(clippy::redundant_clone)]
36798 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
36799 _ => return std::result::Result::Err("Unexpected key while parsing VolumeDevice".to_string())
36800 }
36801 }
36802
36803 key_result = string_iter.next();
36805 }
36806
36807 std::result::Result::Ok(VolumeDevice {
36809 device_path: intermediate_rep.device_path.into_iter().next(),
36810 name: intermediate_rep.name.into_iter().next(),
36811 })
36812 }
36813}
36814
36815#[cfg(feature = "server")]
36818impl std::convert::TryFrom<header::IntoHeaderValue<VolumeDevice>> for HeaderValue {
36819 type Error = String;
36820
36821 fn try_from(hdr_value: header::IntoHeaderValue<VolumeDevice>) -> std::result::Result<Self, Self::Error> {
36822 let hdr_value = hdr_value.to_string();
36823 match HeaderValue::from_str(&hdr_value) {
36824 std::result::Result::Ok(value) => std::result::Result::Ok(value),
36825 std::result::Result::Err(e) => std::result::Result::Err(
36826 format!("Invalid header value for VolumeDevice - value: {} is invalid {}",
36827 hdr_value, e))
36828 }
36829 }
36830}
36831
36832#[cfg(feature = "server")]
36833impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeDevice> {
36834 type Error = String;
36835
36836 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
36837 match hdr_value.to_str() {
36838 std::result::Result::Ok(value) => {
36839 match <VolumeDevice as std::str::FromStr>::from_str(value) {
36840 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
36841 std::result::Result::Err(err) => std::result::Result::Err(
36842 format!("Unable to convert header value '{}' into VolumeDevice - {}",
36843 value, err))
36844 }
36845 },
36846 std::result::Result::Err(e) => std::result::Result::Err(
36847 format!("Unable to convert header: {:?} to string: {}",
36848 hdr_value, e))
36849 }
36850 }
36851}
36852
36853
36854
36855
36856#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
36861#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36862pub struct VolumeListOkBody {
36863#[serde(rename = "Volumes")]
36865 pub volumes: Vec<models::Volume>,
36866
36867#[serde(rename = "Warnings")]
36869 pub warnings: Vec<String>,
36870
36871}
36872
36873
36874impl VolumeListOkBody {
36875 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
36876 pub fn new(volumes: Vec<models::Volume>, warnings: Vec<String>, ) -> VolumeListOkBody {
36877 VolumeListOkBody {
36878 volumes,
36879 warnings,
36880 }
36881 }
36882}
36883
36884impl std::string::ToString for VolumeListOkBody {
36888 fn to_string(&self) -> String {
36889 let params: Vec<Option<String>> = vec![
36890 Some("Warnings".to_string()),
36894 Some(self.warnings.iter().map(|x| x.to_string()).collect::<Vec<_>>().join(",")),
36895
36896 ];
36897
36898 params.into_iter().flatten().collect::<Vec<_>>().join(",")
36899 }
36900}
36901
36902impl std::str::FromStr for VolumeListOkBody {
36906 type Err = String;
36907
36908 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
36909 #[derive(Default)]
36911 #[allow(dead_code)]
36912 struct IntermediateRep {
36913 pub volumes: Vec<Vec<models::Volume>>,
36914 pub warnings: Vec<Vec<String>>,
36915 }
36916
36917 let mut intermediate_rep = IntermediateRep::default();
36918
36919 let mut string_iter = s.split(',');
36921 let mut key_result = string_iter.next();
36922
36923 while key_result.is_some() {
36924 let val = match string_iter.next() {
36925 Some(x) => x,
36926 None => return std::result::Result::Err("Missing value while parsing VolumeListOkBody".to_string())
36927 };
36928
36929 if let Some(key) = key_result {
36930 #[allow(clippy::match_single_binding)]
36931 match key {
36932 "Volumes" => return std::result::Result::Err("Parsing a container in this style is not supported in VolumeListOkBody".to_string()),
36933 "Warnings" => return std::result::Result::Err("Parsing a container in this style is not supported in VolumeListOkBody".to_string()),
36934 _ => return std::result::Result::Err("Unexpected key while parsing VolumeListOkBody".to_string())
36935 }
36936 }
36937
36938 key_result = string_iter.next();
36940 }
36941
36942 std::result::Result::Ok(VolumeListOkBody {
36944 volumes: intermediate_rep.volumes.into_iter().next().ok_or_else(|| "Volumes missing in VolumeListOkBody".to_string())?,
36945 warnings: intermediate_rep.warnings.into_iter().next().ok_or_else(|| "Warnings missing in VolumeListOkBody".to_string())?,
36946 })
36947 }
36948}
36949
36950#[cfg(feature = "server")]
36953impl std::convert::TryFrom<header::IntoHeaderValue<VolumeListOkBody>> for HeaderValue {
36954 type Error = String;
36955
36956 fn try_from(hdr_value: header::IntoHeaderValue<VolumeListOkBody>) -> std::result::Result<Self, Self::Error> {
36957 let hdr_value = hdr_value.to_string();
36958 match HeaderValue::from_str(&hdr_value) {
36959 std::result::Result::Ok(value) => std::result::Result::Ok(value),
36960 std::result::Result::Err(e) => std::result::Result::Err(
36961 format!("Invalid header value for VolumeListOkBody - value: {} is invalid {}",
36962 hdr_value, e))
36963 }
36964 }
36965}
36966
36967#[cfg(feature = "server")]
36968impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeListOkBody> {
36969 type Error = String;
36970
36971 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
36972 match hdr_value.to_str() {
36973 std::result::Result::Ok(value) => {
36974 match <VolumeListOkBody as std::str::FromStr>::from_str(value) {
36975 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
36976 std::result::Result::Err(err) => std::result::Result::Err(
36977 format!("Unable to convert header value '{}' into VolumeListOkBody - {}",
36978 value, err))
36979 }
36980 },
36981 std::result::Result::Err(e) => std::result::Result::Err(
36982 format!("Unable to convert header: {:?} to string: {}",
36983 hdr_value, e))
36984 }
36985 }
36986}
36987
36988
36989
36990
36991
36992
36993
36994#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
36995#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
36996pub struct VolumeMount {
36997#[serde(rename = "mountPath")]
36999 #[serde(skip_serializing_if="Option::is_none")]
37000 pub mount_path: Option<String>,
37001
37002#[serde(rename = "mountPropagation")]
37004 #[serde(skip_serializing_if="Option::is_none")]
37005 pub mount_propagation: Option<String>,
37006
37007#[serde(rename = "name")]
37009 #[serde(skip_serializing_if="Option::is_none")]
37010 pub name: Option<String>,
37011
37012#[serde(rename = "readOnly")]
37014 #[serde(skip_serializing_if="Option::is_none")]
37015 pub read_only: Option<bool>,
37016
37017#[serde(rename = "subPath")]
37019 #[serde(skip_serializing_if="Option::is_none")]
37020 pub sub_path: Option<String>,
37021
37022#[serde(rename = "subPathExpr")]
37024 #[serde(skip_serializing_if="Option::is_none")]
37025 pub sub_path_expr: Option<String>,
37026
37027}
37028
37029
37030impl VolumeMount {
37031 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
37032 pub fn new() -> VolumeMount {
37033 VolumeMount {
37034 mount_path: None,
37035 mount_propagation: None,
37036 name: None,
37037 read_only: None,
37038 sub_path: None,
37039 sub_path_expr: None,
37040 }
37041 }
37042}
37043
37044impl std::string::ToString for VolumeMount {
37048 fn to_string(&self) -> String {
37049 let params: Vec<Option<String>> = vec![
37050
37051 self.mount_path.as_ref().map(|mount_path| {
37052 [
37053 "mountPath".to_string(),
37054 mount_path.to_string(),
37055 ].join(",")
37056 }),
37057
37058
37059 self.mount_propagation.as_ref().map(|mount_propagation| {
37060 [
37061 "mountPropagation".to_string(),
37062 mount_propagation.to_string(),
37063 ].join(",")
37064 }),
37065
37066
37067 self.name.as_ref().map(|name| {
37068 [
37069 "name".to_string(),
37070 name.to_string(),
37071 ].join(",")
37072 }),
37073
37074
37075 self.read_only.as_ref().map(|read_only| {
37076 [
37077 "readOnly".to_string(),
37078 read_only.to_string(),
37079 ].join(",")
37080 }),
37081
37082
37083 self.sub_path.as_ref().map(|sub_path| {
37084 [
37085 "subPath".to_string(),
37086 sub_path.to_string(),
37087 ].join(",")
37088 }),
37089
37090
37091 self.sub_path_expr.as_ref().map(|sub_path_expr| {
37092 [
37093 "subPathExpr".to_string(),
37094 sub_path_expr.to_string(),
37095 ].join(",")
37096 }),
37097
37098 ];
37099
37100 params.into_iter().flatten().collect::<Vec<_>>().join(",")
37101 }
37102}
37103
37104impl std::str::FromStr for VolumeMount {
37108 type Err = String;
37109
37110 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
37111 #[derive(Default)]
37113 #[allow(dead_code)]
37114 struct IntermediateRep {
37115 pub mount_path: Vec<String>,
37116 pub mount_propagation: Vec<String>,
37117 pub name: Vec<String>,
37118 pub read_only: Vec<bool>,
37119 pub sub_path: Vec<String>,
37120 pub sub_path_expr: Vec<String>,
37121 }
37122
37123 let mut intermediate_rep = IntermediateRep::default();
37124
37125 let mut string_iter = s.split(',');
37127 let mut key_result = string_iter.next();
37128
37129 while key_result.is_some() {
37130 let val = match string_iter.next() {
37131 Some(x) => x,
37132 None => return std::result::Result::Err("Missing value while parsing VolumeMount".to_string())
37133 };
37134
37135 if let Some(key) = key_result {
37136 #[allow(clippy::match_single_binding)]
37137 match key {
37138 #[allow(clippy::redundant_clone)]
37139 "mountPath" => intermediate_rep.mount_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37140 #[allow(clippy::redundant_clone)]
37141 "mountPropagation" => intermediate_rep.mount_propagation.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37142 #[allow(clippy::redundant_clone)]
37143 "name" => intermediate_rep.name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37144 #[allow(clippy::redundant_clone)]
37145 "readOnly" => intermediate_rep.read_only.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37146 #[allow(clippy::redundant_clone)]
37147 "subPath" => intermediate_rep.sub_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37148 #[allow(clippy::redundant_clone)]
37149 "subPathExpr" => intermediate_rep.sub_path_expr.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37150 _ => return std::result::Result::Err("Unexpected key while parsing VolumeMount".to_string())
37151 }
37152 }
37153
37154 key_result = string_iter.next();
37156 }
37157
37158 std::result::Result::Ok(VolumeMount {
37160 mount_path: intermediate_rep.mount_path.into_iter().next(),
37161 mount_propagation: intermediate_rep.mount_propagation.into_iter().next(),
37162 name: intermediate_rep.name.into_iter().next(),
37163 read_only: intermediate_rep.read_only.into_iter().next(),
37164 sub_path: intermediate_rep.sub_path.into_iter().next(),
37165 sub_path_expr: intermediate_rep.sub_path_expr.into_iter().next(),
37166 })
37167 }
37168}
37169
37170#[cfg(feature = "server")]
37173impl std::convert::TryFrom<header::IntoHeaderValue<VolumeMount>> for HeaderValue {
37174 type Error = String;
37175
37176 fn try_from(hdr_value: header::IntoHeaderValue<VolumeMount>) -> std::result::Result<Self, Self::Error> {
37177 let hdr_value = hdr_value.to_string();
37178 match HeaderValue::from_str(&hdr_value) {
37179 std::result::Result::Ok(value) => std::result::Result::Ok(value),
37180 std::result::Result::Err(e) => std::result::Result::Err(
37181 format!("Invalid header value for VolumeMount - value: {} is invalid {}",
37182 hdr_value, e))
37183 }
37184 }
37185}
37186
37187#[cfg(feature = "server")]
37188impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeMount> {
37189 type Error = String;
37190
37191 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
37192 match hdr_value.to_str() {
37193 std::result::Result::Ok(value) => {
37194 match <VolumeMount as std::str::FromStr>::from_str(value) {
37195 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
37196 std::result::Result::Err(err) => std::result::Result::Err(
37197 format!("Unable to convert header value '{}' into VolumeMount - {}",
37198 value, err))
37199 }
37200 },
37201 std::result::Result::Err(e) => std::result::Result::Err(
37202 format!("Unable to convert header: {:?} to string: {}",
37203 hdr_value, e))
37204 }
37205 }
37206}
37207
37208
37209
37210
37211
37212
37213
37214#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
37215#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
37216pub struct VolumeOptions {
37217 #[serde(rename = "DriverConfig")]
37218 #[serde(skip_serializing_if="Option::is_none")]
37219 pub driver_config: Option<models::Driver>,
37220
37221 #[serde(rename = "Labels")]
37222 #[serde(skip_serializing_if="Option::is_none")]
37223 pub labels: Option<std::collections::HashMap<String, String>>,
37224
37225 #[serde(rename = "NoCopy")]
37226 #[serde(skip_serializing_if="Option::is_none")]
37227 pub no_copy: Option<bool>,
37228
37229}
37230
37231
37232impl VolumeOptions {
37233 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
37234 pub fn new() -> VolumeOptions {
37235 VolumeOptions {
37236 driver_config: None,
37237 labels: None,
37238 no_copy: None,
37239 }
37240 }
37241}
37242
37243impl std::string::ToString for VolumeOptions {
37247 fn to_string(&self) -> String {
37248 let params: Vec<Option<String>> = vec![
37249 self.no_copy.as_ref().map(|no_copy| {
37255 [
37256 "NoCopy".to_string(),
37257 no_copy.to_string(),
37258 ].join(",")
37259 }),
37260
37261 ];
37262
37263 params.into_iter().flatten().collect::<Vec<_>>().join(",")
37264 }
37265}
37266
37267impl std::str::FromStr for VolumeOptions {
37271 type Err = String;
37272
37273 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
37274 #[derive(Default)]
37276 #[allow(dead_code)]
37277 struct IntermediateRep {
37278 pub driver_config: Vec<models::Driver>,
37279 pub labels: Vec<std::collections::HashMap<String, String>>,
37280 pub no_copy: Vec<bool>,
37281 }
37282
37283 let mut intermediate_rep = IntermediateRep::default();
37284
37285 let mut string_iter = s.split(',');
37287 let mut key_result = string_iter.next();
37288
37289 while key_result.is_some() {
37290 let val = match string_iter.next() {
37291 Some(x) => x,
37292 None => return std::result::Result::Err("Missing value while parsing VolumeOptions".to_string())
37293 };
37294
37295 if let Some(key) = key_result {
37296 #[allow(clippy::match_single_binding)]
37297 match key {
37298 #[allow(clippy::redundant_clone)]
37299 "DriverConfig" => intermediate_rep.driver_config.push(<models::Driver as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37300 "Labels" => return std::result::Result::Err("Parsing a container in this style is not supported in VolumeOptions".to_string()),
37301 #[allow(clippy::redundant_clone)]
37302 "NoCopy" => intermediate_rep.no_copy.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37303 _ => return std::result::Result::Err("Unexpected key while parsing VolumeOptions".to_string())
37304 }
37305 }
37306
37307 key_result = string_iter.next();
37309 }
37310
37311 std::result::Result::Ok(VolumeOptions {
37313 driver_config: intermediate_rep.driver_config.into_iter().next(),
37314 labels: intermediate_rep.labels.into_iter().next(),
37315 no_copy: intermediate_rep.no_copy.into_iter().next(),
37316 })
37317 }
37318}
37319
37320#[cfg(feature = "server")]
37323impl std::convert::TryFrom<header::IntoHeaderValue<VolumeOptions>> for HeaderValue {
37324 type Error = String;
37325
37326 fn try_from(hdr_value: header::IntoHeaderValue<VolumeOptions>) -> std::result::Result<Self, Self::Error> {
37327 let hdr_value = hdr_value.to_string();
37328 match HeaderValue::from_str(&hdr_value) {
37329 std::result::Result::Ok(value) => std::result::Result::Ok(value),
37330 std::result::Result::Err(e) => std::result::Result::Err(
37331 format!("Invalid header value for VolumeOptions - value: {} is invalid {}",
37332 hdr_value, e))
37333 }
37334 }
37335}
37336
37337#[cfg(feature = "server")]
37338impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeOptions> {
37339 type Error = String;
37340
37341 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
37342 match hdr_value.to_str() {
37343 std::result::Result::Ok(value) => {
37344 match <VolumeOptions as std::str::FromStr>::from_str(value) {
37345 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
37346 std::result::Result::Err(err) => std::result::Result::Err(
37347 format!("Unable to convert header value '{}' into VolumeOptions - {}",
37348 value, err))
37349 }
37350 },
37351 std::result::Result::Err(e) => std::result::Result::Err(
37352 format!("Unable to convert header: {:?} to string: {}",
37353 hdr_value, e))
37354 }
37355 }
37356}
37357
37358
37359
37360
37361#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
37366#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
37367pub struct VolumeProjection {
37368 #[serde(rename = "configMap")]
37369 #[serde(skip_serializing_if="Option::is_none")]
37370 pub config_map: Option<models::ConfigMapProjection>,
37371
37372 #[serde(rename = "downwardAPI")]
37373 #[serde(skip_serializing_if="Option::is_none")]
37374 pub downward_api: Option<models::DownwardApiProjection>,
37375
37376 #[serde(rename = "secret")]
37377 #[serde(skip_serializing_if="Option::is_none")]
37378 pub secret: Option<models::SecretProjection>,
37379
37380 #[serde(rename = "serviceAccountToken")]
37381 #[serde(skip_serializing_if="Option::is_none")]
37382 pub service_account_token: Option<models::ServiceAccountTokenProjection>,
37383
37384}
37385
37386
37387impl VolumeProjection {
37388 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
37389 pub fn new() -> VolumeProjection {
37390 VolumeProjection {
37391 config_map: None,
37392 downward_api: None,
37393 secret: None,
37394 service_account_token: None,
37395 }
37396 }
37397}
37398
37399impl std::string::ToString for VolumeProjection {
37403 fn to_string(&self) -> String {
37404 let params: Vec<Option<String>> = vec![
37405 ];
37414
37415 params.into_iter().flatten().collect::<Vec<_>>().join(",")
37416 }
37417}
37418
37419impl std::str::FromStr for VolumeProjection {
37423 type Err = String;
37424
37425 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
37426 #[derive(Default)]
37428 #[allow(dead_code)]
37429 struct IntermediateRep {
37430 pub config_map: Vec<models::ConfigMapProjection>,
37431 pub downward_api: Vec<models::DownwardApiProjection>,
37432 pub secret: Vec<models::SecretProjection>,
37433 pub service_account_token: Vec<models::ServiceAccountTokenProjection>,
37434 }
37435
37436 let mut intermediate_rep = IntermediateRep::default();
37437
37438 let mut string_iter = s.split(',');
37440 let mut key_result = string_iter.next();
37441
37442 while key_result.is_some() {
37443 let val = match string_iter.next() {
37444 Some(x) => x,
37445 None => return std::result::Result::Err("Missing value while parsing VolumeProjection".to_string())
37446 };
37447
37448 if let Some(key) = key_result {
37449 #[allow(clippy::match_single_binding)]
37450 match key {
37451 #[allow(clippy::redundant_clone)]
37452 "configMap" => intermediate_rep.config_map.push(<models::ConfigMapProjection as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37453 #[allow(clippy::redundant_clone)]
37454 "downwardAPI" => intermediate_rep.downward_api.push(<models::DownwardApiProjection as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37455 #[allow(clippy::redundant_clone)]
37456 "secret" => intermediate_rep.secret.push(<models::SecretProjection as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37457 #[allow(clippy::redundant_clone)]
37458 "serviceAccountToken" => intermediate_rep.service_account_token.push(<models::ServiceAccountTokenProjection as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37459 _ => return std::result::Result::Err("Unexpected key while parsing VolumeProjection".to_string())
37460 }
37461 }
37462
37463 key_result = string_iter.next();
37465 }
37466
37467 std::result::Result::Ok(VolumeProjection {
37469 config_map: intermediate_rep.config_map.into_iter().next(),
37470 downward_api: intermediate_rep.downward_api.into_iter().next(),
37471 secret: intermediate_rep.secret.into_iter().next(),
37472 service_account_token: intermediate_rep.service_account_token.into_iter().next(),
37473 })
37474 }
37475}
37476
37477#[cfg(feature = "server")]
37480impl std::convert::TryFrom<header::IntoHeaderValue<VolumeProjection>> for HeaderValue {
37481 type Error = String;
37482
37483 fn try_from(hdr_value: header::IntoHeaderValue<VolumeProjection>) -> std::result::Result<Self, Self::Error> {
37484 let hdr_value = hdr_value.to_string();
37485 match HeaderValue::from_str(&hdr_value) {
37486 std::result::Result::Ok(value) => std::result::Result::Ok(value),
37487 std::result::Result::Err(e) => std::result::Result::Err(
37488 format!("Invalid header value for VolumeProjection - value: {} is invalid {}",
37489 hdr_value, e))
37490 }
37491 }
37492}
37493
37494#[cfg(feature = "server")]
37495impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeProjection> {
37496 type Error = String;
37497
37498 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
37499 match hdr_value.to_str() {
37500 std::result::Result::Ok(value) => {
37501 match <VolumeProjection as std::str::FromStr>::from_str(value) {
37502 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
37503 std::result::Result::Err(err) => std::result::Result::Err(
37504 format!("Unable to convert header value '{}' into VolumeProjection - {}",
37505 value, err))
37506 }
37507 },
37508 std::result::Result::Err(e) => std::result::Result::Err(
37509 format!("Unable to convert header: {:?} to string: {}",
37510 hdr_value, e))
37511 }
37512 }
37513}
37514
37515
37516
37517
37518#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
37523#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
37524pub struct VolumeSource {
37525 #[serde(rename = "awsElasticBlockStore")]
37526 #[serde(skip_serializing_if="Option::is_none")]
37527 pub aws_elastic_block_store: Option<models::AwsElasticBlockStoreVolumeSource>,
37528
37529 #[serde(rename = "azureDisk")]
37530 #[serde(skip_serializing_if="Option::is_none")]
37531 pub azure_disk: Option<models::AzureDiskVolumeSource>,
37532
37533 #[serde(rename = "azureFile")]
37534 #[serde(skip_serializing_if="Option::is_none")]
37535 pub azure_file: Option<models::AzureFileVolumeSource>,
37536
37537 #[serde(rename = "cephfs")]
37538 #[serde(skip_serializing_if="Option::is_none")]
37539 pub cephfs: Option<models::CephFsVolumeSource>,
37540
37541 #[serde(rename = "cinder")]
37542 #[serde(skip_serializing_if="Option::is_none")]
37543 pub cinder: Option<models::CinderVolumeSource>,
37544
37545 #[serde(rename = "configMap")]
37546 #[serde(skip_serializing_if="Option::is_none")]
37547 pub config_map: Option<models::ConfigMapVolumeSource>,
37548
37549 #[serde(rename = "csi")]
37550 #[serde(skip_serializing_if="Option::is_none")]
37551 pub csi: Option<models::CsiVolumeSource>,
37552
37553 #[serde(rename = "downwardAPI")]
37554 #[serde(skip_serializing_if="Option::is_none")]
37555 pub downward_api: Option<models::DownwardApiVolumeSource>,
37556
37557 #[serde(rename = "emptyDir")]
37558 #[serde(skip_serializing_if="Option::is_none")]
37559 pub empty_dir: Option<models::EmptyDirVolumeSource>,
37560
37561 #[serde(rename = "ephemeral")]
37562 #[serde(skip_serializing_if="Option::is_none")]
37563 pub ephemeral: Option<models::EphemeralVolumeSource>,
37564
37565 #[serde(rename = "fc")]
37566 #[serde(skip_serializing_if="Option::is_none")]
37567 pub fc: Option<models::FcVolumeSource>,
37568
37569 #[serde(rename = "flexVolume")]
37570 #[serde(skip_serializing_if="Option::is_none")]
37571 pub flex_volume: Option<models::FlexVolumeSource>,
37572
37573 #[serde(rename = "flocker")]
37574 #[serde(skip_serializing_if="Option::is_none")]
37575 pub flocker: Option<models::FlockerVolumeSource>,
37576
37577 #[serde(rename = "gcePersistentDisk")]
37578 #[serde(skip_serializing_if="Option::is_none")]
37579 pub gce_persistent_disk: Option<models::GcePersistentDiskVolumeSource>,
37580
37581 #[serde(rename = "gitRepo")]
37582 #[serde(skip_serializing_if="Option::is_none")]
37583 pub git_repo: Option<models::GitRepoVolumeSource>,
37584
37585 #[serde(rename = "glusterfs")]
37586 #[serde(skip_serializing_if="Option::is_none")]
37587 pub glusterfs: Option<models::GlusterfsVolumeSource>,
37588
37589 #[serde(rename = "hostPath")]
37590 #[serde(skip_serializing_if="Option::is_none")]
37591 pub host_path: Option<models::HostPathVolumeSource>,
37592
37593 #[serde(rename = "iscsi")]
37594 #[serde(skip_serializing_if="Option::is_none")]
37595 pub iscsi: Option<models::IscsiVolumeSource>,
37596
37597 #[serde(rename = "nfs")]
37598 #[serde(skip_serializing_if="Option::is_none")]
37599 pub nfs: Option<models::NfsVolumeSource>,
37600
37601 #[serde(rename = "persistentVolumeClaim")]
37602 #[serde(skip_serializing_if="Option::is_none")]
37603 pub persistent_volume_claim: Option<models::PersistentVolumeClaimVolumeSource>,
37604
37605 #[serde(rename = "photonPersistentDisk")]
37606 #[serde(skip_serializing_if="Option::is_none")]
37607 pub photon_persistent_disk: Option<models::PhotonPersistentDiskVolumeSource>,
37608
37609 #[serde(rename = "portworxVolume")]
37610 #[serde(skip_serializing_if="Option::is_none")]
37611 pub portworx_volume: Option<models::PortworxVolumeSource>,
37612
37613 #[serde(rename = "projected")]
37614 #[serde(skip_serializing_if="Option::is_none")]
37615 pub projected: Option<models::ProjectedVolumeSource>,
37616
37617 #[serde(rename = "quobyte")]
37618 #[serde(skip_serializing_if="Option::is_none")]
37619 pub quobyte: Option<models::QuobyteVolumeSource>,
37620
37621 #[serde(rename = "rbd")]
37622 #[serde(skip_serializing_if="Option::is_none")]
37623 pub rbd: Option<models::RbdVolumeSource>,
37624
37625 #[serde(rename = "scaleIO")]
37626 #[serde(skip_serializing_if="Option::is_none")]
37627 pub scale_io: Option<models::ScaleIoVolumeSource>,
37628
37629 #[serde(rename = "secret")]
37630 #[serde(skip_serializing_if="Option::is_none")]
37631 pub secret: Option<models::SecretVolumeSource>,
37632
37633 #[serde(rename = "storageos")]
37634 #[serde(skip_serializing_if="Option::is_none")]
37635 pub storageos: Option<models::StorageOsVolumeSource>,
37636
37637 #[serde(rename = "vsphereVolume")]
37638 #[serde(skip_serializing_if="Option::is_none")]
37639 pub vsphere_volume: Option<models::VsphereVirtualDiskVolumeSource>,
37640
37641}
37642
37643
37644impl VolumeSource {
37645 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
37646 pub fn new() -> VolumeSource {
37647 VolumeSource {
37648 aws_elastic_block_store: None,
37649 azure_disk: None,
37650 azure_file: None,
37651 cephfs: None,
37652 cinder: None,
37653 config_map: None,
37654 csi: None,
37655 downward_api: None,
37656 empty_dir: None,
37657 ephemeral: None,
37658 fc: None,
37659 flex_volume: None,
37660 flocker: None,
37661 gce_persistent_disk: None,
37662 git_repo: None,
37663 glusterfs: None,
37664 host_path: None,
37665 iscsi: None,
37666 nfs: None,
37667 persistent_volume_claim: None,
37668 photon_persistent_disk: None,
37669 portworx_volume: None,
37670 projected: None,
37671 quobyte: None,
37672 rbd: None,
37673 scale_io: None,
37674 secret: None,
37675 storageos: None,
37676 vsphere_volume: None,
37677 }
37678 }
37679}
37680
37681impl std::string::ToString for VolumeSource {
37685 fn to_string(&self) -> String {
37686 let params: Vec<Option<String>> = vec![
37687 ];
37746
37747 params.into_iter().flatten().collect::<Vec<_>>().join(",")
37748 }
37749}
37750
37751impl std::str::FromStr for VolumeSource {
37755 type Err = String;
37756
37757 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
37758 #[derive(Default)]
37760 #[allow(dead_code)]
37761 struct IntermediateRep {
37762 pub aws_elastic_block_store: Vec<models::AwsElasticBlockStoreVolumeSource>,
37763 pub azure_disk: Vec<models::AzureDiskVolumeSource>,
37764 pub azure_file: Vec<models::AzureFileVolumeSource>,
37765 pub cephfs: Vec<models::CephFsVolumeSource>,
37766 pub cinder: Vec<models::CinderVolumeSource>,
37767 pub config_map: Vec<models::ConfigMapVolumeSource>,
37768 pub csi: Vec<models::CsiVolumeSource>,
37769 pub downward_api: Vec<models::DownwardApiVolumeSource>,
37770 pub empty_dir: Vec<models::EmptyDirVolumeSource>,
37771 pub ephemeral: Vec<models::EphemeralVolumeSource>,
37772 pub fc: Vec<models::FcVolumeSource>,
37773 pub flex_volume: Vec<models::FlexVolumeSource>,
37774 pub flocker: Vec<models::FlockerVolumeSource>,
37775 pub gce_persistent_disk: Vec<models::GcePersistentDiskVolumeSource>,
37776 pub git_repo: Vec<models::GitRepoVolumeSource>,
37777 pub glusterfs: Vec<models::GlusterfsVolumeSource>,
37778 pub host_path: Vec<models::HostPathVolumeSource>,
37779 pub iscsi: Vec<models::IscsiVolumeSource>,
37780 pub nfs: Vec<models::NfsVolumeSource>,
37781 pub persistent_volume_claim: Vec<models::PersistentVolumeClaimVolumeSource>,
37782 pub photon_persistent_disk: Vec<models::PhotonPersistentDiskVolumeSource>,
37783 pub portworx_volume: Vec<models::PortworxVolumeSource>,
37784 pub projected: Vec<models::ProjectedVolumeSource>,
37785 pub quobyte: Vec<models::QuobyteVolumeSource>,
37786 pub rbd: Vec<models::RbdVolumeSource>,
37787 pub scale_io: Vec<models::ScaleIoVolumeSource>,
37788 pub secret: Vec<models::SecretVolumeSource>,
37789 pub storageos: Vec<models::StorageOsVolumeSource>,
37790 pub vsphere_volume: Vec<models::VsphereVirtualDiskVolumeSource>,
37791 }
37792
37793 let mut intermediate_rep = IntermediateRep::default();
37794
37795 let mut string_iter = s.split(',');
37797 let mut key_result = string_iter.next();
37798
37799 while key_result.is_some() {
37800 let val = match string_iter.next() {
37801 Some(x) => x,
37802 None => return std::result::Result::Err("Missing value while parsing VolumeSource".to_string())
37803 };
37804
37805 if let Some(key) = key_result {
37806 #[allow(clippy::match_single_binding)]
37807 match key {
37808 #[allow(clippy::redundant_clone)]
37809 "awsElasticBlockStore" => intermediate_rep.aws_elastic_block_store.push(<models::AwsElasticBlockStoreVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37810 #[allow(clippy::redundant_clone)]
37811 "azureDisk" => intermediate_rep.azure_disk.push(<models::AzureDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37812 #[allow(clippy::redundant_clone)]
37813 "azureFile" => intermediate_rep.azure_file.push(<models::AzureFileVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37814 #[allow(clippy::redundant_clone)]
37815 "cephfs" => intermediate_rep.cephfs.push(<models::CephFsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37816 #[allow(clippy::redundant_clone)]
37817 "cinder" => intermediate_rep.cinder.push(<models::CinderVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37818 #[allow(clippy::redundant_clone)]
37819 "configMap" => intermediate_rep.config_map.push(<models::ConfigMapVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37820 #[allow(clippy::redundant_clone)]
37821 "csi" => intermediate_rep.csi.push(<models::CsiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37822 #[allow(clippy::redundant_clone)]
37823 "downwardAPI" => intermediate_rep.downward_api.push(<models::DownwardApiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37824 #[allow(clippy::redundant_clone)]
37825 "emptyDir" => intermediate_rep.empty_dir.push(<models::EmptyDirVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37826 #[allow(clippy::redundant_clone)]
37827 "ephemeral" => intermediate_rep.ephemeral.push(<models::EphemeralVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37828 #[allow(clippy::redundant_clone)]
37829 "fc" => intermediate_rep.fc.push(<models::FcVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37830 #[allow(clippy::redundant_clone)]
37831 "flexVolume" => intermediate_rep.flex_volume.push(<models::FlexVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37832 #[allow(clippy::redundant_clone)]
37833 "flocker" => intermediate_rep.flocker.push(<models::FlockerVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37834 #[allow(clippy::redundant_clone)]
37835 "gcePersistentDisk" => intermediate_rep.gce_persistent_disk.push(<models::GcePersistentDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37836 #[allow(clippy::redundant_clone)]
37837 "gitRepo" => intermediate_rep.git_repo.push(<models::GitRepoVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37838 #[allow(clippy::redundant_clone)]
37839 "glusterfs" => intermediate_rep.glusterfs.push(<models::GlusterfsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37840 #[allow(clippy::redundant_clone)]
37841 "hostPath" => intermediate_rep.host_path.push(<models::HostPathVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37842 #[allow(clippy::redundant_clone)]
37843 "iscsi" => intermediate_rep.iscsi.push(<models::IscsiVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37844 #[allow(clippy::redundant_clone)]
37845 "nfs" => intermediate_rep.nfs.push(<models::NfsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37846 #[allow(clippy::redundant_clone)]
37847 "persistentVolumeClaim" => intermediate_rep.persistent_volume_claim.push(<models::PersistentVolumeClaimVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37848 #[allow(clippy::redundant_clone)]
37849 "photonPersistentDisk" => intermediate_rep.photon_persistent_disk.push(<models::PhotonPersistentDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37850 #[allow(clippy::redundant_clone)]
37851 "portworxVolume" => intermediate_rep.portworx_volume.push(<models::PortworxVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37852 #[allow(clippy::redundant_clone)]
37853 "projected" => intermediate_rep.projected.push(<models::ProjectedVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37854 #[allow(clippy::redundant_clone)]
37855 "quobyte" => intermediate_rep.quobyte.push(<models::QuobyteVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37856 #[allow(clippy::redundant_clone)]
37857 "rbd" => intermediate_rep.rbd.push(<models::RbdVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37858 #[allow(clippy::redundant_clone)]
37859 "scaleIO" => intermediate_rep.scale_io.push(<models::ScaleIoVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37860 #[allow(clippy::redundant_clone)]
37861 "secret" => intermediate_rep.secret.push(<models::SecretVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37862 #[allow(clippy::redundant_clone)]
37863 "storageos" => intermediate_rep.storageos.push(<models::StorageOsVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37864 #[allow(clippy::redundant_clone)]
37865 "vsphereVolume" => intermediate_rep.vsphere_volume.push(<models::VsphereVirtualDiskVolumeSource as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
37866 _ => return std::result::Result::Err("Unexpected key while parsing VolumeSource".to_string())
37867 }
37868 }
37869
37870 key_result = string_iter.next();
37872 }
37873
37874 std::result::Result::Ok(VolumeSource {
37876 aws_elastic_block_store: intermediate_rep.aws_elastic_block_store.into_iter().next(),
37877 azure_disk: intermediate_rep.azure_disk.into_iter().next(),
37878 azure_file: intermediate_rep.azure_file.into_iter().next(),
37879 cephfs: intermediate_rep.cephfs.into_iter().next(),
37880 cinder: intermediate_rep.cinder.into_iter().next(),
37881 config_map: intermediate_rep.config_map.into_iter().next(),
37882 csi: intermediate_rep.csi.into_iter().next(),
37883 downward_api: intermediate_rep.downward_api.into_iter().next(),
37884 empty_dir: intermediate_rep.empty_dir.into_iter().next(),
37885 ephemeral: intermediate_rep.ephemeral.into_iter().next(),
37886 fc: intermediate_rep.fc.into_iter().next(),
37887 flex_volume: intermediate_rep.flex_volume.into_iter().next(),
37888 flocker: intermediate_rep.flocker.into_iter().next(),
37889 gce_persistent_disk: intermediate_rep.gce_persistent_disk.into_iter().next(),
37890 git_repo: intermediate_rep.git_repo.into_iter().next(),
37891 glusterfs: intermediate_rep.glusterfs.into_iter().next(),
37892 host_path: intermediate_rep.host_path.into_iter().next(),
37893 iscsi: intermediate_rep.iscsi.into_iter().next(),
37894 nfs: intermediate_rep.nfs.into_iter().next(),
37895 persistent_volume_claim: intermediate_rep.persistent_volume_claim.into_iter().next(),
37896 photon_persistent_disk: intermediate_rep.photon_persistent_disk.into_iter().next(),
37897 portworx_volume: intermediate_rep.portworx_volume.into_iter().next(),
37898 projected: intermediate_rep.projected.into_iter().next(),
37899 quobyte: intermediate_rep.quobyte.into_iter().next(),
37900 rbd: intermediate_rep.rbd.into_iter().next(),
37901 scale_io: intermediate_rep.scale_io.into_iter().next(),
37902 secret: intermediate_rep.secret.into_iter().next(),
37903 storageos: intermediate_rep.storageos.into_iter().next(),
37904 vsphere_volume: intermediate_rep.vsphere_volume.into_iter().next(),
37905 })
37906 }
37907}
37908
37909#[cfg(feature = "server")]
37912impl std::convert::TryFrom<header::IntoHeaderValue<VolumeSource>> for HeaderValue {
37913 type Error = String;
37914
37915 fn try_from(hdr_value: header::IntoHeaderValue<VolumeSource>) -> std::result::Result<Self, Self::Error> {
37916 let hdr_value = hdr_value.to_string();
37917 match HeaderValue::from_str(&hdr_value) {
37918 std::result::Result::Ok(value) => std::result::Result::Ok(value),
37919 std::result::Result::Err(e) => std::result::Result::Err(
37920 format!("Invalid header value for VolumeSource - value: {} is invalid {}",
37921 hdr_value, e))
37922 }
37923 }
37924}
37925
37926#[cfg(feature = "server")]
37927impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeSource> {
37928 type Error = String;
37929
37930 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
37931 match hdr_value.to_str() {
37932 std::result::Result::Ok(value) => {
37933 match <VolumeSource as std::str::FromStr>::from_str(value) {
37934 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
37935 std::result::Result::Err(err) => std::result::Result::Err(
37936 format!("Unable to convert header value '{}' into VolumeSource - {}",
37937 value, err))
37938 }
37939 },
37940 std::result::Result::Err(e) => std::result::Result::Err(
37941 format!("Unable to convert header: {:?} to string: {}",
37942 hdr_value, e))
37943 }
37944 }
37945}
37946
37947
37948
37949
37950#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
37955#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
37956pub struct VolumeUsageData {
37957#[serde(rename = "RefCount")]
37959 pub ref_count: i64,
37960
37961#[serde(rename = "Size")]
37963 pub size: i64,
37964
37965}
37966
37967
37968impl VolumeUsageData {
37969 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
37970 pub fn new(ref_count: i64, size: i64, ) -> VolumeUsageData {
37971 VolumeUsageData {
37972 ref_count,
37973 size,
37974 }
37975 }
37976}
37977
37978impl std::string::ToString for VolumeUsageData {
37982 fn to_string(&self) -> String {
37983 let params: Vec<Option<String>> = vec![
37984
37985 Some("RefCount".to_string()),
37986 Some(self.ref_count.to_string()),
37987
37988
37989 Some("Size".to_string()),
37990 Some(self.size.to_string()),
37991
37992 ];
37993
37994 params.into_iter().flatten().collect::<Vec<_>>().join(",")
37995 }
37996}
37997
37998impl std::str::FromStr for VolumeUsageData {
38002 type Err = String;
38003
38004 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
38005 #[derive(Default)]
38007 #[allow(dead_code)]
38008 struct IntermediateRep {
38009 pub ref_count: Vec<i64>,
38010 pub size: Vec<i64>,
38011 }
38012
38013 let mut intermediate_rep = IntermediateRep::default();
38014
38015 let mut string_iter = s.split(',');
38017 let mut key_result = string_iter.next();
38018
38019 while key_result.is_some() {
38020 let val = match string_iter.next() {
38021 Some(x) => x,
38022 None => return std::result::Result::Err("Missing value while parsing VolumeUsageData".to_string())
38023 };
38024
38025 if let Some(key) = key_result {
38026 #[allow(clippy::match_single_binding)]
38027 match key {
38028 #[allow(clippy::redundant_clone)]
38029 "RefCount" => intermediate_rep.ref_count.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38030 #[allow(clippy::redundant_clone)]
38031 "Size" => intermediate_rep.size.push(<i64 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38032 _ => return std::result::Result::Err("Unexpected key while parsing VolumeUsageData".to_string())
38033 }
38034 }
38035
38036 key_result = string_iter.next();
38038 }
38039
38040 std::result::Result::Ok(VolumeUsageData {
38042 ref_count: intermediate_rep.ref_count.into_iter().next().ok_or_else(|| "RefCount missing in VolumeUsageData".to_string())?,
38043 size: intermediate_rep.size.into_iter().next().ok_or_else(|| "Size missing in VolumeUsageData".to_string())?,
38044 })
38045 }
38046}
38047
38048#[cfg(feature = "server")]
38051impl std::convert::TryFrom<header::IntoHeaderValue<VolumeUsageData>> for HeaderValue {
38052 type Error = String;
38053
38054 fn try_from(hdr_value: header::IntoHeaderValue<VolumeUsageData>) -> std::result::Result<Self, Self::Error> {
38055 let hdr_value = hdr_value.to_string();
38056 match HeaderValue::from_str(&hdr_value) {
38057 std::result::Result::Ok(value) => std::result::Result::Ok(value),
38058 std::result::Result::Err(e) => std::result::Result::Err(
38059 format!("Invalid header value for VolumeUsageData - value: {} is invalid {}",
38060 hdr_value, e))
38061 }
38062 }
38063}
38064
38065#[cfg(feature = "server")]
38066impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VolumeUsageData> {
38067 type Error = String;
38068
38069 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
38070 match hdr_value.to_str() {
38071 std::result::Result::Ok(value) => {
38072 match <VolumeUsageData as std::str::FromStr>::from_str(value) {
38073 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
38074 std::result::Result::Err(err) => std::result::Result::Err(
38075 format!("Unable to convert header value '{}' into VolumeUsageData - {}",
38076 value, err))
38077 }
38078 },
38079 std::result::Result::Err(e) => std::result::Result::Err(
38080 format!("Unable to convert header: {:?} to string: {}",
38081 hdr_value, e))
38082 }
38083 }
38084}
38085
38086
38087
38088
38089
38090
38091
38092#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
38093#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
38094pub struct VsphereVirtualDiskVolumeSource {
38095#[serde(rename = "fsType")]
38097 #[serde(skip_serializing_if="Option::is_none")]
38098 pub fs_type: Option<String>,
38099
38100#[serde(rename = "storagePolicyID")]
38102 #[serde(skip_serializing_if="Option::is_none")]
38103 pub storage_policy_id: Option<String>,
38104
38105#[serde(rename = "storagePolicyName")]
38107 #[serde(skip_serializing_if="Option::is_none")]
38108 pub storage_policy_name: Option<String>,
38109
38110#[serde(rename = "volumePath")]
38112 #[serde(skip_serializing_if="Option::is_none")]
38113 pub volume_path: Option<String>,
38114
38115}
38116
38117
38118impl VsphereVirtualDiskVolumeSource {
38119 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
38120 pub fn new() -> VsphereVirtualDiskVolumeSource {
38121 VsphereVirtualDiskVolumeSource {
38122 fs_type: None,
38123 storage_policy_id: None,
38124 storage_policy_name: None,
38125 volume_path: None,
38126 }
38127 }
38128}
38129
38130impl std::string::ToString for VsphereVirtualDiskVolumeSource {
38134 fn to_string(&self) -> String {
38135 let params: Vec<Option<String>> = vec![
38136
38137 self.fs_type.as_ref().map(|fs_type| {
38138 [
38139 "fsType".to_string(),
38140 fs_type.to_string(),
38141 ].join(",")
38142 }),
38143
38144
38145 self.storage_policy_id.as_ref().map(|storage_policy_id| {
38146 [
38147 "storagePolicyID".to_string(),
38148 storage_policy_id.to_string(),
38149 ].join(",")
38150 }),
38151
38152
38153 self.storage_policy_name.as_ref().map(|storage_policy_name| {
38154 [
38155 "storagePolicyName".to_string(),
38156 storage_policy_name.to_string(),
38157 ].join(",")
38158 }),
38159
38160
38161 self.volume_path.as_ref().map(|volume_path| {
38162 [
38163 "volumePath".to_string(),
38164 volume_path.to_string(),
38165 ].join(",")
38166 }),
38167
38168 ];
38169
38170 params.into_iter().flatten().collect::<Vec<_>>().join(",")
38171 }
38172}
38173
38174impl std::str::FromStr for VsphereVirtualDiskVolumeSource {
38178 type Err = String;
38179
38180 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
38181 #[derive(Default)]
38183 #[allow(dead_code)]
38184 struct IntermediateRep {
38185 pub fs_type: Vec<String>,
38186 pub storage_policy_id: Vec<String>,
38187 pub storage_policy_name: Vec<String>,
38188 pub volume_path: Vec<String>,
38189 }
38190
38191 let mut intermediate_rep = IntermediateRep::default();
38192
38193 let mut string_iter = s.split(',');
38195 let mut key_result = string_iter.next();
38196
38197 while key_result.is_some() {
38198 let val = match string_iter.next() {
38199 Some(x) => x,
38200 None => return std::result::Result::Err("Missing value while parsing VsphereVirtualDiskVolumeSource".to_string())
38201 };
38202
38203 if let Some(key) = key_result {
38204 #[allow(clippy::match_single_binding)]
38205 match key {
38206 #[allow(clippy::redundant_clone)]
38207 "fsType" => intermediate_rep.fs_type.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38208 #[allow(clippy::redundant_clone)]
38209 "storagePolicyID" => intermediate_rep.storage_policy_id.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38210 #[allow(clippy::redundant_clone)]
38211 "storagePolicyName" => intermediate_rep.storage_policy_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38212 #[allow(clippy::redundant_clone)]
38213 "volumePath" => intermediate_rep.volume_path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38214 _ => return std::result::Result::Err("Unexpected key while parsing VsphereVirtualDiskVolumeSource".to_string())
38215 }
38216 }
38217
38218 key_result = string_iter.next();
38220 }
38221
38222 std::result::Result::Ok(VsphereVirtualDiskVolumeSource {
38224 fs_type: intermediate_rep.fs_type.into_iter().next(),
38225 storage_policy_id: intermediate_rep.storage_policy_id.into_iter().next(),
38226 storage_policy_name: intermediate_rep.storage_policy_name.into_iter().next(),
38227 volume_path: intermediate_rep.volume_path.into_iter().next(),
38228 })
38229 }
38230}
38231
38232#[cfg(feature = "server")]
38235impl std::convert::TryFrom<header::IntoHeaderValue<VsphereVirtualDiskVolumeSource>> for HeaderValue {
38236 type Error = String;
38237
38238 fn try_from(hdr_value: header::IntoHeaderValue<VsphereVirtualDiskVolumeSource>) -> std::result::Result<Self, Self::Error> {
38239 let hdr_value = hdr_value.to_string();
38240 match HeaderValue::from_str(&hdr_value) {
38241 std::result::Result::Ok(value) => std::result::Result::Ok(value),
38242 std::result::Result::Err(e) => std::result::Result::Err(
38243 format!("Invalid header value for VsphereVirtualDiskVolumeSource - value: {} is invalid {}",
38244 hdr_value, e))
38245 }
38246 }
38247}
38248
38249#[cfg(feature = "server")]
38250impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<VsphereVirtualDiskVolumeSource> {
38251 type Error = String;
38252
38253 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
38254 match hdr_value.to_str() {
38255 std::result::Result::Ok(value) => {
38256 match <VsphereVirtualDiskVolumeSource as std::str::FromStr>::from_str(value) {
38257 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
38258 std::result::Result::Err(err) => std::result::Result::Err(
38259 format!("Unable to convert header value '{}' into VsphereVirtualDiskVolumeSource - {}",
38260 value, err))
38261 }
38262 },
38263 std::result::Result::Err(e) => std::result::Result::Err(
38264 format!("Unable to convert header: {:?} to string: {}",
38265 hdr_value, e))
38266 }
38267 }
38268}
38269
38270
38271
38272
38273#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
38278#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
38279pub struct WeightDevice {
38280 #[serde(rename = "Path")]
38281 #[serde(skip_serializing_if="Option::is_none")]
38282 pub path: Option<String>,
38283
38284 #[serde(rename = "Weight")]
38285 #[serde(skip_serializing_if="Option::is_none")]
38286 pub weight: Option<i32>,
38287
38288}
38289
38290
38291impl WeightDevice {
38292 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
38293 pub fn new() -> WeightDevice {
38294 WeightDevice {
38295 path: None,
38296 weight: None,
38297 }
38298 }
38299}
38300
38301impl std::string::ToString for WeightDevice {
38305 fn to_string(&self) -> String {
38306 let params: Vec<Option<String>> = vec![
38307
38308 self.path.as_ref().map(|path| {
38309 [
38310 "Path".to_string(),
38311 path.to_string(),
38312 ].join(",")
38313 }),
38314
38315
38316 self.weight.as_ref().map(|weight| {
38317 [
38318 "Weight".to_string(),
38319 weight.to_string(),
38320 ].join(",")
38321 }),
38322
38323 ];
38324
38325 params.into_iter().flatten().collect::<Vec<_>>().join(",")
38326 }
38327}
38328
38329impl std::str::FromStr for WeightDevice {
38333 type Err = String;
38334
38335 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
38336 #[derive(Default)]
38338 #[allow(dead_code)]
38339 struct IntermediateRep {
38340 pub path: Vec<String>,
38341 pub weight: Vec<i32>,
38342 }
38343
38344 let mut intermediate_rep = IntermediateRep::default();
38345
38346 let mut string_iter = s.split(',');
38348 let mut key_result = string_iter.next();
38349
38350 while key_result.is_some() {
38351 let val = match string_iter.next() {
38352 Some(x) => x,
38353 None => return std::result::Result::Err("Missing value while parsing WeightDevice".to_string())
38354 };
38355
38356 if let Some(key) = key_result {
38357 #[allow(clippy::match_single_binding)]
38358 match key {
38359 #[allow(clippy::redundant_clone)]
38360 "Path" => intermediate_rep.path.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38361 #[allow(clippy::redundant_clone)]
38362 "Weight" => intermediate_rep.weight.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38363 _ => return std::result::Result::Err("Unexpected key while parsing WeightDevice".to_string())
38364 }
38365 }
38366
38367 key_result = string_iter.next();
38369 }
38370
38371 std::result::Result::Ok(WeightDevice {
38373 path: intermediate_rep.path.into_iter().next(),
38374 weight: intermediate_rep.weight.into_iter().next(),
38375 })
38376 }
38377}
38378
38379#[cfg(feature = "server")]
38382impl std::convert::TryFrom<header::IntoHeaderValue<WeightDevice>> for HeaderValue {
38383 type Error = String;
38384
38385 fn try_from(hdr_value: header::IntoHeaderValue<WeightDevice>) -> std::result::Result<Self, Self::Error> {
38386 let hdr_value = hdr_value.to_string();
38387 match HeaderValue::from_str(&hdr_value) {
38388 std::result::Result::Ok(value) => std::result::Result::Ok(value),
38389 std::result::Result::Err(e) => std::result::Result::Err(
38390 format!("Invalid header value for WeightDevice - value: {} is invalid {}",
38391 hdr_value, e))
38392 }
38393 }
38394}
38395
38396#[cfg(feature = "server")]
38397impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<WeightDevice> {
38398 type Error = String;
38399
38400 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
38401 match hdr_value.to_str() {
38402 std::result::Result::Ok(value) => {
38403 match <WeightDevice as std::str::FromStr>::from_str(value) {
38404 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
38405 std::result::Result::Err(err) => std::result::Result::Err(
38406 format!("Unable to convert header value '{}' into WeightDevice - {}",
38407 value, err))
38408 }
38409 },
38410 std::result::Result::Err(e) => std::result::Result::Err(
38411 format!("Unable to convert header: {:?} to string: {}",
38412 hdr_value, e))
38413 }
38414 }
38415}
38416
38417
38418
38419
38420#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
38425#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
38426pub struct WeightedPodAffinityTerm {
38427 #[serde(rename = "podAffinityTerm")]
38428 #[serde(skip_serializing_if="Option::is_none")]
38429 pub pod_affinity_term: Option<models::PodAffinityTerm>,
38430
38431#[serde(rename = "weight")]
38433 #[serde(skip_serializing_if="Option::is_none")]
38434 pub weight: Option<i32>,
38435
38436}
38437
38438
38439impl WeightedPodAffinityTerm {
38440 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
38441 pub fn new() -> WeightedPodAffinityTerm {
38442 WeightedPodAffinityTerm {
38443 pod_affinity_term: None,
38444 weight: None,
38445 }
38446 }
38447}
38448
38449impl std::string::ToString for WeightedPodAffinityTerm {
38453 fn to_string(&self) -> String {
38454 let params: Vec<Option<String>> = vec![
38455 self.weight.as_ref().map(|weight| {
38459 [
38460 "weight".to_string(),
38461 weight.to_string(),
38462 ].join(",")
38463 }),
38464
38465 ];
38466
38467 params.into_iter().flatten().collect::<Vec<_>>().join(",")
38468 }
38469}
38470
38471impl std::str::FromStr for WeightedPodAffinityTerm {
38475 type Err = String;
38476
38477 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
38478 #[derive(Default)]
38480 #[allow(dead_code)]
38481 struct IntermediateRep {
38482 pub pod_affinity_term: Vec<models::PodAffinityTerm>,
38483 pub weight: Vec<i32>,
38484 }
38485
38486 let mut intermediate_rep = IntermediateRep::default();
38487
38488 let mut string_iter = s.split(',');
38490 let mut key_result = string_iter.next();
38491
38492 while key_result.is_some() {
38493 let val = match string_iter.next() {
38494 Some(x) => x,
38495 None => return std::result::Result::Err("Missing value while parsing WeightedPodAffinityTerm".to_string())
38496 };
38497
38498 if let Some(key) = key_result {
38499 #[allow(clippy::match_single_binding)]
38500 match key {
38501 #[allow(clippy::redundant_clone)]
38502 "podAffinityTerm" => intermediate_rep.pod_affinity_term.push(<models::PodAffinityTerm as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38503 #[allow(clippy::redundant_clone)]
38504 "weight" => intermediate_rep.weight.push(<i32 as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38505 _ => return std::result::Result::Err("Unexpected key while parsing WeightedPodAffinityTerm".to_string())
38506 }
38507 }
38508
38509 key_result = string_iter.next();
38511 }
38512
38513 std::result::Result::Ok(WeightedPodAffinityTerm {
38515 pod_affinity_term: intermediate_rep.pod_affinity_term.into_iter().next(),
38516 weight: intermediate_rep.weight.into_iter().next(),
38517 })
38518 }
38519}
38520
38521#[cfg(feature = "server")]
38524impl std::convert::TryFrom<header::IntoHeaderValue<WeightedPodAffinityTerm>> for HeaderValue {
38525 type Error = String;
38526
38527 fn try_from(hdr_value: header::IntoHeaderValue<WeightedPodAffinityTerm>) -> std::result::Result<Self, Self::Error> {
38528 let hdr_value = hdr_value.to_string();
38529 match HeaderValue::from_str(&hdr_value) {
38530 std::result::Result::Ok(value) => std::result::Result::Ok(value),
38531 std::result::Result::Err(e) => std::result::Result::Err(
38532 format!("Invalid header value for WeightedPodAffinityTerm - value: {} is invalid {}",
38533 hdr_value, e))
38534 }
38535 }
38536}
38537
38538#[cfg(feature = "server")]
38539impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<WeightedPodAffinityTerm> {
38540 type Error = String;
38541
38542 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
38543 match hdr_value.to_str() {
38544 std::result::Result::Ok(value) => {
38545 match <WeightedPodAffinityTerm as std::str::FromStr>::from_str(value) {
38546 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
38547 std::result::Result::Err(err) => std::result::Result::Err(
38548 format!("Unable to convert header value '{}' into WeightedPodAffinityTerm - {}",
38549 value, err))
38550 }
38551 },
38552 std::result::Result::Err(e) => std::result::Result::Err(
38553 format!("Unable to convert header: {:?} to string: {}",
38554 hdr_value, e))
38555 }
38556 }
38557}
38558
38559
38560
38561
38562
38563
38564
38565#[derive(Debug, Clone, PartialEq, serde::Serialize, serde::Deserialize, validator::Validate)]
38566#[cfg_attr(feature = "conversion", derive(frunk::LabelledGeneric))]
38567pub struct WindowsSecurityContextOptions {
38568#[serde(rename = "gmsaCredentialSpec")]
38570 #[serde(skip_serializing_if="Option::is_none")]
38571 pub gmsa_credential_spec: Option<String>,
38572
38573#[serde(rename = "gmsaCredentialSpecName")]
38575 #[serde(skip_serializing_if="Option::is_none")]
38576 pub gmsa_credential_spec_name: Option<String>,
38577
38578#[serde(rename = "hostProcess")]
38580 #[serde(skip_serializing_if="Option::is_none")]
38581 pub host_process: Option<bool>,
38582
38583#[serde(rename = "runAsUserName")]
38585 #[serde(skip_serializing_if="Option::is_none")]
38586 pub run_as_user_name: Option<String>,
38587
38588}
38589
38590
38591impl WindowsSecurityContextOptions {
38592 #[allow(clippy::new_without_default, clippy::too_many_arguments)]
38593 pub fn new() -> WindowsSecurityContextOptions {
38594 WindowsSecurityContextOptions {
38595 gmsa_credential_spec: None,
38596 gmsa_credential_spec_name: None,
38597 host_process: None,
38598 run_as_user_name: None,
38599 }
38600 }
38601}
38602
38603impl std::string::ToString for WindowsSecurityContextOptions {
38607 fn to_string(&self) -> String {
38608 let params: Vec<Option<String>> = vec![
38609
38610 self.gmsa_credential_spec.as_ref().map(|gmsa_credential_spec| {
38611 [
38612 "gmsaCredentialSpec".to_string(),
38613 gmsa_credential_spec.to_string(),
38614 ].join(",")
38615 }),
38616
38617
38618 self.gmsa_credential_spec_name.as_ref().map(|gmsa_credential_spec_name| {
38619 [
38620 "gmsaCredentialSpecName".to_string(),
38621 gmsa_credential_spec_name.to_string(),
38622 ].join(",")
38623 }),
38624
38625
38626 self.host_process.as_ref().map(|host_process| {
38627 [
38628 "hostProcess".to_string(),
38629 host_process.to_string(),
38630 ].join(",")
38631 }),
38632
38633
38634 self.run_as_user_name.as_ref().map(|run_as_user_name| {
38635 [
38636 "runAsUserName".to_string(),
38637 run_as_user_name.to_string(),
38638 ].join(",")
38639 }),
38640
38641 ];
38642
38643 params.into_iter().flatten().collect::<Vec<_>>().join(",")
38644 }
38645}
38646
38647impl std::str::FromStr for WindowsSecurityContextOptions {
38651 type Err = String;
38652
38653 fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
38654 #[derive(Default)]
38656 #[allow(dead_code)]
38657 struct IntermediateRep {
38658 pub gmsa_credential_spec: Vec<String>,
38659 pub gmsa_credential_spec_name: Vec<String>,
38660 pub host_process: Vec<bool>,
38661 pub run_as_user_name: Vec<String>,
38662 }
38663
38664 let mut intermediate_rep = IntermediateRep::default();
38665
38666 let mut string_iter = s.split(',');
38668 let mut key_result = string_iter.next();
38669
38670 while key_result.is_some() {
38671 let val = match string_iter.next() {
38672 Some(x) => x,
38673 None => return std::result::Result::Err("Missing value while parsing WindowsSecurityContextOptions".to_string())
38674 };
38675
38676 if let Some(key) = key_result {
38677 #[allow(clippy::match_single_binding)]
38678 match key {
38679 #[allow(clippy::redundant_clone)]
38680 "gmsaCredentialSpec" => intermediate_rep.gmsa_credential_spec.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38681 #[allow(clippy::redundant_clone)]
38682 "gmsaCredentialSpecName" => intermediate_rep.gmsa_credential_spec_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38683 #[allow(clippy::redundant_clone)]
38684 "hostProcess" => intermediate_rep.host_process.push(<bool as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38685 #[allow(clippy::redundant_clone)]
38686 "runAsUserName" => intermediate_rep.run_as_user_name.push(<String as std::str::FromStr>::from_str(val).map_err(|x| x.to_string())?),
38687 _ => return std::result::Result::Err("Unexpected key while parsing WindowsSecurityContextOptions".to_string())
38688 }
38689 }
38690
38691 key_result = string_iter.next();
38693 }
38694
38695 std::result::Result::Ok(WindowsSecurityContextOptions {
38697 gmsa_credential_spec: intermediate_rep.gmsa_credential_spec.into_iter().next(),
38698 gmsa_credential_spec_name: intermediate_rep.gmsa_credential_spec_name.into_iter().next(),
38699 host_process: intermediate_rep.host_process.into_iter().next(),
38700 run_as_user_name: intermediate_rep.run_as_user_name.into_iter().next(),
38701 })
38702 }
38703}
38704
38705#[cfg(feature = "server")]
38708impl std::convert::TryFrom<header::IntoHeaderValue<WindowsSecurityContextOptions>> for HeaderValue {
38709 type Error = String;
38710
38711 fn try_from(hdr_value: header::IntoHeaderValue<WindowsSecurityContextOptions>) -> std::result::Result<Self, Self::Error> {
38712 let hdr_value = hdr_value.to_string();
38713 match HeaderValue::from_str(&hdr_value) {
38714 std::result::Result::Ok(value) => std::result::Result::Ok(value),
38715 std::result::Result::Err(e) => std::result::Result::Err(
38716 format!("Invalid header value for WindowsSecurityContextOptions - value: {} is invalid {}",
38717 hdr_value, e))
38718 }
38719 }
38720}
38721
38722#[cfg(feature = "server")]
38723impl std::convert::TryFrom<HeaderValue> for header::IntoHeaderValue<WindowsSecurityContextOptions> {
38724 type Error = String;
38725
38726 fn try_from(hdr_value: HeaderValue) -> std::result::Result<Self, Self::Error> {
38727 match hdr_value.to_str() {
38728 std::result::Result::Ok(value) => {
38729 match <WindowsSecurityContextOptions as std::str::FromStr>::from_str(value) {
38730 std::result::Result::Ok(value) => std::result::Result::Ok(header::IntoHeaderValue(value)),
38731 std::result::Result::Err(err) => std::result::Result::Err(
38732 format!("Unable to convert header value '{}' into WindowsSecurityContextOptions - {}",
38733 value, err))
38734 }
38735 },
38736 std::result::Result::Err(e) => std::result::Result::Err(
38737 format!("Unable to convert header: {:?} to string: {}",
38738 hdr_value, e))
38739 }
38740 }
38741}
38742
38743
38744