forked from NationTech/harmony
Co-authored-by: jeangab <jeangabriel.gc@gmail.com> Co-authored-by: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com> Reviewed-on: https://git.nationtech.io/johnride/harmony/pulls/1 Co-authored-by: jeangab <jg@nationtech.io> Co-committed-by: jeangab <jg@nationtech.io>
31 lines
910 B
Rust
31 lines
910 B
Rust
use std::fmt;
|
|
|
|
pub struct ExecutorResult {
|
|
message: String,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum ExecutorError {
|
|
NetworkError(String),
|
|
AuthenticationError(String),
|
|
ConfigurationError(String),
|
|
UnexpectedError(String),
|
|
}
|
|
|
|
impl fmt::Display for ExecutorError {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
match self {
|
|
ExecutorError::NetworkError(msg) => write!(f, "Network error: {}", msg),
|
|
ExecutorError::AuthenticationError(msg) => write!(f, "Authentication error: {}", msg),
|
|
ExecutorError::ConfigurationError(msg) => write!(f, "Configuration error: {}", msg),
|
|
ExecutorError::UnexpectedError(msg) => write!(f, "Unexpected error: {}", msg),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for ExecutorError {}
|
|
|
|
pub trait SshClient {
|
|
fn test_connection(&self, username: String, password: String) -> Result<(), ExecutorError>;
|
|
}
|