transport

package
v0.1.1-0...-03eb687 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleEchoError

func HandleEchoError(srcErr error, c echo.Context)

func HasAnyAuthoritiesEcho

func HasAnyAuthoritiesEcho(authorities ...string) echo.MiddlewareFunc

func HasAuthoritiesEcho

func HasAuthoritiesEcho(authorities ...string) echo.MiddlewareFunc

func IsResourceOwnerEcho

func IsResourceOwnerEcho(resourceOwnerParamKey string) echo.MiddlewareFunc

func IsResourceOwnerOrHasAnyAuthoritiesEcho

func IsResourceOwnerOrHasAnyAuthoritiesEcho(resourceOwnerParamKey string,
	authorities ...string) echo.MiddlewareFunc

func NewDefaultEchoMiddlewareGroup

func NewDefaultEchoMiddlewareGroup(params DefaultEchoMiddlewareParams, paramsTrace TraceIDEchoParams) []echo.MiddlewareFunc

NewDefaultEchoMiddlewareGroup allocates an Echo middleware group. An array is returned to guarantee ordering within this group. Any other middlewares outside this group will be injected into application in a non-deterministic way (regarding ordering).

func NewEcho

func NewEcho(params NewEchoParams) *echo.Echo

func NewEchoJWTAuthenticator

func NewEchoJWTAuthenticator(config echojwt.Config) echo.MiddlewareFunc

func NewEchoJWTAuthenticatorConfig

func NewEchoJWTAuthenticatorConfig(params NewEchoJWTAuthenticatorConfigParams) echojwt.Config

func NewLogRequestEcho

func NewLogRequestEcho(logger logging.Logger) echo.MiddlewareFunc

func NewRecoverRequestEcho

func NewRecoverRequestEcho(logger logging.Logger) echo.MiddlewareFunc

func NewTraceIDEcho

func NewTraceIDEcho(params TraceIDEchoParams) echo.MiddlewareFunc

NewTraceIDEcho appends a trace identifier to each request using tracing.NewTracedContext.

func RegisterControllersEcho

func RegisterControllersEcho(params RegisterControllersEchoParams)

func RegisterMiddlewaresEcho

func RegisterMiddlewaresEcho(params RegisterMiddlewaresEchoParams)

Types

type ActuatorControllerHTTP

type ActuatorControllerHTTP struct {
	Manager *actuator.Manager
	Logger  logging.Logger
	Config  ConfigActuatorHTTP
}

func (ActuatorControllerHTTP) SetRoutes

func (a ActuatorControllerHTTP) SetRoutes(e *echo.Echo)

type ConfigActuatorHTTP

type ConfigActuatorHTTP struct {
	ActuatorRoleAllowlist []string `env:"HTTP_SERVER_ACTUATOR_ROLE_ALLOWLIST"`
}

func NewConfigActuatorHTTP

func NewConfigActuatorHTTP() (ConfigActuatorHTTP, error)

type ConfigHTTP

type ConfigHTTP struct {
	Address                 string   `env:"HTTP_SERVER_ADDRESS" envDefault:":8080"`
	AuthenticationWhitelist []string `env:"HTTP_SERVER_AUTHN_WHITELIST" envDefault:"/healthz,/readiness"`
	RequestIDTargetHeader   string   `env:"HTTP_REQ_ID_TARGET_HEADER" envDefault:"X-Request-ID"`

	AuthenticationWhitelistSet sets.Set[string]
}

func NewConfigHTTP

func NewConfigHTTP() (ConfigHTTP, error)

type ControllerHTTP

type ControllerHTTP interface {
	SetRoutes(e *echo.Echo)
}

type Data

type Data struct {
	Data any `json:"data"`
}

type DefaultEchoMiddlewareParams

type DefaultEchoMiddlewareParams struct {
	fx.In

	Config ConfigHTTP
	Logger logging.Logger
}

type Error

type Error struct {
	Code     int           `json:"code"`
	Message  string        `json:"message"`
	Status   string        `json:"status"`
	Details  []ErrorDetail `json:"details"`
	Internal error         `json:"-"`
}

type ErrorDetail

type ErrorDetail struct {
	Type     string            `json:"@type"`
	Reason   string            `json:"reason"`
	Metadata map[string]string `json:"metadata"`
}

type Errors

type Errors struct {
	Code   int     `json:"code"`
	Errors []Error `json:"errors"`
}

type NewActuatorControllerHTTPParams

type NewActuatorControllerHTTPParams struct {
	fx.In
	Manager *actuator.Manager
	Logger  logging.Logger
	Config  ConfigActuatorHTTP
}

type NewEchoJWTAuthenticatorConfigParams

type NewEchoJWTAuthenticatorConfigParams struct {
	fx.In

	Config           security.ConfigJWT
	ServerConfig     ConfigHTTP
	Logger           logging.Logger
	PrincipalFactory security.PrincipalFactory[*jwt.Token]
	KeyFunc          keyfunc.Keyfunc `optional:"true"`
}

type NewEchoParams

type NewEchoParams struct {
	fx.In

	Lifecycle fx.Lifecycle
	Config    ConfigHTTP
	Logger    logging.Logger
}

type RegisterControllersEchoParams

type RegisterControllersEchoParams struct {
	fx.In

	Echo                 *echo.Echo
	Config               application.Config
	Logger               logging.Logger
	RootControllers      []ControllerHTTP          `group:"root_controllers_http"`
	VersionedControllers []VersionedControllerHTTP `group:"versioned_controllers_http"`
}

type RegisterMiddlewaresEchoParams

type RegisterMiddlewaresEchoParams struct {
	fx.In

	Echo             *echo.Echo
	Logger           logging.Logger
	GroupMiddlewares [][]echo.MiddlewareFunc `group:"middlewares_groups_http"`
	Middlewares      []echo.MiddlewareFunc   `group:"middlewares_http"`
}

type TraceIDEchoParams

type TraceIDEchoParams struct {
	fx.In
	TraceFactory tracing.TraceFactory `optional:"true"`
}

type VersionedControllerHTTP

type VersionedControllerHTTP interface {
	ControllerHTTP
	SetVersionedRoutes(g *echo.Group)
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