http

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Enable  bool
	Address string
}

Config defines the config structure

func NewConfig

func NewConfig() *Config

NewConfig is used to init config with default values

func (*Config) IsEnabled

func (c *Config) IsEnabled() bool

IsEnabled is used to return whether the current component is enabled This attribute is required in pluggable components

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *pflag.FlagSet)

RegisterFlagsWithPrefix is used to register flags

func (*Config) Validate

func (c *Config) Validate() error

Validate is used to validate config and returns error on failure

type MockServer

type MockServer struct {
	logger.Logger
	// contains filtered or unexported fields
}

MockServer is the implement of http mock server

func (*MockServer) ServeHTTP

func (s *MockServer) ServeHTTP(w http.ResponseWriter, request *http.Request)

ServeHTTP is used to implement the interface of http.Handler

func (*MockServer) Start

func (s *MockServer) Start(ctx context.Context, cancelFunc context.CancelFunc) error

Start is used to start the service

type Provider

type Provider interface {
	Start(ctx context.Context, cancelFunc context.CancelFunc) error
}

Provider defines the mock server interface

func New

func New(cfg *Config,
	apiManager apimanager.Provider,
	logger logger.Logger, registerer prometheus.Registerer) (Provider, error)

New is used to init service

Jump to

Keyboard shortcuts

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