Esempio n. 1
0
        /// <summary>
        /// Provides a Vulnerability Assessment settings model for the given database
        /// </summary>
        public VulnerabilityAssessmentSettingsModel GetVulnerabilityAssessmentSettings(string resourceGroup, string serverName, string databaseName, ApplyToType applyToType)
        {
            switch (applyToType)
            {
            case ApplyToType.Database:
                var vaDbSettings = VulnerabilityAssessmentCommunicator.GetDatabaseVulnerabilityAssessmentSettings(resourceGroup, serverName, databaseName);
                return(ConvertSettingsToModel(resourceGroup, vaDbSettings.RecurringScans, vaDbSettings.StorageContainerPath));

            case ApplyToType.ManagedDatabase:
                var vaManagedDbSettings = VulnerabilityAssessmentCommunicator.GetManagedDatabaseVulnerabilityAssessmentSettings(resourceGroup, serverName, databaseName);
                return(ConvertSettingsToModel(resourceGroup, vaManagedDbSettings.RecurringScans, vaManagedDbSettings.StorageContainerPath));

            case ApplyToType.Server:
                var vaServerSettings = VulnerabilityAssessmentCommunicator.GetServerVulnerabilityAssessmentSettings(resourceGroup, serverName);
                return(ConvertSettingsToModel(resourceGroup, vaServerSettings.RecurringScans, vaServerSettings.StorageContainerPath));

            case ApplyToType.ManagedInstance:
                var vaManagedInstanceSettings = VulnerabilityAssessmentCommunicator.GetManagedInstanceVulnerabilityAssessmentSettings(resourceGroup, serverName);
                return(ConvertSettingsToModel(resourceGroup, vaManagedInstanceSettings.RecurringScans, vaManagedInstanceSettings.StorageContainerPath));

            default:
                throw new Exception(Properties.Resources.VulnerabilityAssessmentTypeNotSupported);
            }
        }