"""Constants and default configurations""" from pathlib import Path AWS_DIR = Path(__file__).resolve().parents[2] def _aws_path(*parts: str) -> Path: """Build paths anchored to the aws package directory.""" return AWS_DIR.joinpath(*parts) DEFAULT_EXPORT_DIR = _aws_path('aws_billing_exports') # Environment configurations ENVIRONMENTS = { 'nonprod': { 'dataset_name': 'gcp-digital-bi.aws_nonprod_billing_native', 'output_dir': DEFAULT_EXPORT_DIR, 'file_prefix': 'aws', 'exclude_recent_days': 2, 'table_pattern': '{account_id}_aws_billing_data', 'cost_field': 'line_item_unblended_cost', 'product_field': 'line_item_product_code', 'date_field': 'line_item_usage_start_date', 'supports_tags': False }, 'shared': { 'dataset_name': 'gcp-digital-bi.aws_nonprod_billing_native', 'output_dir': DEFAULT_EXPORT_DIR, 'file_prefix': 'aws_shared', 'exclude_recent_days': 2, 'table_pattern': '{account_id}_aws_billing_data', 'cost_field': 'line_item_unblended_cost', 'product_field': 'line_item_product_code', 'date_field': 'line_item_usage_start_date', 'supports_tags': True }, 'prod': { 'dataset_name': 'gcp-digital-bi.aws_prod_billing', 'output_dir': DEFAULT_EXPORT_DIR, 'file_prefix': 'aws_prod', 'exclude_recent_days': 2, 'cost_field': 'line_item_unblended_cost', 'product_field': 'product_product_name', 'date_field': 'line_item_usage_start_date', 'supports_tags': True } } # Default settings DEFAULT_SETTINGS = { 'cache_expiry_hours': 24, 'max_workers': 5, 'batch_size': 10000, 'chunk_size': 50000, 'account_details_file': str(_aws_path('aws_account_details.csv')), 'default_exclude_recent_days': 2, 'awsBillingCutoverDate': '2025-10-01', 'awsBillingNoPayerDataset': 'gcp-digital-bi.aws_billing_no_payer', 'awsCur2ProductField': 'product_servicecode', 'awsCur2RegionField': 'product_region_code', 'awsLineItemTypeInclude': ['Usage'], 'awsLineItemTypeExclude': [ 'Tax', 'Credit', 'Refund', 'Fee', 'RIFee', 'SavingsPlanNegation' ], 'enableAccountScopedServiceMonitor': False, 'enableUntaggedTagMonitor': False, 'accountScopedServiceMonitorEnvironments': ['prod'], 'accountScopedServiceMonitorServices': [ 'Amazon GuardDuty', 'AWS Config', 'AWS CloudTrail', 'AWS Audit Manager' ], 'untaggedTagMonitorEnvironments': ['prod'], 'untaggedTagMonitorAccounts': [], 'untaggedTagMonitorMinCost': 0.0, 'untaggedTagMonitorIgnoredServices': [] } # Analysis thresholds DEFAULT_THRESHOLDS = { 'account_warning': 1.5, 'account_critical': 2.0, 'service_warning': 1.5, 'service_critical': 2.0, 'min_cost_threshold': 100.0 } # Date format DATE_FORMAT = '%Y-%m-%d' MONTH_FORMAT = '%Y-%m' # BigQuery settings BQ_TIMEOUT = 300 BQ_MAX_RESULTS = 100000