server

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package server contains implementation of REST API server (HTTPServer) for the Insights content service. In current version, the following REST API endpoints are available:

Index

Constants

View Source
const (
	// MainEndpoint defines suffix of the root endpoint
	MainEndpoint = ""
	// GroupsEndpoint defines suffix of the groups request endpoint
	GroupsEndpoint = "groups"
	// AllContentEndpoint defines suffix for all the content
	AllContentEndpoint = "content"
	// MetricsEndpoint returns prometheus metrics
	MetricsEndpoint = "metrics"
	// StatusEndpoint returns status of all rules that have been read and
	// parsed
	StatusEndpoint = "status"
	// InfoEndpoint returns basic information about content service
	// version, utils repository version, commit hash etc.
	InfoEndpoint = "info"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationError

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

AuthenticationError happens during auth problems, for example malformed token

type Configuration

type Configuration struct {
	Address     string `mapstructure:"address" toml:"address"`
	APIPrefix   string `mapstructure:"api_prefix" toml:"api_prefix"`
	APISpecFile string `mapstructure:"api_spec_file" toml:"api_spec_file"`
	Debug       bool   `mapstructure:"debug" toml:"debug"`
}

Configuration represents configuration of REST API HTTP server

type HTTPServer

type HTTPServer struct {
	Config     Configuration
	InfoParams map[string]string
	Groups     map[string]groups.Group
	Content    content.RuleContentDirectory
	Serv       *http.Server
	// contains filtered or unexported fields
}

HTTPServer in an implementation of Server interface

func New

func New(config Configuration, groupsMap map[string]groups.Group,
	contentDir content.RuleContentDirectory,
	ruleContentStatusMap map[string]types.RuleContentStatus) *HTTPServer

New constructs new implementation of Server interface

func (*HTTPServer) Initialize

func (server *HTTPServer) Initialize() http.Handler

Initialize perform the server initialization

func (*HTTPServer) Start

func (server *HTTPServer) Start() error

Start starts server

func (*HTTPServer) Stop

func (server *HTTPServer) Stop(ctx context.Context) error

Stop stops server's execution

Jump to

Keyboard shortcuts

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