mgmt

package
Version: v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package mgmt provide management server. Provides API to get info about reproxy routes and settings

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewResponseWriter

func NewResponseWriter(w http.ResponseWriter) *responseWriter

NewResponseWriter wraps http.ResponseWriter with stored status code

Types

type Informer

type Informer interface {
	Mappers() (mappers []discovery.URLMapper)
}

Informer wraps interface to get info about servers and mappers

type InformerMock

type InformerMock struct {
	// MappersFunc mocks the Mappers method.
	MappersFunc func() []discovery.URLMapper
	// contains filtered or unexported fields
}

InformerMock is a mock implementation of Informer.

func TestSomethingThatUsesInformer(t *testing.T) {

	// make and configure a mocked Informer
	mockedInformer := &InformerMock{
		MappersFunc: func() []discovery.URLMapper {
			panic("mock out the Mappers method")
		},
	}

	// use mockedInformer in code that requires Informer
	// and then make assertions.

}

func (*InformerMock) Mappers

func (mock *InformerMock) Mappers() []discovery.URLMapper

Mappers calls MappersFunc.

func (*InformerMock) MappersCalls

func (mock *InformerMock) MappersCalls() []struct {
}

MappersCalls gets all the calls that were made to Mappers. Check the length with:

len(mockedInformer.MappersCalls())

type Metrics

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

Metrics provides registration and middleware for prometheus

func NewMetrics

func NewMetrics() *Metrics

NewMetrics create metrics object with all counters registered

func (*Metrics) Middleware

func (m *Metrics) Middleware(next http.Handler) http.Handler

Middleware for the primary proxy server to publish all counters and update metrics

type Server

type Server struct {
	Listen         string
	Informer       Informer
	Version        string
	AssetsLocation string
	AssetsWebRoot  string
	Metrics        *Metrics
}

Server represents management server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

Run the lister and management router, activate rest server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL