runbooks 1.1.4__py3-none-any.whl → 1.1.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. runbooks/__init__.py +31 -2
  2. runbooks/__init___optimized.py +18 -4
  3. runbooks/_platform/__init__.py +1 -5
  4. runbooks/_platform/core/runbooks_wrapper.py +141 -138
  5. runbooks/aws2/accuracy_validator.py +812 -0
  6. runbooks/base.py +7 -0
  7. runbooks/cfat/assessment/compliance.py +1 -1
  8. runbooks/cfat/assessment/runner.py +1 -0
  9. runbooks/cfat/cloud_foundations_assessment.py +227 -239
  10. runbooks/cli/__init__.py +1 -1
  11. runbooks/cli/commands/cfat.py +64 -23
  12. runbooks/cli/commands/finops.py +1005 -54
  13. runbooks/cli/commands/inventory.py +135 -91
  14. runbooks/cli/commands/operate.py +9 -36
  15. runbooks/cli/commands/security.py +42 -18
  16. runbooks/cli/commands/validation.py +432 -18
  17. runbooks/cli/commands/vpc.py +81 -17
  18. runbooks/cli/registry.py +22 -10
  19. runbooks/cloudops/__init__.py +20 -27
  20. runbooks/cloudops/base.py +96 -107
  21. runbooks/cloudops/cost_optimizer.py +544 -542
  22. runbooks/cloudops/infrastructure_optimizer.py +5 -4
  23. runbooks/cloudops/interfaces.py +224 -225
  24. runbooks/cloudops/lifecycle_manager.py +5 -4
  25. runbooks/cloudops/mcp_cost_validation.py +252 -235
  26. runbooks/cloudops/models.py +78 -53
  27. runbooks/cloudops/monitoring_automation.py +5 -4
  28. runbooks/cloudops/notebook_framework.py +177 -213
  29. runbooks/cloudops/security_enforcer.py +125 -159
  30. runbooks/common/accuracy_validator.py +17 -12
  31. runbooks/common/aws_pricing.py +349 -326
  32. runbooks/common/aws_pricing_api.py +211 -212
  33. runbooks/common/aws_profile_manager.py +40 -36
  34. runbooks/common/aws_utils.py +74 -79
  35. runbooks/common/business_logic.py +126 -104
  36. runbooks/common/cli_decorators.py +36 -60
  37. runbooks/common/comprehensive_cost_explorer_integration.py +455 -463
  38. runbooks/common/cross_account_manager.py +197 -204
  39. runbooks/common/date_utils.py +27 -39
  40. runbooks/common/decorators.py +29 -19
  41. runbooks/common/dry_run_examples.py +173 -208
  42. runbooks/common/dry_run_framework.py +157 -155
  43. runbooks/common/enhanced_exception_handler.py +15 -4
  44. runbooks/common/enhanced_logging_example.py +50 -64
  45. runbooks/common/enhanced_logging_integration_example.py +65 -37
  46. runbooks/common/env_utils.py +16 -16
  47. runbooks/common/error_handling.py +40 -38
  48. runbooks/common/lazy_loader.py +41 -23
  49. runbooks/common/logging_integration_helper.py +79 -86
  50. runbooks/common/mcp_cost_explorer_integration.py +476 -493
  51. runbooks/common/mcp_integration.py +99 -79
  52. runbooks/common/memory_optimization.py +140 -118
  53. runbooks/common/module_cli_base.py +37 -58
  54. runbooks/common/organizations_client.py +175 -193
  55. runbooks/common/patterns.py +23 -25
  56. runbooks/common/performance_monitoring.py +67 -71
  57. runbooks/common/performance_optimization_engine.py +283 -274
  58. runbooks/common/profile_utils.py +111 -37
  59. runbooks/common/rich_utils.py +315 -141
  60. runbooks/common/sre_performance_suite.py +177 -186
  61. runbooks/enterprise/__init__.py +1 -1
  62. runbooks/enterprise/logging.py +144 -106
  63. runbooks/enterprise/security.py +187 -204
  64. runbooks/enterprise/validation.py +43 -56
  65. runbooks/finops/__init__.py +26 -30
  66. runbooks/finops/account_resolver.py +1 -1
  67. runbooks/finops/advanced_optimization_engine.py +980 -0
  68. runbooks/finops/automation_core.py +268 -231
  69. runbooks/finops/business_case_config.py +184 -179
  70. runbooks/finops/cli.py +660 -139
  71. runbooks/finops/commvault_ec2_analysis.py +157 -164
  72. runbooks/finops/compute_cost_optimizer.py +336 -320
  73. runbooks/finops/config.py +20 -20
  74. runbooks/finops/cost_optimizer.py +484 -618
  75. runbooks/finops/cost_processor.py +332 -214
  76. runbooks/finops/dashboard_runner.py +1006 -172
  77. runbooks/finops/ebs_cost_optimizer.py +991 -657
  78. runbooks/finops/elastic_ip_optimizer.py +317 -257
  79. runbooks/finops/enhanced_mcp_integration.py +340 -0
  80. runbooks/finops/enhanced_progress.py +32 -29
  81. runbooks/finops/enhanced_trend_visualization.py +3 -2
  82. runbooks/finops/enterprise_wrappers.py +223 -285
  83. runbooks/finops/executive_export.py +203 -160
  84. runbooks/finops/helpers.py +130 -288
  85. runbooks/finops/iam_guidance.py +1 -1
  86. runbooks/finops/infrastructure/__init__.py +80 -0
  87. runbooks/finops/infrastructure/commands.py +506 -0
  88. runbooks/finops/infrastructure/load_balancer_optimizer.py +866 -0
  89. runbooks/finops/infrastructure/vpc_endpoint_optimizer.py +832 -0
  90. runbooks/finops/markdown_exporter.py +337 -174
  91. runbooks/finops/mcp_validator.py +1952 -0
  92. runbooks/finops/nat_gateway_optimizer.py +1512 -481
  93. runbooks/finops/network_cost_optimizer.py +657 -587
  94. runbooks/finops/notebook_utils.py +226 -188
  95. runbooks/finops/optimization_engine.py +1136 -0
  96. runbooks/finops/optimizer.py +19 -23
  97. runbooks/finops/rds_snapshot_optimizer.py +367 -411
  98. runbooks/finops/reservation_optimizer.py +427 -363
  99. runbooks/finops/scenario_cli_integration.py +64 -65
  100. runbooks/finops/scenarios.py +1277 -438
  101. runbooks/finops/schemas.py +218 -182
  102. runbooks/finops/snapshot_manager.py +2289 -0
  103. runbooks/finops/types.py +3 -3
  104. runbooks/finops/validation_framework.py +259 -265
  105. runbooks/finops/vpc_cleanup_exporter.py +189 -144
  106. runbooks/finops/vpc_cleanup_optimizer.py +591 -573
  107. runbooks/finops/workspaces_analyzer.py +171 -182
  108. runbooks/integration/__init__.py +89 -0
  109. runbooks/integration/mcp_integration.py +1920 -0
  110. runbooks/inventory/CLAUDE.md +816 -0
  111. runbooks/inventory/__init__.py +2 -2
  112. runbooks/inventory/aws_decorators.py +2 -3
  113. runbooks/inventory/check_cloudtrail_compliance.py +2 -4
  114. runbooks/inventory/check_controltower_readiness.py +152 -151
  115. runbooks/inventory/check_landingzone_readiness.py +85 -84
  116. runbooks/inventory/cloud_foundations_integration.py +144 -149
  117. runbooks/inventory/collectors/aws_comprehensive.py +1 -1
  118. runbooks/inventory/collectors/aws_networking.py +109 -99
  119. runbooks/inventory/collectors/base.py +4 -0
  120. runbooks/inventory/core/collector.py +495 -313
  121. runbooks/inventory/core/formatter.py +11 -0
  122. runbooks/inventory/draw_org_structure.py +8 -9
  123. runbooks/inventory/drift_detection_cli.py +69 -96
  124. runbooks/inventory/ec2_vpc_utils.py +2 -2
  125. runbooks/inventory/find_cfn_drift_detection.py +5 -7
  126. runbooks/inventory/find_cfn_orphaned_stacks.py +7 -9
  127. runbooks/inventory/find_cfn_stackset_drift.py +5 -6
  128. runbooks/inventory/find_ec2_security_groups.py +48 -42
  129. runbooks/inventory/find_landingzone_versions.py +4 -6
  130. runbooks/inventory/find_vpc_flow_logs.py +7 -9
  131. runbooks/inventory/inventory_mcp_cli.py +48 -46
  132. runbooks/inventory/inventory_modules.py +103 -91
  133. runbooks/inventory/list_cfn_stacks.py +9 -10
  134. runbooks/inventory/list_cfn_stackset_operation_results.py +1 -3
  135. runbooks/inventory/list_cfn_stackset_operations.py +79 -57
  136. runbooks/inventory/list_cfn_stacksets.py +8 -10
  137. runbooks/inventory/list_config_recorders_delivery_channels.py +49 -39
  138. runbooks/inventory/list_ds_directories.py +65 -53
  139. runbooks/inventory/list_ec2_availability_zones.py +2 -4
  140. runbooks/inventory/list_ec2_ebs_volumes.py +32 -35
  141. runbooks/inventory/list_ec2_instances.py +23 -28
  142. runbooks/inventory/list_ecs_clusters_and_tasks.py +26 -34
  143. runbooks/inventory/list_elbs_load_balancers.py +22 -20
  144. runbooks/inventory/list_enis_network_interfaces.py +26 -33
  145. runbooks/inventory/list_guardduty_detectors.py +2 -4
  146. runbooks/inventory/list_iam_policies.py +2 -4
  147. runbooks/inventory/list_iam_roles.py +5 -7
  148. runbooks/inventory/list_iam_saml_providers.py +4 -6
  149. runbooks/inventory/list_lambda_functions.py +38 -38
  150. runbooks/inventory/list_org_accounts.py +6 -8
  151. runbooks/inventory/list_org_accounts_users.py +55 -44
  152. runbooks/inventory/list_rds_db_instances.py +31 -33
  153. runbooks/inventory/list_rds_snapshots_aggregator.py +192 -208
  154. runbooks/inventory/list_route53_hosted_zones.py +3 -5
  155. runbooks/inventory/list_servicecatalog_provisioned_products.py +37 -41
  156. runbooks/inventory/list_sns_topics.py +2 -4
  157. runbooks/inventory/list_ssm_parameters.py +4 -7
  158. runbooks/inventory/list_vpc_subnets.py +2 -4
  159. runbooks/inventory/list_vpcs.py +7 -10
  160. runbooks/inventory/mcp_inventory_validator.py +554 -468
  161. runbooks/inventory/mcp_vpc_validator.py +359 -442
  162. runbooks/inventory/organizations_discovery.py +63 -55
  163. runbooks/inventory/recover_cfn_stack_ids.py +7 -8
  164. runbooks/inventory/requirements.txt +0 -1
  165. runbooks/inventory/rich_inventory_display.py +35 -34
  166. runbooks/inventory/run_on_multi_accounts.py +3 -5
  167. runbooks/inventory/unified_validation_engine.py +281 -253
  168. runbooks/inventory/verify_ec2_security_groups.py +1 -1
  169. runbooks/inventory/vpc_analyzer.py +735 -697
  170. runbooks/inventory/vpc_architecture_validator.py +293 -348
  171. runbooks/inventory/vpc_dependency_analyzer.py +384 -380
  172. runbooks/inventory/vpc_flow_analyzer.py +1 -1
  173. runbooks/main.py +49 -34
  174. runbooks/main_final.py +91 -60
  175. runbooks/main_minimal.py +22 -10
  176. runbooks/main_optimized.py +131 -100
  177. runbooks/main_ultra_minimal.py +7 -2
  178. runbooks/mcp/__init__.py +36 -0
  179. runbooks/mcp/integration.py +679 -0
  180. runbooks/monitoring/performance_monitor.py +9 -4
  181. runbooks/operate/dynamodb_operations.py +3 -1
  182. runbooks/operate/ec2_operations.py +145 -137
  183. runbooks/operate/iam_operations.py +146 -152
  184. runbooks/operate/networking_cost_heatmap.py +29 -8
  185. runbooks/operate/rds_operations.py +223 -254
  186. runbooks/operate/s3_operations.py +107 -118
  187. runbooks/operate/vpc_operations.py +646 -616
  188. runbooks/remediation/base.py +1 -1
  189. runbooks/remediation/commons.py +10 -7
  190. runbooks/remediation/commvault_ec2_analysis.py +70 -66
  191. runbooks/remediation/ec2_unattached_ebs_volumes.py +1 -0
  192. runbooks/remediation/multi_account.py +24 -21
  193. runbooks/remediation/rds_snapshot_list.py +86 -60
  194. runbooks/remediation/remediation_cli.py +92 -146
  195. runbooks/remediation/universal_account_discovery.py +83 -79
  196. runbooks/remediation/workspaces_list.py +46 -41
  197. runbooks/security/__init__.py +19 -0
  198. runbooks/security/assessment_runner.py +1150 -0
  199. runbooks/security/baseline_checker.py +812 -0
  200. runbooks/security/cloudops_automation_security_validator.py +509 -535
  201. runbooks/security/compliance_automation_engine.py +17 -17
  202. runbooks/security/config/__init__.py +2 -2
  203. runbooks/security/config/compliance_config.py +50 -50
  204. runbooks/security/config_template_generator.py +63 -76
  205. runbooks/security/enterprise_security_framework.py +1 -1
  206. runbooks/security/executive_security_dashboard.py +519 -508
  207. runbooks/security/multi_account_security_controls.py +959 -1210
  208. runbooks/security/real_time_security_monitor.py +422 -444
  209. runbooks/security/security_baseline_tester.py +1 -1
  210. runbooks/security/security_cli.py +143 -112
  211. runbooks/security/test_2way_validation.py +439 -0
  212. runbooks/security/two_way_validation_framework.py +852 -0
  213. runbooks/sre/production_monitoring_framework.py +167 -177
  214. runbooks/tdd/__init__.py +15 -0
  215. runbooks/tdd/cli.py +1071 -0
  216. runbooks/utils/__init__.py +14 -17
  217. runbooks/utils/logger.py +7 -2
  218. runbooks/utils/version_validator.py +50 -47
  219. runbooks/validation/__init__.py +6 -6
  220. runbooks/validation/cli.py +9 -3
  221. runbooks/validation/comprehensive_2way_validator.py +745 -704
  222. runbooks/validation/mcp_validator.py +906 -228
  223. runbooks/validation/terraform_citations_validator.py +104 -115
  224. runbooks/validation/terraform_drift_detector.py +461 -454
  225. runbooks/vpc/README.md +617 -0
  226. runbooks/vpc/__init__.py +8 -1
  227. runbooks/vpc/analyzer.py +577 -0
  228. runbooks/vpc/cleanup_wrapper.py +476 -413
  229. runbooks/vpc/cli_cloudtrail_commands.py +339 -0
  230. runbooks/vpc/cli_mcp_validation_commands.py +480 -0
  231. runbooks/vpc/cloudtrail_audit_integration.py +717 -0
  232. runbooks/vpc/config.py +92 -97
  233. runbooks/vpc/cost_engine.py +411 -148
  234. runbooks/vpc/cost_explorer_integration.py +553 -0
  235. runbooks/vpc/cross_account_session.py +101 -106
  236. runbooks/vpc/enhanced_mcp_validation.py +917 -0
  237. runbooks/vpc/eni_gate_validator.py +961 -0
  238. runbooks/vpc/heatmap_engine.py +185 -160
  239. runbooks/vpc/mcp_no_eni_validator.py +680 -639
  240. runbooks/vpc/nat_gateway_optimizer.py +358 -0
  241. runbooks/vpc/networking_wrapper.py +15 -8
  242. runbooks/vpc/pdca_remediation_planner.py +528 -0
  243. runbooks/vpc/performance_optimized_analyzer.py +219 -231
  244. runbooks/vpc/runbooks_adapter.py +1167 -241
  245. runbooks/vpc/tdd_red_phase_stubs.py +601 -0
  246. runbooks/vpc/test_data_loader.py +358 -0
  247. runbooks/vpc/tests/conftest.py +314 -4
  248. runbooks/vpc/tests/test_cleanup_framework.py +1022 -0
  249. runbooks/vpc/tests/test_cost_engine.py +0 -2
  250. runbooks/vpc/topology_generator.py +326 -0
  251. runbooks/vpc/unified_scenarios.py +1297 -1124
  252. runbooks/vpc/vpc_cleanup_integration.py +1943 -1115
  253. runbooks-1.1.6.dist-info/METADATA +327 -0
  254. runbooks-1.1.6.dist-info/RECORD +489 -0
  255. runbooks/finops/README.md +0 -414
  256. runbooks/finops/accuracy_cross_validator.py +0 -647
  257. runbooks/finops/business_cases.py +0 -950
  258. runbooks/finops/dashboard_router.py +0 -922
  259. runbooks/finops/ebs_optimizer.py +0 -973
  260. runbooks/finops/embedded_mcp_validator.py +0 -1629
  261. runbooks/finops/enhanced_dashboard_runner.py +0 -527
  262. runbooks/finops/finops_dashboard.py +0 -584
  263. runbooks/finops/finops_scenarios.py +0 -1218
  264. runbooks/finops/legacy_migration.py +0 -730
  265. runbooks/finops/multi_dashboard.py +0 -1519
  266. runbooks/finops/single_dashboard.py +0 -1113
  267. runbooks/finops/unlimited_scenarios.py +0 -393
  268. runbooks-1.1.4.dist-info/METADATA +0 -800
  269. runbooks-1.1.4.dist-info/RECORD +0 -468
  270. {runbooks-1.1.4.dist-info → runbooks-1.1.6.dist-info}/WHEEL +0 -0
  271. {runbooks-1.1.4.dist-info → runbooks-1.1.6.dist-info}/entry_points.txt +0 -0
  272. {runbooks-1.1.4.dist-info → runbooks-1.1.6.dist-info}/licenses/LICENSE +0 -0
  273. {runbooks-1.1.4.dist-info → runbooks-1.1.6.dist-info}/top_level.txt +0 -0
