webhook

package
v4.0.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// the URL where our webhook will be delivered
	Target string `yaml:"target" json:"target"`

	// the callback url where notifications can be received
	// the notification will be appended to this url
	Callback string `yaml:"callback" json:"callback"`

	// any htp headers necessary for the request to Target
	Headers http.Header `yaml:"headers" json:"headers"`
	// whether the webhook deliverer will sign out going.
	// if true webhooks will be sent with a jwt signed by
	// the notifier's private key.
	Signed bool
	// contains filtered or unexported fields
}

Config provides configuration for an Webhook deliverer.

func (*Config) Validate

func (c *Config) Validate() (Config, error)

Validate will return a copy of the Config on success. If any validation fails an error will be returned.

type Deliverer

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

func New

func New(conf Config, client *http.Client, keymanager *keymanager.Manager) (*Deliverer, error)

New returns a new webhook Deliverer

func (*Deliverer) Deliver

func (d *Deliverer) Deliver(ctx context.Context, nID uuid.UUID) error

Deliver implements the notifier.Deliverer interface.

Deliver POSTS a webhook data structure to the configured target.

func (*Deliverer) Name

func (d *Deliverer) Name() string

Jump to

Keyboard shortcuts

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