diff --git a/mocks/advanced-cloud.json b/mocks/advanced-cloud.json new file mode 100644 index 0000000..cbe1e41 --- /dev/null +++ b/mocks/advanced-cloud.json @@ -0,0 +1,450 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "VBR-CLOUD-01", + "12.1.2.172", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "sobr": { + "SectionName": "sobr", + "Headers": [ + "Name", + "ExtentCount", + "JobCount", + "PolicyType", + "EnableCapacityTier", + "CapacityTierCopy", + "CapacityTierMove", + "ArchiveTierEnabled", + "UsePerVMFiles", + "CapTierType", + "ImmutableEnabled", + "ImmutablePeriod", + "SizeLimitEnabled", + "SizeLimit" + ], + "Rows": [ + [ + "SOBR_Archive", + "2", + "0", + "DataLocality", + "True", + "True", + "True", + "False", + "True", + "DataCloudVault", + "True", + "7", + "False", + null + ] + ] + }, + "extents": { + "SectionName": "extents", + "Headers": [ + "Name", + "SobrName", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "SOBR_Archive_Perf_01", + "SOBR_Archive", + "8", + "16", + "64", + "Server-01", + "/mnt/backup", + "89", + "133", + "True", + "LinuxLocal" + ], + [ + "SOBR_Archive_Perf_02", + "SOBR_Archive", + "8", + "16", + "64", + "Server-02", + "/mnt/backup", + "98", + "124", + "True", + "LinuxLocal" + ] + ] + }, + "capextents": { + "SectionName": "capextents", + "Headers": [ + "Name", + "SobrName", + "Status", + "ConnectionType", + "GatewayServer", + "CopyModeEnabled", + "MoveModeEnabled", + "MovePeriodDays", + "EncryptionEnabled", + "ImmutableEnabled", + "ImmutablePeriod", + "ImmutabilityMode", + "SizeLimitEnabled", + "SizeLimit", + "Type" + ], + "Rows": [ + [ + "SOBR_Archive_Cap_Tier", + "SOBR_Archive", + "Normal", + "Direct", + "VBR-PROD-01", + "True", + "True", + "0", + "True", + "True", + "7", + "Compliance", + "False", + null, + "DataCloudVault" + ] + ] + }, + "archextents": { + "SectionName": "archextents", + "Headers": [ + "Name", + "SobrName", + "Status", + "GatewayMode", + "GatewayServer", + "OffloadPeriod", + "ArchiveTierEnabled", + "CostOptimizedEnabled", + "FullBackupModeEnabled", + "EncryptionEnabled", + "ImmutableEnabled", + "Type" + ], + "Rows": [ + [ + "Archive-Tier-01", + "SOBR_Archive", + "Normal", + "Direct", + "VBR-PROD-01", + "90", + "True", + "True", + "False", + "True", + "False", + "AzureArchive" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Job_GFS_Cloud_1", + "SOBR_Archive", + "4220", + "2532", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_GFS_Cloud_2", + "SOBR_Archive", + "4017", + "2410", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_GFS_Cloud_3", + "SOBR_Archive", + "1553", + "931", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_GFS_Cloud_4", + "SOBR_Archive", + "3107", + "1864", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_GFS_Cloud_5", + "SOBR_Archive", + "2058", + "1234", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Job_GFS_Cloud_1", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "104", + "166.4", + "208", + "249.6", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_GFS_Cloud_2", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "85", + "136", + "170", + "204", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_GFS_Cloud_3", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "128", + "204.8", + "256", + "307.2", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_GFS_Cloud_4", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "136.5", + "218.4", + "273", + "327.59999999999997", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_GFS_Cloud_5", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "76", + "121.60000000000001", + "152", + "182.4", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/blocker-aws.json b/mocks/blocker-aws.json new file mode 100644 index 0000000..8bf4f44 --- /dev/null +++ b/mocks/blocker-aws.json @@ -0,0 +1,303 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "VBR-PROD-01", + "12.2.0.334", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "sobr": { + "SectionName": "sobr", + "Headers": [ + "Name", + "ExtentCount", + "JobCount", + "PolicyType", + "EnableCapacityTier", + "CapacityTierCopy", + "CapacityTierMove", + "ArchiveTierEnabled", + "UsePerVMFiles", + "CapTierType", + "ImmutableEnabled", + "ImmutablePeriod", + "SizeLimitEnabled", + "SizeLimit" + ], + "Rows": [ + [ + "SOBR_Vault", + "2", + "0", + "DataLocality", + "True", + "True", + "True", + "False", + "True", + "DataCloudVault", + "True", + "7", + "False", + null + ] + ] + }, + "extents": { + "SectionName": "extents", + "Headers": [ + "Name", + "SobrName", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "SOBR_Vault_Perf_01", + "SOBR_Vault", + "8", + "16", + "64", + "Server-01", + "/mnt/backup", + "69", + "143", + "True", + "LinuxLocal" + ], + [ + "SOBR_Vault_Perf_02", + "SOBR_Vault", + "8", + "16", + "64", + "Server-02", + "/mnt/backup", + "18", + "59", + "True", + "LinuxLocal" + ] + ] + }, + "capextents": { + "SectionName": "capextents", + "Headers": [ + "Name", + "SobrName", + "Status", + "ConnectionType", + "GatewayServer", + "CopyModeEnabled", + "MoveModeEnabled", + "MovePeriodDays", + "EncryptionEnabled", + "ImmutableEnabled", + "ImmutablePeriod", + "ImmutabilityMode", + "SizeLimitEnabled", + "SizeLimit", + "Type" + ], + "Rows": [ + [ + "SOBR_Vault_Cap_Tier", + "SOBR_Vault", + "Normal", + "Direct", + "VBR-PROD-01", + "True", + "True", + "0", + "True", + "True", + "7", + "Compliance", + "False", + null, + "DataCloudVault" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Job_VM_01", + "SOBR_Vault", + "1651", + "990", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_AWS_Direct", + "SOBR_Vault", + "3032", + "1819", + "Days", + "30", + "True", + "Veeam.Vault.AWS.Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Job_VM_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "231.5", + "370.40000000000003", + "463", + "555.6", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_AWS_Direct", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "187.5", + "300", + "375", + "450", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/community-edition.json b/mocks/community-edition.json new file mode 100644 index 0000000..164c7d5 --- /dev/null +++ b/mocks/community-edition.json @@ -0,0 +1,176 @@ +{ + "Licenses": [ + { + "Edition": "Community Edition", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "LAB-VBR", + "12.1.2.172", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "repos": { + "SectionName": "repos", + "Headers": [ + "Name", + "JobCount", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "Local-Disk", + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + "4", + "10", + "False", + "WinLocal" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Lab_Job_01", + "Local-Disk", + "4222", + "2533", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Lab_Job_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "121", + "193.60000000000002", + "242", + "290.4", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/legacy-v11.json b/mocks/legacy-v11.json new file mode 100644 index 0000000..7ef1ee6 --- /dev/null +++ b/mocks/legacy-v11.json @@ -0,0 +1,176 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "Server_Old", + "11.0.1.1261", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["False", "False", "False", "False", "False"]] + }, + "repos": { + "SectionName": "repos", + "Headers": [ + "Name", + "JobCount", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "Windows-Repo-Old", + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + "11", + "22", + "False", + "WinLocal" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Job_Legacy_01", + "Windows-Repo-Old", + "1243", + "745", + "Days", + "14", + "False", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Job_Legacy_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "196.5", + "314.40000000000003", + "393", + "471.59999999999997", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/low-retention.json b/mocks/low-retention.json new file mode 100644 index 0000000..d55d153 --- /dev/null +++ b/mocks/low-retention.json @@ -0,0 +1,265 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "VBR-PROD-01", + "12.1.2.172", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "sobr": { + "SectionName": "sobr", + "Headers": [ + "Name", + "ExtentCount", + "JobCount", + "PolicyType", + "EnableCapacityTier", + "CapacityTierCopy", + "CapacityTierMove", + "ArchiveTierEnabled", + "UsePerVMFiles", + "CapTierType", + "ImmutableEnabled", + "ImmutablePeriod", + "SizeLimitEnabled", + "SizeLimit" + ], + "Rows": [ + [ + "SOBR_Vault", + "2", + "0", + "DataLocality", + "True", + "True", + "True", + "False", + "True", + "DataCloudVault", + "True", + "7", + "False", + null + ] + ] + }, + "extents": { + "SectionName": "extents", + "Headers": [ + "Name", + "SobrName", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "SOBR_Vault_Perf_01", + "SOBR_Vault", + "8", + "16", + "64", + "Server-01", + "/mnt/backup", + "103", + "167", + "True", + "LinuxLocal" + ], + [ + "SOBR_Vault_Perf_02", + "SOBR_Vault", + "8", + "16", + "64", + "Server-02", + "/mnt/backup", + "66", + "117", + "True", + "LinuxLocal" + ] + ] + }, + "capextents": { + "SectionName": "capextents", + "Headers": [ + "Name", + "SobrName", + "Status", + "ConnectionType", + "GatewayServer", + "CopyModeEnabled", + "MoveModeEnabled", + "MovePeriodDays", + "EncryptionEnabled", + "ImmutableEnabled", + "ImmutablePeriod", + "ImmutabilityMode", + "SizeLimitEnabled", + "SizeLimit", + "Type" + ], + "Rows": [ + [ + "SOBR_Vault_Cap_Tier", + "SOBR_Vault", + "Normal", + "Direct", + "VBR-PROD-01", + "True", + "True", + "0", + "True", + "True", + "7", + "Compliance", + "False", + null, + "DataCloudVault" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Short_Ret_Job_01", + "SOBR_Vault", + "1215", + "729", + "Days", + "7", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Short_Ret_Job_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "153.5", + "245.60000000000002", + "307", + "368.4", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/perfect-v12.json b/mocks/perfect-v12.json new file mode 100644 index 0000000..060aa79 --- /dev/null +++ b/mocks/perfect-v12.json @@ -0,0 +1,651 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "VBR-PROD-01", + "12.1.2.172", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "sobr": { + "SectionName": "sobr", + "Headers": [ + "Name", + "ExtentCount", + "JobCount", + "PolicyType", + "EnableCapacityTier", + "CapacityTierCopy", + "CapacityTierMove", + "ArchiveTierEnabled", + "UsePerVMFiles", + "CapTierType", + "ImmutableEnabled", + "ImmutablePeriod", + "SizeLimitEnabled", + "SizeLimit" + ], + "Rows": [ + [ + "SOBR_Primary", + "2", + "0", + "DataLocality", + "True", + "True", + "True", + "False", + "True", + "DataCloudVault", + "True", + "7", + "False", + null + ] + ] + }, + "extents": { + "SectionName": "extents", + "Headers": [ + "Name", + "SobrName", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "SOBR_Primary_Perf_01", + "SOBR_Primary", + "8", + "16", + "64", + "Server-01", + "/mnt/backup", + "124", + "126", + "True", + "LinuxLocal" + ], + [ + "SOBR_Primary_Perf_02", + "SOBR_Primary", + "8", + "16", + "64", + "Server-02", + "/mnt/backup", + "79", + "128", + "True", + "LinuxLocal" + ] + ] + }, + "capextents": { + "SectionName": "capextents", + "Headers": [ + "Name", + "SobrName", + "Status", + "ConnectionType", + "GatewayServer", + "CopyModeEnabled", + "MoveModeEnabled", + "MovePeriodDays", + "EncryptionEnabled", + "ImmutableEnabled", + "ImmutablePeriod", + "ImmutabilityMode", + "SizeLimitEnabled", + "SizeLimit", + "Type" + ], + "Rows": [ + [ + "SOBR_Primary_Cap_Tier", + "SOBR_Primary", + "Normal", + "Direct", + "VBR-PROD-01", + "True", + "True", + "0", + "True", + "True", + "7", + "Compliance", + "False", + null, + "DataCloudVault" + ] + ] + }, + "repos": { + "SectionName": "repos", + "Headers": [ + "Name", + "JobCount", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "Linux-Hardened-01", + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + "4", + "10", + "True", + "LinuxHardened" + ], + [ + "Dedupe-Appliance-01", + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + "6", + "46", + "False", + "DDBoost" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Job_VM_Critical_1", + "SOBR_Primary", + "2222", + "1333", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_2", + "SOBR_Primary", + "2373", + "1423", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_3", + "SOBR_Primary", + "4474", + "2684", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_4", + "SOBR_Primary", + "3385", + "2031", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_5", + "SOBR_Primary", + "3426", + "2055", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_6", + "SOBR_Primary", + "1580", + "948", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_7", + "SOBR_Primary", + "1718", + "1030", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_VM_Critical_8", + "SOBR_Primary", + "1008", + "604", + "Days", + "31", + "True", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_Physical_Srv_01", + "Linux-Hardened-01", + "2567", + "1540", + "Days", + "30", + "True", + "Agent Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ], + [ + "Job_File_Share_01", + "Dedupe-Appliance-01", + "2987", + "1792", + "Days", + "14", + "True", + "File Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Job_VM_Critical_1", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "132.5", + "212", + "265", + "318", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_2", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "127.5", + "204", + "255", + "306", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_3", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "219", + "350.40000000000003", + "438", + "525.6", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_4", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "65.5", + "104.80000000000001", + "131", + "157.2", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_5", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "64", + "102.4", + "128", + "153.6", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_6", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "242.5", + "388", + "485", + "582", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_7", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "101.5", + "162.4", + "203", + "243.6", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_VM_Critical_8", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "57.5", + "92", + "115", + "138", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_Physical_Srv_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "194.5", + "311.20000000000005", + "389", + "466.79999999999995", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ], + [ + "Job_File_Share_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "142.5", + "228", + "285", + "342", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/mocks/warning-unencrypted.json b/mocks/warning-unencrypted.json new file mode 100644 index 0000000..d8d2bb2 --- /dev/null +++ b/mocks/warning-unencrypted.json @@ -0,0 +1,176 @@ +{ + "Licenses": [ + { + "Edition": "EnterprisePlus", + "Status": "Valid", + "LicensedTo": "Synthetic Testing Corp", + "Type": "Subscription", + "LicensedInstances": "500", + "UsedInstances": "245", + "NewInstances": "0", + "RentalInstances": "0", + "LicensedSockets": "0", + "UsedSockets": "0", + "LicensedNas": "0", + "UsedNas": "0", + "ExpirationDate": "12/31/2028 12:00:00 AM", + "SupportExpirationDate": "12/31/2028 12:00:00 AM", + "CloudConnect": "Disabled" + } + ], + "Sections": { + "backupServer": { + "SectionName": "backupServer", + "Headers": [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget" + ], + "Rows": [ + [ + "VBR-SEC-01", + "12.1.2.172", + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup" + ] + ] + }, + "securitySummary": { + "SectionName": "securitySummary", + "Headers": [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled" + ], + "Rows": [["True", "True", "True", "True", "True"]] + }, + "repos": { + "SectionName": "repos", + "Headers": [ + "Name", + "JobCount", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type" + ], + "Rows": [ + [ + "Linux-Repo-01", + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + "9", + "42", + "False", + "LinuxLocal" + ] + ] + }, + "jobInfo": { + "SectionName": "jobInfo", + "Headers": [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled" + ], + "Rows": [ + [ + "Job_Unencrypted_01", + "Linux-Repo-01", + "2477", + "1486", + "Days", + "31", + "False", + "Backup", + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True" + ] + ] + }, + "jobSessionSummaryByJob": { + "SectionName": "jobSessionSummaryByJob", + "Headers": [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes" + ], + "Rows": [ + [ + "Job_Unencrypted_01", + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + "92.5", + "148", + "185", + "222", + "2.5", + "0", + "0", + "0", + "VMware Backup" + ] + ] + } + } +} diff --git a/package-lock.json b/package-lock.json index a26b0bc..716b62f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -45,6 +45,7 @@ "prettier-plugin-tailwindcss": "^0.7.2", "shadcn": "^3.8.3", "tailwindcss": "^4.1.18", + "tsx": "^4.21.0", "tw-animate-css": "^1.4.0", "typescript": "~5.9.3", "typescript-eslint": "^8.46.4", @@ -7928,6 +7929,19 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-tsconfig": { + "version": "4.13.6", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.6.tgz", + "integrity": "sha512-shZT/QMiSHc/YBLxxOkMtgSid5HFoauqCE3/exfsEcwg1WkeqjG+V40yBbBrsD+jW2HDXcs28xOfcbm2jI8Ddw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/git-raw-commits": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-4.0.0.tgz", @@ -10752,6 +10766,16 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "devOptional": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/restore-cursor": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz", @@ -11631,6 +11655,26 @@ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "license": "0BSD" }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, "node_modules/tw-animate-css": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/tw-animate-css/-/tw-animate-css-1.4.0.tgz", diff --git a/package.json b/package.json index 4ed3bb1..2d821c4 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,8 @@ "prepare": "husky", "test": "vitest", "test:run": "vitest run", - "test:coverage": "vitest run --coverage" + "test:coverage": "vitest run --coverage", + "generate-mocks": "tsx scripts/generate-mocks.ts" }, "dependencies": { "@icons-pack/react-simple-icons": "^13.11.1", @@ -51,6 +52,7 @@ "prettier-plugin-tailwindcss": "^0.7.2", "shadcn": "^3.8.3", "tailwindcss": "^4.1.18", + "tsx": "^4.21.0", "tw-animate-css": "^1.4.0", "typescript": "~5.9.3", "typescript-eslint": "^8.46.4", diff --git a/scripts/generate-mocks.ts b/scripts/generate-mocks.ts new file mode 100644 index 0000000..9bf6a73 --- /dev/null +++ b/scripts/generate-mocks.ts @@ -0,0 +1,29 @@ +import { HealthcheckMockBuilder } from "../src/lib/mocks/generator"; +import * as fs from "fs"; +import * as path from "path"; + +const MOCK_DIR = path.join(process.cwd(), "mocks"); + +if (!fs.existsSync(MOCK_DIR)) { + fs.mkdirSync(MOCK_DIR); +} + +const scenarios = { + "perfect-v12.json": HealthcheckMockBuilder.createPassingV12(), + "legacy-v11.json": HealthcheckMockBuilder.createLegacyV11(), + "blocker-aws.json": HealthcheckMockBuilder.createBlockingAWS(), + "warning-unencrypted.json": HealthcheckMockBuilder.createWarningUnencrypted(), + "community-edition.json": HealthcheckMockBuilder.createCommunityEdition(), + "low-retention.json": HealthcheckMockBuilder.createLowRetention(), + "advanced-cloud.json": HealthcheckMockBuilder.createAdvancedCloud(), +}; + +console.log("Generating synthetic healthcheck files..."); + +Object.entries(scenarios).forEach(([filename, data]) => { + const filePath = path.join(MOCK_DIR, filename); + fs.writeFileSync(filePath, JSON.stringify(data, null, 2)); + console.log(` - ${filename}`); +}); + +console.log("\nDone! Files are available in the /mocks directory."); diff --git a/src/lib/mocks/generator.ts b/src/lib/mocks/generator.ts new file mode 100644 index 0000000..f55d1b5 --- /dev/null +++ b/src/lib/mocks/generator.ts @@ -0,0 +1,579 @@ +import type { HealthcheckRoot } from "../../types/healthcheck"; + +/** + * Accuracy-first Mock Generator for Veeam Healthcheck JSON + * + * This generator ensures: + * 1. Referential integrity (Jobs -> Repos -> SOBRs) + * 2. Proper Header/Row alignment + * 3. Detailed field population for UI testing (Job Details, Sizing, Repos) + */ + +export class HealthcheckMockBuilder { + private data: HealthcheckRoot; + + constructor() { + this.data = { + Licenses: [], + Sections: {}, + }; + } + + private static rand(min: number, max: number): number { + return Math.floor(Math.random() * (max - min + 1) + min); + } + + /** + * Generates a "Standard Passing" environment for VDC Vault + */ + static createPassingV12(): HealthcheckRoot { + const builder = new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("VBR-PROD-01", "12.1.2.172") + .withSecuritySummary(true, true, true, true, true) + .withSobr("SOBR_Primary", true, true, 7) + .withRepo("Linux-Hardened-01", "LinuxHardened", true) + .withRepo("Dedupe-Appliance-01", "DDBoost", false); + + // Add jobs to SOBR + for (let i = 1; i <= 8; i++) { + builder.addDetailedJob( + `Job_VM_Critical_${i}`, + "SOBR_Primary", + true, + 31, + "Backup", + ); + } + + // Add jobs to Repos + builder.addDetailedJob( + "Job_Physical_Srv_01", + "Linux-Hardened-01", + true, + 30, + "Agent Backup", + ); + builder.addDetailedJob( + "Job_File_Share_01", + "Dedupe-Appliance-01", + true, + 14, + "File Backup", + ); + + return builder.build(); + } + + static createLegacyV11(): HealthcheckRoot { + return new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("Server_Old", "11.0.1.1261") + .withSecuritySummary(false, false, false, false, false) + .withRepo("Windows-Repo-Old", "WinLocal", false) + .addDetailedJob("Job_Legacy_01", "Windows-Repo-Old", false, 14) + .build(); + } + + static createBlockingAWS(): HealthcheckRoot { + return new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("VBR-PROD-01", "12.2.0.334") + .withSecuritySummary(true, true, true, true, true) + .withSobr("SOBR_Vault", true, true, 7) + .addDetailedJob("Job_VM_01", "SOBR_Vault", true, 31) + .addDetailedJob( + "Job_AWS_Direct", + "SOBR_Vault", + true, + 30, + "Veeam.Vault.AWS.Backup", + ) + .build(); + } + + static createWarningUnencrypted(): HealthcheckRoot { + return new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("VBR-SEC-01", "12.1.2.172") + .withSecuritySummary(true, true, true, true, true) + .withRepo("Linux-Repo-01", "LinuxLocal", false) + .addDetailedJob("Job_Unencrypted_01", "Linux-Repo-01", false, 31) + .build(); + } + + static createCommunityEdition(): HealthcheckRoot { + return new HealthcheckMockBuilder() + .withLicense("Community Edition", "Valid") + .withBackupServer("LAB-VBR", "12.1.2.172") + .withSecuritySummary(true, true, true, true, true) + .withRepo("Local-Disk", "WinLocal", false) + .addDetailedJob("Lab_Job_01", "Local-Disk", true, 31) + .build(); + } + + static createLowRetention(): HealthcheckRoot { + return new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("VBR-PROD-01", "12.1.2.172") + .withSecuritySummary(true, true, true, true, true) + .withSobr("SOBR_Vault", true, true, 7) + .addDetailedJob("Short_Ret_Job_01", "SOBR_Vault", true, 7) + .build(); + } + + /** + * Generates a high-end enterprise environment with SOBR Archive Tier + */ + static createAdvancedCloud(): HealthcheckRoot { + const builder = new HealthcheckMockBuilder() + .withLicense("EnterprisePlus", "Valid") + .withBackupServer("VBR-CLOUD-01", "12.1.2.172") + .withSecuritySummary(true, true, true, true, true) + .withSobr("SOBR_Archive", true, true, 7); + + // Add Archive Tier to this SOBR + builder.addArchiveExtent("Archive-Tier-01", "SOBR_Archive", 90); + + for (let i = 1; i <= 5; i++) { + builder.addDetailedJob( + `Job_GFS_Cloud_${i}`, + "SOBR_Archive", + true, + 31, + "Backup", + ); + } + + return builder.build(); + } + + withLicense(edition: string, status: string = "Valid"): this { + this.data.Licenses = [ + { + Edition: edition, + Status: status, + LicensedTo: "Synthetic Testing Corp", + Type: "Subscription", + LicensedInstances: "500", + UsedInstances: "245", + NewInstances: "0", + RentalInstances: "0", + LicensedSockets: "0", + UsedSockets: "0", + LicensedNas: "0", + UsedNas: "0", + ExpirationDate: "12/31/2028 12:00:00 AM", + SupportExpirationDate: "12/31/2028 12:00:00 AM", + CloudConnect: "Disabled", + }, + ]; + return this; + } + + withBackupServer(name: string, version: string): this { + this.data.Sections.backupServer = { + SectionName: "backupServer", + Headers: [ + "Name", + "Version", + "DbType", + "DbHost", + "ConfigBackupEnabled", + "ConfigBackupLastResult", + "ConfigBackupEncryption", + "ConfigBackupTarget", + ], + Rows: [ + [ + name, + version, + "PostgreSQL", + "localhost", + "True", + "Success", + "True", + "Default Configuration Backup", + ], + ], + }; + return this; + } + + withSecuritySummary( + mfa: boolean, + fileEnc: boolean, + configEnc: boolean, + trafficEnc: boolean, + immutability: boolean, + ): this { + this.data.Sections.securitySummary = { + SectionName: "securitySummary", + Headers: [ + "MFAEnabled", + "TrafficEncryptionEnabled", + "BackupFileEncryptionEnabled", + "ConfigBackupEncryptionEnabled", + "ImmutabilityEnabled", + ], + Rows: [ + [ + mfa ? "True" : "False", + trafficEnc ? "True" : "False", + fileEnc ? "True" : "False", + configEnc ? "True" : "False", + immutability ? "True" : "False", + ], + ], + }; + return this; + } + + withSobr( + name: string, + hasCapTier: boolean, + immutable: boolean, + immutableDays: number, + ): this { + if (!this.data.Sections.sobr) { + this.data.Sections.sobr = { + SectionName: "sobr", + Headers: [ + "Name", + "ExtentCount", + "JobCount", + "PolicyType", + "EnableCapacityTier", + "CapacityTierCopy", + "CapacityTierMove", + "ArchiveTierEnabled", + "UsePerVMFiles", + "CapTierType", + "ImmutableEnabled", + "ImmutablePeriod", + "SizeLimitEnabled", + "SizeLimit", + ], + Rows: [], + }; + } + + this.data.Sections.sobr.Rows.push([ + name, + "2", + "0", // Will be updated by addDetailedJob if needed, but the normalizer re-calculates + "DataLocality", + hasCapTier ? "True" : "False", + hasCapTier ? "True" : "False", + hasCapTier ? "True" : "False", + "False", + "True", + hasCapTier ? "DataCloudVault" : null, + immutable ? "True" : "False", + immutable ? immutableDays.toString() : null, + "False", + null, + ]); + + // Add Performance Extents + this.addExtent(name + "_Perf_01", name, "LinuxLocal", "Server-01", true); + this.addExtent(name + "_Perf_02", name, "LinuxLocal", "Server-02", true); + + if (hasCapTier) { + this.addCapExtent( + name + "_Cap_Tier", + name, + true, + immutable, + immutableDays, + ); + } + + return this; + } + + private addExtent( + name: string, + sobrName: string, + type: string, + host: string, + immutable: boolean, + ) { + if (!this.data.Sections.extents) { + this.data.Sections.extents = { + SectionName: "extents", + Headers: [ + "Name", + "SobrName", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type", + ], + Rows: [], + }; + } + const total = HealthcheckMockBuilder.rand(50, 200); + const free = HealthcheckMockBuilder.rand(10, total); + + this.data.Sections.extents.Rows.push([ + name, + sobrName, + "8", + "16", + "64", + host, + "/mnt/backup", + free.toString(), + total.toString(), + immutable ? "True" : "False", + type, + ]); + } + + private addCapExtent( + name: string, + sobrName: string, + encrypted: boolean, + immutable: boolean, + days: number, + ) { + if (!this.data.Sections.capextents) { + this.data.Sections.capextents = { + SectionName: "capextents", + Headers: [ + "Name", + "SobrName", + "Status", + "ConnectionType", + "GatewayServer", + "CopyModeEnabled", + "MoveModeEnabled", + "MovePeriodDays", + "EncryptionEnabled", + "ImmutableEnabled", + "ImmutablePeriod", + "ImmutabilityMode", + "SizeLimitEnabled", + "SizeLimit", + "Type", + ], + Rows: [], + }; + } + this.data.Sections.capextents.Rows.push([ + name, + sobrName, + "Normal", + "Direct", + "VBR-PROD-01", + "True", + "True", + "0", + encrypted ? "True" : "False", + immutable ? "True" : "False", + immutable ? days.toString() : null, + "Compliance", + "False", + null, + "DataCloudVault", + ]); + } + + addArchiveExtent(name: string, sobrName: string, offloadPeriod: number) { + if (!this.data.Sections.archextents) { + this.data.Sections.archextents = { + SectionName: "archextents", + Headers: [ + "Name", + "SobrName", + "Status", + "GatewayMode", + "GatewayServer", + "OffloadPeriod", + "ArchiveTierEnabled", + "CostOptimizedEnabled", + "FullBackupModeEnabled", + "EncryptionEnabled", + "ImmutableEnabled", + "Type", + ], + Rows: [], + }; + } + this.data.Sections.archextents.Rows.push([ + name, + sobrName, + "Normal", + "Direct", + "VBR-PROD-01", + offloadPeriod.toString(), + "True", + "True", + "False", + "True", + "False", + "AzureArchive", + ]); + } + + withRepo(name: string, type: string, immutable: boolean): this { + if (!this.data.Sections.repos) { + this.data.Sections.repos = { + SectionName: "repos", + Headers: [ + "Name", + "JobCount", + "MaxTasks", + "Cores", + "Ram", + "Host", + "Path", + "FreeSpace", + "TotalSpace", + "IsImmutabilitySupported", + "Type", + ], + Rows: [], + }; + } + const total = HealthcheckMockBuilder.rand(10, 50); + const free = HealthcheckMockBuilder.rand(1, total); + + this.data.Sections.repos.Rows.push([ + name, + "0", + "4", + "8", + "32", + "Backup-Repo-01", + "/backups", + free.toString(), + total.toString(), + immutable ? "True" : "False", + type, + ]); + return this; + } + + addDetailedJob( + name: string, + repoName: string, + encrypted: boolean, + retentionDays: number, + type: string = "Backup", + ): this { + if (!this.data.Sections.jobInfo) { + this.data.Sections.jobInfo = { + SectionName: "jobInfo", + Headers: [ + "JobName", + "RepoName", + "SourceSizeGB", + "OnDiskGB", + "RetentionScheme", + "RetainDays", + "Encrypted", + "JobType", + "CompressionLevel", + "BlockSize", + "GfsEnabled", + "GfsDetails", + "ActiveFullEnabled", + "SyntheticFullEnabled", + "BackupChainType", + "IndexingEnabled", + ], + Rows: [], + }; + } + + const sourceSize = HealthcheckMockBuilder.rand(500, 5000); + const onDisk = Math.floor(sourceSize * 0.6); + + this.data.Sections.jobInfo.Rows.push([ + name, + repoName, + sourceSize.toString(), + onDisk.toString(), + "Days", + retentionDays.toString(), + encrypted ? "True" : "False", + type, + "Optimal", + "1 MB", + "False", + "", + "False", + "True", + "Forward Incremental", + "True", + ]); + + // Add session history for this job + this.addJobSession(name); + + return this; + } + + private addJobSession(jobName: string) { + if (!this.data.Sections.jobSessionSummaryByJob) { + this.data.Sections.jobSessionSummaryByJob = { + SectionName: "jobSessionSummaryByJob", + Headers: [ + "JobName", + "ItemCount", + "MinJobTime", + "MaxJobTime", + "AvgJobTime", + "SessionCount", + "Fails", + "Retries", + "SuccessRate", + "AvgBackupSize", + "MaxBackupSize", + "AvgDataSize", + "MaxDataSize", + "AvgChangeRate", + "WaitCount", + "MaxWait", + "AvgWait", + "JobTypes", + ], + Rows: [], + }; + } + + const avgDataSize = HealthcheckMockBuilder.rand(100, 500); + + this.data.Sections.jobSessionSummaryByJob.Rows.push([ + jobName, + "10", + "00:05:00", + "02:30:00", + "01:15:00", + "30", + "0", + "1", + "100", + (avgDataSize * 0.5).toString(), + (avgDataSize * 0.8).toString(), + avgDataSize.toString(), + (avgDataSize * 1.2).toString(), + "2.5", + "0", + "0", + "0", + "VMware Backup", + ]); + } + + build(): HealthcheckRoot { + return this.data; + } +} diff --git a/tsconfig.node.json b/tsconfig.node.json index 8a67f62..23af862 100644 --- a/tsconfig.node.json +++ b/tsconfig.node.json @@ -6,6 +6,10 @@ "module": "ESNext", "types": ["node"], "skipLibCheck": true, + "baseUrl": ".", + "paths": { + "@/*": ["./src/*"] + }, /* Bundler mode */ "moduleResolution": "bundler", @@ -22,5 +26,5 @@ "noFallthroughCasesInSwitch": true, "noUncheckedSideEffectImports": true }, - "include": ["vite.config.ts"] + "include": ["vite.config.ts", "scripts"] }