scaleway-rs 0.2.7

A pure Rust scaleway API binding.
Documentation
use serde::Deserialize;

#[derive(Debug, Clone, Copy)]
pub enum SshKeyOrderBy {
    NameAsc,
    NameDesc,
    CreatedAtAsc,
    CreatedAtDesc,
    UpdatedAtAsc,
    UpdatedAtDesc,
}

impl std::fmt::Display for SshKeyOrderBy {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            SshKeyOrderBy::NameAsc => write!(f, "name_asc"),
            SshKeyOrderBy::NameDesc => write!(f, "name_desc"),
            SshKeyOrderBy::CreatedAtAsc => write!(f, "created_at_asc"),
            SshKeyOrderBy::CreatedAtDesc => write!(f, "created_at_desc"),
            SshKeyOrderBy::UpdatedAtAsc => write!(f, "updated_at_asc"),
            SshKeyOrderBy::UpdatedAtDesc => write!(f, "updated_at_desc"),
        }
    }
}

#[derive(Deserialize, Debug)]
pub struct ScalewaySSHKeysRoot {
    pub ssh_keys: Vec<ScalewaySSHKey>,
}

#[derive(Deserialize, Debug)]
pub struct ScalewaySSHKey {
    pub id: String,
    pub name: String,
    pub public_key: String,
    pub fingerprint: Option<String>,
    #[serde(with = "time::serde::rfc3339::option")]
    pub created_at: Option<time::OffsetDateTime>,
    #[serde(with = "time::serde::rfc3339::option")]
    pub updated_at: Option<time::OffsetDateTime>,
    pub organization_id: String,
    pub project_id: String,
    pub disabled: bool,
}