httpapi

package
v0.0.0-...-089673d Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartConfigAPI

func StartConfigAPI(eventtypes event.Service, functions function.Service, subscriptions subscription.Service, corses cors.Service, config ServerConfig)

StartConfigAPI creates a new configuration API server and listens for requests.

func StartEventsAPI

func StartEventsAPI(router http.Handler, config ServerConfig)

StartEventsAPI creates a new gateway endpoint and listens for requests.

Types

type CORSResponse

type CORSResponse struct {
	CORSes cors.CORSes `json:"cors"`
}

CORSResponse is a HTTPAPI JSON response containing cors configuration.

type Error

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

Error represents generic HTTP error returned by Configuration and Events API.

type EventTypesResponse

type EventTypesResponse struct {
	EventTypes event.Types `json:"eventTypes"`
}

EventTypesResponse is a HTTPAPI JSON response containing event types.

type FunctionsResponse

type FunctionsResponse struct {
	Functions function.Functions `json:"functions"`
}

FunctionsResponse is a HTTPAPI JSON response containing functions.

type HTTPAPI

type HTTPAPI struct {
	EventTypes    event.Service
	Functions     function.Service
	Subscriptions subscription.Service
	CORSes        cors.Service
}

HTTPAPI exposes REST API for configuring EG

func (HTTPAPI) RegisterRoutes

func (h HTTPAPI) RegisterRoutes(router *httprouter.Router)

RegisterRoutes register HTTP API routes

type Response

type Response struct {
	Errors []Error `json:"errors"`
}

Response is a generic response object from Configuration and Events API.

type Server

type Server struct {
	Config      ServerConfig
	HTTPHandler *http.Server
}

Server is a context-aware http server.

func (Server) Listen

func (s Server) Listen()

Listen sets up a graceful shutdown mechanism and runs the http.Server.

type ServerConfig

type ServerConfig struct {
	Log           *zap.Logger
	TLSCrt        *string
	TLSKey        *string
	Port          uint
	ShutdownGuard *sync.ShutdownGuard
}

ServerConfig contains information for an HTTP listener to interact with its environment.

type SubscriptionsResponse

type SubscriptionsResponse struct {
	Subscriptions subscription.Subscriptions `json:"subscriptions"`
}

SubscriptionsResponse is a HTTPAPI JSON response containing subscriptions.

Jump to

Keyboard shortcuts

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