"""AWS specific entrypoint for pushing billing exports to MySQL.""" from __future__ import annotations from pathlib import Path from typing import Any, Dict, Iterable, Optional from common.mysql_writer import BillingDataUploader class AWSMySQLWriter: """Thin wrapper that wires AWS exporter data into the shared uploader.""" def __init__(self, config_manager): self.uploader = BillingDataUploader.from_config(config_manager, provider="aws") @property def enabled(self) -> bool: return self.uploader.enabled def sync( self, account_identifier: str, account_name: str, environment: str, records: Iterable[Dict[str, Any]], start_date, end_date, source_file: Optional[Path] = None, metadata: Optional[Dict[str, Any]] = None, ) -> None: """Push records into MySQL if enabled.""" self.uploader.sync_account_costs( account_identifier=account_identifier, account_name=account_name, environment=environment, records=records, start_date=start_date.date() if hasattr(start_date, "date") else start_date, end_date=end_date.date() if hasattr(end_date, "date") else end_date, source_file=source_file, metadata=metadata, )