Skip to main content

Crate alien_sdk

Crate alien_sdk 

Source
Expand description

Alien SDK for Rust.

Cloud-agnostic bindings for storage, KV, queues, vault, commands, and more. Works on AWS, GCP, Azure, Kubernetes, and locally.

This is the public-facing crate for Alien app developers. It re-exports everything from alien_bindings, giving users the alien_sdk import path.

§Example

use alien_sdk::AlienContext;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let ctx = AlienContext::init().await?;

    ctx.on_command("hello", |params: serde_json::Value| async move {
        Ok(serde_json::json!({ "message": "Hello!" }))
    });

    ctx.run().await?;
    Ok(())
}

Modules§

alien_context
AlienContext - Main SDK entry point for Alien applications.
error
grpc
http_client
presigned
provider
Unified BindingsProvider implementation that supports multiple cloud providers
providers
traits

Structs§

AlienContext
Main context for Alien applications that provides access to:
ArtifactRegistryCredentials
Credentials for accessing a repository.
AwsServiceAccountInfo
AWS IAM Role service account information
AzureServiceAccountInfo
Azure User-Assigned Managed Identity information
BindingsProvider
Direct platform-specific bindings provider. Routes to appropriate platform implementations based on binding configuration.
ControlGrpcServer
Control gRPC server implementation
DrainConfig
Configuration for wait_until drain behavior.
DrainResponse
Response from drain operations.
GcpServiceAccountInfo
GCP Service Account information
GrpcServerHandles
Handles returned from run_grpc_server
ImpersonationRequest
Configuration for impersonation
RepositoryResponse
Response from repository operations.
WaitUntilContext
A context for managing wait_until tasks within an application. This handles local task execution and coordinates with the runtime via gRPC.

Enums§

ArtifactRegistryPermissions
Permissions level for artifact registry access.
BindingsMode
How bindings are delivered to the application
ErrorData
Errors related to alien-bindings operations.
Platform
Represents the target cloud platform.
RegistryAuthMethod
How the registry expects credentials to be presented.
ServiceAccountInfo
Platform-specific service account information

Constants§

ENV_ALIEN_BASE_PLATFORM
ENV_ALIEN_BINDINGS_MODE
ENV_ALIEN_DEPLOYMENT_TYPE

Traits§

ArtifactRegistry
A trait for artifact registry bindings that provide container image repository management.
Binding
Marker trait for all binding types.
BindingsProviderApi
A provider must implement methods to load the various types of bindings based on environment variables or other configuration sources.
Build
A build binding that provides build execution capabilities.
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.
Queue
A trait for queue bindings providing minimal, portable queue operations.
ServiceAccount
A service account binding that provides identity and impersonation capabilities.
Storage
A storage binding that provides object store capabilities.
Vault
A trait for vault bindings that provide secure secret management.
WaitUntil
A trait for wait_until bindings that provide task coordination capabilities. Note: This trait is not object-safe due to generic methods, so we use concrete types in providers.
Worker
A trait for worker bindings that enable direct worker-to-worker calls.

Functions§

get_bindings_mode_from_env
Parse ALIEN_BINDINGS_MODE from environment variables. Defaults to Direct if not specified.
get_current_platform
Gets the current platform from the ALIEN_DEPLOYMENT_TYPE environment variable. This is used by the runtime to determine which platform-specific implementations to use.
get_platform_from_env
Gets the platform from a HashMap of environment variables.

Type Aliases§

Result
Convenient alias with default error type ErrorData.