use std::fmt;
use std::borrow::Cow;
use response::NamedResponse;
use response;
#[derive(Deserialize, Debug)]
pub struct SshKey {
id: f64,
fingerprint: String,
public_key: String,
name: String,
}
impl response::NotArray for SshKey {}
impl NamedResponse for SshKey {
fn name<'a>() -> Cow<'a, str> {
"ssh_key".into()
}
}
impl fmt::Display for SshKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"ID: {:.0}\n\
Fingerprint: {}\n\
Public Key: {}\n\
Name: {}",
self.id,
self.fingerprint,
self.public_key,
self.name)
}
}
pub type SshKeys = Vec<SshKey>;