handler

package
v0.0.0-...-c713ad7 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package handler holds Site Manager's route handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateSiteCredsHandler

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

CreateSiteCredsHandler exchanges a Site's OTP for its client credentials.

func NewCreateSiteCredsHandler

func NewCreateSiteCredsHandler(sites crdclientv1.SiteInterface, certManager *certmanager.Client) CreateSiteCredsHandler

NewCreateSiteCredsHandler returns a handler that checks OTPs against sites and gets certificates from certManager.

func (CreateSiteCredsHandler) Handle

func (csch CreateSiteCredsHandler) Handle(c echo.Context) error

Handle returns a client key, certificate and CA certificate for a Site waiting for its handshake, then marks the handshake complete. Every failure after decoding returns `500`, as Site Agent expects.

type CreateSiteHandler

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

CreateSiteHandler creates the Site resource and its first OTP.

func NewCreateSiteHandler

func NewCreateSiteHandler(sites crdclientv1.SiteInterface, otpDuration time.Duration) CreateSiteHandler

NewCreateSiteHandler returns a handler that stores Sites in sites. Their OTPs expire after otpDuration.

func (CreateSiteHandler) Handle

func (csh CreateSiteHandler) Handle(c echo.Context) error

Handle creates the Site resource and sets its status to wait for the handshake. It returns `400` for an invalid body or an existing Site.

type DeleteSiteHandler

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

DeleteSiteHandler deletes a Site.

func NewDeleteSiteHandler

func NewDeleteSiteHandler(sites crdclientv1.SiteInterface) DeleteSiteHandler

NewDeleteSiteHandler returns a handler that deletes Sites from sites.

func (DeleteSiteHandler) Handle

func (dsh DeleteSiteHandler) Handle(c echo.Context) error

Handle deletes the Site resource. It returns `404` for an unknown Site, which the REST API treats as already deleted.

type GetSiteHandler

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

GetSiteHandler returns a Site with its OTP.

func NewGetSiteHandler

func NewGetSiteHandler(sites crdclientv1.SiteInterface) GetSiteHandler

NewGetSiteHandler returns a handler that reads Sites from sites.

func (GetSiteHandler) Handle

func (gsh GetSiteHandler) Handle(c echo.Context) error

Handle returns the Site as a types.SiteGetResponse. It returns `404` for an unknown Site.

type HealthCheckHandler

type HealthCheckHandler struct{}

HealthCheckHandler answers Kubernetes probes.

func NewHealthCheckHandler

func NewHealthCheckHandler() HealthCheckHandler

NewHealthCheckHandler returns a health check handler.

func (HealthCheckHandler) Handle

func (hch HealthCheckHandler) Handle(c echo.Context) error

Handle returns `200` with `ok` and a newline.

type MetricsHandler

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

MetricsHandler serves the default Prometheus registry.

func NewMetricsHandler

func NewMetricsHandler() MetricsHandler

NewMetricsHandler returns a handler for the default Prometheus registry.

func (MetricsHandler) Handle

func (mh MetricsHandler) Handle(c echo.Context) error

Handle returns the metrics in the Prometheus text format.

type RegisterSiteHandler

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

RegisterSiteHandler marks a Site's registration as complete.

func NewRegisterSiteHandler

func NewRegisterSiteHandler(sites crdclientv1.SiteInterface) RegisterSiteHandler

NewRegisterSiteHandler returns a handler that updates Sites in sites.

func (RegisterSiteHandler) Handle

func (rsh RegisterSiteHandler) Handle(c echo.Context) error

Handle sets the Site's bootstrap state to registration complete. It returns `404` for an unknown Site.

type RollSiteHandler

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

RollSiteHandler replaces a Site's OTP.

func NewRollSiteHandler

func NewRollSiteHandler(sites crdclientv1.SiteInterface, otpDuration time.Duration) RollSiteHandler

NewRollSiteHandler returns a handler that updates Sites in sites. New OTPs expire after otpDuration.

func (RollSiteHandler) Handle

func (rsh RollSiteHandler) Handle(c echo.Context) error

Handle gives the Site a new OTP and sets it to wait for the handshake again. It returns `404` for an unknown Site.

type VersionHandler

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

VersionHandler returns Site Manager's release version.

func NewVersionHandler

func NewVersionHandler(version string) VersionHandler

NewVersionHandler returns a handler that answers with version.

func (VersionHandler) Handle

func (vh VersionHandler) Handle(c echo.Context) error

Handle returns `200` with the version and a newline.

Jump to

Keyboard shortcuts

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