configuration

package
v3.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2022 License: Apache-2.0 Imports: 35 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// General error, unknown cause
	ErrGeneralError = 0

	// Errors regarding configurations
	ErrNoParentSpecified      = 10
	ErrParentDoesNotExist     = 11
	ErrBothVersionTransaction = 12
	ErrNoVersionTransaction   = 13
	ErrValidationError        = 14
	ErrVersionMismatch        = 15

	ErrTransactionDoesNotExist  = 20
	ErrTransactionAlreadyExists = 21
	ErrCannotParseTransaction   = 22

	ErrObjectDoesNotExist    = 30
	ErrObjectAlreadyExists   = 31
	ErrObjectIndexOutOfRange = 32

	ErrErrorChangingConfig = 40
	ErrCannotReadConfFile  = 41
	ErrCannotReadVersion   = 42
	ErrCannotSetVersion    = 43

	ErrCannotFindHAProxy = 50

	ErrClientDoesNotExists = 60
)
View Source
const ServiceGrowthTypeExponential = "exponential"

ServiceGrowthTypeExponential indicates exponential growth type in ScalingParams.

View Source
const ServiceGrowthTypeLinear = "linear"

ServiceGrowthTypeLinear indicates linear growth type in ScalingParams.

Variables

This section is empty.

Functions

func CompositeTransactionError

func CompositeTransactionError(e ...error) *oaerrors.CompositeError

CompositeTransactionError helper function to aggregate multiple errors when calling multiple operations in transactions.

func CreateEditSection

func CreateEditSection(object interface{}, section parser.Section, pName string, p parser.Parser) error

CreateEditSection creates or updates a section in the parser based on the provided object

func DeletePeerSection

func DeletePeerSection(p parser.Parser, name string) error

func GetBindByName

func GetBindByName(name string, frontend string, p parser.Parser) (*models.Bind, int)

func GetGroupByName added in v3.1.0

func GetGroupByName(name string, userlist string, p parser.Parser) (*models.Group, int)

func GetNameserverByName

func GetNameserverByName(name string, resolverSection string, p parser.Parser) (*models.Nameserver, int)

func GetPeerEntryByName

func GetPeerEntryByName(name string, peerSection string, p parser.Parser) (*models.PeerEntry, int)

func GetServerByName

func GetServerByName(name string, backend string, p parser.Parser) (*models.Server, int)

func GetServerTemplateByPrefix

func GetServerTemplateByPrefix(prefix string, backend string, p parser.Parser) (*models.ServerTemplate, int)

func GetUserByUsername added in v3.1.0

func GetUserByUsername(username string, userlist string, p parser.Parser) (*models.User, int)

func ParseACL

func ParseACL(f types.ACL) *models.ACL

func ParseACLs

func ParseACLs(t, pName string, p parser.Parser, aclName ...string) (models.Acls, error)

func ParseBackendSwitchingRule

func ParseBackendSwitchingRule(ub types.UseBackend) *models.BackendSwitchingRule

func ParseBackendSwitchingRules

func ParseBackendSwitchingRules(frontend string, p parser.Parser) (models.BackendSwitchingRules, error)

func ParseBind

func ParseBind(ondiskBind types.Bind) *models.Bind

func ParseBinds

func ParseBinds(frontend string, p parser.Parser) (models.Binds, error)

func ParseCacheSection

func ParseCacheSection(p parser.Parser, cache *models.Cache) error

func ParseDeclareCapture

func ParseDeclareCapture(f types.DeclareCapture) *models.Capture

func ParseDeclareCaptures

func ParseDeclareCaptures(frontend string, p parser.Parser) (models.Captures, error)

func ParseFilter

func ParseFilter(f types.Filter) *models.Filter

func ParseFilters

func ParseFilters(t, pName string, p parser.Parser) (models.Filters, error)

func ParseGlobalSection

func ParseGlobalSection(p parser.Parser) (*models.Global, error)

func ParseGroup added in v3.1.0

func ParseGroup(u types.Group) *models.Group

func ParseGroups added in v3.1.0

func ParseGroups(userlist string, p parser.Parser) (models.Groups, error)

func ParseHTTPCheck

func ParseHTTPCheck(f types.Action) (check *models.HTTPCheck, err error)

func ParseHTTPChecks

func ParseHTTPChecks(t, pName string, p parser.Parser) (models.HTTPChecks, error)

func ParseHTTPRequestRule

