handlers

package
v0.0.0-...-3e6e532 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ping

func Ping(c *gin.Context)

Ping is a health check handler func

Types

type HTTPSourceHandler

type HTTPSourceHandler struct {
	Dynamo        SourceRepository
	RouterCreator RouterCreator
}

HTTPSourceHandler struct implementation of SourceHandler for HTTP requests

func (HTTPSourceHandler) CreateRoute

func (handler HTTPSourceHandler) CreateRoute(c *gin.Context)

CreateRoute is a method to create a Route for a given Source

func (HTTPSourceHandler) GetAllSources

func (handler HTTPSourceHandler) GetAllSources(c *gin.Context)

GetAllSources is a method to return all source object

func (HTTPSourceHandler) GetRoutes

func (handler HTTPSourceHandler) GetRoutes(c *gin.Context)

GetRoutes is a function to return a source based on the requested Source Name

type NotFoundError

type NotFoundError struct {
	Resource string
}

NotFoundError is an error corresponding to a resource not found

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Route

type Route struct {
	URL string `json:"url"`
}

Route is the struct representation of a source object. It contains a Url

type RouterCreator

type RouterCreator interface {
	CreateRouters(source *Source) error
	CreateRoutersWithSource(source *Source) error
}

RouterCreator is an interface to define the method to create a list of Routers

type Source

type Source struct {
	Name   string  `json:"name"`
	Routes []Route `json:"routes"`
}

Source is the struct representation of a source object it contains a name and a route object

type SourceDTO

type SourceDTO struct {
	Route              Route `json:"route"`
	WithSourceCreation bool  `json:"withSourceCreation"`
}

SourceDTO is a struct representing a POST sources request

type SourceHandler

type SourceHandler interface {
	GetAllSources(c *gin.Context)
	CreateRoute(c *gin.Context)
	GetRoutes(c *gin.Context)
}

SourceHandler is an interface to handle Source HTTP requests

type SourceRepository

type SourceRepository interface {
	CreateRoute(source Source) error
	GetSource(source Source) (Source, error)
	GetAllSources() ([]Source, error)
	GetRouteForSource(sourceName string, routeName string) (Route, error)
}

SourceRepository is an interface used by the sources.go handler to interact with storage

Jump to

Keyboard shortcuts

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