kempclient

package module
v0.0.0-...-af9af4f Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: Apache-2.0 Imports: 13 Imported by: 2

README

kemp-client

Go Report Card Godoc

A client library for the API of Kemp LoadMaster load balancers.

See Kemp API Docs for further information.

Getting kemp-client

Download the latest release: https://github.com/giantswarm/kemp-client/releases/latest

Clone the git repository: https://github.com/giantswarm/kemp-client.git

Contact

Contributing & Reporting Bugs

See CONTRIBUTING for details on submitting patches, the contribution workflow as well as reporting bugs.

License

kemp-client is under the Apache 2.0 license. See the LICENSE file for details.

Documentation

Index

Constants

View Source
const (
	ContentRuleAddHeader    = "1"
	ContentRuleUpdateHeader = "3"
	ContentRuleDeleteHeader = "2"
	DeleteHeaderProtoName   = "DeleteHeaderProto"
	DeleteHeaderPortName    = "DeleteHeaderPort"
	DeleteHeaderPortValue   = "X-Forwarded-Port"
	DeleteHeaderProtoValue  = "X-Forwarded-Proto"
)
View Source
const (
	VStypeHTTP           = "http"
	VStypeGeneric        = "gen"
	VStypeSTARTTLS       = "tls"
	VStypeRemoteTerminal = "ts"
	VStypeLogInsight     = "log"
)

The type of the virutalservice.

Doc from webui: > Select the type of service that will be run over this Virtual Service. > The LoadMaster automatically tries to determine the type of the service > but the user can override this.

View Source
const (
	VSAddViaLegacyXClientSide    = "0"
	VSAddViaNone                 = "2"
	VSAddViaXClientSideWithVia   = "3"
	VSAddViaXClientSideNoVia     = "4"
	VSAddViaXForwardedForWithVia = "1"
	VSAddViaXForwardedForNoVia   = "5"
	VSAddViaViaOnly              = "6"
)

These are the options for the AddVia field. In the kemp webui it relates to the realserver option under Advanced Properties > Add HTTP Headers

Doc from the webui > Select which headers are to be added to HTTP requests. > X-ClientSide and X-Forwarded-For are only added to Non-Transparent Connections.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(config Config) *Client

func (*Client) AddHeaderContentRule

func (c *Client) AddHeaderContentRule(name, headerKey, headerValue string) error

func (*Client) AddProtoPortHeaderRequestRules

func (c *Client) AddProtoPortHeaderRequestRules() error

func (*Client) AddRealServerByData

func (c *Client) AddRealServerByData(ip, port, protocol string, rs RealServer) error

func (*Client) AddRealServerByID

func (c *Client) AddRealServerByID(id int, rs RealServer) error

func (*Client) AddVirtualService

func (c *Client) AddVirtualService(vs VirtualServiceParams) (VirtualService, error)

func (*Client) DeleteHeaderContentRule

func (c *Client) DeleteHeaderContentRule(name string) error

func (*Client) DeleteRealServerByData

func (c *Client) DeleteRealServerByData(ip, port, protocol string, rs RealServer) error

func (*Client) DeleteRealServerByID

func (c *Client) DeleteRealServerByID(id int, rs RealServer) error

func (*Client) DeleteVirtualServiceByData

func (c *Client) DeleteVirtualServiceByData(ip, port, protocol string) error

func (*Client) DeleteVirtualServiceByID

func (c *Client) DeleteVirtualServiceByID(id int) error

func (*Client) FindVirtualServiceByName

func (c *Client) FindVirtualServiceByName(name string) (VirtualService, error)

func (*Client) Get

func (c *Client) Get(param string) (string, error)

func (*Client) GetStatistics

func (c *Client) GetStatistics() (Statistics, error)

GetStatistics calls the API, and returns a Statistics object.

func (*Client) ListVirtualServices

func (c *Client) ListVirtualServices() ([]VirtualService, error)

func (*Client) Request

func (c *Client) Request(cmd string, parameters map[string]string, data interface{}) error

func (*Client) Set

