api

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: Apache-2.0 Imports: 12 Imported by: 34

Documentation

Overview

Package api provides the Cilium useful helpers for the external API

Index

Constants

View Source
const (
	// CiliumGroupName is the cilium's unix group name.
	CiliumGroupName = "cilium"
	// SocketFileMode is the default file mode for the sockets.
	SocketFileMode os.FileMode = 0660
	// ClientTimeout specifies timeout to be used by clients
	ClientTimeout = 90 * time.Second
)

Variables

This section is empty.

Functions

func SetDefaultPermissions

func SetDefaultPermissions(socketPath string) error

SetDefaultPermissions sets the given socket's group to `CiliumGroupName` and mode to `SocketFileMode`.

Types

type APIError

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

APIError is the error representation for the API.

func Error

func Error(code int, err error) *APIError

Error creates a new API error from the code and error.

func New

func New(code int, msg string, args ...interface{}) *APIError

New creates a API error from the code, msg and extra arguments.

func (*APIError) Error

func (a *APIError) Error() string

Error returns the API error message.

func (*APIError) GetModel

func (a *APIError) GetModel() *models.Error

GetModel returns model error.

func (*APIError) WriteResponse

func (a *APIError) WriteResponse(rw http.ResponseWriter, producer runtime.Producer)

WriteResponse to the client.

type APIPanicHandler

type APIPanicHandler struct {
	Next http.Handler
}

APIPanicHandler recovers from API panics and logs encountered panics

func (*APIPanicHandler) ServeHTTP

func (h *APIPanicHandler) ServeHTTP(wr http.ResponseWriter, req *http.Request)

ServeHTTP implements the http.Handler interface. It recovers from panics of all next handlers and logs them

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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