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

/// Iso : ISO Image that is attached to this Server. Null if no ISO is attached.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Iso {
    /// CPU architecture compatible with the ISO.  Null indicates no restriction on the architecture (wildcard).
    #[serde(rename = "architecture", deserialize_with = "Option::deserialize")]
    pub architecture: Option<models::Architecture>,
    /// Describes if, when and how the resource is deprecated. If this field is set to `null` the resource is not deprecated. If a value is set, it is considered deprecated.
    #[serde(rename = "deprecation", deserialize_with = "Option::deserialize")]
    pub deprecation: Option<Box<models::DeprecationInfo>>,
    /// Description of the ISO.
    #[serde(rename = "description")]
    pub description: String,
    /// ID of the ISO.
    #[serde(rename = "id")]
    pub id: i64,
    /// Unique identifier of the ISO. Only set for public ISOs.
    #[serde(rename = "name", deserialize_with = "Option::deserialize")]
    pub name: Option<String>,
    /// Type of the ISO.
    #[serde(rename = "type", deserialize_with = "Option::deserialize")]
    pub r#type: Option<Type>,
}

impl Iso {
    /// ISO Image that is attached to this Server. Null if no ISO is attached.
    pub fn new(
        architecture: Option<models::Architecture>,
        deprecation: Option<models::DeprecationInfo>,
        description: String,
        id: i64,
        name: Option<String>,
        r#type: Option<Type>,
    ) -> Iso {
        Iso {
            architecture,
            deprecation: deprecation.map(Box::new),
            description,
            id,
            name,
            r#type,
        }
    }
}
/// Type of the ISO.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Type {
    #[serde(rename = "private")]
    Private,
    #[serde(rename = "public")]
    Public,
}

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