pub trait Provider {
// Required methods
fn name(&self) -> &str;
fn short_label(&self) -> &str;
fn fetch_hosts_cancellable(
&self,
token: &str,
cancel: &AtomicBool,
env: &Env,
) -> Result<Vec<ProviderHost>, ProviderError>;
// Provided methods
fn fetch_hosts(
&self,
token: &str,
env: &Env,
) -> Result<Vec<ProviderHost>, ProviderError> { ... }
fn fetch_hosts_with_progress(
&self,
token: &str,
cancel: &AtomicBool,
env: &Env,
_progress: &dyn Fn(&str),
) -> Result<Vec<ProviderHost>, ProviderError> { ... }
}Expand description
Trait implemented by each cloud provider.
Required Methods§
Sourcefn short_label(&self) -> &str
fn short_label(&self) -> &str
Short label for aliases (e.g. “do”).
Sourcefn fetch_hosts_cancellable(
&self,
token: &str,
cancel: &AtomicBool,
env: &Env,
) -> Result<Vec<ProviderHost>, ProviderError>
fn fetch_hosts_cancellable( &self, token: &str, cancel: &AtomicBool, env: &Env, ) -> Result<Vec<ProviderHost>, ProviderError>
Fetch hosts with cancellation support. env carries the resolved
process environment (home directory, credential env vars) so the few
providers that read AWS credentials or expand ~ in key paths take
them from the injected snapshot instead of ambient std::env /
dirs::home_dir. Most providers ignore it.
Provided Methods§
Sourcefn fetch_hosts(
&self,
token: &str,
env: &Env,
) -> Result<Vec<ProviderHost>, ProviderError>
fn fetch_hosts( &self, token: &str, env: &Env, ) -> Result<Vec<ProviderHost>, ProviderError>
Fetch all servers from the provider API.
Sourcefn fetch_hosts_with_progress(
&self,
token: &str,
cancel: &AtomicBool,
env: &Env,
_progress: &dyn Fn(&str),
) -> Result<Vec<ProviderHost>, ProviderError>
fn fetch_hosts_with_progress( &self, token: &str, cancel: &AtomicBool, env: &Env, _progress: &dyn Fn(&str), ) -> Result<Vec<ProviderHost>, ProviderError>
Fetch hosts with progress reporting. Default delegates to fetch_hosts_cancellable.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".