hook

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2018 License: Apache-2.0 Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateWebhook

func ValidateWebhook(w http.ResponseWriter, r *http.Request, hmacSecret []byte) (string, string, []byte, bool)

ValidateWebhook ensures that the provided request conforms to the format of a Github webhook and the payload can be validated with the provided hmac secret. It returns the event type, the event guid, the payload of the request, and whether the webhook is valid or not.

Types

type Metrics

type Metrics struct {
	WebhookCounter *prometheus.CounterVec
}

func NewMetrics

func NewMetrics() *Metrics

type Server

type Server struct {
	Plugins        *plugins.PluginAgent
	ConfigAgent    *config.Agent
	TokenGenerator func() []byte
	Metrics        *Metrics
	// contains filtered or unexported fields
}

Server implements http.Handler. It validates incoming GitHub webhooks and then dispatches them to the appropriate plugins.

func (*Server) GracefulShutdown

func (s *Server) GracefulShutdown()

Implements a graceful shutdown protool. Handles all requests sent before receiving shutdown signal.

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP validates an incoming webhook and puts it into the event channel.

Jump to

Keyboard shortcuts

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