api

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package api implements a type used for creating the Benthos HTTP API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Address       string `json:"address" yaml:"address"`
	ReadTimeoutMS int    `json:"read_timeout_ms" yaml:"read_timeout_ms"`
}

Config contains the configuration fields for the Benthos API.

func NewConfig

func NewConfig() Config

NewConfig creates a new API config with default values.

type Type

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

Type implements the Benthos HTTP API.

func New

func New(
	version string,
	dateBuilt string,
	conf Config,
	wholeConf interface{},
	log log.Modular,
	stats metrics.Type,
) *Type

New creates a new Benthos HTTP API.

func (*Type) ListenAndServe

func (t *Type) ListenAndServe() error

ListenAndServe launches the API and blocks until the server closes or fails.

func (*Type) RegisterEndpoint

func (t *Type) RegisterEndpoint(path, desc string, handler http.HandlerFunc)

RegisterEndpoint registers a http.HandlerFunc under a path with a description that will be displayed under the /endpoints path.

func (*Type) Shutdown

func (t *Type) Shutdown(ctx context.Context) error

Shutdown attempts to close the http server.

Jump to

Keyboard shortcuts

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