Add-KrHealthHttpProbe

SYNOPSIS

Registers an HTTP-based health probe that polls a remote endpoint.

SYNTAX

Add-KrHealthHttpProbe [[-Server] <KestrunHost>] [-Name] <String> [-Url] <String> [[-Tags] <String[]>]
 [[-HttpClient] <HttpClient>] [[-Timeout] <TimeSpan>] [-PassThru] [<CommonParameters>]

DESCRIPTION

Creates a Kestrun HttpProbe that issues a GET request to the specified URL and interprets the response according to the standard health contract. Provide a shared HttpClient instance for production use to avoid socket exhaustion, or rely on the default constructed client for simple scenarios.

EXAMPLES

EXAMPLE 1

Add-KrHealthHttpProbe -Name Api -Url 'https://api.contoso.local/health' -Tags 'remote','api'
Registers a health probe that checks a downstream API health endpoint.

EXAMPLE 2

$client = [System.Net.Http.HttpClient]::new()
Get-KrServer | Add-KrHealthHttpProbe -Name Ping -Url 'https://example.com/health' -HttpClient $client -PassThru
Registers a probe using a shared HttpClient instance and returns the host for additional configuration.

PARAMETERS

-Server

The Kestrun host instance to configure. If omitted, the current server context is resolved automatically.

Type: KestrunHost
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Name

Unique name for the probe.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Url

The absolute URL that the probe polls.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Tags

Optional set of tags used to include or exclude the probe when requests filter by tag.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 4
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-HttpClient

Optional HttpClient reused for the probe requests. When omitted a new HttpClient instance is created.

Type: HttpClient
Parameter Sets: (All)
Aliases:

Required: False
Position: 5
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Timeout

Optional timeout applied to the HTTP request. Defaults to 5 seconds.

Type: TimeSpan
Parameter Sets: (All)
Aliases:

Required: False
Position: 6
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-PassThru

Emits the configured server instance so the call can be chained.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

Kestrun.Hosting.KestrunHost

NOTES