remote

package
v0.6.992 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2019 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package remote provides HTTP endpoints to control booster remotely. Configure it with a `Store` and a `MetricsProvider` and it will be able to not only show the general status of a booster server, but also to control the manage the policies attached to it, and provide usage metrics in both json and prometheus format.

Copyright © 2019 KIM KeepInMind GmbH/srl

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoosterInfo added in v0.6.97

type BoosterInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit"`
	BuildTime string `json:"build_time"`

	ProxyPort int `json:"proxy_port"`
}

BoosterInfo contains the static information displayed by the `/health.json` endpoint.

var Info BoosterInfo = BoosterInfo{}

type PoliciesInput added in v0.6.98

type PoliciesInput struct {
	SourceID string `json:"source_id"`
	Target   string `json:"target"`
	Reason   string `json:"reason"`
	Issuer   string `json:"issuer"`
}

PoliciesInput describes the fields required by most `POST` requests to a `/policies/...` endpoint.

type Remote

type Remote struct {
	*http.Server
}

func New

func New(h http.Handler) *Remote

func (*Remote) ListenAndServe

func (r *Remote) ListenAndServe(ctx context.Context, port int) error

type ReservedPolicyInput added in v0.6.991

type ReservedPolicyInput struct {
	PoliciesInput
	Hosts []string `json:"hosts"`
}

type Router

type Router struct {
	Store           *store.SourceStore
	Info            BoosterInfo
	MetricsProvider http.Handler
	// contains filtered or unexported fields
}

Router is an `http.Handler` instance. Fill its fields with the necessary information before calling `SetupRoutes`. Its zero value IS NOT ready to be used. Create a `Router` instance with `NewRouter` instead.

func NewRouter

func NewRouter() *Router

NewRouter creates a new router instance. Router should not ne created except with this function.

func (*Router) ServeHTTP

func (r *Router) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP implements `http.Handler`.

func (*Router) SetupRoutes

func (r *Router) SetupRoutes()

SetupRoutes adds the routes available to the router. Make sure to fill the public fields of the Router before calling this function, otherwise the handlers will not be able to work properly.

Jump to

Keyboard shortcuts

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