components

package module
v0.0.0-...-c871df3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

README

Deprecated

See our various component-* repos for individual pieces and runtthp for an example on how to compose them.

Documentation

Index

Constants

View Source
const (
	// HTTPTypeDefault is used to select the default Go HTTP client.
	HTTPTypeDefault = "DEFAULT"
	// HTTPTypeSmart is used to select the transportd HTTP client.
	HTTPTypeSmart = "SMART"
)
View Source
const (
	// ProducerTypeBenthos is used to select a Benthos producer.
	ProducerTypeBenthos = "BENTHOS"
	// ProducerTypePOST is used to select an HTTP POST client.
	ProducerTypePOST = "POST"
)

Variables

This section is empty.

Functions

func LoadHTTP

func LoadHTTP(ctx context.Context, source settings.Source, c *HTTPComponent) (http.RoundTripper, error)

LoadHTTP is a convenience method for binding the source to the component.

func NewHTTP

func NewHTTP(ctx context.Context, source settings.Source) (http.RoundTripper, error)

NewHTTP is the top-level entry point for creating a new HTTP client. The default set of plugins will be installed for the smart client. Use the LoadHTTP() method if a custom set of plugins are required.

Types

type HTTPComponent

type HTTPComponent struct {
	Default *HTTPDefaultComponent
	Smart   *HTTPSmartComponent
}

HTTPComponent is the top level HTTP client component.

func NewHTTPComponent

func NewHTTPComponent() *HTTPComponent

NewHTTPComponent populates an HTTPComponent with defaults.

func (*HTTPComponent) New

New constructs a client from the given configuration.

func (*HTTPComponent) Settings

func (c *HTTPComponent) Settings() *HTTPConfig

Settings returns the default configuration.

type HTTPConfig

type HTTPConfig struct {
	Type    string `description:"The type of HTTP client. Choices are SMART and DEFAULT."`
	Default *HTTPDefaultConfig
	Smart   *HTTPSmartConfig
}

HTTPConfig wraps all HTTP related settings.

func (*HTTPConfig) Name

func (*HTTPConfig) Name() string

Name of the config.

type HTTPDefaultComponent

type HTTPDefaultComponent struct{}

HTTPDefaultComponent is a component for creating the default Go HTTP client.

func (*HTTPDefaultComponent) New

New constructs a client from the given configuration

func (*HTTPDefaultComponent) Settings

Settings returns the default configuration.

type HTTPDefaultConfig

type HTTPDefaultConfig struct {
	ContentType string
}

HTTPDefaultConfig contains all settings for the default Go HTTP client.

type HTTPSmartComponent

type HTTPSmartComponent struct {
	Plugins []transportd.NewComponent
}

HTTPSmartComponent is a component for creating a transportd HTTP client.

func (*HTTPSmartComponent) New

New constructs a client from the given configuration.

func (*HTTPSmartComponent) Settings

func (*HTTPSmartComponent) Settings() *HTTPSmartConfig

Settings returns the default configuration.

type HTTPSmartConfig

type HTTPSmartConfig struct {
	OpenAPI string `description:"The full OpenAPI specification with transportd extensions."`
}

HTTPSmartConfig contains all settings for the transportd HTTP client.

func (*HTTPSmartConfig) Name

func (*HTTPSmartConfig) Name() string

Name of the configuration tree.

type Producer

type Producer interface {
	// Produce ships the event to the destination and returns the final
	// version of the data sent.
	Produce(ctx context.Context, event interface{}) (interface{}, error)
}

Producer is the interface used for sending all events to a destination.

func LoadProducer

func LoadProducer(ctx context.Context, source settings.Source, c *ProducerComponent) (Producer, error)

LoadProducer is a convenience method for binding the source to the component.

func NewProducer

func NewProducer(ctx context.Context, source settings.Source) (Producer, error)

NewProducer is the top-level entry point for creating a producer client.

type ProducerBenthosComponent

type ProducerBenthosComponent struct{}

ProducerBenthosComponent is a component for creating a Benthos producer.

func NewProducerBenthosComponent

func NewProducerBenthosComponent() *ProducerBenthosComponent

NewProducerBenthosComponent generates a ProducerBenthosComponent and populates it with defaults

func (*ProducerBenthosComponent) New

New constructs a benthos producer.

func (*ProducerBenthosComponent) Settings

Settings returns the default configuration.

type ProducerBenthosConfig

type ProducerBenthosConfig struct {
	YAML string `description:"The YAML or JSON text of a Benthos configuration."`
}

ProducerBenthosConfig adapts the Benthos configuration system to this one.

func (*ProducerBenthosConfig) Name

func (*ProducerBenthosConfig) Name() string

Name of the configuration section.

type ProducerComponent

type ProducerComponent struct {
	Benthos *ProducerBenthosComponent
	POST    *ProducerPOSTComponent
}

ProducerComponent is the top level producer component.

func NewProducerComponent

func NewProducerComponent() *ProducerComponent

NewProducerComponent populates a ProducerComponent with defaults.

func (*ProducerComponent) New

New constructs a Producer from the given configuration.

func (*ProducerComponent) Settings

func (c *ProducerComponent) Settings() *ProducerConfig

Settings generates a default configuration.

type ProducerConfig

type ProducerConfig struct {
	Type    string `default:"The type of producer. The choices are BENTHOS and POST."`
	Benthos *ProducerBenthosConfig
	POST    *ProducerPOSTConfig
}

ProducerConfig wraps all producer related configuration.

func (*ProducerConfig) Name

func (*ProducerConfig) Name() string

Name of the configuration.

type ProducerPOSTComponent

type ProducerPOSTComponent struct {
	HTTP *HTTPComponent
}

ProducerPOSTComponent is a component for creating an HTTP POST producer.

func NewProducerPOSTComponent

func NewProducerPOSTComponent() *ProducerPOSTComponent

NewProducerPOSTComponent populates a ProducerPOSTComponent with defaults.

func (*ProducerPOSTComponent) New

New constructs a benthos configuration.

func (*ProducerPOSTComponent) Settings

Settings returns the default configuration.

type ProducerPOSTConfig

type ProducerPOSTConfig struct {
	Endpoint   string `description:"The URL to POST."`
	HTTPClient *HTTPConfig
}

ProducerPOSTConfig contains settings for the HTTP POST producer.

func (*ProducerPOSTConfig) Name

func (*ProducerPOSTConfig) Name() string

Name of the configuration section.

type RoundTripper

type RoundTripper = http.RoundTripper

RoundTripper is the interface that handles all HTTP operations. It is almost exclusively used with an http.Client wrapped around it. This is included here for documentation purposes only.

Jump to

Keyboard shortcuts

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