|
| 1 | +namespace sigtran.net.Core.Utilities; |
| 2 | + |
| 3 | +/// <summary> |
| 4 | +/// Describes production operations readiness. |
| 5 | +/// </summary> |
| 6 | +public sealed class SigtranOperationsReadinessReport |
| 7 | +{ |
| 8 | + /// <summary>Creates an operations readiness report.</summary> |
| 9 | + /// <param name="hasRunbooks">Whether runbooks are available.</param> |
| 10 | + /// <param name="hasIncidentTargets">Whether incident targets are available.</param> |
| 11 | + /// <param name="hasHealthChecks">Whether health checks are available.</param> |
| 12 | + /// <param name="hasRollbackPlan">Whether rollback plan is available.</param> |
| 13 | + /// <param name="hasMaintenancePolicy">Whether maintenance policy is available.</param> |
| 14 | + /// <param name="hasSupportHandbook">Whether support handbook is available.</param> |
| 15 | + /// <param name="commercialReady">Whether commercial readiness is complete.</param> |
| 16 | + public SigtranOperationsReadinessReport( |
| 17 | + bool hasRunbooks, |
| 18 | + bool hasIncidentTargets, |
| 19 | + bool hasHealthChecks, |
| 20 | + bool hasRollbackPlan, |
| 21 | + bool hasMaintenancePolicy, |
| 22 | + bool hasSupportHandbook, |
| 23 | + bool commercialReady) |
| 24 | + { |
| 25 | + HasRunbooks = hasRunbooks; |
| 26 | + HasIncidentTargets = hasIncidentTargets; |
| 27 | + HasHealthChecks = hasHealthChecks; |
| 28 | + HasRollbackPlan = hasRollbackPlan; |
| 29 | + HasMaintenancePolicy = hasMaintenancePolicy; |
| 30 | + HasSupportHandbook = hasSupportHandbook; |
| 31 | + CommercialReady = commercialReady; |
| 32 | + } |
| 33 | + |
| 34 | + /// <summary>Whether runbooks are available.</summary> |
| 35 | + public bool HasRunbooks { get; } |
| 36 | + |
| 37 | + /// <summary>Whether incident targets are available.</summary> |
| 38 | + public bool HasIncidentTargets { get; } |
| 39 | + |
| 40 | + /// <summary>Whether health checks are available.</summary> |
| 41 | + public bool HasHealthChecks { get; } |
| 42 | + |
| 43 | + /// <summary>Whether rollback plan is available.</summary> |
| 44 | + public bool HasRollbackPlan { get; } |
| 45 | + |
| 46 | + /// <summary>Whether maintenance policy is available.</summary> |
| 47 | + public bool HasMaintenancePolicy { get; } |
| 48 | + |
| 49 | + /// <summary>Whether support handbook is available.</summary> |
| 50 | + public bool HasSupportHandbook { get; } |
| 51 | + |
| 52 | + /// <summary>Whether commercial readiness is complete.</summary> |
| 53 | + public bool CommercialReady { get; } |
| 54 | + |
| 55 | + /// <summary>Whether operations foundation is ready.</summary> |
| 56 | + public bool FoundationReady => HasRunbooks && HasIncidentTargets && HasHealthChecks && HasRollbackPlan && HasMaintenancePolicy && HasSupportHandbook; |
| 57 | + |
| 58 | + /// <summary>Whether production operations are ready.</summary> |
| 59 | + public bool ProductionOperationsReady => FoundationReady && CommercialReady; |
| 60 | +} |
| 61 | + |
| 62 | +/// <summary> |
| 63 | +/// Provides operations readiness helpers. |
| 64 | +/// </summary> |
| 65 | +public static class SigtranOperationsReadiness |
| 66 | +{ |
| 67 | + /// <summary>Returns the current operations readiness report.</summary> |
| 68 | + /// <returns>The current operations readiness report.</returns> |
| 69 | + public static SigtranOperationsReadinessReport GetReport() |
| 70 | + { |
| 71 | + return new( |
| 72 | + hasRunbooks: SigtranRunbooks.GetRunbooks().Count > 0, |
| 73 | + hasIncidentTargets: SigtranIncidentResponse.GetTargets().Count > 0, |
| 74 | + hasHealthChecks: SigtranHealthChecks.GetDefinitions().Count > 0, |
| 75 | + hasRollbackPlan: SigtranRollbackPlans.CreateDefaultPackageRollback().Steps.Count > 0, |
| 76 | + hasMaintenancePolicy: SigtranMaintenancePolicies.CreateDefault().RequiresRollbackPlan, |
| 77 | + hasSupportHandbook: SigtranSupportHandbook.GetRules().Count > 0, |
| 78 | + commercialReady: SigtranCommercialReadiness.GetReport().CommercialReady); |
| 79 | + } |
| 80 | +} |
0 commit comments