runbooks 0.7.9__py3-none-any.whl → 0.9.1__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.
- runbooks/__init__.py +1 -1
- runbooks/cfat/README.md +12 -1
- runbooks/cfat/__init__.py +1 -1
- runbooks/cfat/assessment/compliance.py +4 -1
- runbooks/cfat/assessment/runner.py +42 -34
- runbooks/cfat/models.py +1 -1
- runbooks/cloudops/__init__.py +123 -0
- runbooks/cloudops/base.py +385 -0
- runbooks/cloudops/cost_optimizer.py +811 -0
- runbooks/cloudops/infrastructure_optimizer.py +29 -0
- runbooks/cloudops/interfaces.py +828 -0
- runbooks/cloudops/lifecycle_manager.py +29 -0
- runbooks/cloudops/mcp_cost_validation.py +678 -0
- runbooks/cloudops/models.py +251 -0
- runbooks/cloudops/monitoring_automation.py +29 -0
- runbooks/cloudops/notebook_framework.py +676 -0
- runbooks/cloudops/security_enforcer.py +449 -0
- runbooks/common/__init__.py +152 -0
- runbooks/common/accuracy_validator.py +1039 -0
- runbooks/common/context_logger.py +440 -0
- runbooks/common/cross_module_integration.py +594 -0
- runbooks/common/enhanced_exception_handler.py +1108 -0
- runbooks/common/enterprise_audit_integration.py +634 -0
- runbooks/common/mcp_cost_explorer_integration.py +900 -0
- runbooks/common/mcp_integration.py +548 -0
- runbooks/common/performance_monitor.py +387 -0
- runbooks/common/profile_utils.py +216 -0
- runbooks/common/rich_utils.py +172 -1
- runbooks/feedback/user_feedback_collector.py +440 -0
- runbooks/finops/README.md +377 -458
- runbooks/finops/__init__.py +4 -21
- runbooks/finops/account_resolver.py +279 -0
- runbooks/finops/accuracy_cross_validator.py +638 -0
- runbooks/finops/aws_client.py +721 -36
- runbooks/finops/budget_integration.py +313 -0
- runbooks/finops/cli.py +59 -5
- runbooks/finops/cost_optimizer.py +1340 -0
- runbooks/finops/cost_processor.py +211 -37
- runbooks/finops/dashboard_router.py +900 -0
- runbooks/finops/dashboard_runner.py +990 -232
- runbooks/finops/embedded_mcp_validator.py +288 -0
- runbooks/finops/enhanced_dashboard_runner.py +8 -7
- runbooks/finops/enhanced_progress.py +327 -0
- runbooks/finops/enhanced_trend_visualization.py +423 -0
- runbooks/finops/finops_dashboard.py +184 -1829
- runbooks/finops/helpers.py +509 -196
- runbooks/finops/iam_guidance.py +400 -0
- runbooks/finops/markdown_exporter.py +466 -0
- runbooks/finops/multi_dashboard.py +1502 -0
- runbooks/finops/optimizer.py +15 -15
- runbooks/finops/profile_processor.py +2 -2
- runbooks/finops/runbooks.inventory.organizations_discovery.log +0 -0
- runbooks/finops/runbooks.security.report_generator.log +0 -0
- runbooks/finops/runbooks.security.run_script.log +0 -0
- runbooks/finops/runbooks.security.security_export.log +0 -0
- runbooks/finops/schemas.py +589 -0
- runbooks/finops/service_mapping.py +195 -0
- runbooks/finops/single_dashboard.py +710 -0
- runbooks/finops/tests/test_reference_images_validation.py +1 -1
- runbooks/inventory/README.md +12 -1
- runbooks/inventory/core/collector.py +157 -29
- runbooks/inventory/list_ec2_instances.py +9 -6
- runbooks/inventory/list_ssm_parameters.py +10 -10
- runbooks/inventory/organizations_discovery.py +210 -164
- runbooks/inventory/rich_inventory_display.py +74 -107
- runbooks/inventory/run_on_multi_accounts.py +13 -13
- runbooks/inventory/runbooks.inventory.organizations_discovery.log +0 -0
- runbooks/inventory/runbooks.security.security_export.log +0 -0
- runbooks/main.py +1371 -240
- runbooks/metrics/dora_metrics_engine.py +711 -17
- runbooks/monitoring/performance_monitor.py +433 -0
- runbooks/operate/README.md +394 -0
- runbooks/operate/base.py +215 -47
- runbooks/operate/ec2_operations.py +435 -5
- runbooks/operate/iam_operations.py +598 -3
- runbooks/operate/privatelink_operations.py +1 -1
- runbooks/operate/rds_operations.py +508 -0
- runbooks/operate/s3_operations.py +508 -0
- runbooks/operate/vpc_endpoints.py +1 -1
- runbooks/remediation/README.md +489 -13
- runbooks/remediation/base.py +5 -3
- runbooks/remediation/commons.py +8 -4
- runbooks/security/ENTERPRISE_SECURITY_FRAMEWORK.md +506 -0
- runbooks/security/README.md +12 -1
- runbooks/security/__init__.py +265 -33
- runbooks/security/cloudops_automation_security_validator.py +1164 -0
- runbooks/security/compliance_automation.py +12 -10
- runbooks/security/compliance_automation_engine.py +1021 -0
- runbooks/security/enterprise_security_framework.py +930 -0
- runbooks/security/enterprise_security_policies.json +293 -0
- runbooks/security/executive_security_dashboard.py +1247 -0
- runbooks/security/integration_test_enterprise_security.py +879 -0
- runbooks/security/module_security_integrator.py +641 -0
- runbooks/security/multi_account_security_controls.py +2254 -0
- runbooks/security/real_time_security_monitor.py +1196 -0
- runbooks/security/report_generator.py +1 -1
- runbooks/security/run_script.py +4 -8
- runbooks/security/security_baseline_tester.py +39 -52
- runbooks/security/security_export.py +99 -120
- runbooks/sre/README.md +472 -0
- runbooks/sre/__init__.py +33 -0
- runbooks/sre/mcp_reliability_engine.py +1049 -0
- runbooks/sre/performance_optimization_engine.py +1032 -0
- runbooks/sre/production_monitoring_framework.py +584 -0
- runbooks/sre/reliability_monitoring_framework.py +1011 -0
- runbooks/validation/__init__.py +2 -2
- runbooks/validation/benchmark.py +154 -149
- runbooks/validation/cli.py +159 -147
- runbooks/validation/mcp_validator.py +291 -248
- runbooks/vpc/README.md +478 -0
- runbooks/vpc/__init__.py +2 -2
- runbooks/vpc/manager_interface.py +366 -351
- runbooks/vpc/networking_wrapper.py +68 -36
- runbooks/vpc/rich_formatters.py +22 -8
- runbooks-0.9.1.dist-info/METADATA +308 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/RECORD +120 -59
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/entry_points.txt +1 -1
- runbooks/finops/cross_validation.py +0 -375
- runbooks-0.7.9.dist-info/METADATA +0 -636
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/WHEEL +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/licenses/LICENSE +0 -0
- {runbooks-0.7.9.dist-info → runbooks-0.9.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,251 @@
|
|
1
|
+
"""
|
2
|
+
Type-Safe Business Models for CloudOps Enterprise Scenarios
|
3
|
+
|
4
|
+
Provides comprehensive Pydantic models for business scenario inputs/outputs,
|
5
|
+
ensuring type safety and validation across all CloudOps operations.
|
6
|
+
|
7
|
+
Strategic Alignment:
|
8
|
+
- Business-focused data structures for executive reporting
|
9
|
+
- Type safety for enterprise-scale operations
|
10
|
+
- Integration with Rich CLI for consistent UX
|
11
|
+
"""
|
12
|
+
|
13
|
+
from pydantic import BaseModel, Field, validator, root_validator
|
14
|
+
from typing import List, Dict, Optional, Union, Any
|
15
|
+
from enum import Enum
|
16
|
+
from datetime import datetime
|
17
|
+
import boto3
|
18
|
+
|
19
|
+
class BusinessScenario(str, Enum):
|
20
|
+
"""Business scenario categories for CloudOps automation."""
|
21
|
+
COST_OPTIMIZATION = "cost_optimization"
|
22
|
+
SECURITY_ENFORCEMENT = "security_enforcement"
|
23
|
+
LIFECYCLE_MANAGEMENT = "lifecycle_management"
|
24
|
+
INFRASTRUCTURE_OPTIMIZATION = "infrastructure_optimization"
|
25
|
+
MONITORING_AUTOMATION = "monitoring_automation"
|
26
|
+
GOVERNANCE_CAMPAIGN = "governance_campaign"
|
27
|
+
|
28
|
+
class RiskLevel(str, Enum):
|
29
|
+
"""Risk assessment levels for business operations."""
|
30
|
+
LOW = "low"
|
31
|
+
MEDIUM = "medium"
|
32
|
+
HIGH = "high"
|
33
|
+
CRITICAL = "critical"
|
34
|
+
|
35
|
+
class ExecutionMode(str, Enum):
|
36
|
+
"""Execution modes for CloudOps operations."""
|
37
|
+
DRY_RUN = "dry_run"
|
38
|
+
EXECUTE = "execute"
|
39
|
+
VALIDATE_ONLY = "validate_only"
|
40
|
+
|
41
|
+
class ResourceImpact(BaseModel):
|
42
|
+
"""Business impact assessment for individual resources."""
|
43
|
+
resource_type: str = Field(description="AWS resource type (ec2, s3, nat-gateway, etc)")
|
44
|
+
resource_id: str = Field(description="Unique resource identifier")
|
45
|
+
resource_name: Optional[str] = Field(description="Human-readable resource name")
|
46
|
+
region: str = Field(description="AWS region")
|
47
|
+
account_id: str = Field(description="AWS account ID")
|
48
|
+
|
49
|
+
# Financial Impact
|
50
|
+
estimated_monthly_cost: Optional[float] = Field(description="Current monthly cost estimate")
|
51
|
+
projected_savings: Optional[float] = Field(description="Projected monthly savings")
|
52
|
+
|
53
|
+
# Risk Assessment
|
54
|
+
risk_level: RiskLevel = Field(description="Risk level for modification", default=RiskLevel.LOW)
|
55
|
+
business_criticality: str = Field(description="Business criticality (low/medium/high/critical)", default="low")
|
56
|
+
|
57
|
+
# Operational Impact
|
58
|
+
modification_required: bool = Field(description="Whether resource requires modification", default=False)
|
59
|
+
estimated_downtime: Optional[float] = Field(description="Expected downtime in minutes", default=None)
|
60
|
+
|
61
|
+
@validator('risk_level')
|
62
|
+
def validate_risk_level(cls, v):
|
63
|
+
"""Ensure risk level is valid."""
|
64
|
+
if isinstance(v, str):
|
65
|
+
try:
|
66
|
+
return RiskLevel(v.lower())
|
67
|
+
except ValueError:
|
68
|
+
raise ValueError(f'Risk level must be one of: {[e.value for e in RiskLevel]}')
|
69
|
+
return v
|
70
|
+
|
71
|
+
@validator('projected_savings')
|
72
|
+
def validate_savings(cls, v, values):
|
73
|
+
"""Validate savings against current cost."""
|
74
|
+
if v is not None and 'estimated_monthly_cost' in values:
|
75
|
+
current_cost = values['estimated_monthly_cost']
|
76
|
+
if current_cost is not None and v > current_cost:
|
77
|
+
raise ValueError('Projected savings cannot exceed current cost')
|
78
|
+
return v
|
79
|
+
|
80
|
+
class ComplianceMetrics(BaseModel):
|
81
|
+
"""Security and compliance assessment metrics."""
|
82
|
+
framework: str = Field(description="Compliance framework (SOC2, PCI-DSS, HIPAA, etc)")
|
83
|
+
current_score: float = Field(ge=0, le=100, description="Current compliance score percentage")
|
84
|
+
target_score: float = Field(ge=0, le=100, description="Target compliance score percentage")
|
85
|
+
violations_found: int = Field(ge=0, description="Number of violations identified")
|
86
|
+
violations_fixed: int = Field(ge=0, description="Number of violations remediated")
|
87
|
+
|
88
|
+
@validator('violations_fixed')
|
89
|
+
def validate_violations_fixed(cls, v, values):
|
90
|
+
"""Ensure violations fixed doesn't exceed violations found."""
|
91
|
+
if 'violations_found' in values and v > values['violations_found']:
|
92
|
+
raise ValueError('Violations fixed cannot exceed violations found')
|
93
|
+
return v
|
94
|
+
|
95
|
+
class BusinessMetrics(BaseModel):
|
96
|
+
"""High-level business impact metrics for executive reporting."""
|
97
|
+
total_monthly_savings: float = Field(description="Total projected monthly savings")
|
98
|
+
implementation_cost: Optional[float] = Field(description="One-time implementation cost", default=None)
|
99
|
+
roi_percentage: Optional[float] = Field(description="Return on investment percentage", default=None)
|
100
|
+
payback_period_months: Optional[int] = Field(description="Payback period in months", default=None)
|
101
|
+
|
102
|
+
# Operational Metrics
|
103
|
+
operational_efficiency_gain: Optional[float] = Field(description="Operational efficiency improvement percentage", default=None)
|
104
|
+
manual_effort_reduction: Optional[float] = Field(description="Manual effort reduction percentage", default=None)
|
105
|
+
|
106
|
+
# Risk Metrics
|
107
|
+
overall_risk_level: RiskLevel = Field(description="Overall operation risk level")
|
108
|
+
business_continuity_impact: str = Field(description="Impact on business continuity", default="minimal")
|
109
|
+
|
110
|
+
class CloudOpsExecutionResult(BaseModel):
|
111
|
+
"""Comprehensive execution result for enterprise CloudOps operations."""
|
112
|
+
# Scenario Metadata
|
113
|
+
scenario: BusinessScenario = Field(description="Business scenario executed")
|
114
|
+
scenario_name: str = Field(description="Human-readable scenario name")
|
115
|
+
execution_timestamp: datetime = Field(description="Execution timestamp")
|
116
|
+
execution_mode: ExecutionMode = Field(description="Execution mode used")
|
117
|
+
|
118
|
+
# Execution Metrics
|
119
|
+
execution_time: float = Field(description="Total execution time in seconds")
|
120
|
+
success: bool = Field(description="Overall execution success")
|
121
|
+
error_message: Optional[str] = Field(description="Error message if execution failed", default=None)
|
122
|
+
|
123
|
+
# Resource Impact
|
124
|
+
resources_analyzed: int = Field(ge=0, description="Total resources analyzed")
|
125
|
+
resources_impacted: List[ResourceImpact] = Field(description="Detailed resource impact list")
|
126
|
+
|
127
|
+
# Business Impact
|
128
|
+
business_metrics: BusinessMetrics = Field(description="Business impact summary")
|
129
|
+
compliance_improvements: List[ComplianceMetrics] = Field(description="Compliance improvements", default=[])
|
130
|
+
|
131
|
+
# Recommendations
|
132
|
+
recommendations: List[str] = Field(description="Follow-up recommendations")
|
133
|
+
action_items: List[str] = Field(description="Required action items", default=[])
|
134
|
+
|
135
|
+
# Audit Trail
|
136
|
+
aws_profile_used: str = Field(description="AWS profile used for execution")
|
137
|
+
regions_analyzed: List[str] = Field(description="AWS regions analyzed", default=[])
|
138
|
+
services_analyzed: List[str] = Field(description="AWS services analyzed", default=[])
|
139
|
+
|
140
|
+
@validator('execution_time')
|
141
|
+
def validate_execution_time(cls, v):
|
142
|
+
"""Ensure execution time is positive."""
|
143
|
+
if v < 0:
|
144
|
+
raise ValueError('Execution time must be positive')
|
145
|
+
return v
|
146
|
+
|
147
|
+
@property
|
148
|
+
def summary_metrics(self) -> Dict[str, Any]:
|
149
|
+
"""Generate executive summary metrics."""
|
150
|
+
return {
|
151
|
+
"scenario": self.scenario_name,
|
152
|
+
"success": self.success,
|
153
|
+
"resources_analyzed": self.resources_analyzed,
|
154
|
+
"resources_impacted": len(self.resources_impacted),
|
155
|
+
"projected_monthly_savings": self.business_metrics.total_monthly_savings,
|
156
|
+
"roi_percentage": self.business_metrics.roi_percentage,
|
157
|
+
"overall_risk": self.business_metrics.overall_risk_level.value,
|
158
|
+
"execution_time_seconds": self.execution_time
|
159
|
+
}
|
160
|
+
|
161
|
+
class CostOptimizationResult(CloudOpsExecutionResult):
|
162
|
+
"""Specialized result for cost optimization scenarios."""
|
163
|
+
|
164
|
+
# Cost-Specific Metrics
|
165
|
+
current_monthly_spend: float = Field(description="Current monthly spend for analyzed resources")
|
166
|
+
optimized_monthly_spend: float = Field(description="Projected monthly spend after optimization")
|
167
|
+
savings_percentage: float = Field(ge=0, le=100, description="Savings percentage")
|
168
|
+
|
169
|
+
# Resource Categories
|
170
|
+
idle_resources: List[ResourceImpact] = Field(description="Identified idle resources", default=[])
|
171
|
+
oversized_resources: List[ResourceImpact] = Field(description="Identified oversized resources", default=[])
|
172
|
+
unattached_resources: List[ResourceImpact] = Field(description="Identified unattached resources", default=[])
|
173
|
+
|
174
|
+
@validator('optimized_monthly_spend')
|
175
|
+
def validate_optimized_spend(cls, v, values):
|
176
|
+
"""Ensure optimized spend is less than current spend."""
|
177
|
+
if 'current_monthly_spend' in values and v > values['current_monthly_spend']:
|
178
|
+
raise ValueError('Optimized spend cannot exceed current spend')
|
179
|
+
return v
|
180
|
+
|
181
|
+
class SecurityEnforcementResult(CloudOpsExecutionResult):
|
182
|
+
"""Specialized result for security enforcement scenarios."""
|
183
|
+
|
184
|
+
# Security-Specific Metrics
|
185
|
+
security_score_before: float = Field(ge=0, le=100, description="Security score before enforcement")
|
186
|
+
security_score_after: float = Field(ge=0, le=100, description="Security score after enforcement")
|
187
|
+
|
188
|
+
# Compliance Frameworks
|
189
|
+
compliance_frameworks: List[ComplianceMetrics] = Field(description="Compliance framework results")
|
190
|
+
|
191
|
+
# Security Findings
|
192
|
+
critical_findings: int = Field(ge=0, description="Critical security findings")
|
193
|
+
high_findings: int = Field(ge=0, description="High severity security findings")
|
194
|
+
medium_findings: int = Field(ge=0, description="Medium severity security findings")
|
195
|
+
low_findings: int = Field(ge=0, description="Low severity security findings")
|
196
|
+
|
197
|
+
# Remediation
|
198
|
+
auto_remediated: int = Field(ge=0, description="Automatically remediated findings")
|
199
|
+
manual_remediation_required: int = Field(ge=0, description="Findings requiring manual remediation")
|
200
|
+
|
201
|
+
class ProfileConfiguration(BaseModel):
|
202
|
+
"""AWS profile configuration for multi-account operations."""
|
203
|
+
profile_name: str = Field(description="AWS profile name")
|
204
|
+
profile_type: str = Field(description="Profile type (billing/management/operational)")
|
205
|
+
account_id: Optional[str] = Field(description="AWS account ID")
|
206
|
+
regions: List[str] = Field(description="Target AWS regions", default=["us-east-1"])
|
207
|
+
|
208
|
+
@validator('profile_name')
|
209
|
+
def validate_profile_exists(cls, v):
|
210
|
+
"""Validate that AWS profile exists in local configuration."""
|
211
|
+
try:
|
212
|
+
session = boto3.Session(profile_name=v)
|
213
|
+
# Test if profile is valid by trying to get caller identity
|
214
|
+
return v
|
215
|
+
except Exception:
|
216
|
+
# In dry-run or test environments, allow any profile name
|
217
|
+
return v
|
218
|
+
|
219
|
+
class BusinessScenarioConfig(BaseModel):
|
220
|
+
"""Configuration for business scenario execution."""
|
221
|
+
scenario_name: str = Field(description="Business scenario name")
|
222
|
+
scenario_type: BusinessScenario = Field(description="Scenario type")
|
223
|
+
execution_mode: ExecutionMode = Field(description="Execution mode", default=ExecutionMode.DRY_RUN)
|
224
|
+
|
225
|
+
# AWS Configuration
|
226
|
+
primary_profile: ProfileConfiguration = Field(description="Primary AWS profile")
|
227
|
+
additional_profiles: List[ProfileConfiguration] = Field(description="Additional profiles for multi-account", default=[])
|
228
|
+
|
229
|
+
# Business Parameters
|
230
|
+
cost_threshold: Optional[float] = Field(description="Minimum cost threshold for analysis")
|
231
|
+
risk_tolerance: RiskLevel = Field(description="Maximum acceptable risk level", default=RiskLevel.MEDIUM)
|
232
|
+
|
233
|
+
# Executive Reporting
|
234
|
+
generate_executive_report: bool = Field(description="Generate executive PDF report", default=True)
|
235
|
+
include_detailed_analysis: bool = Field(description="Include detailed technical analysis", default=False)
|
236
|
+
notify_stakeholders: List[str] = Field(description="Stakeholder notification emails", default=[])
|
237
|
+
|
238
|
+
# Export all models for easy importing
|
239
|
+
__all__ = [
|
240
|
+
"BusinessScenario",
|
241
|
+
"RiskLevel",
|
242
|
+
"ExecutionMode",
|
243
|
+
"ResourceImpact",
|
244
|
+
"ComplianceMetrics",
|
245
|
+
"BusinessMetrics",
|
246
|
+
"CloudOpsExecutionResult",
|
247
|
+
"CostOptimizationResult",
|
248
|
+
"SecurityEnforcementResult",
|
249
|
+
"ProfileConfiguration",
|
250
|
+
"BusinessScenarioConfig"
|
251
|
+
]
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"""
|
2
|
+
Monitoring Automation - Enterprise Monitoring and Alerting
|
3
|
+
|
4
|
+
Placeholder for MonitoringAutomation - comprehensive monitoring and alerting automation
|
5
|
+
integrating CloudOps-Automation monitoring and performance notebooks.
|
6
|
+
|
7
|
+
This module will be fully implemented in the next development phase.
|
8
|
+
"""
|
9
|
+
|
10
|
+
from .base import CloudOpsBase
|
11
|
+
from .models import CloudOpsExecutionResult, BusinessScenario, ExecutionMode
|
12
|
+
|
13
|
+
class MonitoringAutomation(CloudOpsBase):
|
14
|
+
"""
|
15
|
+
Monitoring automation scenarios for operational excellence and SRE practices.
|
16
|
+
|
17
|
+
Future Implementation Will Include:
|
18
|
+
- CloudWatch automation and alerting
|
19
|
+
- Performance monitoring and optimization
|
20
|
+
- SRE monitoring patterns and dashboards
|
21
|
+
- Incident response automation
|
22
|
+
"""
|
23
|
+
|
24
|
+
def __init__(self, profile: str = "default", dry_run: bool = True):
|
25
|
+
super().__init__(profile, dry_run, ExecutionMode.DRY_RUN)
|
26
|
+
|
27
|
+
def placeholder_method(self):
|
28
|
+
"""Placeholder for future implementation."""
|
29
|
+
return "MonitoringAutomation - Coming in next development phase"
|