common

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GHHeaderEvent    = "X-GitHub-Event"
	GHHeaderDelivery = "X-GitHub-Delivery"
)

Variables

Functions

func GracefulShutdown

func GracefulShutdown(server *http.Server, logger *zap.SugaredLogger, stopCh <-chan struct{}, done chan<- bool)

GracefulShutdown gracefully shutdown server

func SecretFrom

func SecretFrom(kubeClientSet kubernetes.Interface, namespace string, secretKeySelector *corev1.SecretKeySelector) (string, error)

func SubjectFromGitHubEvent

func SubjectFromGitHubEvent(gitHubEvent gh.Event, payload interface{}, logger *zap.SugaredLogger) string

SubjectFromGitHubEvent computes the CE subject from GitHub event

Types

type Handler

type Handler struct {
	Logger  *zap.SugaredLogger
	Client  cloudevents.Client
	Hook    *gh.Webhook
	Source  string
	SinkURI string
}

func NewHandler

func NewHandler(ceClient cloudevents.Client, sinkURI, source, secretToken string, logger *zap.SugaredLogger) *Handler

New creates an adapter to convert incoming GitHub webhook events from a single source to CloudEvents and then sends them to the specified Sink

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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