func ParseHTTPRequestRule(f types.Action) (rule *models.HTTPRequestRule, err error)

func ParseHTTPRequestRules

func ParseHTTPRequestRules(t, pName string, p parser.Parser) (models.HTTPRequestRules, error)

func ParseHTTPResponseRule

func ParseHTTPResponseRule(f types.Action) *models.HTTPResponseRule

func ParseHTTPResponseRules

func ParseHTTPResponseRules(t, pName string, p parser.Parser) (models.HTTPResponseRules, error)

func ParseLogTarget

func ParseLogTarget(l types.Log) *models.LogTarget

func ParseLogTargets

func ParseLogTargets(t, pName string, p parser.Parser) (models.LogTargets, error)

func ParseNameserver

func ParseNameserver(p types.Nameserver) *models.Nameserver

func ParseNameservers

func ParseNameservers(resolverSection string, p parser.Parser) (models.Nameservers, error)

func ParsePeerEntries

func ParsePeerEntries(peerSection string, p parser.Parser) (models.PeerEntries, error)

func ParsePeerEntry

func ParsePeerEntry(p types.Peer) *models.PeerEntry

func ParseResolverSection

func ParseResolverSection(p parser.Parser, resolver *models.Resolver) error

func ParseSection

func ParseSection(object interface{}, section parser.Section, pName string, p parser.Parser) error

ParseSection sets the fields of the section based on the provided parser

func ParseServer

func ParseServer(ondiskServer types.Server) *models.Server

func ParseServerSwitchingRule

func ParseServerSwitchingRule(us types.UseServer) *models.ServerSwitchingRule

func ParseServerSwitchingRules

func ParseServerSwitchingRules(backend string, p parser.Parser) (models.ServerSwitchingRules, error)

func ParseServerTemplate

func ParseServerTemplate(ondiskServerTemplate types.ServerTemplate) *models.ServerTemplate

func ParseServerTemplates

func ParseServerTemplates(backend string, p parser.Parser) (models.ServerTemplates, error)

func ParseServers

func ParseServers(backend string, p parser.Parser) (models.Servers, error)

func ParseStickRule

func ParseStickRule(s types.Stick) *models.StickRule

func ParseStickRules

func ParseStickRules(backend string, p parser.Parser) (models.StickRules, error)

func ParseTCPCheck

func ParseTCPCheck(f types.Action) (check *models.TCPCheck, err error)

func ParseTCPChecks

func ParseTCPChecks(t, pName string, p parser.Parser) (models.TCPChecks, error)

func ParseTCPRequestRule

func ParseTCPRequestRule(f types.TCPType) (rule *models.TCPRequestRule, err error)

func ParseTCPRequestRules

func ParseTCPRequestRules(t, pName string, p parser.Parser) (models.TCPRequestRules, error)

func ParseTCPResponseRule

func ParseTCPResponseRule(t types.TCPType) *models.TCPResponseRule

func ParseTCPResponseRules

func ParseTCPResponseRules(backend string, p parser.Parser) (models.TCPResponseRules, error)

func ParseUser added in v3.1.0

func ParseUser(u types.User) *models.User

func ParseUsers added in v3.1.0

func ParseUsers(userlist string, p parser.Parser) (models.Users, error)

func SerializeACL

func SerializeACL(f models.ACL) types.ACL

func SerializeBackendSwitchingRule

func SerializeBackendSwitchingRule(bRule models.BackendSwitchingRule) types.UseBackend

func SerializeBind

func SerializeBind(b models.Bind) types.Bind

func SerializeCacheSection

func SerializeCacheSection(p parser.Parser, data *models.Cache) error

func SerializeDeclareCapture

func SerializeDeclareCapture(f models.Capture) types.DeclareCapture

func SerializeFarmToBackend

func SerializeFarmToBackend(farm *models.SiteFarm) *models.Backend

func SerializeFilter

func SerializeFilter(f models.Filter) types.Filter

func SerializeGlobalSection

func SerializeGlobalSection(p parser.Parser, data *models.Global) error

func SerializeGroup added in v3.1.1

func SerializeGroup(u models.Group) types.Group

func SerializeHTTPCheck

func SerializeHTTPCheck(f models.HTTPCheck) (action types.Action, err error)

func SerializeHTTPRequestRule

func SerializeHTTPRequestRule(f models.HTTPRequestRule) (rule types.Action, err error)

func SerializeHTTPResponseRule