@@ -2,7 +2,7 @@
2
2
  🏗️ CloudOps-Automation Enterprise Wrappers Module
3
3
  Enterprise-Specific Pattern Implementations for CloudOps Consolidation
4
4
 
5
- Strategic Achievement: Enterprise wrapper patterns enabling seamless integration
5
+ Strategic Achievement: Enterprise wrapper patterns enabling seamless integration
6
6
  of 67+ legacy notebooks into unified modular architecture with FAANG naming conventions.
7
7
 
8
8
  Module Focus: Provide enterprise-specific wrappers and integration patterns that
@@ -16,34 +16,42 @@ Key Features:
16
16
  - Enterprise CLI wrapper interfaces
17
17
  - Business stakeholder interface adapters
18
18
 
19
- Author: Enterprise Agile Team (6-Agent Coordination)
19
+ Author: Enterprise Agile Team (6-Agent Coordination)
20
20
  Version: latest version - Distributed Architecture Framework
21
21
  """
22
22
 
23
- import os
24
23
  import json
25
- from typing import Dict, List, Optional, Any, Union, Callable
24
+ import os
25
+ from abc import ABC, abstractmethod
26
26
  from dataclasses import dataclass, field
27
- from enum import Enum
28
27
  from datetime import datetime
29
- from abc import ABC, abstractmethod
28
+ from enum import Enum
29
+ from typing import Any, Callable, Dict, List, Optional, Union
30
30
 
31
31
  from ..common.rich_utils import (
32
- console, print_header, print_success, print_warning, print_error,
33
- create_table, create_progress_bar, format_cost
32
+ console,
33
+ create_progress_bar,
34
+ create_table,
35
+ format_cost,
36
+ print_error,
37
+ print_header,
38
+ print_success,
39
+ print_warning,
34
40
  )
35
41
 
36
42
 
37
43
  class EnterpriseSize(Enum):
38
44
  """Enterprise size classification for wrapper adaptation."""
39
- STARTUP = "startup" # <100 employees, simple configurations
40
- SMB = "small_medium" # 100-1000 employees, moderate complexity
41
- ENTERPRISE = "enterprise" # 1000-10000 employees, complex environments
42
- GLOBAL = "global" # >10000 employees, multi-region complexity
45
+
46
+ STARTUP = "startup" # <100 employees, simple configurations
47
+ SMB = "small_medium" # 100-1000 employees, moderate complexity
48
+ ENTERPRISE = "enterprise" # 1000-10000 employees, complex environments
49
+ GLOBAL = "global" # >10000 employees, multi-region complexity
43
50
 
44
51
 
45
52
  class ComplianceFramework(Enum):
46
53
  """Compliance frameworks supported by enterprise wrappers."""
54
+
47
55
  SOC2 = "soc2"
48
56
  PCI_DSS = "pci_dss"
49
57
  HIPAA = "hipaa"
@@ -55,15 +63,17 @@ class ComplianceFramework(Enum):
55
63
 
56
64
  class IntegrationPattern(Enum):
57
65
  """Integration patterns for legacy notebook consolidation."""
58
- DIRECT_MIGRATION = "direct_migration" # Direct 1:1 notebook → module
59
- BUSINESS_EXTRACTION = "business_extraction" # Extract business logic only
60
- WRAPPER_ADAPTATION = "wrapper_adaptation" # Wrap existing logic
61
- HYBRID_CONSOLIDATION = "hybrid_consolidation" # Mix multiple notebooks
66
+
67
+ DIRECT_MIGRATION = "direct_migration" # Direct 1:1 notebook → module
68
+ BUSINESS_EXTRACTION = "business_extraction" # Extract business logic only
69
+ WRAPPER_ADAPTATION = "wrapper_adaptation" # Wrap existing logic
70
+ HYBRID_CONSOLIDATION = "hybrid_consolidation" # Mix multiple notebooks
62
71
 
63
72
 
64
73
  @dataclass
65
74
  class EnterpriseConfiguration:
66
75
  """Enterprise-specific configuration for wrapper adaptation."""
76
+
67
77
  organization_name: str
68
78
  enterprise_size: EnterpriseSize
69
79
  compliance_frameworks: List[ComplianceFramework]
@@ -74,21 +84,22 @@ class EnterpriseConfiguration:
74
84
  naming_conventions: Dict[str, str] # resource_type -> naming_pattern
75
85
  business_hours: Dict[str, str] # timezone and hours configuration
76
86
  risk_tolerance: str # low, medium, high
77
-
87
+
78
88
  # FAANG naming enforcement
79
89
  faang_naming_enabled: bool = True
80
90
  traceability_required: bool = True
81
91
  executive_reporting: bool = True
82
-
92
+
83
93
  # Legacy integration settings
84
94
  legacy_notebook_path: Optional[str] = None
85
95
  migration_batch_size: int = 5
86
96
  validation_threshold: float = 99.5 # MCP validation accuracy
87
97
 
88
98
 
89
- @dataclass
99
+ @dataclass
90
100
  class WrapperResult:
91
101
  """Standardized result format for enterprise wrapper operations."""
102
+
92
103
  operation_name: str
93
104
  execution_status: str # success, warning, error, skipped
94
105
  business_impact: Dict[str, Any]
@@ -104,74 +115,62 @@ class WrapperResult:
104
115
  class EnterpriseWrapper(ABC):
105
116
  """
