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

/// FirewallResourceId : Resource a Firewall should be applied to.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct FirewallResourceId {
    /// Resources applied to via this Label Selector.
    #[serde(
        rename = "applied_to_resources",
        skip_serializing_if = "Option::is_none"
    )]
    pub applied_to_resources: Option<Vec<models::FirewallResourceIdAppliedToResources>>,
    #[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>>,
    /// The type of resource to apply.
    #[serde(rename = "type")]
    pub r#type: Type,
}

impl FirewallResourceId {
    /// Resource a Firewall should be applied to.
    pub fn new(r#type: Type) -> FirewallResourceId {
        FirewallResourceId {
            applied_to_resources: None,
            label_selector: None,
            server: None,
            r#type,
        }
    }
}
/// The type of resource to apply.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "label_selector")]
    LabelSelector,
    #[serde(rename = "server")]
    Server,
}

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