outputs

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrInvalidConfig signals an invalid configuration input
	ErrInvalidConfig = func(name Type, c interface{}) error {
		return fmt.Errorf("invalid config for %q output. Got type %v instead of %s.Config", name, reflect.TypeOf(c), strings.ToLower(name.String()))
	}
)

Functions

func AddTLSFlags

func AddTLSFlags(flags *pflag.FlagSet, typ Type)

AddTLSFlags register the TLS flags for the specified output type.

func Register

func Register(typ Type, factory Factory)

Register registers a new output implementation. Note this function should be only called once per output.

Types

type Client

type Client interface {
	Close() error
	Publish(*kevent.Batch) error
	Connect() error
}

Client represents the minimal interface all output implementors have to satisfy.

type Config

type Config struct {
	Type   Type
	Output interface{}
}

Config contains the output configuration.

type Factory

type Factory func(config Config) (OutputGroup, error)

Factory serves for constructing different output implementations from configuration.

func FindFactory

func FindFactory(typ Type) Factory

FindFactory locates the output factory.

type OutputGroup

type OutputGroup struct {
	// Clients is the list of clients to which events are forwarded.
	Clients []Client
}

OutputGroup is a collection of outputs that can be configured in a load-balanced fashion.

func Fail

func Fail(err error) (OutputGroup, error)

Fail returns an empty output group and an error signaling the failure that caused the output group initialization.

func Load

func Load(typ Type, config Config) (OutputGroup, error)

Load loads the specified output from configuration. The output must have been registered previously.

func Success

func Success(clients ...Client) OutputGroup

Success builds the output group from the provided clients.

type TLSConfig

type TLSConfig struct {
	// TLSCA represents the path of the certificate file that is associated with the Certification Authority (CA).
	TLSCA string `mapstructure:"tls-ca"`
	// TLSCert is the path to the certificate file.
	TLSCert string `mapstructure:"tls-cert"`
	// TLSKey represents the path to the public/private key file.
	TLSKey string `mapstructure:"tls-key"`
	// TLSInsecureSkipVerify skips the chain and host verification.
	TLSInsecureSkipVerify bool `mapstructure:"tls-insecure-skip-verify"`
}

TLSConfig stores the client TLS parameters.

type Type

type Type uint8

Type is the alias for the output type.

const (
	// Console represents the default terminal output.
	Console Type = iota
	// AMQP denotest the AMQP output.
	AMQP
	// Elasticsearch denotes the Elasticsearch output.
	Elasticsearch
	// Null is the null output.
	Null
)

func (Type) String

func (t Type) String() string

String returns the string representation of the output type.

Jump to

Keyboard shortcuts

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