Crate llm_shield_cloud

Crate llm_shield_cloud 

Source
Expand description

Cloud abstraction layer for LLM Shield.

This crate provides unified traits and types for interacting with cloud services across AWS, GCP, and Azure. It enables LLM Shield to leverage cloud-native features for secrets management, object storage, metrics, logging, and distributed tracing.

§Architecture

The crate defines trait-based abstractions for common cloud operations:

§Features

This crate provides the core abstractions. Concrete implementations are provided by:

  • llm-shield-cloud-aws - AWS integrations (enable with cloud-aws feature)
  • llm-shield-cloud-gcp - GCP integrations (enable with cloud-gcp feature)
  • llm-shield-cloud-azure - Azure integrations (enable with cloud-azure feature)

§Example

use llm_shield_cloud::{CloudSecretManager, SecretValue, Result};

async fn load_api_keys(
    secret_manager: &dyn CloudSecretManager
) -> Result<Vec<String>> {
    // Fetch API keys from cloud secret manager
    let secret = secret_manager.get_secret("llm-shield/api-keys").await?;

    // Parse the secret value
    let api_keys: Vec<String> = serde_json::from_str(secret.as_string())?;

    Ok(api_keys)
}

§Configuration

Cloud integrations are configured via CloudConfig:

cloud:
  provider: aws
  aws:
    region: us-east-1
    secrets_manager:
      enabled: true
      cache_ttl_seconds: 300
    s3:
      bucket: llm-shield-models

Re-exports§

pub use config::AzureConfig;
pub use config::AwsConfig;
pub use config::CloudConfig;
pub use config::CloudProvider;
pub use config::GcpConfig;
pub use error::CloudError;
pub use error::Result;
pub use observability::CloudLogger;
pub use observability::CloudMetrics;
pub use observability::CloudTracer;
pub use observability::LogEntry;
pub use observability::LogLevel;
pub use observability::Metric;
pub use observability::Span;
pub use secrets::CloudSecretManager;
pub use secrets::SecretCache;
pub use secrets::SecretMetadata;
pub use secrets::SecretValue;
pub use storage::CloudStorage;
pub use storage::GetObjectOptions;
pub use storage::ObjectMetadata;
pub use storage::PutObjectOptions;

Modules§

config
Configuration structures for cloud integrations.
error
Error types for cloud integrations.
observability
Cloud observability abstractions.
secrets
Secret management abstractions.
storage
Cloud storage abstractions.

Constants§

LIB_NAME
Library name.
VERSION
Library version.

Attribute Macros§

async_trait