Documentation ¶
Index ¶
- func JSON(c echo.Context, status int, i interface{}) error
- func Msgpack(c echo.Context, status int, i interface{}) error
- func NewHandler(s *Server) http.Handler
- type Emailer
- type ErrHTTP
- type Fire
- type LogLevel
- type Logger
- type Redis
- type Server
- func (s *Server) AddRoutes(e *echo.Echo)
- func (s *Server) ErrBadRequest(c echo.Context, err error) error
- func (s *Server) ErrConflict(c echo.Context, err error) error
- func (s *Server) ErrEntityTooLarge(c echo.Context, err error) error
- func (s *Server) ErrForbidden(c echo.Context, err error) error
- func (s *Server) ErrNotFound(c echo.Context, err error) error
- func (s *Server) ErrResponse(c echo.Context, err error) error
- func (s *Server) ErrTooManyRequests(c echo.Context, err error) error
- func (s *Server) ErrorHandler(err error, c echo.Context)
- func (s *Server) GenerateToken() (string, error)
- func (s *Server) SetAdmins(admins []keys.ID)
- func (s *Server) SetClock(clock tsutil.Clock)
- func (s *Server) SetEmailer(emailer Emailer)
- func (s *Server) SetInternalAuth(internalAuth string)
- func (s *Server) SetInternalKey(internalKey string) error
- func (s *Server) SetTasks(tasks Tasks)
- func (s *Server) SetTokenKey(tokenKey string) error
- func (s *Server) ValidateToken(token string) error
- type TaskPriority
- type Tasks
- type Vault
- type VaultResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHandler ¶
NewHandler returns http.Handler for Server.
Types ¶
type ErrHTTP ¶
type ErrHTTP struct { Code int `json:"code,omitempty"` Message string `json:"message,omitempty"` Err error `json:"-"` }
ErrHTTP ...
type Logger ¶
type Logger interface { Debugf(format string, args ...interface{}) Infof(format string, args ...interface{}) Errorf(format string, args ...interface{}) }
Logger compatible with GCP.
type Redis ¶
type Redis interface { // Get returns value at key. Get(ctx context.Context, k string) (string, error) // Put puts a value at key. Set(ctx context.Context, k string, v string) error // Delete key. Delete(ctx context.Context, k string) error // Expire key. Expire(ctx context.Context, k string, dt time.Duration) error // Increment value at key. Increment(ctx context.Context, k string) (int64, error) // Publish data to key. Publish(ctx context.Context, k string, b []byte) error }
Redis defines interface for a distributed key value store. Used to prevent nonce re-use for authenticated requests.
func NewRedisTest ¶
NewRedisTest returns Redis for testing.
type Server ¶
type Server struct { // URL (base) of form http(s)://host:port with no trailing slash to help // authorization checks in testing where the host is ambiguous. URL string // contains filtered or unexported fields }
Server ...
func (*Server) AddRoutes ¶
func (s *Server) AddRoutes(e *echo.Echo)
AddRoutes adds routes to an Echo instance.
func (*Server) ErrBadRequest ¶
ErrBadRequest response.
func (*Server) ErrConflict ¶
ErrConflict response.
func (*Server) ErrEntityTooLarge ¶
ErrEntityTooLarge response.
func (*Server) ErrForbidden ¶
ErrForbidden response.
func (*Server) ErrNotFound ¶
ErrNotFound response.
func (*Server) ErrResponse ¶
ErrResponse is a generate error response. All errors come through here.
func (*Server) ErrTooManyRequests ¶
ErrTooManyRequests response.
func (*Server) ErrorHandler ¶
ErrorHandler returns error handler that returns in the format: {"error": {"message": "error message", status: 500}}".
func (*Server) GenerateToken ¶
func (*Server) SetInternalAuth ¶
SetInternalAuth for authorizing internal requests, like tasks.
func (*Server) SetInternalKey ¶
SetInternalKey for encrypting between internal services.
func (*Server) SetTokenKey ¶
SetTokenKey for setting token key.
func (*Server) ValidateToken ¶
type TaskPriority ¶
type TaskPriority int
TaskPriority suggests a higher priority queue.
const ( // HighPriority ... HighPriority TaskPriority = 1 // LowPriority ... LowPriority TaskPriority = 100 )
type Tasks ¶
type Tasks interface { // CreateTask ... CreateTask(ctx context.Context, method string, url string, authToken string, priority TaskPriority) error }
Tasks ..
func NewTestTasks ¶
NewTestTasks returns Tasks for use in tests.