106
117
  Abstract base class for enterprise-specific CloudOps automation wrappers.
107
-
118
+
108
119
  Provides standardized interface for adapting CloudOps-Automation patterns
109
120
  to different enterprise environments while maintaining FAANG naming and
110
121
  traceability requirements.
111
122
  """
112
-
123
+
113
124
  def __init__(self, config: EnterpriseConfiguration):
114
125
  """Initialize enterprise wrapper with configuration."""
115
126
  self.config = config
116
127
  self.execution_history: List[WrapperResult] = []
117
128
  self.compliance_validator = ComplianceValidator(config.compliance_frameworks)
118
-
129
+
119
130
  @abstractmethod
120
- def execute_wrapper_operation(
121
- self,
122
- operation_params: Dict[str, Any],
123
- dry_run: bool = True
124
- ) -> WrapperResult:
131
+ def execute_wrapper_operation(self, operation_params: Dict[str, Any], dry_run: bool = True) -> WrapperResult:
125
132
  """Execute enterprise-wrapped operation with standardized result."""
126
133
  pass
127
-
134
+
128
135
  def validate_enterprise_compliance(self, operation_result: WrapperResult) -> bool:
129
136
  """Validate operation result against enterprise compliance requirements."""
130
137
  return self.compliance_validator.validate_result(operation_result)
131
-
132
- def generate_faang_naming(
133
- self,
134
- resource_type: str,
135
- business_context: str
136
- ) -> str:
138
+
139
+ def generate_faang_naming(self, resource_type: str, business_context: str) -> str:
137
140
  """
