Example #1
0
 internal HealthConfigurationBuilder(
     IHealthBuilder healthBuilder,
     HealthOptions currentOptions,
     Action <HealthOptions> setupAction)
 {
     Builder      = healthBuilder ?? throw new ArgumentNullException(nameof(healthBuilder));
     _setupAction = setupAction ?? throw new ArgumentNullException(nameof(setupAction));
     _options     = currentOptions ?? new HealthOptions();
 }
Example #2
0
        /// <inheritdoc />
        public IHealthBuilder Configure(HealthOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _setupAction(options);

            _options = options;

            return(Builder);
        }
Example #3
0
 public HealthRoot(
     IHealth health,
     HealthOptions options,
     HealthFormatterCollection metricsOutputFormatters,
     IHealthOutputFormatter defaultMetricsOutputFormatter,
     IRunHealthChecks healthCheckRunner)
 {
     Options = options ?? throw new ArgumentNullException(nameof(options));
     _health = health ?? throw new ArgumentNullException(nameof(health));
     OutputHealthFormatters       = metricsOutputFormatters ?? new HealthFormatterCollection();
     DefaultOutputHealthFormatter = defaultMetricsOutputFormatter;
     HealthCheckRunner            = healthCheckRunner;
 }
Example #4
0
        /// <inheritdoc />
        public IHealthBuilder Configure(IEnumerable <KeyValuePair <string, string> > optionValues)
        {
            if (optionValues == null)
            {
                throw new ArgumentNullException(nameof(optionValues));
            }

            var mergedOptions = new KeyValuePairHealthOptions(_options, optionValues).AsOptions();

            _setupAction(mergedOptions);

            _options = mergedOptions;

            return(Builder);
        }
Example #5
0
        /// <inheritdoc />
        public IHealthBuilder Extend(HealthOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            var optionsValuesToExtend = options.ToKeyValue();
            var extendedOptions       = new KeyValuePairHealthOptions(_options, optionsValuesToExtend).AsOptions();

            _setupAction(extendedOptions);

            _options = extendedOptions;

            return(Builder);
        }