Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // DefaultClient denotes the client used for all default accessors. DefaultClient *Client // ErrInvalidRequest occurs when trying to create a new request using malformed parameters. ErrInvalidRequest = errors.New("Invalid request") // ErrRequestFailed occurs when sending a request or receiving a response failed. ErrRequestFailed = errors.New("Request failed") )
View Source
var ( // ErrGraceShutdown is returned when the server has been gracefully shut down. ErrGraceShutdown = errors.New("Server gracefully shut down") // ErrServeFailed occurs when an error occurs during http serving. ErrServeFailed = errors.New("Serving failed") )
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
DefaultHeader Header
// DisableSSLCheck can be set to true, to accept invalid and self-signed certificates in HTTPS connections.
DisableSSLCheck bool
// RequestResponder denotes the technical implementation for sending requests. Overwrite this property to inject mocked responses.
RequestResponder func(req *Request) (*Response, errors.Error)
}
Client is used to send or mock HTTP requests.
type RequestMethod ¶
type RequestMethod string
RequestMethod denotes a HTTP request method.
const ( // MethodGet specifies the HTTP GET method. MethodGet RequestMethod = "GET" // MethodHead specifies the HTTP HEAD method. MethodHead RequestMethod = "HEAD" // MethodPost specifies the HTTP POST method. MethodPost RequestMethod = "POST" // MethodPut specifies the HTTP PUT method. MethodPut RequestMethod = "PUT" // MethodDelete specifies the HTTP DELETE method. MethodDelete RequestMethod = "DELETE" // MethodConnect specifies the HTTP CONNECT method. MethodConnect RequestMethod = "CONNECT" // MethodOptions specifies the HTTP OPTIONS method. MethodOptions RequestMethod = "OPTIONS" // MethodTrace specifies the HTTP TRACE method. MethodTrace RequestMethod = "TRACE" )
func (RequestMethod) String ¶
func (m RequestMethod) String() string
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains http web server functionality with kubernetes probes and prometheus metrics. It can serve an arbitrary collection of services.
func NewServer ¶
func NewServer(config *ServerConfig) (*Server, errors.Error)
NewServer returns a new instance of Server to handle web requests.
func (*Server) RegisterService ¶
RegisterService registers a new named service in the server. The name is used to identify the server in probes.
func (*Server) Run ¶
Run executes the server and gracefully shuts it down when a system signal is received.
type ServerConfig ¶
type ServerConfig struct {
ListenAddress string `json:"listenAddress"`
SubSystemName string `json:"subsystemName,omitempty"`
}
ServerConfig contains all web server specific configuration parameters.
Click to show internal directories.
Click to hide internal directories.