/// <summary> /// Adds a <see cref="HttpHealthCheck"/> to the services. /// </summary> /// <param name="builder">The health check builder</param> /// <param name="name">The health check name</param> /// <param name="url">The url address</param> /// <param name="timeoutInMs">The request timeout</param> /// <param name="ensureSuccessfulStatus">Ensure a successful HTTP status code of 2XX?</param> /// <param name="required">Is the health check required?</param> /// <param name="tags">The collection of tags</param> /// <returns>The builder after changes</returns> /// <exception cref="ArgumentNullException"></exception> public static IHealthCheckBuilder AddHttp(this IHealthCheckBuilder builder, string name, Uri url, int timeoutInMs = 5000, bool ensureSuccessfulStatus = true, bool required = false, params string[] tags) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } return(builder.AddHttp(new HttpHealthCheckProperties(name, url, timeoutInMs, ensureSuccessfulStatus, required, tags))); }
/// <summary> /// Adds a <see cref="HttpHealthCheck"/> to the services. /// </summary> /// <param name="builder">The health check builder</param> /// <param name="name">The health check name</param> /// <param name="urlBuilder">The url addres builders</param> /// <param name="timeoutInMs">The request timeout</param> /// <param name="ensureSuccessfulStatus">Ensure a successful HTTP status code of 2XX?</param> /// <param name="required">Is the health check required?</param> /// <param name="tags">The collection of tags</param> /// <returns>The builder after changes</returns> /// <exception cref="ArgumentNullException"></exception> public static IHealthCheckBuilder AddHttp(this IHealthCheckBuilder builder, string name, Func <IServiceProvider, string> urlBuilder, int timeoutInMs = 5000, bool ensureSuccessfulStatus = true, bool required = false, params string[] tags) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (urlBuilder == null) { throw new ArgumentNullException(nameof(urlBuilder)); } return(builder.AddHttp(name, p => new Uri(urlBuilder(p)), timeoutInMs, ensureSuccessfulStatus, required, tags)); }