Documentation
¶
Overview ¶
Package transformation provides an interface to altering (transforming) webhook messages.
Index ¶
- func NewChickenTransformation(ctx context.Context, uri string) (webhookd.WebhookTransformation, error)
- func NewNullTransformation(ctx context.Context, uri string) (webhookd.WebhookTransformation, error)
- func NewTransformation(ctx context.Context, uri string) (webhookd.WebhookTransformation, error)
- func RegisterTransformation(ctx context.Context, scheme string, init_func TransformationInitializationFunc) error
- func Schemes() []string
- func Transformations() []string
- type ChickenTransformation
- type NullTransformation
- type TransformationInitializationFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChickenTransformation ¶
func NewChickenTransformation(ctx context.Context, uri string) (webhookd.WebhookTransformation, error)
NewInsecureTransformation returns a new `ChickenTransformation` instance configured by 'uri' in the form of:
chicken://{LANGUAGE_TAG}?{PARAMETERS}
Where {LANGUAGE_TAG} is any valid language tag supported by the `aaronland/go-chicken` package. Valid {PARAMETERS} are: * `clucking={BOOLEAN}` A boolean flag to indicate whether messages should be transformed in the form of chicken noises.
func NewNullTransformation ¶
NewInsecureTransformation returns a new `NullTransformation` instance configured by 'uri' in the form of:
null://
func NewTransformation ¶
NewTransformation() returns a new `webhookd.WebhookTransformation` instance derived from 'uri'. The semantics of and requirements for 'uri' as specific to the package implementing the interface.
func RegisterTransformation ¶
func RegisterTransformation(ctx context.Context, scheme string, init_func TransformationInitializationFunc) error
RegisterTransformation() associates 'scheme' with 'init_func' in an internal list of avilable `webhookd.WebhookTransformation` implementations.
func Schemes ¶ added in v3.1.0
func Schemes() []string
Schemes() returns the list of schemes that have been "registered".
func Transformations ¶
func Transformations() []string
Transformations() returns the list of schemes that have been "registered". This method is deprecated and you should use `Schemes()` instead.
Types ¶
type ChickenTransformation ¶
type ChickenTransformation struct {
webhookd.WebhookTransformation
// contains filtered or unexported fields
}
ChickenTransformation implements the `webhookd.WebhookTransformation` interface for transforming messages using the `aaronland/go-chicken` package. the output of the `Transform` method is the same as its input.
func (*ChickenTransformation) Transform ¶
func (tr *ChickenTransformation) Transform(ctx context.Context, body []byte) ([]byte, *webhookd.WebhookError)
Transform returns 'body' translated in to "chicken".
type NullTransformation ¶
type NullTransformation struct {
webhookd.WebhookTransformation
}
NullTransformation implements the `webhookd.WebhookTransformation` interface for a no-op transformation meaning the output of the `Transform` method is the same as its input.
func (*NullTransformation) Transform ¶
func (p *NullTransformation) Transform(ctx context.Context, body []byte) ([]byte, *webhookd.WebhookError)
Transform returns 'body' unaltered.
type TransformationInitializationFunc ¶
type TransformationInitializationFunc func(ctx context.Context, uri string) (webhookd.WebhookTransformation, error)
TransformationInitializationFunc is a function used to initialize an implementation of the `webhookd.WebhookTransformation` interface.