Skip to main content

Crate alien_sdk

Crate alien_sdk 

Source
Expand description

Alien SDK for Rust.

Cloud-agnostic bindings for storage, KV, queues, vaults, and linked containers, plus the Worker application context. Works on AWS, GCP, Azure, Kubernetes, and locally.

This is the public-facing crate for Alien app developers. Its binding API is deliberately limited to Bindings and the kinds applications use directly: Storage, Kv, Queue, Vault, and Container.

Platform tooling that needs provider construction or managed resource kinds such as builds and artifact registries uses alien_bindings directly. Worker applications enable the worker Cargo feature and use the worker module for task, event, lifecycle, and waitUntil APIs. The feature is not enabled by default, so direct-binding-only applications do not depend on the Worker protocol.

§Example

use alien_sdk::Bindings;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let bindings = Bindings::from_env()?;
    let cache = bindings.kv("cache").await?;
    cache.put("greeting", b"hello".to_vec(), None).await?;
    assert_eq!(cache.get("greeting").await?, Some(b"hello".to_vec()));
    Ok(())
}

Provider construction and managed resource bindings are not part of this crate’s application API:

use alien_sdk::BindingsProvider;
use alien_sdk::BindingsProviderApi;
use alien_sdk::Binding;
use alien_sdk::{ArtifactRegistry, Build, Postgres, ServiceAccount, Worker};
use alien_sdk::provider;
use alien_sdk::providers;
use alien_sdk::http_client;

Modules§

error
Errors returned by the application binding and Worker APIs.
presigned
Serializable requests returned by storage presigning operations.
traits
App-facing binding value types (the option/message/result types that flow through storage/KV/queue/vault/container calls).

Structs§

Bindings
App-facing entry point for environment-backed bindings.
Queue
A queue binding scoped to its configured queue name.

Enums§

ErrorData
Errors related to alien-bindings operations.

Traits§

Container
A trait for container bindings that enable container-to-container communication
Kv
A trait for key-value store bindings that provide minimal, platform-agnostic KV operations. This API is designed to work consistently across DynamoDB, Firestore, Redis, and Azure Table Storage.
Storage
A storage binding that provides object store capabilities.
Vault
A trait for vault bindings that provide secure secret management.

Type Aliases§

Result
Convenient alias with default error type ErrorData.