138
141
  Generate FAANG-compliant naming with traceability.
139
-
142
+
140
143
  Pattern: {organization}_{resource_type}_{business_context}_{timestamp}
141
144
  Example: acme_ebs_cost_optimizer_20241201
142
145
  """
143
146
  if not self.config.faang_naming_enabled:
144
147
  return f"{resource_type}_{business_context}"
145
-
148
+
146
149
  timestamp = datetime.now().strftime("%Y%m%d")
147
- org_prefix = self.config.organization_name.lower().replace(' ', '_')
148
-
150
+ org_prefix = self.config.organization_name.lower().replace(" ", "_")
151
+
149
152
  faang_name = f"{org_prefix}_{resource_type}_{business_context}_{timestamp}"
150
-
153
+
151
154
  # Validate against enterprise naming conventions
152
155
  if resource_type in self.config.naming_conventions:
153
156
  pattern = self.config.naming_conventions[resource_type]
154
157
  if not self._validate_naming_pattern(faang_name, pattern):
155
158
  print_warning(f"Generated name '{faang_name}' doesn't match pattern '{pattern}'")
156
-
159
+
157
160
  return faang_name
158
-
161
+
159
162
  def _validate_naming_pattern(self, name: str, pattern: str) -> bool:
160
163
  """Validate generated name against enterprise pattern."""
161
164
  # Simple pattern validation - can be enhanced with regex
162
- required_components = pattern.split('_')
163
- name_components = name.split('_')
164
-
165
+ required_components = pattern.split("_")
166
+ name_components = name.split("_")
167
+
165
168
  return len(name_components) >= len(required_components)
166
-
167
- def create_traceability_record(
168
- self,
169
- operation: str,
170
- source_notebook: Optional[str] = None
171
- ) -> str:
169
+
170
+ def create_traceability_record(self, operation: str, source_notebook: Optional[str] = None) -> str:
172
171
  """Create traceability record for enterprise audit requirements."""
173
172
  traceability_id = f"{self.config.organization_name}_{operation}_{datetime.now().strftime('%Y%m%d_%H%M%S')}"
174
-
173
+
175
174
  if self.config.traceability_required:
176
175
  traceability_record = {
177
176
  "id": traceability_id,
@@ -180,68 +179,60 @@ class EnterpriseWrapper(ABC):
180
179
  "enterprise": self.config.organization_name,
181
180
  "timestamp": datetime.now().isoformat(),
182
181
  "compliance_frameworks": [f.value for f in self.config.compliance_frameworks],
183
- "executor": "CloudOps-Automation-Enterprise-Wrapper"
182
+ "executor": "CloudOps-Automation-Enterprise-Wrapper",
184
183
  }
185
-
184
+
186
185
  # Store traceability record (implementation depends on enterprise requirements)
187
186
  self._store_traceability_record(traceability_record)
188
-
187
+
189
188
  return traceability_id
190
-
189
+
191
190
  def _store_traceability_record(self, record: Dict[str, Any]) -> None:
192
191
  """Store traceability record according to enterprise requirements."""
193
192
  # Default implementation - enterprises can override
194
193
  artifacts_dir = "./tmp/enterprise_traceability"
195
194
  os.makedirs(artifacts_dir, exist_ok=True)
196
-
195
+
197
196
  record_path = f"{artifacts_dir}/{record['id']}.json"
198
- with open(record_path, 'w') as f:
197
+ with open(record_path, "w") as f:
199
198
  json.dump(record, f, indent=2)
200
199
 
201
200
 
202
201
  class CostOptimizationWrapper(EnterpriseWrapper):
203
202
  """
204
203
  Enterprise wrapper for cost optimization operations.
205
-
204
+
206
205
  Consolidates 18 cost optimization notebooks with enterprise-specific
207
206
  adaptations and FAANG naming conventions.
208
207
  """
209
-
208
+
210
209
  def __init__(self, config: EnterpriseConfiguration):
211
210
  """Initialize cost optimization wrapper."""
212
211
  super().__init__(config)
213
212
  self.supported_operations = [
214
213
  "ebs_volume_optimization",
215
- "nat_gateway_consolidation",
214
+ "nat_gateway_consolidation",
216
215
  "elastic_ip_cleanup",
217
216
  "ec2_rightsizing",
218
- "reserved_instance_planning"
217
+ "reserved_instance_planning",
219
218
  ]
220
-
221
- def execute_wrapper_operation(
222
- self,
223
- operation_params: Dict[str, Any],
224
- dry_run: bool = True
225
- ) -> WrapperResult:
219
+
220
+ def execute_wrapper_operation(self, operation_params: Dict[str, Any], dry_run: bool = True) -> WrapperResult:
226
221
  """
227
222
  Execute cost optimization with enterprise integration.
228
-
223
+
229
224
  Supports operations: ebs_optimization, nat_gateway_cleanup, elastic_ip_management
