forked from NationTech/harmony
Core domain structure for harmony rs (#1)
Co-authored-by: jeangab <jeangabriel.gc@gmail.com> Co-authored-by: Jean-Gabriel Gill-Couture <jeangabriel.gc@gmail.com> Reviewed-on: johnride/harmony#1 Co-authored-by: jeangab <jg@nationtech.io> Co-committed-by: jeangab <jg@nationtech.io>
This commit is contained in:
30
harmony-rs/src/domain/executors/mod.rs
Normal file
30
harmony-rs/src/domain/executors/mod.rs
Normal file
@@ -0,0 +1,30 @@
|
||||
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user