private void ValidateWhitelistSetRelationship( EntityFilter subsetFilter, EntityFilter supersetFilter, string subsetFilterConditionParamName, string supersetFilterConditionParamName, string subsetParamName, string supersetParamName) { if (supersetFilter.WhenToReport == WhenToReportEntityHealth.Never && subsetFilter.WhenToReport != WhenToReportEntityHealth.Never) { throw new Exception(); //throw new ConfigurationErrorsException( // string.Format( // "Invalid value {0} in parameter {1}. {1} must equal or more restrictive than {2}.", // subsetFilter.WhenToReport, // subsetFilterConditionParamName, // supersetFilterConditionParamName)); } if (supersetFilter.ReportAllApps || subsetFilter.WhenToReport == WhenToReportEntityHealth.Never) { return; } if (!supersetFilter.ReportAllApps && subsetFilter.ReportAllApps) { throw new Exception(); //throw new ConfigurationErrorsException( // string.Format( // "Invalid value 'All' in parameter {0}. {0} must be subset of {1}.", // subsetParamName, // supersetParamName)); } var subsetList = subsetFilter.AppWhitelist; var supersetList = supersetFilter.AppWhitelist; if (!subsetList.IsSubsetOf(supersetList)) { var deltaSet = subsetList.Except(supersetList); throw new Exception(); //throw new ConfigurationErrorsException( // string.Format( // "{0} should be subset of {1}. Add the following to {0} or remove from {1} {2}.", // subsetParamName, // supersetParamName, // string.Join(",", deltaSet))); } }
internal void RefreshFilterRepository() { this.ServiceHealthFilter = this.GetEntityHealthFilter( this.ParseServiceEnum(), this.config.ApplicationsThatReportServiceHealth); this.PartitionHealthFilter = this.GetEntityHealthFilter( this.ParsePartitionEnum(), this.config.ApplicationsThatReportPartitionHealth); this.ReplicaHealthFilter = this.GetEntityHealthFilter( this.ParseReplicaEnum(), this.config.ApplicationsThatReportReplicaHealth); this.DeployedApplicationHealthFilter = this.GetEntityHealthFilter( this.ParseDeployedApplicationEnum(), this.config.ApplicationsThatReportDeployedApplicationHealth); this.ServicePackageHealthFilter = this.GetEntityHealthFilter( this.ParseServicePackageEnum(), this.config.ApplicationsThatReportServicePackageHealth); this.HealthEventsFilter = this.GetEntityHealthFilter( this.ParseHealthEventsEnum(), this.config.ApplicationsThatReportHealthEvents); this.ValidateWhitelistSetRelationship( this.PartitionHealthFilter, this.ServiceHealthFilter, nameof(this.config.ReportPartitionHealth), nameof(this.config.ReportServiceHealth), nameof(this.config.ApplicationsThatReportPartitionHealth), nameof(this.config.ApplicationsThatReportServiceHealth)); this.ValidateWhitelistSetRelationship( this.ReplicaHealthFilter, this.PartitionHealthFilter, nameof(this.config.ReportReplicaHealth), nameof(this.config.ReportPartitionHealth), nameof(this.config.ApplicationsThatReportReplicaHealth), nameof(this.config.ApplicationsThatReportPartitionHealth)); this.ValidateWhitelistSetRelationship( this.ServicePackageHealthFilter, this.DeployedApplicationHealthFilter, nameof(this.config.ReportServicePackageHealth), nameof(this.config.ReportDeployedApplicationHealth), nameof(this.config.ApplicationsThatReportServicePackageHealth), nameof(this.config.ApplicationsThatReportDeployedApplicationHealth)); }