def config_changes() -> Response: def serialize( key: str, ts: float, user: Optional[str], before: Optional[ConfigType], after: Optional[ConfigType], ) -> ConfigChange: return { "key": key, "timestamp": ts, "user": user, "before": str(before) if before is not None else None, "beforeType": get_config_type_from_value(before), "after": str(after) if after is not None else None, "afterType": get_config_type_from_value(after), } data = [ serialize(key, ts, user, before, after) for [key, ts, user, before, after] in state.get_config_changes() ] return Response(json.dumps(data), 200, {"Content-Type": "application/json"})
def config_changes(): return ( json.dumps(state.get_config_changes()), 200, { 'Content-Type': 'application/json' }, )
def config_changes() -> RespTuple: return ( json.dumps(state.get_config_changes()), 200, { "Content-Type": "application/json" }, )
def log() -> None: "Dump the config change log." from datetime import datetime for key, (ts, user, before, after) in state.get_config_changes(): click.echo( f"{datetime.fromtimestamp(int(ts)).isoformat()}: " f"key={key!r} user={user!r} " f"before={before!r} after={after!r}" )