interceptors

package
v0.0.0-...-af2e4d2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSecretToken

func GetSecretToken(req *http.Request, cs kubernetes.Interface, sr *triggersv1.SecretRef, eventListenerNamespace string) ([]byte, error)

GetSecretToken queries Kubernetes for the given secret reference. We use this function to resolve secret material like GitHub webhook secrets, and call it once for every trigger that references it.

As we may have many triggers that all use the same secret, we cache the secret values in the request cache.

func WithCache

func WithCache(req *http.Request) *http.Request

WithCache clones the given request and sets the request context to include a cache. This allows us to cache results from expensive operations and perform them just once per each trigger.

Each request should have its own cache, and those caches should expire once the request is processed. For this reason, it's appropriate to store the cache on the request context.

Types

type Interceptor

type Interceptor interface {
	ExecuteTrigger(req *http.Request) (*http.Response, error)
}

Interceptor is the interface that all interceptors implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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