support_kit/hosts/
host_details.rs1use crate::HostDefinition;
2
3#[derive(Debug, Clone)]
4pub struct HostDetails {
5 pub address: String,
6 pub port: u16,
7 pub user: String,
8 pub auth: String,
9}
10
11#[bon::bon]
12impl HostDetails {
16 #[builder]
17 pub fn new(
18 #[builder(into)] address: String,
19 #[builder(into)] port: Option<u16>,
20 #[builder(into)] user: Option<String>,
21 #[builder(into)] auth: Option<String>,
22 ) -> Self {
23 Self {
24 address,
25 port: port.unwrap_or(22),
26 user: user.unwrap_or("root".into()),
27 auth: auth.unwrap_or("~/.ssh/id_rsa".into()),
28 }
29 }
30}
31
32impl From<HostDefinition> for HostDetails {
33 fn from(host: HostDefinition) -> Self {
34 Self::builder()
35 .address(host.address)
36 .maybe_port(host.port)
37 .maybe_user(host.user)
38 .maybe_auth(host.auth)
39 .build()
40 }
41}