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

/// LoadBalancerTarget : A target of a Load Balancer.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct LoadBalancerTarget {
    /// List of health statuses of the services on this target. Only present for target types \"server\" and \"ip\".
    #[serde(rename = "health_status", skip_serializing_if = "Option::is_none")]
    pub health_status: Option<Vec<models::LoadBalancerTargetHealthStatus>>,
    #[serde(rename = "ip", skip_serializing_if = "Option::is_none")]
    pub ip: Option<Box<models::LoadBalancerTargetIp>>,
    #[serde(rename = "label_selector", skip_serializing_if = "Option::is_none")]
    pub label_selector: Option<Box<models::LabelSelector>>,
    #[serde(rename = "server", skip_serializing_if = "Option::is_none")]
    pub server: Option<Box<models::ResourceId>>,
    /// List of resolved label selector target Servers. Only present for type \"label_selector\".
    #[serde(rename = "targets", skip_serializing_if = "Option::is_none")]
    pub targets: Option<Vec<models::LoadBalancerSelectedTarget>>,
    /// Type of the resource.
    #[serde(rename = "type")]
    pub r#type: Type,
    /// Use the private network IP instead of the public IP. Only present for target types \"server\" and \"label_selector\".
    #[serde(rename = "use_private_ip", skip_serializing_if = "Option::is_none")]
    pub use_private_ip: Option<bool>,
}

impl LoadBalancerTarget {
    /// A target of a Load Balancer.
    pub fn new(r#type: Type) -> LoadBalancerTarget {
        LoadBalancerTarget {
            health_status: None,
            ip: None,
            label_selector: None,
            server: None,
            targets: None,
            r#type,
            use_private_ip: None,
        }
    }
}
/// Type of the resource.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "ip")]
    Ip,
    #[serde(rename = "label_selector")]
    LabelSelector,
    #[serde(rename = "server")]
    Server,
}

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