oxigeo_cloud_enhanced/
lib.rs1#![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#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24pub enum CloudProvider {
25 Aws,
27 Azure,
29 Gcp,
31}
32
33impl CloudProvider {
34 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#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
52pub enum ResourceType {
53 Storage,
55 Analytics,
57 DataCatalog,
59 MachineLearning,
61 Monitoring,
63 ServerlessCompute,
65}
66
67impl ResourceType {
68 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}