configuration

package
v5.1.14 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 35 Imported by: 3

Documentation

Index

Constants

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

View Source
var (
	// General error, unknown cause
	ErrGeneralError = errors.New("unknown error")

	// Errors regarding configurations
	ErrNoParentSpecified      = errors.New("unspecified parent")
	ErrParentDoesNotExist     = errors.New("missing parent")
	ErrBothVersionTransaction = errors.New("both version and transaction specified, specify only one")
	ErrNoVersionTransaction   = errors.New("version or transaction not specified")
	ErrValidationError        = errors.New("validation error")
	ErrVersionMismatch        = errors.New("version mismatch")

	ErrTransactionDoesNotExist  = errors.New("transaction does not exist")
	ErrTransactionAlreadyExists = errors.New("transaction already exist")
	ErrCannotParseTransaction   = errors.New("failed to parse transaction")

	ErrObjectDoesNotExist    = errors.New("missing object")
	ErrObjectAlreadyExists   = errors.New("object already exists")
	ErrObjectIndexOutOfRange = errors.New("index out of range")

	ErrErrorChangingConfig = errors.New("invalid change")
	ErrCannotReadConfFile  = errors.New("failed to read configuration")
	ErrCannotReadVersion   = errors.New("cannot read version")
	ErrCannotSetVersion    = errors.New("cannot set version")

	ErrCannotFindHAProxy = errors.New("failed to find HAProxy")

	ErrClientDoesNotExists = errors.New("client does not exist")
)

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 GetBindByName

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

func GetDgramBindByName

func GetDgramBindByName(name string, logForward string, p parser.Parser) (*models.DgramBind, int)

func GetGroupByName

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

func GetMailerEntryByName

func GetMailerEntryByName(name, section string, p parser.Parser) (*models.MailerEntry, 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, parentType string, parentName string, p parser.Parser) (*models.Server, int)

func GetServerTemplateByPrefix

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

func GetTableByName

func GetTableByName(name string, peerSection string, p parser.Parser) (*models.Table, int)

