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};

/// CreateNetworkRequest : Request for POST https://api.hetzner.cloud/v1/networks
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateNetworkRequest {
    /// Toggle to expose routes to the Networks vSwitch.  Indicates if the routes from this Network should be exposed to the vSwitch in this Network. Only takes effect if a [vSwitch is setup](https://docs.hetzner.com/cloud/networks/connect-dedi-vswitch) in this Network.
    #[serde(
        rename = "expose_routes_to_vswitch",
        skip_serializing_if = "Option::is_none"
    )]
    pub expose_routes_to_vswitch: Option<bool>,
    /// IP range of the Network.  Uses CIDR notation.  Must span all included subnets. Must be one of the private IPv4 ranges of RFC1918.  Minimum network size is /24. We highly recommend that you pick a larger Network with a /16 netmask.
    #[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", skip_serializing_if = "Option::is_none")]
    pub labels: Option<std::collections::HashMap<String, String>>,
    /// Name of the Network.
    #[serde(rename = "name")]
    pub name: String,
    /// Array of routes set in this Network.
    #[serde(rename = "routes", skip_serializing_if = "Option::is_none")]
    pub routes: Option<Vec<models::Route>>,
    /// Array of subnets to allocate.
    #[serde(rename = "subnets", skip_serializing_if = "Option::is_none")]
    pub subnets: Option<Vec<models::Subnet>>,
}

impl CreateNetworkRequest {
    /// Request for POST https://api.hetzner.cloud/v1/networks
    pub fn new(ip_range: String, name: String) -> CreateNetworkRequest {
        CreateNetworkRequest {
            expose_routes_to_vswitch: None,
            ip_range,
            labels: None,
            name,
            routes: None,
            subnets: None,
        }
    }
}