use crate::core::remote::CloudProvider;
use blueprint_std::collections::HashMap;
use serde::{Deserialize, Serialize};
pub struct CostEstimator;
impl CostEstimator {
pub fn new() -> Self {
Self
}
pub fn estimate(
&self,
_provider: &CloudProvider,
_cpu_cores: f64,
_memory_gb: f64,
_storage_gb: f64,
_replicas: u32,
) -> Result<CostReport, String> {
Err(
"CostEstimator has been removed. All hardcoded pricing eliminated. \
Use PricingFetcher for real VM pricing or FaasPricingFetcher for serverless pricing."
.to_string(),
)
}
pub fn track_usage(
&self,
_provider: &CloudProvider,
_cpu_hours: f64,
_memory_gb_hours: f64,
_storage_gb_days: f64,
_network_gb: f64,
) -> Result<f64, String> {
Err(
"CostEstimator has been removed. All hardcoded pricing eliminated. \
Use PricingFetcher for real VM pricing or FaasPricingFetcher for serverless pricing."
.to_string(),
)
}
}
impl Default for CostEstimator {
fn default() -> Self {
Self::new()
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CostReport {
pub estimated_hourly: f64,
pub estimated_monthly: f64,
pub currency: String,
pub breakdown: HashMap<String, f64>,
}
impl CostReport {
pub fn alert_if_exceeds(&self, monthly_limit: f64) -> Option<String> {
if self.estimated_monthly > monthly_limit {
Some(format!(
"WARNING: Estimated monthly cost ${:.2} exceeds limit ${:.2}",
self.estimated_monthly, monthly_limit
))
} else {
None
}
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_cost_estimation_returns_error() {
let estimator = CostEstimator::new();
let result = estimator.estimate(
&CloudProvider::AWS,
2.0, 4.0, 10.0, 3, );
assert!(result.is_err());
assert!(result.unwrap_err().contains("hardcoded pricing eliminated"));
}
#[test]
fn test_usage_tracking_returns_error() {
let estimator = CostEstimator::new();
let result = estimator.track_usage(
&CloudProvider::DigitalOcean,
100.0, 200.0, 300.0, 50.0, );
assert!(result.is_err());
assert!(result.unwrap_err().contains("hardcoded pricing eliminated"));
}
}