support_kit/deployments/
host_deployment_context.rs

1use crate::{shell, Configuration, HostDetails, Registry, ShellCommand};
2
3#[derive(Debug, Clone, bon::Builder)]
4pub struct HostDeploymentContext {
5    pub config: Configuration,
6    #[builder(into)]
7    pub host: HostDetails,
8    pub registry: Registry,
9}
10
11impl HostDeploymentContext {
12    pub fn send_file(
13        &self,
14        from_path: impl AsRef<str>,
15        to_path: impl AsRef<str>,
16    ) -> crate::Result<ShellCommand> {
17        shell(format!(
18            "scp -i {key} {local} {user}@{host}:{remote}",
19            local = from_path.as_ref(),
20            key = self.host.auth,
21            user = self.host.user,
22            host = self.host.address,
23            remote = to_path.as_ref(),
24        ))
25    }
26}