restproxy

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const ActiveProjectID = "ActiveProjectID"

Variables

This section is empty.

Functions

func QueryParameterValidationMiddleware

func QueryParameterValidationMiddleware() gin.HandlerFunc

QueryParameterValidationMiddleware creates middleware that validates query parameters for REST API endpoints to ensure only documented parameters are accepted

func ValidateQueryParameterValues

func ValidateQueryParameterValues(queryParams url.Values) error

ValidateQueryParameterValues validates the values of specific query parameters

Types

type ChartsHandler

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

ChartsHandler provides reverse proxy for access to a list of Help charts provided by a named repository.

func NewChartsHandler

func NewChartsHandler(endpoint string, opts []grpc.DialOption) (*ChartsHandler, error)

NewChartsHandler creates a new charts handler.

func (*ChartsHandler) FetchChartsList

func (h *ChartsHandler) FetchChartsList(c *gin.Context)

FetchChartsList relays the Help charts list request to the back-end registry with appropriate authentication.

type Config

type Config struct {
	Port               int
	OIDCExternal       string
	GRPCEndpoint       string
	BasePath           string
	SpecFilePath       string
	AllowedCorsOrigins string
	// ProjectServiceURL is the URL of the project lookup service used to resolve
	// a project name (from the URL path) to its UUID for OPA authorization.
	// Currently points to the Nexus API GW as an interim solution;
	// will be replaced by the Tenant Manager REST API.
	ProjectServiceURL string
}

Config defines configurable parameters for setting up the REST proxy.

type EventHandler

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

EventHandler represents entity capable of relaying various Watch<X> events to a web-socket channel

func NewEventHandler

func NewEventHandler(endpoint string, opts []grpc.DialOption) (*EventHandler, error)

NewEventHandler creates a new event handler relay.

func (*EventHandler) Watch

func (h *EventHandler) Watch(c *gin.Context)

Watch upgrades the incoming GET request into a web-socket connection on which it creates a session for accepting subscriptions and relaying of subsequent events.

type FileHandler

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

func NewFileHandler

func NewFileHandler(endpoint string, opts []grpc.DialOption) (*FileHandler, error)

func (*FileHandler) Download

func (h *FileHandler) Download(mux *runtime.ServeMux, w http.ResponseWriter, r *http.Request, pathParams map[string]string)

func (*FileHandler) Upload

func (h *FileHandler) Upload(c *gin.Context)

func (*FileHandler) UploadHTTP added in v0.17.3

func (h *FileHandler) UploadHTTP(w http.ResponseWriter, r *http.Request)

UploadHTTP is a net/http-compatible upload handler for use with grpc-gateway mux.HandlePath. It is functionally identical to Upload but uses plain http.ResponseWriter and *http.Request instead of gin.Context, enabling registration on the grpc-gateway ServeMux. The ActiveProjectID header is already populated by the ServeMux WithMetadata handler.

type Message

type Message struct {
	Op      string `json:"op"`
	Kind    string `json:"kind"`
	Project string `json:"project"`
	Payload []byte `json:"payload"`
}

Message represents subscription control message

type OCIChartNameRecord

type OCIChartNameRecord struct {
	Name string `json:"name"`
}

type OCIChartVersionRecord

type OCIChartVersionRecord struct {
	ExtraAttrs struct {
		Name    string `json:"name"`
		Version string `json:"version"`
	} `json:"extra_attrs"`
}

type RESTProxy

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

RESTProxy represents the REST proxy state

func NewRESTProxy

func NewRESTProxy(cfg *Config) (*RESTProxy, error)

func (*RESTProxy) Run

func (p *RESTProxy) Run() error

type Session

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

Session represents a watch-event session.

func NewSession

func NewSession(ws *websocket.Conn, grpcClient catalogv3.CatalogServiceClient, c *gin.Context) *Session

NewSession creates a new session backed by the specified socket connection.

func (*Session) Close

func (s *Session) Close() error

Close closes the session

func (*Session) Done

func (s *Session) Done() <-chan interface{}

Done returns the channel for reading the signal that the session is done

func (*Session) Error

func (s *Session) Error() <-chan error

Error returns the channel for reading errors encountered during interaction with the backing web socket

func (*Session) ID

func (s *Session) ID() string

ID returns the session ID

func (*Session) Listen

func (s *Session) Listen() <-chan *Message

Listen returns the channel for reading messages from the client

func (*Session) Send

func (s *Session) Send(msg Message) error

Send sends the specified message to the client

func (*Session) Start

func (s *Session) Start(ctx context.Context)

Start kicks off the session using the supplied context

Jump to

Keyboard shortcuts

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