1use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Network {
16 #[serde(rename = "created")]
18 pub created: String,
19 #[serde(rename = "expose_routes_to_vswitch")]
21 pub expose_routes_to_vswitch: bool,
22 #[serde(rename = "id")]
24 pub id: i64,
25 #[serde(rename = "ip_range")]
27 pub ip_range: String,
28 #[serde(rename = "labels")]
30 pub labels: std::collections::HashMap<String, String>,
31 #[serde(rename = "load_balancers", skip_serializing_if = "Option::is_none")]
33 pub load_balancers: Option<Vec<i64>>,
34 #[serde(rename = "name")]
36 pub name: String,
37 #[serde(rename = "protection")]
38 pub protection: Box<models::Protection>,
39 #[serde(rename = "routes")]
41 pub routes: Vec<models::Route>,
42 #[serde(rename = "servers")]
44 pub servers: Vec<i64>,
45 #[serde(rename = "subnets")]
47 pub subnets: Vec<models::SubnetWithGateway>,
48}
49
50impl Network {
51 pub fn new(
52 created: String,
53 expose_routes_to_vswitch: bool,
54 id: i64,
55 ip_range: String,
56 labels: std::collections::HashMap<String, String>,
57 name: String,
58 protection: models::Protection,
59 routes: Vec<models::Route>,
60 servers: Vec<i64>,
61 subnets: Vec<models::SubnetWithGateway>,
62 ) -> Network {
63 Network {
64 created,
65 expose_routes_to_vswitch,
66 id,
67 ip_range,
68 labels,
69 load_balancers: None,
70 name,
71 protection: Box::new(protection),
72 routes,
73 servers,
74 subnets,
75 }
76 }
77}