func SerializeHTTPResponseRule(f models.HTTPResponseRule) (rule types.Action, err error)

func SerializeLogTarget

func SerializeLogTarget(l models.LogTarget) types.Log

func SerializeNameserver

func SerializeNameserver(pe models.Nameserver) types.Nameserver

func SerializePeerEntry

func SerializePeerEntry(pe models.PeerEntry) types.Peer

func SerializePeerSection

func SerializePeerSection(p parser.Parser, data *models.PeerSection) error

func SerializeResolverSection

func SerializeResolverSection(p parser.Parser, data *models.Resolver) error

func SerializeServer

func SerializeServer(s models.Server) types.Server

func SerializeServerSwitchingRule

func SerializeServerSwitchingRule(sRule models.ServerSwitchingRule) types.UseServer

func SerializeServerTemplate

func SerializeServerTemplate(s models.ServerTemplate) types.ServerTemplate

func SerializeServiceToFrontend

func SerializeServiceToFrontend(service *models.SiteService, name string) *models.Frontend

func SerializeStickRule

func SerializeStickRule(sRule models.StickRule) types.Stick

func SerializeTCPCheck

func SerializeTCPCheck(f models.TCPCheck) (action types.Action, err error)

func SerializeTCPRequestRule

func SerializeTCPRequestRule(f models.TCPRequestRule) (rule types.TCPType, err error)

func SerializeTCPResponseRule

func SerializeTCPResponseRule(t models.TCPResponseRule) types.TCPType

func SerializeUser added in v3.1.1

func SerializeUser(u models.User) types.User

Types

type ACL

