Skip to main content

MachineProvider

Trait MachineProvider 

Source
pub trait MachineProvider: Send + Sync {
    // Required methods
    fn ensure_project<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<ProjectId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_server<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        project: &'life1 ProjectId,
        spec: &'life2 ServerSpec,
        user_data: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<ServerId>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn create_bucket<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        location: Location,
    ) -> Pin<Box<dyn Future<Output = Result<BucketRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn server_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ServerId,
    ) -> Pin<Box<dyn Future<Output = Result<ServerStatus>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_server_by_name<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ServerSummary>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn bucket_exists<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        location: Location,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn destroy_server<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 ServerId,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_bucket<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        location: Location,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn set_bucket_acl<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
        location: Location,
        acl: BucketAcl,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Abstracts over cloud providers for the machine + bucket lifecycle.

Required Methods§

Source

fn ensure_project<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<ProjectId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Return or create a logical project scope.

Hetzner Cloud tokens are already project-scoped — this returns a no-op ProjectId(name) without calling the API.

Source

fn create_server<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, project: &'life1 ProjectId, spec: &'life2 ServerSpec, user_data: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<ServerId>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Provision a new server with the given cloud-init user_data string.

Source

fn create_bucket<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, location: Location, ) -> Pin<Box<dyn Future<Output = Result<BucketRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create an object-storage bucket in the given location.

Uses Hetzner Object Storage S3-compat API (separate from Cloud API). Requires HETZNER_S3_ACCESS_KEY + HETZNER_S3_SECRET_KEY — run yah cloud secrets for the canonical contract.

Source

fn server_status<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ServerId, ) -> Pin<Box<dyn Future<Output = Result<ServerStatus>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch the current lifecycle status of a server.

Source

fn find_server_by_name<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ServerSummary>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Look up a server by its declared name. Ok(None) means the API responded but no server with that name exists; Err(_) means the API call itself failed.

Source

fn bucket_exists<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, location: Location, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Probe whether a bucket exists in location. Ok(true) = HEAD 200, Ok(false) = HEAD 404. Auth failures (403) propagate as Err so the caller can distinguish “missing” from “can’t tell”.

Source

fn destroy_server<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 ServerId, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Irreversibly destroy a server. Returns Ok(()) if already deleted.

Source

fn delete_bucket<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, location: Location, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Irreversibly delete an object-storage bucket. Lists and deletes every object first (S3 won’t delete a non-empty bucket), then deletes the bucket itself. Returns Ok(()) if the bucket was already gone (404 on the final DELETE). Auth/transport failures propagate as Err.

Source

fn set_bucket_acl<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, location: Location, acl: BucketAcl, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set the canned ACL on an existing bucket via PUT /<bucket>?acl.

BucketAcl::Private covers both “private” and “signed-only” semantics — presigned URLs work regardless of ACL. BucketAcl::PublicRead enables anonymous GET/HEAD. The call is idempotent: applying the same ACL twice succeeds without error.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§