Crate armature_gcp

Crate armature_gcp 

Source
Expand description

§Armature GCP

Google Cloud Platform services integration with dynamic loading and dependency injection.

§Features

Services are loaded dynamically based on feature flags and configuration. Only the services you enable are compiled and loaded.

§Quick Start

use armature_gcp::{GcpServices, GcpConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Configure which services to load
    let config = GcpConfig::builder()
        .project_id("my-project")
        .enable_storage()
        .enable_pubsub()
        .build();

    // Load services
    let services = GcpServices::new(config).await?;

    // Use Cloud Storage
    let storage = services.storage()?;

    Ok(())
}

§With Dependency Injection

use armature::prelude::*;
use armature_gcp::{GcpServices, GcpConfig};

#[module]
struct GcpModule;

#[module_impl]
impl GcpModule {
    #[provider(singleton)]
    async fn gcp_services() -> GcpServices {
        let config = GcpConfig::from_env()
            .enable_storage()
            .enable_pubsub()
            .build();
        GcpServices::new(config).await.unwrap()
    }
}

Structs§

GcpConfig
GCP service configuration.
GcpConfigBuilder
Builder for GCP configuration.
GcpServices
Container for GCP service clients.

Enums§

CredentialsSource
Credentials source for GCP authentication.
GcpError
GCP service errors.

Type Aliases§

Result
Result type for GCP operations.