driverclient

package
v0.0.4-solo Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 14 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// DispatchEventsGatewayFlag defines the name of the flag used by Event Manager to set its API endpoint
	// when provisioning driver. Drivers must implement this flag and use WithGateway with its value.
	DispatchEventsGatewayFlag = "dispatch-api-endpoint"

	// AuthToken defines the environment variable set by Event manager to authenticate events.
	// Drivers must read this environment variable and use WithToken if value is is set.
	AuthToken = "AUTH_TOKEN"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Send(event []events.CloudEvent) error
	SendOne(event *events.CloudEvent) error
	Validate(event []events.CloudEvent) error
	ValidateOne(event *events.CloudEvent) error
}

Client specifies an interface that event-driver clients must implement.

func NewHTTPClient

func NewHTTPClient(opts ...HTTPClientOpt) (Client, error)

NewHTTPClient returns new instance of driverclient.Client using HTTPClient implementation

type HTTPClient

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

HTTPClient implements event driver client using HTTP protocol

func (*HTTPClient) Send

func (c *HTTPClient) Send(evs []events.CloudEvent) error

Send sends slice of vents to Dispatch system. It runs Validate() first.

func (*HTTPClient) SendOne

func (c *HTTPClient) SendOne(event *events.CloudEvent) error

SendOne sends single event to Dispatch system. It runs Validate() first.

func (*HTTPClient) Validate

func (c *HTTPClient) Validate(evs []events.CloudEvent) error

Validate validates slice of events without sending it

func (*HTTPClient) ValidateOne

func (c *HTTPClient) ValidateOne(event *events.CloudEvent) error

ValidateOne validates single event without sending it

type HTTPClientOpt

type HTTPClientOpt func(client *HTTPClient) error

HTTPClientOpt allows customization of HTTPClient

func WithGateway

func WithGateway(endpoint string) HTTPClientOpt

WithGateway allows to customize host & port

func WithHost

func WithHost(host string) HTTPClientOpt

WithHost allows to customize host

func WithPort

func WithPort(port string) HTTPClientOpt

WithPort allows to customize port

func WithToken

func WithToken(token string) HTTPClientOpt

WithToken allows setting custom authentication token

func WithTracer

func WithTracer(t opentracing.Tracer) HTTPClientOpt

WithTracer allows setting custom tracer

type PipeClient

type PipeClient struct {
}

PipeClient implements Event Driver client using named pipes.

func (PipeClient) Send

func (PipeClient) Send(event []events.CloudEvent) error

Send sends slice of events to event driver sidecar

func (PipeClient) SendOne

func (PipeClient) SendOne(event *events.CloudEvent) error

SendOne sends single event to event driver sidecar

func (PipeClient) Validate

func (PipeClient) Validate(event []events.CloudEvent) error

Validate validates list of events without sending them.

func (PipeClient) ValidateOne

func (PipeClient) ValidateOne(event *events.CloudEvent) error

ValidateOne validates single event without sending it.

Jump to

Keyboard shortcuts

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