コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the type
        /// </summary>
        /// <param name="configuration">The configuration of the probe</param>
        /// <param name="loggerFactory">A factory used to create loggers from</param>
        /// <param name="validator">The validation instance</param>
        public MultiProbeStartup(IMultiProbeConfiguration configuration, ILoggerFactory loggerFactory, IMultiProbeValidator validator)
        {
            Guard.NotNull(nameof(configuration), configuration);
            Guard.NotNull(nameof(validator), validator);
            Guard.NotNull(nameof(loggerFactory), loggerFactory);

            _configuration = configuration;
            _validator     = validator;
            _loggerFactory = loggerFactory;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the type
        /// </summary>
        /// <param name="next">The next module to pass the context to</param>
        /// <param name="loggerFactory">A factory that can be used to create loggers</param>
        /// <param name="validator">Logic that is used to validate probe requests</param>
        /// <param name="configuration">Configuration that specifies the operation and endpoints for multy logic probes</param>
        public MultiProbeMiddleware(RequestDelegate next, IMultiProbeConfiguration configuration, ILoggerFactory loggerFactory, IMultiProbeValidator validator)
        {
            Guard.NotNull(nameof(configuration), configuration);
            Guard.NotNull(nameof(validator), validator);
            Guard.NotNull(nameof(validator.Name), validator.Name);
            Guard.NotNull(nameof(loggerFactory), loggerFactory);

            _next          = next;
            _configuration = configuration;
            _loggerFactory = loggerFactory;
            _logger        = _loggerFactory.CreateLogger(validator.Name);
            _validator     = validator;
        }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the type
 /// </summary>
 /// <param name="kestrelConfiguration">The kestrel configuration details</param>
 /// <param name="loggerFactory">A factory to create loggers from</param>
 /// <param name="probeConfiguration">The probe configuration</param>
 /// <param name="validator">The validation routine</param>
 public MultiProbe(IKestrelHostConfiguration kestrelConfiguration, ILoggerFactory loggerFactory, IMultiProbeConfiguration probeConfiguration, IMultiProbeValidator validator)
     : base(kestrelConfiguration, loggerFactory, () => new MultiProbeStartup(probeConfiguration, loggerFactory, validator))
 {
 }
コード例 #4
0
        /// <summary>
        /// Adds the probe middleware
        /// </summary>
        /// <param name="app">The application builder to add the middleware to</param>
        /// <param name="configuration">Probe configuration</param>
        /// <param name="loggerFactory">A factory to create loggers from</param>
        /// <param name="validator">Validation logic for the probes</param>
        /// <returns>The builder to enable pipelining</returns>
        public static IApplicationBuilder UseMultiProbe(this IApplicationBuilder app, IMultiProbeConfiguration configuration, ILoggerFactory loggerFactory, IMultiProbeValidator validator)
        {
            app.UseMiddleware(typeof(MultiProbeMiddleware), configuration, loggerFactory, validator);

            return(app);
        }