Skip to content

MaintenanceState ​

A snapshot of maintenance mode, returned by IMaintenanceService.GetAsync.

It carries only what a caller needs to report the current state; the allow lists and the redirect flag are persisted configuration and are not exposed here. Change maintenance mode through MaintenanceRequest rather than by writing the state file.

Fields

IsEnabled: bool
Whether maintenance mode is currently on.
Default: false

Message: string?
The message for the current window, or the configured DefaultMessage when the request did not supply one.
Default: null

StartsAt: DateTimeOffset?
When the window becomes active. A window with a future StartsAt is enabled but not yet blocking traffic.
Default: null

EndsAt: DateTimeOffset?
When the window ends. Also what the middleware writes Retry-After from.
Default: null

EnabledAt: DateTimeOffset?
When maintenance mode was turned on.
Default: null

Type signature ​

csharp
public sealed record MaintenanceState
{
    public bool IsEnabled { get; init; }
    public string? Message { get; init; }
    public DateTimeOffset? StartsAt { get; init; }
    public DateTimeOffset? EndsAt { get; init; }
    public DateTimeOffset? EnabledAt { get; init; }
}

All packages are released under the MIT License.