pub trait ClienteSshTrait:
Send
+ Sync
+ 'static {
// Required methods
fn conectar<'async_trait>(
cfg: ConfiguracaoConexao,
) -> Pin<Box<dyn Future<Output = Result<Box<Self>, ErroSshCli>> + Send + 'async_trait>>
where Self: Sized + 'async_trait;
fn executar_comando<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cmd: &'life1 str,
max_chars: usize,
) -> Pin<Box<dyn Future<Output = Result<SaidaExecucao, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn upload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local: &'life1 Path,
remote: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
remote: &'life1 Path,
local: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn abrir_canal_tunel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
host_remoto: &'life1 str,
porta_remota: u16,
endereco_origem: &'life2 str,
porta_origem: u16,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn CanalTunel>, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn desconectar<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait para cliente SSH que permite implementação real (russh) ou mock para testes.
Este trait abstrai as operações de conexão SSH para permitir testes unitários sem necessidade de conexão de rede real.
Required Methods§
Sourcefn conectar<'async_trait>(
cfg: ConfiguracaoConexao,
) -> Pin<Box<dyn Future<Output = Result<Box<Self>, ErroSshCli>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
fn conectar<'async_trait>(
cfg: ConfiguracaoConexao,
) -> Pin<Box<dyn Future<Output = Result<Box<Self>, ErroSshCli>> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
Conecta a um servidor SSH e autentica com as credenciais fornecidas.
Sourcefn executar_comando<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cmd: &'life1 str,
max_chars: usize,
) -> Pin<Box<dyn Future<Output = Result<SaidaExecucao, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn executar_comando<'life0, 'life1, 'async_trait>(
&'life0 mut self,
cmd: &'life1 str,
max_chars: usize,
) -> Pin<Box<dyn Future<Output = Result<SaidaExecucao, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Executa um comando shell remoto e retorna a saída capturada.
Sourcefn upload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local: &'life1 Path,
remote: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn upload<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
local: &'life1 Path,
remote: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Faz upload de um arquivo local para o servidor remoto via SCP.
Sourcefn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
remote: &'life1 Path,
local: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn download<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
remote: &'life1 Path,
local: &'life2 Path,
) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Faz download de um arquivo remoto para o sistema local via SCP.
Sourcefn abrir_canal_tunel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
host_remoto: &'life1 str,
porta_remota: u16,
endereco_origem: &'life2 str,
porta_origem: u16,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn CanalTunel>, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn abrir_canal_tunel<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
host_remoto: &'life1 str,
porta_remota: u16,
endereco_origem: &'life2 str,
porta_origem: u16,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn CanalTunel>, ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Abre um canal direct-tcpip para forwarding de tunnel.
Sourcefn desconectar<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn desconectar<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), ErroSshCli>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Encerra a conexão SSH de forma limpa.
Implementors§
impl ClienteSshTrait for ClienteSsh
Available on crate feature
ssh-real only.