apiserver

package
v0.83.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2021 License: MIT Imports: 17 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CurrencyRatesHandler added in v0.57.0

func CurrencyRatesHandler(store eventio.CurrencyRateReader) echo.HandlerFunc

func ForecastEventsHandler

func ForecastEventsHandler(store eventio.BillableEventForecaster) echo.HandlerFunc

func ListenAndServe

func ListenAndServe(ctx context.Context, logger lager.Logger, e *echo.Echo, addr string) error

func New

func New(cfg Config) *echo.Echo

New creates a new server. Use ListenAndServe to start accepting connections.

func PricingPlansHandler

func PricingPlansHandler(store eventio.PricingPlanReader) echo.HandlerFunc

func TotalCostHandler added in v0.65.0

func TotalCostHandler(store eventio.TotalCostReader) echo.HandlerFunc

func UsageEventsHandler

func UsageEventsHandler(store eventio.UsageEventReader, uaa auth.Authenticator) echo.HandlerFunc

func VATRatesHandler added in v0.57.0

func VATRatesHandler(store eventio.VATRateReader) echo.HandlerFunc

func WriteRowsAsJson

func WriteRowsAsJson(writer io.Writer, flusher http.Flusher, rows eventio.BillableEventRows) error

Types

type Config

type Config struct {
	// Authenticator sets the auth mechanism (required)
	Authenticator auth.Authenticator
	// Store sets the Store used for querying events (required)
	Store eventio.EventStore
	// Logger sets the request logger
	Logger lager.Logger
	// EnablePanic will cause the server to crash on panic if set to true
	EnablePanic bool
}

type ErrorResponse

type ErrorResponse struct {
	Error      string `json:"error"`
	Constraint string `json:"constraint,omitempty"`
}

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger wraps a lager.Logger in the echo.Logger interface

func NewLogger

func NewLogger(logger lager.Logger) *Logger

func (*Logger) Debug

func (l *Logger) Debug(i ...interface{})

func (*Logger) Debugf

func (l *Logger) Debugf(format string, i ...interface{})

func (*Logger) Debugj

func (l *Logger) Debugj(j log.JSON)

func (*Logger) Error

func (l *Logger) Error(i ...interface{})

func (*Logger) Errorf

func (l *Logger) Errorf(format string, i ...interface{})

func (*Logger) Errorj

func (l *Logger) Errorj(j log.JSON)

func (*Logger) Fatal

func (l *Logger) Fatal(i ...interface{})

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, i ...interface{})

func (*Logger) Fatalj

func (l *Logger) Fatalj(j log.JSON)

func (*Logger) Info

func (l *Logger) Info(i ...interface{})

func (*Logger) Infof

func (l *Logger) Infof(format string, i ...interface{})

func (*Logger) Infoj

func (l *Logger) Infoj(j log.JSON)

func (*Logger) Level

func (l *Logger) Level() log.Lvl

func (*Logger) Output

func (l *Logger) Output() io.Writer

func (*Logger) Panic

func (l *Logger) Panic(i ...interface{})

func (*Logger) Panicf

func (l *Logger) Panicf(format string, i ...interface{})

func (*Logger) Panicj

func (l *Logger) Panicj(j log.JSON)

func (*Logger) Prefix

func (l *Logger) Prefix() string

func (*Logger) Print

func (l *Logger) Print(i ...interface{})

func (*Logger) Printf

func (l *Logger) Printf(format string, i ...interface{})

func (*Logger) Printj

func (l *Logger) Printj(j log.JSON)

func (*Logger) SetHeader added in v0.63.0

func (l *Logger) SetHeader(_ string)

func (*Logger) SetLevel

func (l *Logger) SetLevel(newLvl log.Lvl)

func (*Logger) SetOutput

func (l *Logger) SetOutput(w io.Writer)

func (*Logger) SetPrefix

func (l *Logger) SetPrefix(p string)

func (*Logger) Warn

func (l *Logger) Warn(i ...interface{})

func (*Logger) Warnf

func (l *Logger) Warnf(format string, i ...interface{})

func (*Logger) Warnj

func (l *Logger) Warnj(j log.JSON)

func (*Logger) Write added in v0.63.0

func (l *Logger) Write(p []byte) (int, error)

Write writes len(p) bytes from p to the underlying data stream. It returns the number of bytes written from p (0 <= n <= len(p)) and any error encountered that caused the write to stop early. Write must return a non-nil error if it returns n < len(p). Write must not modify the slice data, even temporarily.

So… * Always say you wrote all the data. * Never return an error? * Parse the data as JSON without ever modifying the slice.

type RowOfRows

type RowOfRows struct {
	RowsCollection []eventio.BillableEventRows
	// contains filtered or unexported fields
}

func (*RowOfRows) Close

func (r *RowOfRows) Close() error

func (*RowOfRows) Err

func (r *RowOfRows) Err() error

func (*RowOfRows) Event

func (r *RowOfRows) Event() (*eventio.BillableEvent, error)

func (*RowOfRows) EventJSON

func (r *RowOfRows) EventJSON() ([]byte, error)

func (*RowOfRows) Next

func (r *RowOfRows) Next() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL