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