type ACL interface {
	GetACLs(parentType, parentName string, transactionID string, aclName ...string) (int64, models.Acls, error)
	GetACL(id int64, parentType, parentName string, transactionID string) (int64, *models.ACL, error)
	DeleteACL(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateACL(parentType string, parentName string, data *models.ACL, transactionID string, version int64) error
	EditACL(id int64, parentType string, parentName string, data *models.ACL, transactionID string, version int64) error
}

type Backend

type Backend interface {
	GetBackends(transactionID string) (int64, models.Backends, error)
	GetBackend(name string, transactionID string) (int64, *models.Backend, error)
	DeleteBackend(name string, transactionID string, version int64) error
	CreateBackend(data *models.Backend, transactionID string, version int64) error
	EditBackend(name string, data *models.Backend, transactionID string, version int64) error
	GetBackendSwitchingRules(frontend string, transactionID string) (int64, models.BackendSwitchingRules, error)
	GetBackendSwitchingRule(id int64, frontend string, transactionID string) (int64, *models.BackendSwitchingRule, error)
	DeleteBackendSwitchingRule(id int64, frontend string, transactionID string, version int64) error
	CreateBackendSwitchingRule(frontend string, data *models.BackendSwitchingRule, transactionID string, version int64) error
	EditBackendSwitchingRule(id int64, frontend string, data *models.BackendSwitchingRule, transactionID string, version int64) error
}

type Bind

type Bind interface {
	GetBinds(frontend string, transactionID string) (int64, models.Binds, error)
	GetBind(name string, frontend string, transactionID string) (int64, *models.Bind, error)
	DeleteBind(name string, frontend string, transactionID string, version int64) error
	CreateBind(frontend string, data *models.Bind, transactionID string, version int64) error
	EditBind(name string, frontend string, data *models.Bind, transactionID string, version int64) error
}

type Cache

type Cache interface {
	GetCaches(transactionID string) (int64, models.Caches, error)
	GetCache(name string, transactionID string) (int64, *models.Cache, error)
	DeleteCache(name string, transactionID string, version int64) error
	EditCache(name string, data *models.Cache, transactionID string, version int64) error
	CreateCache(data *models.Cache, transactionID string, version int64) error
}

type Capture

type Capture interface {
	GetDeclareCaptures(frontend string, transactionID string) (int64, models.Captures, error)
	GetDeclareCapture(index int64, frontend string, transactionID string) (int64, *models.Capture, error)
	DeleteDeclareCapture(index int64, frontend string, transactionID string, version int64) error
	CreateDeclareCapture(frontend string, data *models.Capture, transactionID string, version int64) error
	EditDeclareCapture(index int64, frontend string, data *models.Capture, transactionID string, version int64) error
}

type ClientParams

type ClientParams struct {
	ConfigurationFile         string
	Haproxy                   string
	TransactionDir            string
	BackupsNumber             int
	UseValidation             bool
	PersistentTransactions    bool
	ValidateConfigurationFile bool
	MasterWorker              bool
	SkipFailedTransactions    bool
	UseMd5Hash                bool

	// ValidateCmd allows specifying a custom script to validate the transaction file.
	// The injected environment variable DATAPLANEAPI_TRANSACTION_FILE must be used to get the location of the file.
	ValidateCmd               string
	ValidateConfigFilesBefore []string
	ValidateConfigFilesAfter  []string
}

ClientParams is just a placeholder for all client options

type ConfError

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

ConfError general configuration client error

func NewConfError

func NewConfError(code int, msg string) *ConfError

NewConfError constructor for ConfError

func (*ConfError) Code

func (e *ConfError) Code() int

Code returns ConfError code, which is one of constants in this package

func (*ConfError) Error

func (e *ConfError) Error() string

Error implementation for ConfError

type Counter

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

type Defaults

type Defaults interface {
	GetDefaultsConfiguration(transactionID string) (int64, *models.Defaults, error)
	PushDefaultsConfiguration(data *models.Defaults, transactionID string, version int64) error
}

type Filter

type Filter interface {
	GetFilters(parentType, parentName string, transactionID string) (int64, models.Filters, error)
	GetFilter(id int64, parentType, parentName string, transactionID string) (int64, *models.Filter, error)
	DeleteFilter(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateFilter(parentType string, parentName string, data *models.Filter, transactionID string, version int64) error
	EditFilter(id int64, parentType string, parentName string, data *models.Filter, transactionID string, version int64) error
}

type Frontend

type Frontend interface {
	GetFrontends(transactionID string) (int64, models.Frontends, error)
	GetFrontend(name string, transactionID string) (int64, *models.Frontend, error)
	DeleteFrontend(name string, transactionID string, version int64) error
	EditFrontend(name string, data *models.Frontend, transactionID string, version int64) error
	CreateFrontend(data *models.Frontend, transactionID string, version int64) error
}

type Global

type Global interface {
	GetGlobalConfiguration(transactionID string) (int64, *models.Global, error)
	PushGlobalConfiguration(data *models.Global, transactionID string, version int64) error
}

type Group added in v3.1.0

type Group interface {
	GetGroups(userlist string, transactionID string) (int64, models.Groups, error)
	GetGroup(name string, userlist string, transactionID string) (int64, *models.Group, error)
	DeleteGroup(name string, userlist string, transactionID string, version int64) error
	CreateGroup(userlist string, data *models.Group, transactionID string, version int64) error
	EditGroup(name string, userlist string, data *models.Group, transactionID string, version int64) error
}

type HTTPCheck

type HTTPCheck interface {
	GetHTTPChecks(parentType, parentName string, transactionID string) (int64, models.HTTPChecks, error)
	GetHTTPCheck(id int64, parentType string, parentName string, transactionID string) (int64, *models.HTTPCheck, error)
	DeleteHTTPCheck(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateHTTPCheck(parentType string, parentName string, data *models.HTTPCheck, transactionID string, version int64) error
	EditHTTPCheck(id int64, parentType string, parentName string, data *models.HTTPCheck, transactionID string, version int64) error
}

type HTTPRequestRule

type HTTPRequestRule interface {
	GetHTTPRequestRules(parentType, parentName string, transactionID string) (int64, models.HTTPRequestRules, error)
	GetHTTPRequestRule(id int64, parentType, parentName string, transactionID string) (int64, *models.HTTPRequestRule, error)
	DeleteHTTPRequestRule(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateHTTPRequestRule(parentType string, parentName string, data *models.HTTPRequestRule, transactionID string, version int64) error
	EditHTTPRequestRule(id int64, parentType string, parentName string, data *models.HTTPRequestRule, transactionID string, version int64) error
}

type HTTPResponseRule

type HTTPResponseRule interface {
	GetHTTPResponseRules(parentType, parentName string, transactionID string) (int64, models.HTTPResponseRules, error)
	GetHTTPResponseRule(id int64, parentType, parentName string, transactionID string) (int64, *models.HTTPResponseRule, error)
	DeleteHTTPResponseRule(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateHTTPResponseRule(parentType string, parentName string, data *models.HTTPResponseRule, transactionID string, version int64) error
	EditHTTPResponseRule(id int64, parentType string, parentName string, data *models.HTTPResponseRule, transactionID string, version int64) error
}

type LogTarget

type LogTarget interface {
	GetLogTargets(parentType, parentName string, transactionID string) (int64, models.LogTargets, error)
	GetLogTarget(id int64, parentType, parentName string, transactionID string) (int64, *models.LogTarget, error)
	DeleteLogTarget(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateLogTarget(parentType string, parentName string, data *models.LogTarget, transactionID string, version int64) error
	EditLogTarget(id int64, parentType string, parentName string, data *models.LogTarget, transactionID string, version int64) error
}

type Nameserver

type Nameserver interface {
	GetNameservers(resolverSection string, transactionID string) (int64, models.Nameservers, error)
	GetNameserver(name string, resolverSection string, transactionID string) (int64, *models.Nameserver, error)
	DeleteNameserver(name string, resolverSection string, transactionID string, version int64) error
	CreateNameserver(resolverSection string, data *models.Nameserver, transactionID string, version int64) error
	EditNameserver(name string, resolverSection string, data *models.Nameserver, transactionID string, version int64) error
}

type Parser

type Parser interface {
	Parser() parser.Parser
	HasParser(transactionID string) bool
	GetParser(transactionID string) (parser.Parser, error)
	AddParser(transactionID string) error
	DeleteParser(transactionID string) error
	CommitParser(transactionID string) error
	GetVersion(transactionID string) (int64, error)
	IncrementVersion() error
	LoadData(filename string) error
	Save(transactionFile, transactionID string) error
}

type PeerEntry

type PeerEntry interface {
	GetPeerEntries(peerSection string, transactionID string) (int64, models.PeerEntries, error)
	GetPeerEntry(name string, peerSection string, transactionID string) (int64, *models.PeerEntry, error)
	DeletePeerEntry(name string, peerSection string, transactionID string, version int64) error
	CreatePeerEntry(peerSection string, data *models.PeerEntry, transactionID string, version int64) error
	EditPeerEntry(name string, peerSection string, data *models.PeerEntry, transactionID string, version int64) error
}

type PeerSection

type PeerSection interface {
	GetPeerSections(transactionID string) (int64, models.PeerSections, error)
	GetPeerSection(name string, transactionID string) (int64, *models.PeerSection, error)
	DeletePeerSection(name string, transactionID string, version int64) error
	CreatePeerSection(data *models.PeerSection, transactionID string, version int64) error
}

type Raw

type Raw interface {
	GetRawConfiguration(transactionID string, version int64) (int64, string, error)
	PostRawConfiguration(config *string, version int64, skipVersionCheck bool, onlyValidate ...bool) error
}

type Resolver

type Resolver interface {
	GetResolvers(transactionID string) (int64, models.Resolvers, error)
	GetResolver(name string, transactionID string) (int64, *models.Resolver, error)
	DeleteResolver(name string, transactionID string, version int64) error
	EditResolver(name string, data *models.Resolver, transactionID string, version int64) error
	CreateResolver(data *models.Resolver, transactionID string, version int64) error
}

type ScalingParams

type ScalingParams struct {
	BaseSlots       int
	SlotsGrowthType string
	SlotsIncrement  int
}

ScalingParams defines parameter for dynamic server scaling of the Service backend.

type SectionObject

type SectionObject struct {
	Object  interface{}
	Section parser.Section
	Name    string
	Parser  parser.Parser
}

SectionObject represents a configuration section

func (*SectionObject) CreateEditSection

func (s *SectionObject) CreateEditSection() error

CreateEditSection creates or updates a section in the parser based on the provided object

type SectionParser

type SectionParser struct {
	Object  interface{}
	Section parser.Section
	Name    string
	Parser  parser.Parser
}

SectionParser is used set fields of a section based on the provided parser

func (*SectionParser) Parse

func (s *SectionParser) Parse() error

Parse parses the sections fields and sets their values with the data from the parser

type Server

type Server interface {
	GetServers(backend string, transactionID string) (int64, models.Servers, error)
	GetServer(name string, backend string, transactionID string) (int64, *models.Server, error)
	DeleteServer(name string, backend string, transactionID string, version int64) error
	CreateServer(backend string, data *models.Server, transactionID string, version int64) error
	EditServer(name string, backend string, data *models.Server, transactionID string, version int64) error
	GetServerSwitchingRules(backend string, transactionID string) (int64, models.ServerSwitchingRules, error)
	GetServerSwitchingRule(id int64, backend string, transactionID string) (int64, *models.ServerSwitchingRule, error)
	DeleteServerSwitchingRule(id int64, backend string, transactionID string, version int64) error
	CreateServerSwitchingRule(backend string, data *models.ServerSwitchingRule, transactionID string, version int64) error
	EditServerSwitchingRule(id int64, backend string, data *models.ServerSwitchingRule, transactionID string, version int64) error
}

type ServerTemplate

type ServerTemplate interface {
	GetServerTemplates(backend string, transactionID string) (int64, models.ServerTemplates, error)
	GetServerTemplate(prefix string, backend string, transactionID string) (int64, *models.ServerTemplate, error)
	DeleteServerTemplate(prefix string, backend string, transactionID string, version int64) error
	CreateServerTemplate(backend string, data *models.ServerTemplate, transactionID string, version int64) error
	EditServerTemplate(prefix string, backend string, data *models.ServerTemplate, transactionID string, version int64) error
}

type Service

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

Service represents the maping from a discovery service into a configuration backend.

func (*Service) Delete

func (s *Service) Delete() error

Delete removes the service from the client with all the associated configuration resources.

func (*Service) GetServers

func (s *Service) GetServers() (models.Servers, error)

GetServers returns the list of servers as they are currently configured in the services backend

func (*Service) Init

func (s *Service) Init(transactionID string) (bool, error)

Init initiates the client by reading the configuration associated with it or created the initial configuration if it does not exist.

func (*Service) SetTransactionID

func (s *Service) SetTransactionID(transactionID string)

SetTransactionID updates the transaction ID to be used for modifications on the configuration associated with the service.

func (*Service) Update

func (s *Service) Update(servers []ServiceServer) (bool, error)

Update updates the backend associated with the server based on the list of servers provided

func (*Service) UpdateScalingParams

func (s *Service) UpdateScalingParams(scaling ScalingParams) error

UpdateScalingParams updates parameters used for dynamic server scaling of the Service backend

type ServiceI

type ServiceI interface {
	NewService(name string, scaling ScalingParams) (*Service, error)
	DeleteService(name string)
}

type ServiceServer

type ServiceServer struct {
	Address string
	Port    int
}

ServiceServer contains information for one server in the service.

type Site

type Site interface {
	GetSites(transactionID string) (int64, models.Sites, error)
	GetSite(name string, transactionID string) (int64, *models.Site, error)
	CreateSite(data *models.Site, transactionID string, version int64) error
	EditSite(name string, data *models.Site, transactionID string, version int64) error
	DeleteSite(name string, transactionID string, version int64) error
}

type StickRule

type StickRule interface {
	GetStickRules(backend string, transactionID string) (int64, models.StickRules, error)
	GetStickRule(id int64, backend string, transactionID string) (int64, *models.StickRule, error)
	DeleteStickRule(id int64, backend string, transactionID string, version int64) error
	CreateStickRule(backend string, data *models.StickRule, transactionID string, version int64) error
	EditStickRule(id int64, backend string, data *models.StickRule, transactionID string, version int64) error
}

type TCPCheck

type TCPCheck interface {
	GetTCPChecks(parentType, parentName string, transactionID string) (int64, models.TCPChecks, error)
	GetTCPCheck(id int64, parentType string, parentName string, transactionID string) (int64, *models.TCPCheck, error)
	DeleteTCPCheck(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateTCPCheck(parentType string, parentName string, data *models.TCPCheck, transactionID string, version int64) error
	EditTCPCheck(id int64, parentType string, parentName string, data *models.TCPCheck, transactionID string, version int64) error
}

type TCPRequestRule

type TCPRequestRule interface {
	GetTCPRequestRules(parentType, parentName string, transactionID string) (int64, models.TCPRequestRules, error)
	GetTCPRequestRule(id int64, parentType, parentName string, transactionID string) (int64, *models.TCPRequestRule, error)
	DeleteTCPRequestRule(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateTCPRequestRule(parentType string, parentName string, data *models.TCPRequestRule, transactionID string, version int64) error
	EditTCPRequestRule(id int64, parentType string, parentName string, data *models.TCPRequestRule, transactionID string, version int64) error
}

type TCPResponseRule

type TCPResponseRule interface {
	GetTCPResponseRules(backend string, transactionID string) (int64, models.TCPResponseRules, error)
	GetTCPResponseRule(id int64, backend string, transactionID string) (int64, *models.TCPResponseRule, error)
	DeleteTCPResponseRule(id int64, backend string, transactionID string, version int64) error
	CreateTCPResponseRule(backend string, data *models.TCPResponseRule, transactionID string, version int64) error
	EditTCPResponseRule(id int64, backend string, data *models.TCPResponseRule, transactionID string, version int64) error
}

type Transaction

type Transaction struct {
	options.ConfigurationOptions
	TransactionClient TransactionClient
	// contains filtered or unexported fields
}

func (*Transaction) CheckTransactionOrVersion

func (t *Transaction) CheckTransactionOrVersion(transactionID string, version int64) (string, error)

func (*Transaction) CommitTransaction

func (t *Transaction) CommitTransaction(transactionID string) (*models.Transaction, error)

CommitTransaction commits a transaction by id.

func (*Transaction) DeleteTransaction

func (t *Transaction) DeleteTransaction(transactionID string) error

DeleteTransaction deletes a transaction by id.

func (*Transaction) ErrAndDeleteTransaction

func (t *Transaction) ErrAndDeleteTransaction(err error, tID string) error

func (*Transaction) GetTransaction

func (t *Transaction) GetTransaction(transactionID string) (*models.Transaction, error)

GetTransaction returns transaction information by id

func (*Transaction) GetTransactionFile

func (t *Transaction) GetTransactionFile(transactionID string) (string, error)

func (*Transaction) GetTransactions

func (t *Transaction) GetTransactions(status string) (*models.Transactions, error)

GetTransactions returns an array of transactions

func (*Transaction) HandleError

func (t *Transaction) HandleError(id, parentType, parentName, transactionID string, implicit bool, err error) error

func (*Transaction) MarkTransactionOutdated

func (t *Transaction) MarkTransactionOutdated(transactionID string) (err error)

MarkTransactionOutdated is marking the transaction by ID as outdated due to a newer commit, moving it to the `outdated` folder, as well cleaning from the current parsers.

func (*Transaction) SaveData

func (t *Transaction) SaveData(prsr interface{}, tID string, commitImplicit bool) error

func (*Transaction) StartTransaction

func (t *Transaction) StartTransaction(version int64) (*models.Transaction, error)

StartTransaction starts a new empty lbctl transaction

type TransactionClient

type TransactionClient interface {
	GetVersion(transactionID string) (int64, error)
	AddParser(transactionID string) error
	CommitParser(transactionID string) error
	DeleteParser(transactionID string) error
	IncrementTransactionVersion(transactionID string) error
	LoadData(filename string) error
	Save(transactionFile, transactionID string) error
	HasParser(transactionID string) bool
	GetParserTransactions() models.Transactions
	GetFailedParserTransactionVersion(transactionID string) (int64, error)
	CheckTransactionOrVersion(transactionID string, version int64) (string, error)
}

type TransactionHandling

type TransactionHandling interface {
	InitTransactionParsers() error
	GetParserTransactions() models.Transactions
	GetFailedParserTransactionVersion(transactionID string) (int64, error)
	IncrementTransactionVersion(transactionID string) error
}

type Transactions

type Transactions interface {
	GetTransactions(status string) (*models.Transactions, error)
	GetTransaction(transactionID string) (*models.Transaction, error)
	StartTransaction(version int64) (*models.Transaction, error)
	DeleteTransaction(transactionID string) error
	CommitTransaction(transactionID string) (*models.Transaction, error)
	MarkTransactionOutdated(transactionID string) (err error)
}

type User added in v3.1.0

type User interface {
	GetUsers(userlist string, transactionID string) (int64, models.Users, error)
	GetUser(username string, userlist string, transactionID string) (int64, *models.User, error)
	DeleteUser(username string, userlist string, transactionID string, version int64) error
	CreateUser(userlist string, data *models.User, transactionID string, version int64) error
	EditUser(username string, userlist string, data *models.User, transactionID string, version int64) error
}

type Userlist added in v3.1.0

type Userlist interface {
	GetUserLists(transactionID string) (int64, models.Userlists, error)
	GetUserList(name string, transactionID string) (int64, *models.Userlist, error)
	DeleteUserList(name string, transactionID string, version int64) error
	CreateUserList(data *models.Userlist, transactionID string, version int64) error
}

type Version

type Version interface {
	GetConfigurationVersion(transactionID string) (int64, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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