Skip to main content

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