230
225
  """
231
226
  operation_type = operation_params.get("operation_type")
232
-
227
+
233
228
  if operation_type not in self.supported_operations:
234
229
  return self._create_error_result(
235
- operation_type or "unknown",
236
- f"Unsupported operation. Supported: {', '.join(self.supported_operations)}"
230
+ operation_type or "unknown", f"Unsupported operation. Supported: {', '.join(self.supported_operations)}"
237
231
  )
238
-
232
+
239
233
  # Create traceability record
240
- traceability_id = self.create_traceability_record(
241
- operation_type,
242
- operation_params.get("source_notebook")
243
- )
244
-
234
+ traceability_id = self.create_traceability_record(operation_type, operation_params.get("source_notebook"))
235
+
245
236
  try:
246
237
  # Execute operation based on type
247
238
  if operation_type == "ebs_volume_optimization":
@@ -252,34 +243,30 @@ class CostOptimizationWrapper(EnterpriseWrapper):
252
243
  result = self._execute_elastic_ip_cleanup(operation_params, dry_run)
253
244
  else:
254
245
  result = self._execute_generic_cost_optimization(operation_params, dry_run)
255
-
246
+
256
247
  # Add traceability and compliance validation
257
248
  result.traceability_id = traceability_id
258
249
  result.compliance_status = self._validate_compliance_for_result(result)
259
-
250
+
260
251
  # Store execution history
261
252
  self.execution_history.append(result)
262
-
253
+
263
254
  return result
264
-
255
+
265
256
  except Exception as e:
266
257
  return self._create_error_result(operation_type, str(e), traceability_id)
267
-
268
- def _execute_ebs_optimization(
269
- self,
270
- params: Dict[str, Any],
271
- dry_run: bool
272
- ) -> WrapperResult:
258
+
259
+ def _execute_ebs_optimization(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
273
260
  """Execute EBS volume optimization with enterprise patterns."""
274
-
261
+
275
262
  print_header("EBS Volume Cost Optimization", "Enterprise Wrapper latest version")
276
-
263
+
277
264
  # Enterprise-specific profile resolution
278
265
  aws_profile = self._resolve_enterprise_profile("cost_optimization")
279
-
266
+
280
267
  # Generate FAANG naming for operation
281
268
  operation_name = self.generate_faang_naming("ebs", "cost_optimizer")
282
-
269
+
283
270
  # Execute real EBS analysis via runbooks CLI
284
271
  try:
285
272
  from ..finops.ebs_cost_optimizer import EBSCostOptimizer
@@ -308,8 +295,8 @@ class CostOptimizationWrapper(EnterpriseWrapper):
308
295
  progress.update(task, advance=10, description="Generating recommendations...")
309
296
 
310
297
  # Calculate actual savings from results
311
- total_savings = sum(float(r.get('annual_savings', 0)) for r in optimization_results)
312
- total_volumes = sum(int(r.get('volumes_analyzed', 0)) for r in optimization_results)
298
+ total_savings = sum(float(r.get("annual_savings", 0)) for r in optimization_results)
299
+ total_volumes = sum(int(r.get("volumes_analyzed", 0)) for r in optimization_results)
313
300
 
314
301
  except Exception as e:
315
302
  console.print(f"[red]❌ EBS analysis failed: {e}[/red]")
@@ -322,36 +309,38 @@ class CostOptimizationWrapper(EnterpriseWrapper):
322
309
  "annual_savings_usd": estimated_savings,
323
310
  "cost_reduction_percentage": (estimated_savings / max(params.get("current_spend", 1), 1)) * 100,
324
311
  "volumes_analyzed": total_volumes,
325
- "optimization_candidates": len([r for r in optimization_results if r.get('optimization_opportunities', 0) > 0]),
326
- "roi_percentage": (estimated_savings / max(params.get("implementation_cost", 1000), 1000)) * 100
312
+ "optimization_candidates": len(
313
+ [r for r in optimization_results if r.get("optimization_opportunities", 0) > 0]
314
+ ),
315
+ "roi_percentage": (estimated_savings / max(params.get("implementation_cost", 1000), 1000)) * 100,
327
316
  }
328
-
317
+
329
318
  # Technical details
330
319
  technical_details = {
331
320
  "aws_profile_used": aws_profile,
332
321
  "regions_analyzed": ["us-east-1", "us-west-2", "eu-west-1"],
333
322
  "analysis_method": "GP2 to GP3 cost comparison with performance analysis",
334
- "dry_run_executed": dry_run
323
+ "dry_run_executed": dry_run,
335
324
  }
336
-
325
+
337
326
  # Recommendations
338
327
  recommendations = [
339
328
  f"Migrate 89 GP2 volumes to GP3 for ${estimated_savings:,} annual savings",
340
329
  "Schedule migration during maintenance windows to minimize impact",
341
330
  "Monitor performance metrics post-migration for 30 days",
342
- "Implement automated GP3 selection for new volume creation"
331
+ "Implement automated GP3 selection for new volume creation",
343
332
  ]
344
-
333
+
345
334
  # Next steps
346
335
  next_steps = [
347
336
  "Review volume list with infrastructure team",
348
337
  "Schedule pilot migration for 10 volumes",
349
338
  "Create migration runbook and rollback procedures",
350
- "Execute full migration plan with approval"
339
+ "Execute full migration plan with approval",
351
340
  ]
352
-
341
+
353
342
  print_success(f"EBS Optimization Analysis Complete: ${estimated_savings:,} potential savings")
354
-
343
+
355
344
  return WrapperResult(
356
345
  operation_name=operation_name,
357
346
  execution_status="success",
@@ -362,51 +351,47 @@ class CostOptimizationWrapper(EnterpriseWrapper):
362
351
  next_steps=next_steps,
363
352
  evidence_artifacts=[f"./tmp/{operation_name}_analysis.json"],
364
353
  execution_timestamp=datetime.now().isoformat(),
365
- traceability_id="" # Will be set by caller
354
+ traceability_id="", # Will be set by caller
366
355
  )
367
-
368
- def _execute_nat_gateway_optimization(
369
- self,
370
- params: Dict[str, Any],
371
- dry_run: bool
372
- ) -> WrapperResult:
356
+
357
+ def _execute_nat_gateway_optimization(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
373
358
  """Execute NAT Gateway consolidation with enterprise patterns."""
374
-
359
+
375
360
  print_header("NAT Gateway Cost Optimization", "Enterprise Wrapper latest version")
376
-
361
+
377
362
  aws_profile = self._resolve_enterprise_profile("network_optimization")
378
363
  operation_name = self.generate_faang_naming("nat_gateway", "consolidation_engine")
379
-
364
+
380
365
  # Real NAT Gateway analysis implementation
381
366
  estimated_savings = params.get("projected_savings", 240000) # $240K example
382
-
367
+
383
368
  business_impact = {
384
369
  "annual_savings_usd": estimated_savings,
385
370
  "monthly_cost_reduction": estimated_savings // 12,
386
371
  "nat_gateways_analyzed": 45,
387
372
  "consolidation_opportunities": 18,
388
- "network_efficiency_gain": "35%"
373
+ "network_efficiency_gain": "35%",
389
374
  }
390
-
375
+
391
376
  technical_details = {
392
377
  "aws_profile_used": aws_profile,
393
378
  "cross_region_analysis": True,
394
379
  "traffic_pattern_analysis": "30-day average utilization",
395
- "consolidation_strategy": "Multi-AZ optimization with redundancy preservation"
380
+ "consolidation_strategy": "Multi-AZ optimization with redundancy preservation",
396
381
  }
397
-
382
+
398
383
  recommendations = [
399
384
  f"Consolidate 18 underutilized NAT Gateways for ${estimated_savings:,} annual savings",
400
- "Implement cross-AZ traffic routing optimization",
385
+ "Implement cross-AZ traffic routing optimization",
401
386
  "Establish NAT Gateway utilization monitoring and alerting",
402
- "Create automated rightsizing policies for future deployments"
387
+ "Create automated rightsizing policies for future deployments",
403
388
  ]
404
-
389
+
405
390
  print_success(f"NAT Gateway Optimization Complete: ${estimated_savings:,} potential savings")
406
-
391
+
407
392
  return WrapperResult(
408
393
  operation_name=operation_name,
409
- execution_status="success",
394
+ execution_status="success",
410
395
  business_impact=business_impact,
411
396
  technical_details=technical_details,
412
397
  compliance_status={},
@@ -414,71 +399,63 @@ class CostOptimizationWrapper(EnterpriseWrapper):
414
399
  next_steps=["Review consolidation plan", "Execute pilot consolidation", "Monitor network performance"],
415
400
  evidence_artifacts=[f"./tmp/{operation_name}_analysis.json"],
416
401
  execution_timestamp=datetime.now().isoformat(),
417
- traceability_id=""
402
+ traceability_id="",
418
403
  )
419
-
420
- def _execute_elastic_ip_cleanup(
421
- self,
422
- params: Dict[str, Any],
423
- dry_run: bool
424
- ) -> WrapperResult:
404
+
405
+ def _execute_elastic_ip_cleanup(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
425
406
  """Execute Elastic IP cleanup with enterprise patterns."""
426
-
407
+
427
408
  print_header("Elastic IP Resource Optimization", "Enterprise Wrapper latest version")
428
-
429
- aws_profile = self._resolve_enterprise_profile("resource_cleanup")
409
+
410
+ aws_profile = self._resolve_enterprise_profile("resource_cleanup")
430
411
  operation_name = self.generate_faang_naming("elastic_ip", "efficiency_analyzer")
431
-
412
+
432
413
  # Real Elastic IP analysis implementation
433
414
  estimated_savings = params.get("projected_savings", 180000) # $180K example
434
-
415
+
435
416
  business_impact = {
436
417
  "annual_savings_usd": estimated_savings,
437
418
  "monthly_ip_cost_reduction": estimated_savings // 12,
438
419
  "unattached_ips_found": 125,
439
420
  "optimization_percentage": "78%",
440
- "cost_per_ip_monthly": 3.60 # Current AWS pricing
421
+ "cost_per_ip_monthly": 3.60, # Current AWS pricing
441
422
  }
442
-
423
+
443
424
  technical_details = {
444
425
  "aws_profile_used": aws_profile,
445
426
  "regions_scanned": ["us-east-1", "us-west-2", "eu-central-1", "ap-southeast-1"],
446
427
  "analysis_criteria": "Unattached for >7 days, no recent association history",
447
- "safety_validation": "Business hours check, tag-based protection"
428
+ "safety_validation": "Business hours check, tag-based protection",
448
429
  }
449
-
430
+
450
431
  recommendations = [
451
432
  f"Release 125 unattached Elastic IPs for ${estimated_savings:,} annual savings",
452
433
  "Implement automated IP lifecycle management policies",
453
434
  "Create IP usage monitoring and alerting",
454
- "Establish monthly IP optimization reviews"
435
+ "Establish monthly IP optimization reviews",
455
436
  ]
456
-
437
+
457
438
  print_success(f"Elastic IP Analysis Complete: ${estimated_savings:,} potential savings")
458
-
439
+
459
440
  return WrapperResult(
460
441
  operation_name=operation_name,
461
442
  execution_status="success",
462
- business_impact=business_impact,
443
+ business_impact=business_impact,
463
444
  technical_details=technical_details,
464
445
  compliance_status={},
465
446
  recommendations=recommendations,
466
447
  next_steps=["Validate IP release list", "Execute cleanup in batches", "Monitor for impacts"],
467
448
  evidence_artifacts=[f"./tmp/{operation_name}_analysis.json"],
468
449
  execution_timestamp=datetime.now().isoformat(),
469
- traceability_id=""
450
+ traceability_id="",
470
451
  )
471
-
472
- def _execute_generic_cost_optimization(
473
- self,
474
- params: Dict[str, Any],
475
- dry_run: bool
476
- ) -> WrapperResult:
452
+
453
+ def _execute_generic_cost_optimization(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
477
454
  """Execute generic cost optimization for other operations."""
478
-
455
+
479
456
  operation_type = params.get("operation_type", "generic_optimization")
480
457
  operation_name = self.generate_faang_naming("cost", operation_type)
481
-
458
+
482
459
  return WrapperResult(
483
460
  operation_name=operation_name,
484
461
  execution_status="success",
@@ -489,26 +466,26 @@ class CostOptimizationWrapper(EnterpriseWrapper):
489
466
  next_steps=["Implement optimization plan"],
490
467
  evidence_artifacts=[],
491
468
  execution_timestamp=datetime.now().isoformat(),
492
- traceability_id=""
469
+ traceability_id="",
493
470
  )
494
-
471
+
495
472
  def _resolve_enterprise_profile(self, operation_category: str) -> str:
496
473
  """Resolve AWS profile based on enterprise configuration and operation."""
497
474
  # Default profile mapping
498
475
  profile_mapping = {
499
476
  "cost_optimization": "billing",
500
- "network_optimization": "operational",
477
+ "network_optimization": "operational",
501
478
  "resource_cleanup": "operational",
502
- "security_analysis": "management"
479
+ "security_analysis": "management",
503
480
  }
504
-
481
+
505
482
  operation_type = profile_mapping.get(operation_category, "operational")
506
483
  return self.config.aws_profiles.get(operation_type, "default")
507
-
484
+
508
485
  def _validate_compliance_for_result(self, result: WrapperResult) -> Dict[ComplianceFramework, bool]:
509
486
  """Validate operation result against compliance frameworks."""
510
487
  compliance_status = {}
511
-
488
+
512
489
  for framework in self.config.compliance_frameworks:
513
490
  # Simplified compliance validation
514
491
  if framework == ComplianceFramework.SOC2:
@@ -517,15 +494,10 @@ class CostOptimizationWrapper(EnterpriseWrapper):
517
494
  compliance_status[framework] = "cost_optimization" in result.operation_name
518
495
  else:
519
496
  compliance_status[framework] = True # Default pass
520
-
497
+
521
498
  return compliance_status
522
-
523
- def _create_error_result(
524
- self,
525
- operation: str,
526
- error_message: str,
527
- traceability_id: str = ""
528
- ) -> WrapperResult:
499
+
500
+ def _create_error_result(self, operation: str, error_message: str, traceability_id: str = "") -> WrapperResult:
529
501
  """Create standardized error result."""
530
502
  return WrapperResult(
531
503
  operation_name=f"error_{operation}",
@@ -537,55 +509,45 @@ class CostOptimizationWrapper(EnterpriseWrapper):
537
509
  next_steps=["Debug and retry operation"],
538
510
  evidence_artifacts=[],
539
511
  execution_timestamp=datetime.now().isoformat(),
540
- traceability_id=traceability_id
512
+ traceability_id=traceability_id,
541
513
  )
542
514
 
543
515
 
544
516
  class SecurityComplianceWrapper(EnterpriseWrapper):
545
517
  """
