Documentation ¶
Index ¶
- Constants
- func LoadHTTP(ctx context.Context, source settings.Source, c *HTTPComponent) (http.RoundTripper, error)
- func NewHTTP(ctx context.Context, source settings.Source) (http.RoundTripper, error)
- type HTTPComponent
- type HTTPConfig
- type HTTPDefaultComponent
- type HTTPDefaultConfig
- type HTTPSmartComponent
- type HTTPSmartConfig
- type Producer
- type ProducerBenthosComponent
- type ProducerBenthosConfig
- type ProducerComponent
- type ProducerConfig
- type ProducerPOSTComponent
- type ProducerPOSTConfig
- type RoundTripper
Constants ¶
const ( // HTTPTypeDefault is used to select the default Go HTTP client. HTTPTypeDefault = "DEFAULT" // HTTPTypeSmart is used to select the transportd HTTP client. HTTPTypeSmart = "SMART" )
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.
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 ¶
func (c *HTTPComponent) New(ctx context.Context, conf *HTTPConfig) (http.RoundTripper, error)
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.
type HTTPDefaultComponent ¶
type HTTPDefaultComponent struct{}
HTTPDefaultComponent is a component for creating the default Go HTTP client.
func (*HTTPDefaultComponent) New ¶
func (*HTTPDefaultComponent) New(ctx context.Context, conf *HTTPDefaultConfig) (http.RoundTripper, error)
New constructs a client from the given configuration
func (*HTTPDefaultComponent) Settings ¶
func (*HTTPDefaultComponent) Settings() *HTTPDefaultConfig
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 ¶
func (c *HTTPSmartComponent) New(ctx context.Context, conf *HTTPSmartConfig) (http.RoundTripper, error)
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.
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 ¶
func (*ProducerBenthosComponent) New(ctx context.Context, conf *ProducerBenthosConfig) (Producer, error)
New constructs a benthos producer.
func (*ProducerBenthosComponent) Settings ¶
func (*ProducerBenthosComponent) Settings() *ProducerBenthosConfig
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 ¶
func (c *ProducerComponent) New(ctx context.Context, conf *ProducerConfig) (Producer, error)
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.
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 ¶
func (c *ProducerPOSTComponent) New(ctx context.Context, conf *ProducerPOSTConfig) (Producer, error)
New constructs a benthos configuration.
func (*ProducerPOSTComponent) Settings ¶
func (c *ProducerPOSTComponent) Settings() *ProducerPOSTConfig
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.