func (c *Client) Set(param, value string) (string, error)

func (*Client) ShowVirtualServiceByData

func (c *Client) ShowVirtualServiceByData(ip, port, protocol string) (VirtualService, error)

func (*Client) ShowVirtualServiceByID

func (c *Client) ShowVirtualServiceByID(id int) (VirtualService, error)

func (*Client) UpdateHeaderContentRule

func (c *Client) UpdateHeaderContentRule(name, headerKey, headerValue string) error

func (*Client) UpdateVirtualService

func (c *Client) UpdateVirtualService(id int, vs VirtualServiceParams) (VirtualService, error)

type Config

type Config struct {
	User     string
	Password string
	Endpoint string
	Debug    bool
}

type ContentRule

type ContentRule struct {
	Name        string `xml:"Name"`
	Header      string `xml:"Header"`
	HeaderValue string `xml:"HeaderValue"`
}

type ContentRuleResponse

type ContentRuleResponse struct {
	Debug   string      `xml:",innerxml"`
	XMLName xml.Name    `xml:"Response"`
	CR      ContentRule `xml:"Success>Data"`
}

type ErrorResponse

type ErrorResponse struct {
	Debug string `xml:",innerxml"`
	Error string
}
type Header struct {
	Key   string
	Value string
}

type Parameter

type Parameter struct {
	XMLName xml.Name `xml:""`
	Value   string   `xml:",chardata"`
}

type ParameterList

type ParameterList struct {
	Parameters []Parameter `xml:",any"`
}

type ParameterResponse

type ParameterResponse struct {
	Debug   string        `xml:",innerxml"`
	XMLName xml.Name      `xml:"Response"`
	Data    ParameterList `xml:"Success>Data"`
}

type RealServer

type RealServer struct {
	ID             int `xml:"RsIndex"`
	Status         string
	VirtualService int    `xml:"VsIndex"`
	IPAddress      string `xml:"Addr"`
	Port           string
	Forward        string
	Weight         string
	Limit          string
	Enable         string
}

type RealServerList

type RealServerList struct {
	Rs []RealServer `xml:",any"`
}

type RealServerResponse

type RealServerResponse struct {
	Debug   string     `xml:",innerxml"`
	XMLName xml.Name   `xml:"Response"`
	Data    RealServer `xml:"Success>Data"`
}

type RealServerStats

type RealServerStats struct {
	VSIndex           int
	RSIndex           int
	Address           string `xml:"Addr"`
	Port              int
	TotalConnections  int `xml:"Conns"`
	TotalPackets      int `xml:"Pkts"`
	TotalBytes        int `xml:"Bytes"`
	TotalBits         int `xml:"Bits"`
	ActiveConnections int `xml:"ActivConns"`
	ConnectionsPerSec int `xml:"ConnsPerSec"`
	BytesRead         int
	BytesWritten      int
	Enabled           int `xml:"Enable"`
	Weight            int
	Persist           int
}

RealServerStats represents statistics for a Real Server.

type RealServerStatsList

type RealServerStatsList []RealServerStats

RealServerStatsList is a list of RealServerStats.

func (RealServerStatsList) Len

func (l RealServerStatsList) Len() int

func (RealServerStatsList) Less

func (l RealServerStatsList) Less(i int, j int) bool

func (RealServerStatsList) Swap

func (l RealServerStatsList) Swap(i int, j int)

type Statistics

type Statistics struct {
	Totals          Totals                  `xml:"VStotals"`
	VirtualServices VirtualServiceStatsList `xml:"Vs"`
	RealServers     RealServerStatsList     `xml:"Rs"`
}

Statistics represents the statistics data returned by the API.

type StatisticsResponse

type StatisticsResponse struct {
	Debug   string     `xml:",innerxml"`
	XMLName xml.Name   `xml:"Response"`
	Data    Statistics `xml:"Success>Data"`
}

StatisticsResponse represents the API response from the `stats` endpoint.

type Totals

