seamless-glance 1.0.0

Fast, read-only AWS TUI for cloud infrastructure visibility and triage
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use crate::models::ec2::Ec2InstanceInfo;

pub struct SshContext {
    pub instance_name: String,
    pub user: String,
    pub host: String,
    pub key_name: Option<String>,
}

pub fn ssh_command(instance: &Ec2InstanceInfo) -> Option<SshContext> {
    Some(SshContext {
        instance_name: instance.name.clone().unwrap_or_else(|| instance.id.clone()),
        user: "ec2-user".into(),
        host: instance.public_ip.as_ref()?.clone(),
        key_name: instance.key_name.clone(),
    })
}