hcloud/models/network.rs
1/*
2 * Hetzner Cloud API
3 *
4 * Copied from the official API documentation for the Public Hetzner Cloud.
5 *
6 * The version of the OpenAPI document: 0.26.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct Network {
16 /// Point in time when the Resource was created (in ISO-8601 format).
17 #[serde(rename = "created")]
18 pub created: String,
19 /// Indicates if the routes from this [Network](#networks) should be exposed to the vSwitch connection.
20 #[serde(rename = "expose_routes_to_vswitch")]
21 pub expose_routes_to_vswitch: bool,
22 /// ID of the [Network](#networks).
23 #[serde(rename = "id")]
24 pub id: i64,
25 /// IP range of the [Network](#networks). Uses CIDR notation.
26 #[serde(rename = "ip_range")]
27 pub ip_range: String,
28 /// User-defined labels (`key/value` pairs) for the Resource. For more information, see \"[Labels](#labels)\". | User-defined labels (`key/value` pairs) for the Resource. Note that the set of [Labels](#labels) provided in the request will overwrite the existing one. For more information, see \"[Labels](#labels)\". | The Storage Boxes' labels. | The Subaccounts' labels. | The Snapshots' labels.
29 #[serde(rename = "labels")]
30 pub labels: std::collections::HashMap<String, String>,
31 /// Array of IDs of [Load Balancers](#load-balancers) attached to this [Network](#networks).
32 #[serde(rename = "load_balancers", skip_serializing_if = "Option::is_none")]
33 pub load_balancers: Option<Vec<i64>>,
34 /// Name of the [Network](#networks).
35 #[serde(rename = "name")]
36 pub name: String,
37 #[serde(rename = "protection")]
38 pub protection: Box<models::Protection>,
39 /// Array of routes set in this [Network](#networks).
40 #[serde(rename = "routes")]
41 pub routes: Vec<models::Route>,
42 /// Array of IDs of [Servers](#servers) attached to this [Network](#networks).
43 #[serde(rename = "servers")]
44 pub servers: Vec<i64>,
45 /// List of subnets allocated in this [Network](#networks).
46 #[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}