Versions in this module Expand all Collapse all v1 v1.0.0 Dec 20, 2023 Changes in this version + var ErrBadreq = newError("bad request", http.StatusBadRequest) + var ErrForbidden = newError("forbidden", http.StatusForbidden) + var ErrISE = newError("internal server error", http.StatusInternalServerError) + var ErrInvalid = newError("invalid data", http.StatusBadRequest) + var ErrInvalidAPIRoute = newError("invalid api route", http.StatusNotFound) + var ErrKeyNotFound = newError("key not found", http.StatusNotFound) + var ErrKeyRequestRejected = newError("key request rejected", http.StatusForbidden) + var ErrMNA = newError("method not allowed", http.StatusMethodNotAllowed) + var ErrNotFound = newError("not found", http.StatusNotFound) + var ErrReqNotFound = newError("key request not found", http.StatusNotFound) + var ErrTooManyApprovals = newError("too many approvals pending", http.StatusConflict) + type Approval struct + ID string + IP string + Name string + Status Status + type ApprovalMap map[string]Approval + type Approver struct + func NewApprover() *Approver + func (a *Approver) List() (m ApprovalMap) + func (a *Approver) New(id, name, ip string) (aid string, err error) + func (a *Approver) Status(id, aid, ip string) (s Status) + func (a *Approver) Update(aid string, s Status) (err error) + type Context struct + Code int + Data *ContextData + Log logr.Logger + Request *http.Request + Response http.ResponseWriter + func NewContext(w http.ResponseWriter, r *http.Request, data *ContextData, log logr.Logger) *Context + func (c *Context) Body(b []byte) + func (c *Context) ClientIP() string + func (c *Context) Err(err Error) + func (c *Context) Form(name string) string + func (c *Context) HTTPErr(err string, code int) + func (c *Context) Header(name string) string + func (c *Context) JSON(v any) + func (c *Context) Method() string + func (c *Context) NotFound() + func (c *Context) OK() + func (c *Context) Path() string + func (c *Context) ReadBody() (b []byte, err error) + func (c *Context) Redirect(url string, code int) + func (c *Context) SetHeader(name, value string) + func (c *Context) Var(name string) string + type ContextData struct + Approver *Approver + DB *db.DB + type CtxHandler func(*Context) + type Err struct + func (a Err) Code() int + func (a Err) Error() string + func (a Err) JSON() string + type Error interface + Code func() int + Error func() string + JSON func() string + type Route struct + Handler CtxHandler + Methods []string + Path string + type Status int + const Approved + const NotFound + const Pending + const Rejected + func (s Status) String() string