interceptor

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SecretCertsName is name of secret where ca-cert, server-cert, server-key will be stored after generation.
	SecretCertsName = "tekton-edp-interceptor-certs"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CertData

type CertData struct {
	ServerKey  []byte
	ServerCert []byte
	CaCert     []byte
}

func NewCertData

func NewCertData(serverKey, serverCert, caCert []byte) *CertData

type EDPInterceptor

type EDPInterceptor struct {
	// contains filtered or unexported fields
}

EDPInterceptor is an interceptor for EDP.

func NewEDPInterceptor

func NewEDPInterceptor(
	c ctrlClient.Reader,
	gitHubProcessor event_processor.Processor,
	gitLabProcessor event_processor.Processor,
	gerritProcessor event_processor.Processor,
	l *zap.SugaredLogger,
) *EDPInterceptor

NewEDPInterceptor creates a new EDPInterceptor.

func (*EDPInterceptor) Execute

func (i *EDPInterceptor) Execute(r *http.Request) ([]byte, error)

Execute executes the interceptor.

func (*EDPInterceptor) Process

Process processes the interceptor request.

type EDPInterceptorInterface

type EDPInterceptorInterface interface {
	Execute(r *http.Request) ([]byte, error)
}

EDPInterceptorInterface is an interface for EDPInterceptor.

type Error

type Error interface {
	error
	Status() int
}

Error represents a handler error. It provides methods for an HTTP status code and embeds the built-in error interface.

type HTTPError

type HTTPError struct {
	Code int
	Err  error
}

HTTPError represents an error with an associated HTTP status code.

func (HTTPError) Error

func (se HTTPError) Error() string

HTTPError allows to satisfy the error interface.

func (HTTPError) Status

func (se HTTPError) Status() int

Status returns our HTTP status code.

type SecretService

type SecretService struct {
	// contains filtered or unexported fields
}

func NewSecretService

func NewSecretService(client ctrlClient.Client) *SecretService

func (*SecretService) CreateCertsSecret

func (s *SecretService) CreateCertsSecret(
	ctx context.Context,
	namespace,
	interceptorName string,
) (*CertData, error)

CreateCertsSecret creates and returns a CA certificate and certificate and key for the server. serverKey and serverCert are used by the server to establish trust for clients, CA certificate is used by the client to verify the server authentication chain. Certificates are based on Interceptor spec. After generation all certificates are stored in secret: SecretCertsName.

func (*SecretService) UpdateCABundle

func (s *SecretService) UpdateCABundle(
	ctx context.Context,
	namespace,
	interceptorName string,
	ca []byte,
) error

UpdateCABundle updates Interceptor CaBundle spec with CA certificate.

Jump to

Keyboard shortcuts

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