api

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2018 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(rootUsername, rootPassword string, s store.Store) echo.MiddlewareFunc

AuthMiddleware checks login credentials.

func BadRequest

func BadRequest(c echo.Context, msg string) error

BadRequest generates an HTTP 400 Bad Request response with specified error message serialized as JSON.

func Conflict

func Conflict(c echo.Context, msg string) error

Conflict generates an HTTP 409 Conflict response with specified error message serialized as JSON.

func Created

func Created(c echo.Context, payload interface{}) error

Created generates an HTTP 201 Created response with specified payload serialized as JSON.

func InstrumentMiddleware

func InstrumentMiddleware(stats *statsd.Client) echo.MiddlewareFunc

InstrumentMiddleware collects metrics about the current request.

func InternalServerError

func InternalServerError(c echo.Context, err error) error

InternalServerError generates an HTTP 500 Internal Server Error response with a generic error message serialized as JSON, while the provided error is logged with ERROR level.

func Invalid

func Invalid(c echo.Context, msg string) error

Invalid generates an HTTP 422 Unprocessable Entity response with specified error message serialized as JSON.

func LogMiddleware

func LogMiddleware() echo.MiddlewareFunc

LogMiddleware logs information about the current request.

func NewServer

func NewServer(conf ServerConfig) (*standard.Server, error)

NewServer creates a new server.

func NoContent

func NoContent(c echo.Context) error

NoContent generates an empty HTTP 204 No Conent response.

func NotFound

func NotFound(c echo.Context) error

NotFound generates an HTTP 404 Not Found response with a generic error message serialized as JSON.

func OK

func OK(c echo.Context, payload interface{}) error

OK generates an HTTP 200 OK response with specified payload serialized as JSON.

func RequestID

func RequestID(c echo.Context) string

RequestID returns the request ID from the current context.

func TraceMiddleware

func TraceMiddleware() echo.MiddlewareFunc

TraceMiddleware attaches an ID to the current request.

Types

type EnvironmentResource

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

func NewEnvironmentResource

func NewEnvironmentResource(store store.Store, stats *statsd.Client) *EnvironmentResource

func (*EnvironmentResource) List

type Error

type Error struct {
	Message string `json:"message"`
}

Error represents an error message response.

type EventResource added in v1.0.0

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

func NewEventResource added in v1.0.0

func NewEventResource(store store.Store, stats *statsd.Client, notifier notifier.Notifier) *EventResource

func (*EventResource) Create added in v1.0.0

func (r *EventResource) Create(c echo.Context) error

type FeatureResource

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

func NewFeatureResource

func NewFeatureResource(store store.Store, stats *statsd.Client, notifier notifier.Notifier) *FeatureResource

func (*FeatureResource) Get

func (r *FeatureResource) Get(c echo.Context) error

func (*FeatureResource) List

func (r *FeatureResource) List(c echo.Context) error

type ServerConfig

type ServerConfig struct {
	RootUsername string
	RootPassword string
	Store        store.Store
	Stats        *statsd.Client
	Notifier     notifier.Notifier
}

ServerConfig is used to parametrize a Server.

Jump to

Keyboard shortcuts

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