httptransformer

package
v1.1.20 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, transformer func(*viper.Viper) ResponseBodyTransformer)

Register saves a name and trasformer pair for use with the factory

Types

type NoopTransformer

type NoopTransformer struct{}

NoopTransformer is the concrete type for ResponseBodyTransformer that does nothing (DEFUALT)

func (NoopTransformer) Transform

func (t NoopTransformer) Transform(traceID uuid.UUID, body []byte) ([]byte, error)

Transform is a noop for the NoopTransformer

type NotificationServiceTransformer

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

NotificationServiceTransformer transforms the body of an HTTP Writer and handles the logic for posting to the Pantheon Notification Service (Pub/Sub Proxy)

func (NotificationServiceTransformer) Transform

func (t NotificationServiceTransformer) Transform(traceID uuid.UUID, body []byte) ([]byte, error)

Transform takes the body and wraps the notification service structure around it

type ResponseBodyTransformer

type ResponseBodyTransformer interface {
	// Transform takes the result in byte array and returns
	// a transformed byte array or error
	Transform(uuid.UUID, []byte) ([]byte, error)
}

ResponseBodyTransformer is an interface that allows different preparations to happen on the body of the message before it is sent (STORED AS A SINGLETON)

func GetResponseBodyTransformer

func GetResponseBodyTransformer(name string, config *viper.Viper) ResponseBodyTransformer

GetResponseBodyTransformer returns a transformer by name

func NewNoopTransformer added in v1.0.5

func NewNoopTransformer(config *viper.Viper) ResponseBodyTransformer

NewNoopTransformer creates new transformer that does nothing

func NewNotificationServiceTransformer added in v1.0.5

func NewNotificationServiceTransformer(config *viper.Viper) ResponseBodyTransformer

NewNotificationServiceTransformer creates new transformer

Jump to

Keyboard shortcuts

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