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

/// ServerPublicNet : Public network information. The Server's IPv4 address can be found in `public_net->ipv4->ip`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct ServerPublicNet {
    /// Firewalls applied to the public network interface of this Server.
    #[serde(rename = "firewalls", skip_serializing_if = "Option::is_none")]
    pub firewalls: Option<Vec<models::ServerPublicNetFirewall>>,
    /// IDs of Floating IPs assigned to this Server.
    #[serde(rename = "floating_ips")]
    pub floating_ips: Vec<i64>,
    /// IP address (v4) and its reverse DNS entry of this Server.
    #[serde(rename = "ipv4", deserialize_with = "Option::deserialize")]
    pub ipv4: Option<Box<models::Ipv4>>,
    /// IPv6 network assigned to this Server and its reverse DNS entry.
    #[serde(rename = "ipv6", deserialize_with = "Option::deserialize")]
    pub ipv6: Option<Box<models::Ipv6>>,
}

impl ServerPublicNet {
    /// Public network information. The Server's IPv4 address can be found in `public_net->ipv4->ip`.
    pub fn new(
        floating_ips: Vec<i64>,
        ipv4: Option<models::Ipv4>,
        ipv6: Option<models::Ipv6>,
    ) -> ServerPublicNet {
        ServerPublicNet {
            firewalls: None,
            floating_ips,
            ipv4: ipv4.map(Box::new),
            ipv6: ipv6.map(Box::new),
        }
    }
}