1use std;
2use std::collections::HashMap;
3
4#[derive(Serialize, Deserialize, Debug)]
5#[allow(non_snake_case)]
6pub struct Network {
7 pub Name: String,
8 pub Id: String,
9 pub Created: String,
10 pub Scope: String,
11 pub Driver: Option<String>,
12 pub EnableIPv6: bool,
13 pub Internal: bool,
14 pub Attachable: bool,
15 pub Ingress: bool,
16 pub Options: HashMap<String, String>,
17 pub Labels: Option<HashMap<String, String>>, }
19
20impl Clone for Network {
21 fn clone(&self) -> Self {
22 Network {
23 Name: self.Name.clone(),
24 Id: self.Id.clone(),
25 Created: self.Created.clone(),
26 Scope: self.Scope.clone(),
27 Driver: self.Driver.clone(),
28 EnableIPv6: self.EnableIPv6,
29 Internal: self.Internal,
30 Attachable: self.Attachable,
31 Ingress: self.Ingress,
32 Options: self.Options.clone(),
33 Labels: self.Labels.clone(),
34 }
35 }
36}
37
38impl std::fmt::Display for Network {
39 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
40 write!(f, "{}", self.Id)
41 }
42}
43
44#[derive(Serialize, Deserialize, Debug)]
45#[allow(non_snake_case)]
46pub struct NetworkCreate {
47 pub Name: String,
48 pub CheckDuplicate: Option<bool>,
49 pub Driver: Option<String>,
50 pub Internal: Option<bool>,
51 pub Attachable: Option<bool>,
52 pub Ingress: Option<bool>,
53 pub EnableIPv6: Option<bool>,
54 pub Options: Option<HashMap<String, String>>,
55 pub Labels: Option<HashMap<String, String>>, }
57
58impl Clone for NetworkCreate {
59 fn clone(&self) -> Self {
60 NetworkCreate {
61 Name: self.Name.clone(),
62 CheckDuplicate: self.CheckDuplicate,
63 Driver: self.Driver.clone(),
64 Internal: self.Internal,
65 Attachable: self.Attachable,
66 Ingress: self.Ingress,
67 EnableIPv6: self.EnableIPv6,
68 Options: self.Options.clone(),
69 Labels: self.Labels.clone(),
70 }
71 }
72}
73
74impl std::fmt::Display for NetworkCreate {
75 fn fmt(&self, f: &mut std::fmt::Formatter) -> std::result::Result<(), std::fmt::Error> {
76 write!(f, "{}", self.Name)
77 }
78}