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 SubnetWithGateway {
    /// Gateway for Servers attached to this subnet.  For subnets of type `server` this is always the first IP of the subnets IP range.
    #[serde(rename = "gateway")]
    pub gateway: String,
    /// IP range of the subnet.  Uses CIDR notation.
    #[serde(rename = "ip_range", skip_serializing_if = "Option::is_none")]
    pub ip_range: Option<String>,
    /// Name of the Network Zone.  The Location contains the `network_zone` property it belongs to.
    #[serde(rename = "network_zone")]
    pub network_zone: String,
    /// Type of subnet.  - `cloud` - Used to connect cloud Servers and Load Balancers. - `server` - Same as the `cloud` type. **Deprecated**, use the `cloud` type instead. - `vswitch` - Used to [connect cloud Servers and Load Balancers with dedicated Servers](https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch).
    #[serde(rename = "type")]
    pub r#type: Type,
    /// ID of the robot vSwitch if the subnet is of type `vswitch`.
    #[serde(
        rename = "vswitch_id",
        default,
        with = "::serde_with::rust::double_option",
        skip_serializing_if = "Option::is_none"
    )]
    pub vswitch_id: Option<Option<i64>>,
}

impl SubnetWithGateway {
    pub fn new(gateway: String, network_zone: String, r#type: Type) -> SubnetWithGateway {
        SubnetWithGateway {
            gateway,
            ip_range: None,
            network_zone,
            r#type,
            vswitch_id: None,
        }
    }
}
/// Type of subnet.  - `cloud` - Used to connect cloud Servers and Load Balancers. - `server` - Same as the `cloud` type. **Deprecated**, use the `cloud` type instead. - `vswitch` - Used to [connect cloud Servers and Load Balancers with dedicated Servers](https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch).
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "cloud")]
    Cloud,
    #[serde(rename = "server")]
    Server,
    #[serde(rename = "vswitch")]
    Vswitch,
}

impl Default for Type {
    fn default() -> Type {
        Self::Cloud
    }
}