Esempio n. 1
0
        /// <summary>
        /// Provides a database Vulnerability Assessment Rule Baseline model for the given database
        /// </summary>
        public DatabaseVulnerabilityAssessmentRuleBaselineModel GetDatabaseVulnerabilityAssessmentRuleBaseline(string resourceGroup, string serverName,
                                                                                                               string databaseName, string ruleId, bool ruleAppliesToMaster)
        {
            var vulnerabilityAssessmentRuleBaseline = VulnerabilityAssessmentCommunicator.GetDatabaseVulnerabilityAssessmentRuleBaseline(resourceGroup,
                                                                                                                                         serverName, databaseName, ruleId, ruleAppliesToMaster);

            var ruleBaselineModel = new DatabaseVulnerabilityAssessmentRuleBaselineModel()
            {
                ResourceGroupName   = resourceGroup,
                ServerName          = serverName,
                DatabaseName        = databaseName,
                RuleId              = ruleId,
                RuleAppliesToMaster = ruleAppliesToMaster
            };

            ruleBaselineModel.BaselineResult = new List <DatabaseVulnerabilityAssessmentRuleBaselineRowModel>();

            foreach (var baselineResult in vulnerabilityAssessmentRuleBaseline.BaselineResults)
            {
                var ruleBaselineItem = new DatabaseVulnerabilityAssessmentRuleBaselineRowModel()
                {
                    Result = baselineResult.Result
                };

                ruleBaselineModel.BaselineResult.Add(ruleBaselineItem);
            }

            return(ruleBaselineModel);
        }
        /// <summary>
        /// Provides a database Vulnerability Assessment Rule Baseline model for the given database
        /// </summary>
        public VulnerabilityAssessmentRuleBaselineModel GetVulnerabilityAssessmentRuleBaseline(string resourceGroup, string serverName,
                                                                                               string databaseName, string ruleId, bool ruleAppliesToMaster, ApplyToType applyToType)
        {
            var vulnerabilityAssessmentRuleBaseline = (applyToType == ApplyToType.Database)
                ? VulnerabilityAssessmentCommunicator.GetDatabaseVulnerabilityAssessmentRuleBaseline(resourceGroup, serverName, databaseName, ruleId, ruleAppliesToMaster)
                : VulnerabilityAssessmentCommunicator.GetManagedDatabaseVulnerabilityAssessmentRuleBaseline(resourceGroup, serverName, databaseName, ruleId, ruleAppliesToMaster);

            var ruleBaselineModel = new VulnerabilityAssessmentRuleBaselineModel()
            {
                ResourceGroupName   = resourceGroup,
                RuleId              = ruleId,
                RuleAppliesToMaster = ruleAppliesToMaster
            };

            ruleBaselineModel.BaselineResult = new List <VulnerabilityAssessmentRuleBaselineRowModel>();

            foreach (var baselineResult in vulnerabilityAssessmentRuleBaseline.BaselineResults)
            {
                var ruleBaselineItem = new VulnerabilityAssessmentRuleBaselineRowModel()
                {
                    Result = baselineResult.Result
                };

                ruleBaselineModel.BaselineResult.Add(ruleBaselineItem);
            }

            return(ruleBaselineModel);
        }