Skip to main content

oxigeo_cloud_enhanced/
lib.rs

1//! Deep cloud platform integrations for AWS, Azure, and GCP.
2//!
3//! This crate provides enhanced cloud platform integrations beyond basic storage,
4//! including analytics, ML services, cost optimization, and monitoring.
5
6#![warn(missing_docs)]
7#![deny(unsafe_code)]
8
9pub mod error;
10
11#[cfg(feature = "aws")]
12pub mod aws;
13
14#[cfg(feature = "azure")]
15pub mod azure;
16
17#[cfg(feature = "gcp")]
18pub mod gcp;
19
20pub use error::{CloudEnhancedError, Result};
21
22/// Cloud provider type.
23#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24pub enum CloudProvider {
25    /// Amazon Web Services
26    Aws,
27    /// Microsoft Azure
28    Azure,
29    /// Google Cloud Platform
30    Gcp,
31}
32
33impl CloudProvider {
34    /// Returns the name of the cloud provider.
35    pub fn name(&self) -> &'static str {
36        match self {
37            Self::Aws => "AWS",
38            Self::Azure => "Azure",
39            Self::Gcp => "GCP",
40        }
41    }
42}
43
44impl std::fmt::Display for CloudProvider {
45    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
46        write!(f, "{}", self.name())
47    }
48}
49
50/// Cloud resource type.
51#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
52pub enum ResourceType {
53    /// Storage (S3, Blob, GCS)
54    Storage,
55    /// Analytics/Query service (Athena, Synapse, BigQuery)
56    Analytics,
57    /// Data catalog (Glue, Purview, Data Catalog)
58    DataCatalog,
59    /// ML service (SageMaker, Azure ML, Vertex AI)
60    MachineLearning,
61    /// Monitoring (CloudWatch, Monitor, Cloud Monitoring)
62    Monitoring,
63    /// Serverless compute (Lambda, Functions, Cloud Functions)
64    ServerlessCompute,
65}
66
67impl ResourceType {
68    /// Returns the name of the resource type.
69    pub fn name(&self) -> &'static str {
70        match self {
71            Self::Storage => "Storage",
72            Self::Analytics => "Analytics",
73            Self::DataCatalog => "Data Catalog",
74            Self::MachineLearning => "Machine Learning",
75            Self::Monitoring => "Monitoring",
76            Self::ServerlessCompute => "Serverless Compute",
77        }
78    }
79}
80
81impl std::fmt::Display for ResourceType {
82    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
83        write!(f, "{}", self.name())
84    }
85}
86
87#[cfg(test)]
88mod tests {
89    use super::*;
90
91    #[test]
92    fn test_cloud_provider_name() {
93        assert_eq!(CloudProvider::Aws.name(), "AWS");
94        assert_eq!(CloudProvider::Azure.name(), "Azure");
95        assert_eq!(CloudProvider::Gcp.name(), "GCP");
96    }
97
98    #[test]
99    fn test_resource_type_name() {
100        assert_eq!(ResourceType::Storage.name(), "Storage");
101        assert_eq!(ResourceType::Analytics.name(), "Analytics");
102        assert_eq!(ResourceType::DataCatalog.name(), "Data Catalog");
103    }
104}