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.28.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 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.
23    #[serde(rename = "id")]
24    pub id: i64,
25    /// IP range of the Network.  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\".  | User-defined labels (`key/value` pairs) for the Resource.  Note that the set of Labels provided in the request will overwrite the existing one.  For more information, see \"Labels\".
29    #[serde(rename = "labels")]
30    pub labels: std::collections::HashMap<String, String>,
31    /// Array of IDs of Load Balancers attached to this Network.
32    #[serde(rename = "load_balancers", skip_serializing_if = "Option::is_none")]
33    pub load_balancers: Option<Vec<i64>>,
34    /// Name of the Network.
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.
40    #[serde(rename = "routes")]
41    pub routes: Vec<models::Route>,
42    /// Array of IDs of Servers attached to this Network.
43    #[serde(rename = "servers")]
44    pub servers: Vec<i64>,
45    /// List of subnets allocated in this Network.
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}