armature_gcp/
lib.rs

1//! # Armature GCP
2//!
3//! Google Cloud Platform services integration with dynamic loading and dependency injection.
4//!
5//! ## Features
6//!
7//! Services are loaded dynamically based on feature flags and configuration.
8//! Only the services you enable are compiled and loaded.
9//!
10//! ## Quick Start
11//!
12//! ```rust,ignore
13//! use armature_gcp::{GcpServices, GcpConfig};
14//!
15//! #[tokio::main]
16//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
17//!     // Configure which services to load
18//!     let config = GcpConfig::builder()
19//!         .project_id("my-project")
20//!         .enable_storage()
21//!         .enable_pubsub()
22//!         .build();
23//!
24//!     // Load services
25//!     let services = GcpServices::new(config).await?;
26//!
27//!     // Use Cloud Storage
28//!     let storage = services.storage()?;
29//!
30//!     Ok(())
31//! }
32//! ```
33//!
34//! ## With Dependency Injection
35//!
36//! ```rust,ignore
37//! use armature::prelude::*;
38//! use armature_gcp::{GcpServices, GcpConfig};
39//!
40//! #[module]
41//! struct GcpModule;
42//!
43//! #[module_impl]
44//! impl GcpModule {
45//!     #[provider(singleton)]
46//!     async fn gcp_services() -> GcpServices {
47//!         let config = GcpConfig::from_env()
48//!             .enable_storage()
49//!             .enable_pubsub()
50//!             .build();
51//!         GcpServices::new(config).await.unwrap()
52//!     }
53//! }
54//! ```
55
56mod config;
57mod error;
58mod services;
59
60pub use config::{CredentialsSource, GcpConfig, GcpConfigBuilder};
61pub use error::{GcpError, Result};
62pub use services::GcpServices;
63
64// Re-export enabled service clients
65#[cfg(feature = "storage")]
66pub use google_cloud_storage;
67
68#[cfg(feature = "pubsub")]
69pub use google_cloud_pubsub;
70
71#[cfg(feature = "spanner")]
72pub use google_cloud_spanner;
73
74#[cfg(feature = "bigquery")]
75pub use google_cloud_bigquery;