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

/// LoadBalancerService : A service for a Load Balancer.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LoadBalancerService {
    /// Port the Load Balancer will balance to.
    #[serde(rename = "destination_port")]
    pub destination_port: i32,
    #[serde(rename = "health_check")]
    pub health_check: Box<models::LoadBalancerServiceHealthCheck>,
    #[serde(rename = "http", skip_serializing_if = "Option::is_none")]
    pub http: Option<Box<models::Http>>,
    /// Port the Load Balancer listens on.
    #[serde(rename = "listen_port")]
    pub listen_port: i32,
    /// Protocol of the Load Balancer.
    #[serde(rename = "protocol")]
    pub protocol: Protocol,
    /// Is Proxyprotocol enabled or not.
    #[serde(rename = "proxyprotocol")]
    pub proxyprotocol: bool,
}

impl LoadBalancerService {
    /// A service for a Load Balancer.
    pub fn new(
        destination_port: i32,
        health_check: models::LoadBalancerServiceHealthCheck,
        listen_port: i32,
        protocol: Protocol,
        proxyprotocol: bool,
    ) -> LoadBalancerService {
        LoadBalancerService {
            destination_port,
            health_check: Box::new(health_check),
            http: None,
            listen_port,
            protocol,
            proxyprotocol,
        }
    }
}
/// Protocol of the Load Balancer.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Protocol {
    #[serde(rename = "http")]
    Http,
    #[serde(rename = "https")]
    Https,
    #[serde(rename = "tcp")]
    Tcp,
}

impl Default for Protocol {
    fn default() -> Protocol {
        Self::Http
    }
}