scaleway-rs 0.2.8

A pure Rust scaleway API binding.
Documentation
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum FlexibleIpType {
    UnknownIptype,
    RoutedIpv4,
    RoutedIpv6,
}

impl std::fmt::Display for FlexibleIpType {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            FlexibleIpType::UnknownIptype => write!(f, "unknown_iptype"),
            FlexibleIpType::RoutedIpv4 => write!(f, "routed_ipv4"),
            FlexibleIpType::RoutedIpv6 => write!(f, "routed_ipv6"),
        }
    }
}

#[derive(Deserialize, Debug)]
pub struct ScalewayFlexibleIpsRoot {
    pub ips: Vec<ScalewayFlexibleIp>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayFlexibleIpRoot {
    pub ip: ScalewayFlexibleIp,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayFlexibleIp {
    pub id: String,
    pub address: Option<String>,
    pub reverse: Option<String>,
    pub server: Option<ScalewayFlexibleIpServerRef>,
    pub organization: String,
    pub project: String,
    pub tags: Vec<String>,
    #[serde(rename = "type")]
    pub ip_type: FlexibleIpType,
    pub state: String,
    pub prefix: Option<String>,
    pub ipam_id: Option<String>,
    pub zone: String,
}

#[derive(Deserialize, Debug)]
pub struct ScalewayFlexibleIpServerRef {
    pub id: String,
    pub name: String,
}