webhooks

package
v0.4.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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(service Service) (http.Handler, error)

handler is an implementation of the http.Handler interface that can handle webhooks (events) from Docker Hub by delegating to a transport-agnostic Service interface.

func NewTokenFilter

func NewTokenFilter(config TokenFilterConfig) libHTTP.Filter

NewTokenFilter returns a component that implements the http.Filter interface and can conditionally allow or disallow a request on the basis of a recognized token having been provided.

Types

type Service

type Service interface {
	// Handle handles a webhook (event) from Docker Hub.
	Handle(context.Context, docker.BuildPayload) error
}

Service is an interface for components that can handle webhooks (events) from Docker Hub. Implementations of this interface are transport-agnostic.

func NewService

func NewService(eventsClient sdk.EventsClient) Service

NewService returns an implementation of the Service interface for handling webhooks (events) from Docker Hub.

type TokenFilterConfig

type TokenFilterConfig interface {
	// AddToken adds a token to the TokenFilterConfig implementation's instance's
	// internal list of tokens. Implementations MUST hash the provided token
	// before addition to the list so that plain text tokens do not float around
	// in memory long-term.
	AddToken(string)
	// contains filtered or unexported methods
}

TokenFilterConfig is the interface for a component that encapsulates token filter configuration.

func NewTokenFilterConfig

func NewTokenFilterConfig() TokenFilterConfig

NewTokenFilterConfig returns an initialized implementation of the TokenFilterConfig interface.

Jump to

Keyboard shortcuts

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