546
518
  Enterprise wrapper for security and compliance operations.
547
-
519
+
548
520
  Consolidates 15 security notebooks with enterprise compliance integration.
549
521
  """
550
-
522
+
551
523
  def __init__(self, config: EnterpriseConfiguration):
552
524
  """Initialize security compliance wrapper."""
553
525
  super().__init__(config)
554
526
  self.supported_operations = [
555
527
  "s3_encryption_automation",
556
- "iam_security_baseline",
528
+ "iam_security_baseline",
557
529
  "access_key_rotation",
558
530
  "compliance_assessment",
559
- "governance_enforcement"
531
+ "governance_enforcement",
560
532
  ]
561
-
562
- def execute_wrapper_operation(
563
- self,
564
- operation_params: Dict[str, Any],
565
- dry_run: bool = True
566
- ) -> WrapperResult:
533
+
534
+ def execute_wrapper_operation(self, operation_params: Dict[str, Any], dry_run: bool = True) -> WrapperResult:
567
535
  """Execute security compliance operation with enterprise patterns."""
568
-
536
+
569
537
  operation_type = operation_params.get("operation_type")
570
-
538
+
571
539
  if operation_type not in self.supported_operations:
572
540
  return self._create_error_result(
573
541
  operation_type or "unknown",
574
- f"Unsupported security operation. Supported: {', '.join(self.supported_operations)}"
542
+ f"Unsupported security operation. Supported: {', '.join(self.supported_operations)}",
575
543
  )
576
-
544
+
577
545
  # Security operations require additional validation
578
546
  if not self._validate_security_permissions():
579
- return self._create_error_result(
580
- operation_type,
581
- "Insufficient security permissions for operation"
582
- )
583
-
584
- traceability_id = self.create_traceability_record(
585
- operation_type,
586
- operation_params.get("source_notebook")
587
- )
588
-
547
+ return self._create_error_result(operation_type, "Insufficient security permissions for operation")
548
+
549
+ traceability_id = self.create_traceability_record(operation_type, operation_params.get("source_notebook"))
550
+
589
551
  try:
590
552
  if operation_type == "s3_encryption_automation":
591
553
  result = self._execute_s3_encryption_automation(operation_params, dry_run)
@@ -593,57 +555,53 @@ class SecurityComplianceWrapper(EnterpriseWrapper):
593
555
  result = self._execute_iam_security_baseline(operation_params, dry_run)
594
556
  else:
595
557
  result = self._execute_generic_security_operation(operation_params, dry_run)
596
-
558
+
597
559
  result.traceability_id = traceability_id
598
560
  result.compliance_status = self._validate_security_compliance(result)
599
-
561
+
600
562
  self.execution_history.append(result)
601
563
  return result
602
-
564
+
603
565
  except Exception as e:
604
566
  return self._create_error_result(operation_type, str(e), traceability_id)
605
-
567
+
606
568
  def _validate_security_permissions(self) -> bool:
607
569
  """Validate that current credentials have required security permissions."""
608
570
  # Simplified validation - real implementation would check IAM permissions
609
571
  return True
610
-
611
- def _execute_s3_encryption_automation(
612
- self,
613
- params: Dict[str, Any],
614
- dry_run: bool
615
- ) -> WrapperResult:
572
+
573
+ def _execute_s3_encryption_automation(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
616
574
  """Execute S3 encryption automation with compliance validation."""
617
-
575
+
618
576
  print_header("S3 Bucket Encryption Automation", "Security Wrapper latest version")
619
-
577
+
620
578
  aws_profile = self._resolve_enterprise_profile("security_analysis")
621
579
  operation_name = self.generate_faang_naming("s3_security", "encryption_automation")
622
-
580
+
623
581
  # Real S3 encryption analysis implementation
624
582
  business_impact = {
625
583
  "buckets_analyzed": 245,
626
584
  "unencrypted_buckets": 23,
627
585
  "encryption_compliance_improvement": "94%",
628
- "risk_mitigation_value": "High - Data protection compliance"
586
+ "risk_mitigation_value": "High - Data protection compliance",
629
587
  }
630
-
588
+
631
589
  technical_details = {
632
590
  "aws_profile_used": aws_profile,
633
591
  "encryption_method": "AWS KMS with customer managed keys",
634
592
  "compliance_frameworks_validated": [f.value for f in self.config.compliance_frameworks],
635
- "bucket_policy_enforcement": "Deny unencrypted uploads"
593
+ "bucket_policy_enforcement": "Deny unencrypted uploads",
636
594
  }
637
-
595
+
638
596
  recommendations = [
639
597
  "Enable default encryption on 23 unencrypted S3 buckets",
640
598
  "Implement bucket policy enforcement for encryption requirements",
641
599
  "Create automated compliance monitoring for new buckets",
642
- "Establish quarterly encryption compliance reviews"
600
+ "Establish quarterly encryption compliance reviews",
643
601
  ]
644
-
602
+
645
603
  print_success("S3 Encryption Analysis Complete: 23 buckets require encryption")
646
-
604
+
647
605
  return WrapperResult(
648
606
  operation_name=operation_name,
649
607
  execution_status="success",
@@ -654,45 +612,41 @@ class SecurityComplianceWrapper(EnterpriseWrapper):
654
612
  next_steps=["Review encryption requirements", "Implement bucket encryption", "Validate compliance"],
655
613
  evidence_artifacts=[f"./tmp/{operation_name}_compliance_report.json"],
656
614
  execution_timestamp=datetime.now().isoformat(),
657
- traceability_id=""
615
+ traceability_id="",
658
616
  )
659
-
660
- def _execute_iam_security_baseline(
661
- self,
662
- params: Dict[str, Any],
663
- dry_run: bool
664
- ) -> WrapperResult:
617
+
618
+ def _execute_iam_security_baseline(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
665
619
  """Execute IAM security baseline assessment."""
666
-
620
+
667
621
  print_header("IAM Security Baseline Assessment", "Security Wrapper latest version")
668
-
622
+
669
623
  aws_profile = self._resolve_enterprise_profile("security_analysis")
670
624
  operation_name = self.generate_faang_naming("iam_security", "baseline_assessment")
671
-
625
+
672
626
  business_impact = {
673
627
  "users_analyzed": 156,
674
628
  "excessive_permissions_found": 34,
675
629
  "access_key_rotation_required": 12,
676
630
  "security_posture_improvement": "67%",
677
- "compliance_risk_reduction": "High"
631
+ "compliance_risk_reduction": "High",
678
632
  }
679
-
633
+
680
634
  technical_details = {
681
635
  "aws_profile_used": aws_profile,
682
636
  "least_privilege_analysis": "Policy analysis with unused permission identification",
683
637
  "access_key_age_threshold": "90 days",
684
- "mfa_enforcement_analysis": "Multi-factor authentication requirement validation"
638
+ "mfa_enforcement_analysis": "Multi-factor authentication requirement validation",
685
639
  }
686
-
640
+
687
641
  recommendations = [
688
642
  "Remediate excessive permissions for 34 IAM users",
689
643
  "Implement access key rotation for 12 users with old keys",
690
644
  "Enforce MFA requirements for privileged accounts",
691
- "Establish automated IAM security monitoring"
645
+ "Establish automated IAM security monitoring",
692
646
  ]
693
-
647
+
694
648
  print_success("IAM Security Baseline Complete: 46 security improvements identified")
695
-
649
+
696
650
  return WrapperResult(
697
651
  operation_name=operation_name,
698
652
  execution_status="success",
@@ -703,19 +657,15 @@ class SecurityComplianceWrapper(EnterpriseWrapper):
703
657
  next_steps=["Prioritize security remediation", "Implement access controls", "Monitor compliance"],
704
658
  evidence_artifacts=[f"./tmp/{operation_name}_security_report.json"],
705
659
  execution_timestamp=datetime.now().isoformat(),
706
- traceability_id=""
660
+ traceability_id="",
707
661
  )
708
-
709
- def _execute_generic_security_operation(
710
- self,
711
- params: Dict[str, Any],
712
- dry_run: bool
713
- ) -> WrapperResult:
662
+
663
+ def _execute_generic_security_operation(self, params: Dict[str, Any], dry_run: bool) -> WrapperResult:
714
664
  """Execute generic security operation."""
715
-
665
+
716
666
  operation_type = params.get("operation_type", "generic_security")
717
667
  operation_name = self.generate_faang_naming("security", operation_type)
718
-
668
+
719
669
  return WrapperResult(
720
670
  operation_name=operation_name,
721
671
  execution_status="success",
@@ -726,32 +676,27 @@ class SecurityComplianceWrapper(EnterpriseWrapper):
726
676
  next_steps=["Implement security improvements"],
727
677
  evidence_artifacts=[],
728
678
  execution_timestamp=datetime.now().isoformat(),
729
- traceability_id=""
679
+ traceability_id="",
730
680
  )
731
-
681
+
732
682
  def _validate_security_compliance(self, result: WrapperResult) -> Dict[ComplianceFramework, bool]:
733
683
  """Validate security operation against compliance frameworks."""
734
684
  compliance_status = {}
735
-
685
+
736
686
  for framework in self.config.compliance_frameworks:
737
687
  if framework in [ComplianceFramework.SOC2, ComplianceFramework.PCI_DSS, ComplianceFramework.HIPAA]:
738
688
  # Security operations generally support these frameworks
739
689
  compliance_status[framework] = result.execution_status == "success"
740
690
  else:
741
691
  compliance_status[framework] = True
742
-
692
+
743
693
  return compliance_status
744
-
694
+
745
695
  def _resolve_enterprise_profile(self, operation_category: str) -> str:
746
696
  """Resolve AWS profile for security operations."""
747
697
  return self.config.aws_profiles.get("management", "default")
748
-
749
- def _create_error_result(
750
- self,
751
- operation: str,
752
- error_message: str,
753
- traceability_id: str = ""
754
- ) -> WrapperResult:
698
+
699
+ def _create_error_result(self, operation: str, error_message: str, traceability_id: str = "") -> WrapperResult:
755
700
  """Create standardized security error result."""
756
701
  return WrapperResult(
757
702
  operation_name=f"security_error_{operation}",
@@ -763,58 +708,49 @@ class SecurityComplianceWrapper(EnterpriseWrapper):
763
708
  next_steps=["Review security configuration", "Retry operation"],
764
709
  evidence_artifacts=[],
765
710
  execution_timestamp=datetime.now().isoformat(),
766
- traceability_id=traceability_id
711
+ traceability_id=traceability_id,
767
712
  )
768
713
 
769
714
 
770
715
  class ComplianceValidator:
771
716
  """Validate operations against enterprise compliance requirements."""
772
-
717
+
773
718
  def __init__(self, frameworks: List[ComplianceFramework]):
774
719
  """Initialize compliance validator with required frameworks."""
775
720
  self.required_frameworks = frameworks
776
-
721
+
777
722
  def validate_result(self, result: WrapperResult) -> bool:
778
723
  """Validate operation result against all required compliance frameworks."""
779
724
  if not self.required_frameworks:
780
725
  return True # No compliance requirements
781
-
726
+
782
727
  # All frameworks must pass for overall compliance
783
- return all(
784
- result.compliance_status.get(framework, False)
785
- for framework in self.required_frameworks
786
- )
728
+ return all(result.compliance_status.get(framework, False) for framework in self.required_frameworks)
787
729
 
788
730
 
789
- def create_enterprise_wrapper(
790
- wrapper_type: str,
791
- config: EnterpriseConfiguration
792
- ) -> EnterpriseWrapper:
731
+ def create_enterprise_wrapper(wrapper_type: str, config: EnterpriseConfiguration) -> EnterpriseWrapper:
793
732
  """
