from .monitor_cert_expiry import CertExpiryState from .monitor_check_status import CheckStatus _STATUS = {"ok": "up", "warning": "up", "critical": "degraded", "expired": "down"} def cert_check(state: CertExpiryState) -> CheckStatus: """A certificate as one check behind a status page component. A warning is work for the operator, not something a visitor notices, so it stays up; critical is degraded because renewal is now urgent; an expired certificate breaks every client, so it is down.""" if state not in _STATUS: raise ValueError("unknown certificate state: %s" % (state,)) return _STATUS[state] # type: ignore[return-value]