func GetUserByUsername

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(section parser.Section, name 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(parentType string, parentName 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 ParseDgramBind

func ParseDgramBind(ondiskDgramBind types.DgramBind) *models.DgramBind

func ParseDgramBinds

func ParseDgramBinds(logForward string, p parser.Parser) (models.DgramBinds, error)

func ParseFCGIApp

func ParseFCGIApp(p parser.Parser, name string) (*models.FCGIApp, 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

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

func ParseGroups

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

func ParseHTTPAfterRule

func ParseHTTPAfterRule(f types.Action) (*models.HTTPAfterResponseRule, error)

func ParseHTTPAfterRules

func ParseHTTPAfterRules(t, pName string, p parser.Parser) (models.HTTPAfterResponseRules, 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 ParseHTTPErrorRule

func ParseHTTPErrorRule(f types.Action) *models.HTTPErrorRule

func ParseHTTPErrorRules

func ParseHTTPErrorRules(t, pName string, p parser.Parser) (models.HTTPErrorRules, error)

func ParseHTTPErrorsSection

func ParseHTTPErrorsSection(p parser.Parser, name string) (*models.HTTPErrorsSection, error)

ParseHTTPErrorsSection parses a single http-errors section with a given name.

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 ParseLogForward

func ParseLogForward(p parser.Parser, lf *models.LogForward) error

func ParseLogTarget

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

func ParseLogTargets

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

func ParseMailerEntries

func ParseMailerEntries(mailersSection string, p parser.Parser) (models.MailerEntries, error)

func ParseMailerEntry

func ParseMailerEntry(m types.Mailer) *models.MailerEntry

func ParseMailersSection

func ParseMailersSection(p parser.Parser, ms *models.MailersSection) 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 ParseProgram

func ParseProgram(p parser.Parser, name string) (*models.Program, error)

func ParseResolverSection

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

func ParseRingSection

func ParseRingSection(p parser.Parser, ring *models.Ring) 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(parentType string, parentName 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, error)

func ParseTCPResponseRules

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

func ParseTable

func ParseTable(t types.Table) *models.Table

func ParseTables

func ParseTables(peerSection string, p parser.Parser) (models.Tables, error)

func ParseUser

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

func ParseUsers

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 SerializeDgramBind

func SerializeDgramBind(b models.DgramBind) types.DgramBind

func SerializeFCGIAppSection

func SerializeFCGIAppSection(p parser.Parser, data *models.FCGIApp) (err error)

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

func SerializeGroup(u models.Group) types.Group

func SerializeHTTPAfterRule

func SerializeHTTPAfterRule(f models.HTTPAfterResponseRule) (rule types.Action, err error)

func SerializeHTTPCheck

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

func SerializeHTTPErrorRule

func SerializeHTTPErrorRule(f models.HTTPErrorRule) (rule types.Action, err error)

func SerializeHTTPErrorsSection

func SerializeHTTPErrorsSection(p parser.Parser, data *models.HTTPErrorsSection) error

SerializeProgramSection saves a single http-errors section's data in the configuration.

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 SerializeLogForwardSection

func SerializeLogForwardSection(p parser.Parser, data *models.LogForward) error

func SerializeLogTarget

func SerializeLogTarget(l models.LogTarget) types.Log

func SerializeMailerEntry

func SerializeMailerEntry(me models.MailerEntry) types.Mailer

func SerializeMailersSection

func SerializeMailersSection(p parser.Parser, data *models.MailersSection) error

func SerializeNameserver

func SerializeNameserver(pe models.Nameserver) types.Nameserver

func SerializePeerEntry

func SerializePeerEntry(pe models.PeerEntry) types.Peer

func SerializeProgramSection

func SerializeProgramSection(p parser.Parser, data *models.Program) error

func SerializeResolverSection

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

func SerializeRingSection

func SerializeRingSection(p parser.Parser, data *models.Ring) 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, error)

func SerializeTable

func SerializeTable(t models.Table) types.Table

func SerializeUser

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(parentType string, parentName string, transactionID string) (int64, models.Binds, error)
	GetBind(name string, parentType string, parentName string, transactionID string) (int64, *models.Bind, error)
	DeleteBind(name string, parentType string, parentName string, transactionID string, version int64) error
	CreateBind(parentType string, parentName string, data *models.Bind, transactionID string, version int64) error
	EditBind(name string, parentType string, parentName 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

	// 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
	BackupsNumber             int
	UseValidation             bool
	PersistentTransactions    bool
	ValidateConfigurationFile bool
	MasterWorker              bool
	SkipFailedTransactions    bool
	UseMd5Hash                bool
}

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(err error, reason string) *ConfError

NewConfError constructor for ConfError

func (*ConfError) Err added in v5.1.0

func (e *ConfError) Err() error

func (*ConfError) Error

func (e *ConfError) Error() string

Error implementation for ConfError

func (*ConfError) Is added in v5.1.0

func (e *ConfError) Is(target error) bool

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
	GetDefaultsSections(transactionID string) (int64, models.DefaultsSections, error)
	GetDefaultsSection(name string, transactionID string) (int64, *models.Defaults, error)
	DeleteDefaultsSection(name string, transactionID string, version int64) error
	EditDefaultsSection(name string, data *models.Defaults, transactionID string, version int64) error
	CreateDefaultsSection(data *models.Defaults, transactionID string, version int64) error
}

type DgramBind

type DgramBind interface {
	GetDgramBinds(logForward string, transactionID string) (int64, models.DgramBinds, error)
	GetDgramBind(name string, logForward string, transactionID string) (int64, *models.DgramBind, error)
	DeleteDgramBind(name string, logForward string, transactionID string, version int64) error
	CreateDgramBind(logForward string, data *models.DgramBind, transactionID string, version int64) error
	EditDgramBind(name string, logForward string, data *models.DgramBind, transactionID string, version int64) error
}

type FCGIApp

type FCGIApp interface {
	GetFCGIApplications(transactionID string) (int64, models.FCGIApps, error)
	GetFCGIApplication(name string, transactionID string) (int64, *models.FCGIApp, error)
	DeleteFCGIApplication(name string, transactionID string, version int64) error
	EditFCGIApplication(name string, data *models.FCGIApp, transactionID string, version int64) error
	CreateFCGIApplication(data *models.FCGIApp, 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

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 HTTPAfterResponseRule

type HTTPAfterResponseRule interface {
	GetHTTPAfterResponseRules(parentType, parentName string, transactionID string) (int64, models.HTTPAfterResponseRules, error)
	GetHTTPAfterResponseRule(id int64, parentType, parentName string, transactionID string) (int64, *models.HTTPAfterResponseRule, error)
	DeleteHTTPAfterResponseRule(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateHTTPAfterResponseRule(parentType string, parentName string, data *models.HTTPAfterResponseRule, transactionID string, version int64) error
	EditHTTPAfterResponseRule(id int64, parentType string, parentName string, data *models.HTTPAfterResponseRule, 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 HTTPErrorRule

type HTTPErrorRule interface {
	GetHTTPErrorRules(parentType, parentName string, transactionID string) (int64, models.HTTPErrorRules, error)
	GetHTTPErrorRule(id int64, parentType, parentName string, transactionID string) (int64, *models.HTTPErrorRule, error)
	DeleteHTTPErrorRule(id int64, parentType string, parentName string, transactionID string, version int64) error
	CreateHTTPErrorRule(parentType string, parentName string, data *models.HTTPErrorRule, transactionID string, version int64) error
	EditHTTPErrorRule(id int64, parentType string, parentName string, data *models.HTTPErrorRule, transactionID string, version int64) error
}

type HTTPErrorsSection

type HTTPErrorsSection interface {
	GetHTTPErrorsSections(transactionID string) (int64, models.HTTPErrorsSections, error)
	GetHTTPErrorsSection(name string, transactionID string) (int64, *models.HTTPErrorsSection, error)
	DeleteHTTPErrorsSection(name string, transactionID string, version int64) error
	CreateHTTPErrorsSection(data *models.HTTPErrorsSection, transactionID string, version int64) error
	EditHTTPErrorsSection(name string, data *models.HTTPErrorsSection, 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 LogForward

type LogForward interface {
	GetLogForwards(transactionID string) (int64, models.LogForwards, error)
	GetLogForward(name string, transactionID string) (int64, *models.LogForward, error)
	DeleteLogForward(name string, transactionID string, version int64) error
	CreateLogForward(data *models.LogForward, transactionID string, version int64) error
	EditLogForward(name string, data *models.LogForward, 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 MailerEntry

type MailerEntry interface {
	GetMailerEntries(mailersSection string, transactionID string) (int64, models.MailerEntries, error)
	GetMailerEntry(name string, mailersSection string, transactionID string) (int64, *models.MailerEntry, error)
	DeleteMailerEntry(name string, mailersSection string, transactionID string, version int64) error
	CreateMailerEntry(mailersSection string, data *models.MailerEntry, transactionID string, version int64) error
	EditMailerEntry(name string, mailersSection string, data *models.MailerEntry, transactionID string, version int64) error
}

type MailersSection

type MailersSection interface {
	GetMailersSections(transactionID string) (int64, models.MailersSections, error)
	GetMailersSection(name, transactionID string) (int64, *models.MailersSection, error)
	DeleteMailersSection(name, transactionID string, version int64) error
	CreateMailersSection(data *models.MailersSection, transactionID string, version int64) error
	EditMailersSection(name string, data *models.MailersSection, 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
	EditPeerSection(data *models.PeerSection, transactionID string, version int64) error
}

type Program

type Program interface {
	GetPrograms(transactionID string) (int64, models.Programs, error)
	GetProgram(name string, transactionID string) (int64, *models.Program, error)
	DeleteProgram(name string, transactionID string, version int64) error
	CreateProgram(data *models.Program, transactionID string, version int64) error
	EditProgram(name string, data *models.Program, transactionID string, version int64) error
}

type Raw

type Raw interface {
	GetRawConfigurationWithClusterData(transactionID string, version int64) (int64, int64, string, string, error)
	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 Ring

type Ring interface {
	GetRings(transactionID string) (int64, models.Rings, error)
	GetRing(name string, transactionID string) (int64, *models.Ring, error)
	DeleteRing(name string, transactionID string, version int64) error
	CreateRing(data *models.Ring, transactionID string, version int64) error
	EditRing(name string, data *models.Ring, transactionID string, version int64) error
}

type ScalingParams

type ScalingParams struct {
	SlotsGrowthType string
	BaseSlots       int
	SlotsIncrement  int
}

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

type SectionObject

type SectionObject struct {
	Object  interface{}
	Parser  parser.Parser
	Section parser.Section
	Name    string
	// contains filtered or unexported fields
}

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{}
	Parser  parser.Parser
	Section parser.Section
	Name    string
}

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

func NewParseSection

func NewParseSection(section parser.Section, pName string, p parser.Parser) *SectionParser

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(parentType string, parentName string, transactionID string) (int64, models.Servers, error)
	GetServer(name string, parentType string, parentName string, transactionID string) (int64, *models.Server, error)
	DeleteServer(name string, parentType string, parentName string, transactionID string, version int64) error
	CreateServer(parentType string, parentName string, data *models.Server, transactionID string, version int64) error
	EditServer(name string, parentType string, parentName 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 mapping 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, from 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 Table

type Table interface {
	GetTables(peerSection string, transactionID string) (int64, models.Tables, error)
	GetTable(name string, peerSection string, transactionID string) (int64, *models.Table, error)
	DeleteTable(name string, peerSection string, transactionID string, version int64) error
	CreateTable(peerSection string, data *models.Table, transactionID string, version int64) error
	EditTable(name string, peerSection string, data *models.Table, transactionID string, version int64) error
}

type Transaction

type Transaction struct {
	TransactionClient TransactionClient
	options.ConfigurationOptions
	// 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)
	SetValidateConfigFiles(before, after []string)
}

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)
	SetValidateConfigFiles(before, after []string)
}

type User

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

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