webhooks

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler added in v0.3.0

func NewHandler(service Service) http.Handler

NewHandler returns an implementation of the http.Handler interface that can handle webhooks from GitHub by delegating to a transport-agnostic Service interface.

func NewSignatureVerificationFilter added in v0.3.0

func NewSignatureVerificationFilter(
	config SignatureVerificationFilterConfig,
) libHTTP.Filter

NewSignatureVerificationFilter returns a component that implements the http.Filter interface and can conditionally allow or disallow a request based on the ability to verify the signature of the inbound request.

Types

type Service

type Service interface {
	// Handle handles a GitHub webhook.
	Handle(
		ctx context.Context,
		appID int64,
		webhookType string,
		payload []byte,
	) (sdk.EventList, error)
}

Service is an interface for components that can handle webhooks from GitHub. Implementations of this interface are transport-agnostic.

func NewService

func NewService(
	eventsClient sdk.EventsClient,
	config ServiceConfig,
) Service

NewService returns an implementation of the Service interface for handling webhooks from GitHub.

type ServiceConfig

type ServiceConfig struct {
	// GitHubApps is a map of GitHub App configurations indexed by App ID.
	GitHubApps map[int64]ghlib.App
	// CheckSuiteAllowedAuthorAssociations enumerates the author associations who
	// are allowed to have their PRs and "/brig check" or "/brig run" comments
	// trigger the creation of a GitHub CheckSuite. Possible values are:
	// COLLABORATOR, CONTRIBUTOR, OWNER, NONE, MEMBER, FIRST_TIMER, and
	// FIRST_TME_CONTRIBUTOR.
	CheckSuiteAllowedAuthorAssociations []string
}

ServiceConfig encapsulates configuration options for webhook-handling service.

type SignatureVerificationFilterConfig added in v0.3.0

type SignatureVerificationFilterConfig struct {
	// GitHubApps is a map of GitHub App configurations indexed by App ID.
	GitHubApps map[int64]ghlib.App
}

SignatureVerificationFilterConfig encapsulates configuration for the signature verification based auth filter.

Jump to

Keyboard shortcuts

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