Provider API Reference
Provider Trait
#[async_trait]
pub trait Provider: Send + Sync {
/// Returns the provider name for logging and identification
fn name(&self) -> &'static str;
/// Creates a new cloud instance
async fn create_instance(&self, request: &InstanceRequest) -> ProviderResult<ProviderInstance>;
/// Destroys an instance by ID (must be idempotent)
async fn destroy_instance(&self, id: &str) -> ProviderResult<()>;
/// Gets instance details by ID, returns None if not found
async fn get_instance(&self, id: &str) -> ProviderResult<Option<ProviderInstance>>;
/// Lists all spuff-managed instances
async fn list_instances(&self) -> ProviderResult<Vec<ProviderInstance>>;
/// Waits for instance to be ready (running + has IP)
async fn wait_ready(&self, id: &str) -> ProviderResult<ProviderInstance>;
/// Creates a snapshot of an instance
async fn create_snapshot(&self, instance_id: &str, name: &str) -> ProviderResult<Snapshot>;
/// Lists all spuff-managed snapshots
async fn list_snapshots(&self) -> ProviderResult<Vec<Snapshot>>;
/// Deletes a snapshot by ID (must be idempotent)
async fn delete_snapshot(&self, id: &str) -> ProviderResult<()>;
/// Returns SSH key identifiers (optional, default returns empty)
async fn get_ssh_keys(&self) -> ProviderResult<Vec<String>> { Ok(vec![]) }
/// Returns whether this provider supports snapshots
fn supports_snapshots(&self) -> bool { true }
}Core Types
InstanceRequest
ImageSpec
ImageSpec
DigitalOcean
Hetzner
AWS
ProviderInstance
InstanceStatus
Provider State
Spuff Status
Snapshot
ProviderTimeouts
Error Types
ProviderError
Method Specifications
name
create_instance
destroy_instance
get_instance
list_instances
wait_ready
create_snapshot
list_snapshots
delete_snapshot
ProviderFactory Trait
ProviderRegistry
Type Aliases
Last updated
Was this helpful?