type Totals struct {
	ConnectionsPerSec int `xml:"ConnsPerSec"`
	BitsPerSec        int
	BytesPerSec       int
	PacketsPerSec     int `xml:"PktsPerSec"`
}

Totals represents global statistics data.

type VirtualService

type VirtualService struct {
	ID               int    `xml:"Index"`
	Name             string `xml:"NickName"`
	IPAddress        string `xml:"VSAddress"`
	Port             string `xml:"VSPort"`
	Protocol         string
	Status           string
	Enable           string
	SSLReverse       string
	SSLReencrypt     string
	Intercept        string
	InterceptOpts    []string `xml:"InterceptOpts>Opt"`
	AlertThreshold   string
	Transactionlimit string
	Transparent      string
	ServerInit       string
	StartTLSMode     string
	Idletime         string
	Cache            string
	Compress         string
	Verify           string
	UseforSnat       string
	ForceL7          string
	ClientCert       string
	ErrorCode        string
	CertFile         string
	CheckURL         string `xml:"CheckUrl"`
	CheckUse11       string `xml:"CheckUse1.1"`
	MatchLen         string
	CheckUseGet      string
	SSLRewrite       string
	VStype           string
	FollowVSID       int
	Schedule         string
	CheckType        string
	PersistTimeout   string
	SSLAcceleration  string
	CheckPort        string
	NRules           string
	NRequestRules    string
	NResponseRules   string
	NPreProcessRules string
	EspEnabled       string
	InputAuthMode    string
	OutputAuthMode   string
	MasterVS         string
	MasterVSID       int
	AddVia           string
	TlsType          string
	NeedHostName     string
	OCSPVerify       string
	NumberOfRSs      string
	Rs               []RealServer `xml:"Rs"`
	ExtraHdrKey      string
	ExtraHdrValue    string
}

type VirtualServiceList

type VirtualServiceList struct {
	VS []VirtualService `xml:",any"`
}

type VirtualServiceListResponse

type VirtualServiceListResponse struct {
	Debug   string             `xml:",innerxml"`
	XMLName xml.Name           `xml:"Response"`
	Data    VirtualServiceList `xml:"Success>Data"`
}

type VirtualServiceParams

type VirtualServiceParams struct {
	Name                    string
	IPAddress               string
	Port                    string
	Protocol                string
	CheckType               string
	CheckURL                string
	CheckPort               string
	SSLAcceleration         bool
	Transparent             bool
	AddVia                  string
	VStype                  string
	ExtraRequestHeaderKey   string
	ExtraRequestHeaderValue string
	Headers                 map[string]string
	ContentRequestRules     []string
}

type VirtualServiceResponse

type VirtualServiceResponse struct {
	Debug   string         `xml:",innerxml"`
	XMLName xml.Name       `xml:"Response"`
	VS      VirtualService `xml:"Success>Data"`
}

type VirtualServiceStats

type VirtualServiceStats struct {
	Index             int
	Address           string `xml:"VSAddress"`
	Port              int    `xml:"VSPort"`
	Protocol          string `xml:"VSProt"`
	TotalConnections  int    `xml:"TotalConns"`
	TotalPackets      int    `xml:"TotalPkts"`
	TotalBytes        int
	TotalBits         int
	ActiveConnections int `xml:"ActiveConns"`
	ConnectionsPerSec int `xml:"ConnsPerSec"`
	BytesRead         int
	BytesWritten      int
	Enabled           int `xml:"Enable"`
	WafEnable         int
	ErrorCode         int
}

VirtualServiceStats represents statistics for a Virtual Service.

type VirtualServiceStatsList

type VirtualServiceStatsList []VirtualServiceStats

VirtualServiceStatsList is a list of VirtualServiceStats.

func (VirtualServiceStatsList) Len

func (l VirtualServiceStatsList) Len() int

func (VirtualServiceStatsList) Less

func (l VirtualServiceStatsList) Less(i int, j int) bool

func (VirtualServiceStatsList) Swap

func (l VirtualServiceStatsList) Swap(i int, j int)

Jump to

Keyboard shortcuts

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