hcloud 0.25.0

Unofficial Rust crate for accessing the Hetzner Cloud API
Documentation
/*
 * Hetzner Cloud API
 *
 * Copied from the official API documentation for the Public Hetzner Cloud.
 *
 * The version of the OpenAPI document: 0.28.0
 *
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Network {
    /// Point in time when the Resource was created (in ISO-8601 format).
    #[serde(rename = "created")]
    pub created: String,
    /// Indicates if the routes from this Network should be exposed to the vSwitch connection.
    #[serde(rename = "expose_routes_to_vswitch")]
    pub expose_routes_to_vswitch: bool,
    /// ID of the Network.
    #[serde(rename = "id")]
    pub id: i64,
    /// IP range of the Network.  Uses CIDR notation.
    #[serde(rename = "ip_range")]
    pub ip_range: String,
    /// 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\".
    #[serde(rename = "labels")]
    pub labels: std::collections::HashMap<String, String>,
    /// Array of IDs of Load Balancers attached to this Network.
    #[serde(rename = "load_balancers", skip_serializing_if = "Option::is_none")]
    pub load_balancers: Option<Vec<i64>>,
    /// Name of the Network.
    #[serde(rename = "name")]
    pub name: String,
    #[serde(rename = "protection")]
    pub protection: Box<models::Protection>,
    /// Array of routes set in this Network.
    #[serde(rename = "routes")]
    pub routes: Vec<models::Route>,
    /// Array of IDs of Servers attached to this Network.
    #[serde(rename = "servers")]
    pub servers: Vec<i64>,
    /// List of subnets allocated in this Network.
    #[serde(rename = "subnets")]
    pub subnets: Vec<models::SubnetWithGateway>,
}

impl Network {
    pub fn new(
        created: String,
        expose_routes_to_vswitch: bool,
        id: i64,
        ip_range: String,
        labels: std::collections::HashMap<String, String>,
        name: String,
        protection: models::Protection,
        routes: Vec<models::Route>,
        servers: Vec<i64>,
        subnets: Vec<models::SubnetWithGateway>,
    ) -> Network {
        Network {
            created,
            expose_routes_to_vswitch,
            id,
            ip_range,
            labels,
            load_balancers: None,
            name,
            protection: Box::new(protection),
            routes,
            servers,
            subnets,
        }
    }
}