Skip to main content

flow_execution/
connections.rs

1//! Connection-resolution seam for credentialed adapters.
2//!
3//! The actual storage lives in [`flow-application::connections`]. This trait
4//! is defined here so credentialed adapters can consume the resolution
5//! interface without depending on the higher-level application layer -
6//! keeping the dependency graph one-directional.
7
8use thiserror::Error;
9
10#[derive(Debug, Error)]
11pub enum ConnectionError {
12    #[error("connection '{0}' not found")]
13    NotFound(String),
14    #[error("credential lookup failed: {0}")]
15    Credential(String),
16}
17
18#[derive(Debug, Clone)]
19pub struct ResolvedZoweConnection {
20    pub host: String,
21    pub port: u16,
22    pub user: String,
23    pub password: String,
24    pub protocol: String,
25    pub reject_unauthorized: bool,
26}
27
28pub trait ConnectionLookup: Send + Sync {
29    fn resolve_zowe(&self, connection_id: &str) -> Result<ResolvedZoweConnection, ConnectionError>;
30}