UNPKG

cloud-report

Version:

Collects and analyzes cloud resources

46 lines (45 loc) 2.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const types_1 = require("../../../types"); const base_1 = require("../../base"); class RdsDeleteProtectionEnabledAnalyzer extends base_1.BaseAnalyzer { analyze(params, fullReport) { const allInstances = params.instances; if (!allInstances) { return undefined; } const delete_protection_enabled = { type: types_1.CheckAnalysisType.Reliability }; delete_protection_enabled.what = "Is delete protection enabled for RDS instances?"; delete_protection_enabled.why = `Enabling delete protection for all production RDS instances, protects them from accidental deletion.`; delete_protection_enabled.recommendation = `Recommended to enable delete protection for all production RDS instances.`; delete_protection_enabled.benchmark = ['all']; const allRegionsAnalysis = {}; for (const region in allInstances) { const regionInstances = allInstances[region]; allRegionsAnalysis[region] = []; for (const instance of regionInstances) { const instance_analysis = {}; instance_analysis.resource = instance; instance_analysis.resourceSummary = { name: "DBInstance", value: instance.DBInstanceIdentifier, }; if (instance.DeletionProtection) { instance_analysis.severity = types_1.SeverityStatus.Good; instance_analysis.message = "Deletion Protection enabled"; } else { instance_analysis.severity = types_1.SeverityStatus.Failure; instance_analysis.message = "Deletion Protection not enabled"; instance_analysis.action = "Enable deletion protection for all production instances"; } allRegionsAnalysis[region].push(instance_analysis); } } delete_protection_enabled.regions = allRegionsAnalysis; return { delete_protection_enabled }; } } exports.RdsDeleteProtectionEnabledAnalyzer = RdsDeleteProtectionEnabledAnalyzer;