794
733
  Factory function to create appropriate enterprise wrapper.
795
-
734
+
796
735
  Args:
797
736
  wrapper_type: Type of wrapper (cost_optimization, security_compliance)
798
737
  config: Enterprise configuration
799
-
738
+
800
739
  Returns:
801
740
  Configured enterprise wrapper instance
802
741
  """
803
- wrapper_registry = {
804
- "cost_optimization": CostOptimizationWrapper,
805
- "security_compliance": SecurityComplianceWrapper
806
- }
807
-
742
+ wrapper_registry = {"cost_optimization": CostOptimizationWrapper, "security_compliance": SecurityComplianceWrapper}
743
+
808
744
  if wrapper_type not in wrapper_registry:
809
745
  raise ValueError(f"Unknown wrapper type: {wrapper_type}. Supported: {list(wrapper_registry.keys())}")
810
-
746
+
811
747
  wrapper_class = wrapper_registry[wrapper_type]
812
748
  return wrapper_class(config)
813
749
 
814
750
 
815
751
  def main():
816
752
  """Demo enterprise wrapper functionality."""
817
-
753
+
818
754
  # Example enterprise configuration
819
755
  demo_config = EnterpriseConfiguration(
820
756
  organization_name="ACME Corporation",
@@ -822,33 +758,35 @@ def main():
822
758
  compliance_frameworks=[ComplianceFramework.SOC2, ComplianceFramework.AWS_WELL_ARCHITECTED],
823
759
  aws_profiles={
824
760
  "billing": "acme-billing-readonly",
825
- "operational": "acme-ops-readonly",
826
- "management": "acme-mgmt-readonly"
761
+ "operational": "acme-ops-readonly",
762
+ "management": "acme-mgmt-readonly",
827
763
  },
828
764
  cost_allocation_tags=["Department", "Project", "Environment"],
829
765
  approval_workflows={"cost_optimization": ["manager", "finance"]},
830
766
  notification_channels={"slack": "#cloudops-alerts"},
831
767
  naming_conventions={"ebs": "acme_ebs_{purpose}_{date}"},
832
768
  business_hours={"timezone": "US/Eastern", "hours": "9-17"},
833
- risk_tolerance="medium"
769
+ risk_tolerance="medium",
834
770
  )
835
-
771
+
836
772
  print_header("Enterprise Wrapper Demo", "latest version")
837
-
773
+
838
774
  # Demo cost optimization wrapper
839
775
  cost_wrapper = create_enterprise_wrapper("cost_optimization", demo_config)
840
-
841
- result = cost_wrapper.execute_wrapper_operation({
842
- "operation_type": "ebs_volume_optimization",
843
- "projected_savings": 200000,
844
- "source_notebook": "AWS_Change_EBS_Volume_To_GP3_Type.ipynb"
845
- })
846
-
776
+
777
+ result = cost_wrapper.execute_wrapper_operation(
778
+ {
779
+ "operation_type": "ebs_volume_optimization",
780
+ "projected_savings": 200000,
781
+ "source_notebook": "AWS_Change_EBS_Volume_To_GP3_Type.ipynb",
782
+ }
783
+ )
784
+
847
785
  print_success(f"Demo completed: {result.operation_name}")
848
786
  print_success(f"Business Impact: ${result.business_impact.get('annual_savings_usd', 0):,} potential savings")
849
-
787
+
850
788
  return result
851
789
 
852
790
 
853
791
  if __name__ == "__main__":
854
- main()
792
+ main()