Skip to content

MaintenanceRequest ​

Describes a maintenance window, passed to IMaintenanceService.EnableAsync.

Every field is nullable and every omitted field falls back to MaintenanceSettings, so a caller sends only what differs from the configured defaults. A supplied list replaces the configured one for the duration of the window; it is not merged with it.

Fields

Message: string?
Message shown for this window. Falls back to DefaultMessage from configuration.
Default: null

StartsAt: DateTimeOffset?
When the window should begin. Until it passes, maintenance mode is enabled but traffic is served normally. Omit to start immediately.
Default: null

EndsAt: DateTimeOffset?
When the window should end. Required for the middleware to send a Retry-After header, and for AutoDisableWhenExpired to have anything to act on. Must be after StartsAt when both are set.
Default: null

AutoDisableWhenExpired: bool?
Whether the window turns itself off once EndsAt has passed. Falls back to configuration.
Default: null

RedirectBlockedRequests: bool?
Whether blocked requests that accept text/html are redirected to the maintenance path. Falls back to configuration.
Default: null

AllowedPaths: IReadOnlyList<string>?
Exact paths that stay reachable for this window. Replaces the configured list rather than adding to it.
Default: null

AllowedPathPrefixes: IReadOnlyList<string>?
Path prefixes that stay reachable for this window. Replaces the configured list rather than adding to it.
Default: null

AllowedIpAddresses: IReadOnlyList<string>?
Client addresses that stay able to reach the application. Replaces the configured list rather than adding to it.
Default: null

Type signature ​

csharp
public sealed record MaintenanceRequest
{
    public string? Message { get; init; }
    public DateTimeOffset? StartsAt { get; init; }
    public DateTimeOffset? EndsAt { get; init; }
    public bool? AutoDisableWhenExpired { get; init; }
    public bool? RedirectBlockedRequests { get; init; }
    public IReadOnlyList<string>? AllowedPaths { get; init; }
    public IReadOnlyList<string>? AllowedPathPrefixes { get; init; }
    public IReadOnlyList<string>? AllowedIpAddresses { get; init; }
}

All packages are released under the MIT License.