sections

package
v0.1.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package sections provides factory functions for creating HAProxy configuration operations.

This file contains generic CRUD builders that generate Create/Update/Delete operation factories from a single registration, eliminating repetitive boilerplate.

Package sections provides factory functions for creating HAProxy configuration operations.

These factory functions use generic operation types to eliminate repetitive boilerplate while maintaining type safety and compile-time verification.

Package sections provides factory functions for creating HAProxy Enterprise Edition operations.

This file contains factory functions for EE-only sections: - Bot Management Profiles (v3.0+ EE) - Captcha (v3.0+ EE) - WAF Profile (v3.2+ EE) - WAF Global (v3.2+ EE)

Package sections provides factory functions for creating HAProxy configuration operations.

This file contains helper functions to reduce repetition in factory functions.

Package sections provides generic operation types for HAProxy configuration management.

This file contains type-safe generic operation implementations that replace the repetitive per-section operation struct definitions. Each generic type handles a specific "shape" of API operation pattern.

Index

Constants

View Source
const (
	// PriorityEEBotMgmtProfile is the priority for bot management profile operations.
	// These are top-level EE sections, similar to resolvers and caches.
	PriorityEEBotMgmtProfile = 15

	// PriorityEECaptcha is the priority for captcha operations.
	PriorityEECaptcha = 15

	// PriorityEEWAFGlobal is the priority for WAF global operations.
	// WAF global should be created before WAF profiles.
	PriorityEEWAFGlobal = 12

	// PriorityEEWAFProfile is the priority for WAF profile operations.
	PriorityEEWAFProfile = 15
)

Priority constants for Enterprise Edition sections.

View Source
const (
	// Priority 10 - Top-level sections that must exist first.
	PriorityGlobal     = 10
	PriorityDefaults   = 20
	PriorityUserlist   = 10
	PriorityCrtStore   = 10
	PriorityLogForward = 10
	PriorityFCGIApp    = 10
	PriorityProgram    = 10

	// Priority 15 - Container sections.
	PriorityPeer     = 15
	PriorityRing     = 15
	PriorityMailers  = 15
	PriorityUser     = 15
	PriorityCache    = 15
	PriorityResolver = 15

	// Priority 15 - Observability sections (v3.1+ features).
	PriorityLogProfile = 15
	PriorityTraces     = 15

	// Priority 15 - Certificate automation sections (v3.2+ features).
	PriorityAcmeProvider = 15

	// Priority 20-25 - HTTP errors and other mid-level.
	PriorityHTTPErrors = 25

	// Priority 30 - Frontend/Backend sections.
	PriorityFrontend = 30
	PriorityBackend  = 30

	// Priority 40 - Direct children of frontends/backends.
	PriorityBind        = 40
	PriorityServer      = 40
	PriorityMailerEntry = 40
	PriorityPeerEntry   = 40
	PriorityNameserver  = 40

	// Priority 50 - ACLs.
	PriorityACL = 50

	// Priority 60 - Rules (depend on ACLs).
	PriorityRule                 = 60
	PriorityCapture              = 60
	PriorityStickRule            = 60
	PriorityHTTPAfterRule        = 60
	PriorityServerSwitchingRule  = 60
	PriorityBackendSwitchingRule = 60
	PriorityHTTPCheck            = 60
	PriorityLogTarget            = 60
	PriorityTCPCheck             = 60
	PriorityFilter               = 60
	PriorityQUICInitialRule      = 60 // v3.1+ only
)

Priority constants for operation ordering (base priorities, before multiplier). Lower priority = executed first for Creates, executed last for Deletes. Higher priority = executed last for Creates, executed first for Deletes. Note: Effective priority = BasePriority * PriorityMultiplier (+ index adjustment for IndexChildOp).

View Source
const PriorityMultiplier = 1000

PriorityMultiplier is used to create sub-priority space for index-based operations. All operation types multiply their base priority by this value to create effective priorities. For IndexChildOp, the index is added (for creates) or subtracted from 999 (for deletes) to ensure correct ordering within the same base priority level.

Variables

This section is empty.

Functions

func ACLName

func ACLName(a *models.ACL) string

ACLName extracts the name from an ACL model.

func AcmeProviderName

func AcmeProviderName(a *models.AcmeProvider) string

AcmeProviderName extracts the name from an AcmeProvider model.

func BackendName

func BackendName(b *models.Backend) string

BackendName extracts the name from a Backend model.

func BindName

func BindName(b *models.Bind) string

BindName extracts the name from a Bind model.

func BotMgmtProfileName

func BotMgmtProfileName(p *v32ee.BotmgmtProfile) string

BotMgmtProfileName extracts the name from a BotmgmtProfile model.

func CacheName

func CacheName(c *models.Cache) string

CacheName extracts the name from a Cache model.

func CaptchaEEName

func CaptchaEEName(c *v32ee.Captcha) string

CaptchaEEName extracts the name from a Captcha model. Named CaptchaEEName to avoid conflict with CaptchaName in helpers.go.

func CrtStoreName

func CrtStoreName(c *models.CrtStore) string

CrtStoreName extracts the name from a CrtStore model.

func DefaultsName

func DefaultsName(d *models.Defaults) string

DefaultsName extracts the name from a Defaults model.

func DescribeACL

func DescribeACL(op OperationType, aclName, parentType, parentName string) func() string

DescribeACL returns a description function for ACL operations with ACL name.

func DescribeContainerChild

func DescribeContainerChild(op OperationType, childType, childName, containerType, containerName string) func() string

DescribeContainerChild returns a description function for container child operations.

func DescribeIndexChild

func DescribeIndexChild(op OperationType, childType string, index int, parentType, parentName string) func() string

DescribeIndexChild returns a description function for indexed child operations.

func DescribeNamedChild

func DescribeNamedChild(op OperationType, childType, childName, parentType, parentName string) func() string

DescribeNamedChild returns a description function for named child operations.

func DescribeSingleton

func DescribeSingleton(op OperationType, section string) func() string

DescribeSingleton returns a description function for singleton operations.

func DescribeTopLevel

func DescribeTopLevel(op OperationType, section, name string) func() string

DescribeTopLevel returns a description function for top-level operations.

func FCGIAppName

func FCGIAppName(f *models.FCGIApp) string

FCGIAppName extracts the name from an FCGIApp model.

func FilterType

func FilterType(f *models.Filter) string

FilterType extracts the type from a Filter model (for description purposes).

func FrontendName

func FrontendName(f *models.Frontend) string

FrontendName extracts the name from a Frontend model.

func HTTPErrorsSectionName

func HTTPErrorsSectionName(h *models.HTTPErrorsSection) string

HTTPErrorsSectionName extracts the name from an HTTPErrorsSection model.

func Identity

func Identity[T any](model T) T

Identity returns the model as-is. Used as transform function for create/update operations.

func LogForwardName

func LogForwardName(l *models.LogForward) string

LogForwardName extracts the name from a LogForward model.

func LogProfileName

func LogProfileName(l *models.LogProfile) string

LogProfileName extracts the name from a LogProfile model.

func MailerEntryName

func MailerEntryName(m *models.MailerEntry) string

MailerEntryName extracts the name from a MailerEntry model.

func MailersSectionName

func MailersSectionName(m *models.MailersSection) string

MailersSectionName extracts the name from a MailersSection model.

func NameserverName

func NameserverName(n *models.Nameserver) string

NameserverName extracts the name from a Nameserver model.

func Nil

func Nil[T any](_ T) T

Nil returns the zero value of T. Used as transform function for delete operations where the model isn't needed.

func PeerEntryName

func PeerEntryName(p *models.PeerEntry) string

PeerEntryName extracts the name from a PeerEntry model.

func PeerSectionName

func PeerSectionName(p *models.PeerSection) string

PeerSectionName extracts the name from a PeerSection model.

func ProgramName

func ProgramName(p *models.Program) string

ProgramName extracts the name from a Program model.

func ResolverName

func ResolverName(r *models.Resolver) string

ResolverName extracts the name from a Resolver model.

func RingName

func RingName(r *models.Ring) string

RingName extracts the name from a Ring model.

func ServerName

func ServerName(s *models.Server) string

ServerName extracts the name from a Server model.

func ServerTemplateName

func ServerTemplateName(s *models.ServerTemplate) string

ServerTemplateName extracts the prefix from a ServerTemplate model.

func UserName

func UserName(u *models.User) string

UserName extracts the name from a User model.

func UserlistName

func UserlistName(u *models.Userlist) string

UserlistName extracts the name from a Userlist model.

func WAFProfileName

func WAFProfileName(p *v32ee.WafProfile) string

WAFProfileName extracts the name from a WafProfile model.

Types

type ContainerChildOp

type ContainerChildOp[TModel any, TAPI any] struct {
	// contains filtered or unexported fields
}

ContainerChildOp handles operations for container child resources like user, mailer_entry. These resources belong to a container (userlist, mailers) where the parent is passed via params.

func NewContainerChildOp

func NewContainerChildOp[TModel any, TAPI any](
	opType OperationType,
	sectionName string,
	priority int,
	containerName string,
	model TModel,
	transformFn func(TModel) TAPI,
	nameFn func(TModel) string,
	executeFn ExecuteContainerChildFunc[TAPI],
	describeFn func() string,
) *ContainerChildOp[TModel, TAPI]

NewContainerChildOp creates a new container child operation.

func (*ContainerChildOp[TModel, TAPI]) Describe

func (op *ContainerChildOp[TModel, TAPI]) Describe() string

func (*ContainerChildOp[TModel, TAPI]) Execute

func (op *ContainerChildOp[TModel, TAPI]) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

func (*ContainerChildOp[TModel, TAPI]) Priority

func (op *ContainerChildOp[TModel, TAPI]) Priority() int

Priority returns the effective priority. Uses multiplier for compatibility with IndexChildOp.

func (*ContainerChildOp[TModel, TAPI]) Section

func (op *ContainerChildOp[TModel, TAPI]) Section() string

func (*ContainerChildOp[TModel, TAPI]) Type

func (op *ContainerChildOp[TModel, TAPI]) Type() OperationType

type ExecuteContainerChildFunc

type ExecuteContainerChildFunc[TAPI any] func(
	ctx context.Context,
	c *client.DataplaneClient,
	txID string,
	containerName string,
	childName string,
	model TAPI,
) error

ExecuteContainerChildFunc is the function signature for container child operations. Used by user, mailer_entry, peer_entry, nameserver where parent is in params.

type ExecuteIndexChildFunc

type ExecuteIndexChildFunc[TAPI any] func(
	ctx context.Context,
	c *client.DataplaneClient,
	txID string,
	parent string,
	index int,
	model TAPI,
) error

ExecuteIndexChildFunc is the function signature for index-based child operations. Used by ACL, HTTP rules, TCP rules, filters, etc.

type ExecuteNameChildFunc

type ExecuteNameChildFunc[TAPI any] func(
	ctx context.Context,
	c *client.DataplaneClient,
	txID string,
	parent string,
	childName string,
	model TAPI,
) error

ExecuteNameChildFunc is the function signature for name-based child operations. Used by bind, server_template.

type ExecuteSingletonFunc

type ExecuteSingletonFunc[TAPI any] func(
	ctx context.Context,
	c *client.DataplaneClient,
	txID string,
	model TAPI,
) error

ExecuteSingletonFunc is the function signature for singleton operations. Used by global section which only supports update.

type ExecuteTopLevelFunc

type ExecuteTopLevelFunc[TAPI any] func(
	ctx context.Context,
	c *client.DataplaneClient,
	txID string,
	model TAPI,
	name string,
) error

ExecuteTopLevelFunc is the function signature for top-level resource operations. Used by backend, frontend, defaults, cache, etc.

type IndexChildCRUD

type IndexChildCRUD[T any] struct {
	Create func(parentName string, index int, model T) Operation
	Update func(parentName string, index int, model T) Operation
	Delete func(parentName string, index int, model T) Operation
}

IndexChildCRUD holds pre-built Create/Update/Delete factory functions for an index-based child resource.

func NewIndexChildCRUD

func NewIndexChildCRUD[T any](
	section, childType, parentType string,
	priority int,
	createExec, updateExec, deleteExec ExecuteIndexChildFunc[T],
) IndexChildCRUD[T]

NewIndexChildCRUD creates a CRUD builder for an index-based child resource (ACL, HTTP rules, etc.). The childType is used in operation descriptions (e.g. "ACL", "HTTP request rule").

type IndexChildOp

type IndexChildOp[TModel any, TAPI any] struct {
	// contains filtered or unexported fields
}

IndexChildOp handles operations for index-based child resources like ACL, HTTP rules, TCP rules. These resources belong to a parent (frontend/backend) and are identified by index position.

func NewIndexChildOp

func NewIndexChildOp[TModel any, TAPI any](
	opType OperationType,
	sectionName string,
	priority int,
	parentName string,
	index int,
	model TModel,
	transformFn func(TModel) TAPI,
	executeFn ExecuteIndexChildFunc[TAPI],
	describeFn func() string,
) *IndexChildOp[TModel, TAPI]

NewIndexChildOp creates a new index-based child operation.

func (*IndexChildOp[TModel, TAPI]) Describe

func (op *IndexChildOp[TModel, TAPI]) Describe() string

func (*IndexChildOp[TModel, TAPI]) Execute

func (op *IndexChildOp[TModel, TAPI]) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

func (*IndexChildOp[TModel, TAPI]) Priority

func (op *IndexChildOp[TModel, TAPI]) Priority() int

Priority returns the effective priority incorporating the index for correct ordering. For creates: lower indexes run first (index 0 before index 1). For deletes: higher indexes run first (index 1 before index 0). This ensures index-based operations execute in the correct order even with parallel execution.

func (*IndexChildOp[TModel, TAPI]) Section

func (op *IndexChildOp[TModel, TAPI]) Section() string

func (*IndexChildOp[TModel, TAPI]) Type

func (op *IndexChildOp[TModel, TAPI]) Type() OperationType

type NameChildCRUD

type NameChildCRUD[T any] struct {
	Create func(parentName string, model T) Operation
	Update func(parentName string, model T) Operation
	Delete func(parentName string, model T) Operation
}

NameChildCRUD holds pre-built Create/Update/Delete factory functions for a name-based child resource.

func NewNameChildCRUD

func NewNameChildCRUD[T any](
	section, childType, parentType string,
	priority int,
	nameFn func(T) string,
	createExec, updateExec, deleteExec ExecuteNameChildFunc[T],
) NameChildCRUD[T]

NewNameChildCRUD creates a CRUD builder for a name-based child resource (bind, server template). The childType and parentType are used in operation descriptions.

type NameChildOp

type NameChildOp[TModel any, TAPI any] struct {
	// contains filtered or unexported fields
}

NameChildOp handles operations for name-based child resources like bind, server_template. These resources belong to a parent and are identified by name (not index).

func NewNameChildOp

func NewNameChildOp[TModel any, TAPI any](
	opType OperationType,
	sectionName string,
	priority int,
	parentName string,
	childName string,
	model TModel,
	transformFn func(TModel) TAPI,
	executeFn ExecuteNameChildFunc[TAPI],
	describeFn func() string,
) *NameChildOp[TModel, TAPI]

NewNameChildOp creates a new name-based child operation.

func (*NameChildOp[TModel, TAPI]) Describe

func (op *NameChildOp[TModel, TAPI]) Describe() string

func (*NameChildOp[TModel, TAPI]) Execute

func (op *NameChildOp[TModel, TAPI]) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

func (*NameChildOp[TModel, TAPI]) Priority

func (op *NameChildOp[TModel, TAPI]) Priority() int

Priority returns the effective priority. Uses multiplier for compatibility with IndexChildOp.

func (*NameChildOp[TModel, TAPI]) Section

func (op *NameChildOp[TModel, TAPI]) Section() string

func (*NameChildOp[TModel, TAPI]) Type

func (op *NameChildOp[TModel, TAPI]) Type() OperationType

type Operation

type Operation interface {
	// Type returns the operation type (Create, Update, Delete)
	Type() OperationType

	// Section returns the configuration section this operation affects
	Section() string

	// Priority returns the execution priority (lower = first for creates, higher = first for deletes)
	Priority() int

	// Execute performs the operation via the Dataplane API
	Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

	// Describe returns a human-readable description of the operation
	Describe() string
}

Operation defines the interface for all HAProxy configuration operations. This interface is implemented by all generic operation types (TopLevelOp, IndexChildOp, etc.)

func NewACLBackendCreate

func NewACLBackendCreate(backendName string, acl *models.ACL, index int) Operation

NewACLBackendCreate creates an operation to create an ACL in a backend.

func NewACLBackendDelete

func NewACLBackendDelete(backendName string, acl *models.ACL, index int) Operation

NewACLBackendDelete creates an operation to delete an ACL from a backend.

func NewACLBackendUpdate

func NewACLBackendUpdate(backendName string, acl *models.ACL, index int) Operation

NewACLBackendUpdate creates an operation to update an ACL in a backend.

func NewACLFrontendCreate

func NewACLFrontendCreate(frontendName string, acl *models.ACL, index int) Operation

NewACLFrontendCreate creates an operation to create an ACL in a frontend.

func NewACLFrontendDelete

func NewACLFrontendDelete(frontendName string, acl *models.ACL, index int) Operation

NewACLFrontendDelete creates an operation to delete an ACL from a frontend.

func NewACLFrontendUpdate

func NewACLFrontendUpdate(frontendName string, acl *models.ACL, index int) Operation

NewACLFrontendUpdate creates an operation to update an ACL in a frontend.

func NewAcmeProviderCreate

func NewAcmeProviderCreate(acmeProvider *models.AcmeProvider) Operation

NewAcmeProviderCreate creates an operation to create an acme section.

func NewAcmeProviderDelete

func NewAcmeProviderDelete(acmeProvider *models.AcmeProvider) Operation

NewAcmeProviderDelete creates an operation to delete an acme section.

func NewAcmeProviderUpdate

func NewAcmeProviderUpdate(acmeProvider *models.AcmeProvider) Operation

NewAcmeProviderUpdate creates an operation to update an acme section.

func NewBackendCreate

func NewBackendCreate(backend *models.Backend) Operation

NewBackendCreate creates an operation to create a backend.

func NewBackendDelete

func NewBackendDelete(backend *models.Backend) Operation

NewBackendDelete creates an operation to delete a backend.

func NewBackendSwitchingRuleFrontendCreate

func NewBackendSwitchingRuleFrontendCreate(frontendName string, rule *models.BackendSwitchingRule, index int) Operation

NewBackendSwitchingRuleFrontendCreate creates an operation to create a backend switching rule.

func NewBackendSwitchingRuleFrontendDelete

func NewBackendSwitchingRuleFrontendDelete(frontendName string, rule *models.BackendSwitchingRule, index int) Operation

NewBackendSwitchingRuleFrontendDelete creates an operation to delete a backend switching rule.

func NewBackendSwitchingRuleFrontendUpdate

func NewBackendSwitchingRuleFrontendUpdate(frontendName string, rule *models.BackendSwitchingRule, index int) Operation

NewBackendSwitchingRuleFrontendUpdate creates an operation to update a backend switching rule.

func NewBackendUpdate

func NewBackendUpdate(backend *models.Backend) Operation

NewBackendUpdate creates an operation to update a backend.

func NewBindFrontendCreate

func NewBindFrontendCreate(frontendName, bindName string, bind *models.Bind) Operation

NewBindFrontendCreate creates an operation to create a bind in a frontend.

func NewBindFrontendDelete

func NewBindFrontendDelete(frontendName, bindName string, bind *models.Bind) Operation

NewBindFrontendDelete creates an operation to delete a bind from a frontend.

func NewBindFrontendUpdate

func NewBindFrontendUpdate(frontendName, bindName string, bind *models.Bind) Operation

NewBindFrontendUpdate creates an operation to update a bind in a frontend.

func NewBotMgmtProfileCreate

func NewBotMgmtProfileCreate(profile *v32ee.BotmgmtProfile) Operation

NewBotMgmtProfileCreate creates an operation to create a bot management profile. Bot management profiles are only available in HAProxy Enterprise Edition.

func NewBotMgmtProfileDelete

func NewBotMgmtProfileDelete(profile *v32ee.BotmgmtProfile) Operation

NewBotMgmtProfileDelete creates an operation to delete a bot management profile.

func NewBotMgmtProfileUpdate

func NewBotMgmtProfileUpdate(profile *v32ee.BotmgmtProfile) Operation

NewBotMgmtProfileUpdate creates an operation to update a bot management profile.

func NewCacheCreate

func NewCacheCreate(cache *models.Cache) Operation

NewCacheCreate creates an operation to create a cache section.

func NewCacheDelete

func NewCacheDelete(cache *models.Cache) Operation

NewCacheDelete creates an operation to delete a cache section.

func NewCacheUpdate

func NewCacheUpdate(cache *models.Cache) Operation

NewCacheUpdate creates an operation to update a cache section.

func NewCaptchaCreate

func NewCaptchaCreate(captcha *v32ee.Captcha) Operation

NewCaptchaCreate creates an operation to create a captcha section. Captcha is only available in HAProxy Enterprise Edition.

func NewCaptchaDelete

func NewCaptchaDelete(captcha *v32ee.Captcha) Operation

NewCaptchaDelete creates an operation to delete a captcha section.

func NewCaptchaUpdate

func NewCaptchaUpdate(captcha *v32ee.Captcha) Operation

NewCaptchaUpdate creates an operation to update a captcha section.

func NewCaptureFrontendCreate

func NewCaptureFrontendCreate(frontendName string, capture *models.Capture, index int) Operation

NewCaptureFrontendCreate creates an operation to create a capture declaration in a frontend.

func NewCaptureFrontendDelete

func NewCaptureFrontendDelete(frontendName string, capture *models.Capture, index int) Operation

NewCaptureFrontendDelete creates an operation to delete a capture declaration from a frontend.

func NewCaptureFrontendUpdate

func NewCaptureFrontendUpdate(frontendName string, capture *models.Capture, index int) Operation

NewCaptureFrontendUpdate creates an operation to update a capture declaration in a frontend.

func NewCrtStoreCreate

func NewCrtStoreCreate(crtStore *models.CrtStore) Operation

NewCrtStoreCreate creates an operation to create a crt-store section.

func NewCrtStoreDelete

func NewCrtStoreDelete(crtStore *models.CrtStore) Operation

NewCrtStoreDelete creates an operation to delete a crt-store section.

func NewCrtStoreUpdate

func NewCrtStoreUpdate(crtStore *models.CrtStore) Operation

NewCrtStoreUpdate creates an operation to update a crt-store section.

func NewDefaultsCreate

func NewDefaultsCreate(defaults *models.Defaults) Operation

NewDefaultsCreate creates an operation to create a defaults section.

func NewDefaultsDelete

func NewDefaultsDelete(defaults *models.Defaults) Operation

NewDefaultsDelete creates an operation to delete a defaults section.

func NewDefaultsUpdate

func NewDefaultsUpdate(defaults *models.Defaults) Operation

NewDefaultsUpdate creates an operation to update a defaults section.

func NewFCGIAppCreate

func NewFCGIAppCreate(fcgiApp *models.FCGIApp) Operation

NewFCGIAppCreate creates an operation to create a fcgi-app section.

func NewFCGIAppDelete

func NewFCGIAppDelete(fcgiApp *models.FCGIApp) Operation

NewFCGIAppDelete creates an operation to delete a fcgi-app section.

func NewFCGIAppUpdate

func NewFCGIAppUpdate(fcgiApp *models.FCGIApp) Operation

NewFCGIAppUpdate creates an operation to update a fcgi-app section.

func NewFilterBackendCreate

func NewFilterBackendCreate(backendName string, filter *models.Filter, index int) Operation

NewFilterBackendCreate creates an operation to create a filter in a backend.

func NewFilterBackendDelete

func NewFilterBackendDelete(backendName string, filter *models.Filter, index int) Operation

NewFilterBackendDelete creates an operation to delete a filter from a backend.

func NewFilterBackendUpdate

func NewFilterBackendUpdate(backendName string, filter *models.Filter, index int) Operation

NewFilterBackendUpdate creates an operation to update a filter in a backend.

func NewFilterFrontendCreate

func NewFilterFrontendCreate(frontendName string, filter *models.Filter, index int) Operation

NewFilterFrontendCreate creates an operation to create a filter in a frontend.

func NewFilterFrontendDelete

func NewFilterFrontendDelete(frontendName string, filter *models.Filter, index int) Operation

NewFilterFrontendDelete creates an operation to delete a filter from a frontend.

func NewFilterFrontendUpdate

func NewFilterFrontendUpdate(frontendName string, filter *models.Filter, index int) Operation

NewFilterFrontendUpdate creates an operation to update a filter in a frontend.

func NewFrontendCreate

func NewFrontendCreate(frontend *models.Frontend) Operation

NewFrontendCreate creates an operation to create a frontend.

func NewFrontendDelete

func NewFrontendDelete(frontend *models.Frontend) Operation

NewFrontendDelete creates an operation to delete a frontend.

func NewFrontendUpdate

func NewFrontendUpdate(frontend *models.Frontend) Operation

NewFrontendUpdate creates an operation to update a frontend.

func NewGlobalUpdate

func NewGlobalUpdate(global *models.Global) Operation

NewGlobalUpdate creates an operation to update the global section.

func NewHTTPAfterResponseRuleBackendCreate

func NewHTTPAfterResponseRuleBackendCreate(backendName string, rule *models.HTTPAfterResponseRule, index int) Operation

NewHTTPAfterResponseRuleBackendCreate creates an operation to create an HTTP after-response rule in a backend.

func NewHTTPAfterResponseRuleBackendDelete

func NewHTTPAfterResponseRuleBackendDelete(backendName string, rule *models.HTTPAfterResponseRule, index int) Operation

NewHTTPAfterResponseRuleBackendDelete creates an operation to delete an HTTP after-response rule from a backend.

func NewHTTPAfterResponseRuleBackendUpdate

func NewHTTPAfterResponseRuleBackendUpdate(backendName string, rule *models.HTTPAfterResponseRule, index int) Operation

NewHTTPAfterResponseRuleBackendUpdate creates an operation to update an HTTP after-response rule in a backend.

func NewHTTPCheckBackendCreate

func NewHTTPCheckBackendCreate(backendName string, check *models.HTTPCheck, index int) Operation

NewHTTPCheckBackendCreate creates an operation to create an HTTP check in a backend.

func NewHTTPCheckBackendDelete

func NewHTTPCheckBackendDelete(backendName string, check *models.HTTPCheck, index int) Operation

NewHTTPCheckBackendDelete creates an operation to delete an HTTP check from a backend.

func NewHTTPCheckBackendUpdate

func NewHTTPCheckBackendUpdate(backendName string, check *models.HTTPCheck, index int) Operation

NewHTTPCheckBackendUpdate creates an operation to update an HTTP check in a backend.

func NewHTTPErrorsSectionCreate

func NewHTTPErrorsSectionCreate(section *models.HTTPErrorsSection) Operation

NewHTTPErrorsSectionCreate creates an operation to create an http-errors section.

func NewHTTPErrorsSectionDelete

func NewHTTPErrorsSectionDelete(section *models.HTTPErrorsSection) Operation

NewHTTPErrorsSectionDelete creates an operation to delete an http-errors section.

func NewHTTPErrorsSectionUpdate

func NewHTTPErrorsSectionUpdate(section *models.HTTPErrorsSection) Operation

NewHTTPErrorsSectionUpdate creates an operation to update an http-errors section.

func NewHTTPRequestRuleBackendCreate

func NewHTTPRequestRuleBackendCreate(backendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleBackendCreate creates an operation to create an HTTP request rule in a backend.

func NewHTTPRequestRuleBackendDelete

func NewHTTPRequestRuleBackendDelete(backendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleBackendDelete creates an operation to delete an HTTP request rule from a backend.

func NewHTTPRequestRuleBackendUpdate

func NewHTTPRequestRuleBackendUpdate(backendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleBackendUpdate creates an operation to update an HTTP request rule in a backend.

func NewHTTPRequestRuleFrontendCreate

func NewHTTPRequestRuleFrontendCreate(frontendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleFrontendCreate creates an operation to create an HTTP request rule in a frontend.

func NewHTTPRequestRuleFrontendDelete

func NewHTTPRequestRuleFrontendDelete(frontendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleFrontendDelete creates an operation to delete an HTTP request rule from a frontend.

func NewHTTPRequestRuleFrontendUpdate

func NewHTTPRequestRuleFrontendUpdate(frontendName string, rule *models.HTTPRequestRule, index int) Operation

NewHTTPRequestRuleFrontendUpdate creates an operation to update an HTTP request rule in a frontend.

func NewHTTPResponseRuleBackendCreate

func NewHTTPResponseRuleBackendCreate(backendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleBackendCreate creates an operation to create an HTTP response rule in a backend.

func NewHTTPResponseRuleBackendDelete

func NewHTTPResponseRuleBackendDelete(backendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleBackendDelete creates an operation to delete an HTTP response rule from a backend.

func NewHTTPResponseRuleBackendUpdate

func NewHTTPResponseRuleBackendUpdate(backendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleBackendUpdate creates an operation to update an HTTP response rule in a backend.

func NewHTTPResponseRuleFrontendCreate

func NewHTTPResponseRuleFrontendCreate(frontendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleFrontendCreate creates an operation to create an HTTP response rule in a frontend.

func NewHTTPResponseRuleFrontendDelete

func NewHTTPResponseRuleFrontendDelete(frontendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleFrontendDelete creates an operation to delete an HTTP response rule from a frontend.

func NewHTTPResponseRuleFrontendUpdate

func NewHTTPResponseRuleFrontendUpdate(frontendName string, rule *models.HTTPResponseRule, index int) Operation

NewHTTPResponseRuleFrontendUpdate creates an operation to update an HTTP response rule in a frontend.

func NewLogForwardCreate

func NewLogForwardCreate(logForward *models.LogForward) Operation

NewLogForwardCreate creates an operation to create a log-forward section.

func NewLogForwardDelete

func NewLogForwardDelete(logForward *models.LogForward) Operation

NewLogForwardDelete creates an operation to delete a log-forward section.

func NewLogForwardUpdate

func NewLogForwardUpdate(logForward *models.LogForward) Operation

NewLogForwardUpdate creates an operation to update a log-forward section.

func NewLogProfileCreate

func NewLogProfileCreate(logProfile *models.LogProfile) Operation

NewLogProfileCreate creates an operation to create a log-profile section.

func NewLogProfileDelete

func NewLogProfileDelete(logProfile *models.LogProfile) Operation

NewLogProfileDelete creates an operation to delete a log-profile section.

func NewLogProfileUpdate

func NewLogProfileUpdate(logProfile *models.LogProfile) Operation

NewLogProfileUpdate creates an operation to update a log-profile section.

func NewLogTargetBackendCreate

func NewLogTargetBackendCreate(backendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetBackendCreate creates an operation to create a log target in a backend.

func NewLogTargetBackendDelete

func NewLogTargetBackendDelete(backendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetBackendDelete creates an operation to delete a log target from a backend.

func NewLogTargetBackendUpdate

func NewLogTargetBackendUpdate(backendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetBackendUpdate creates an operation to update a log target in a backend.

func NewLogTargetFrontendCreate

func NewLogTargetFrontendCreate(frontendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetFrontendCreate creates an operation to create a log target in a frontend.

func NewLogTargetFrontendDelete

func NewLogTargetFrontendDelete(frontendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetFrontendDelete creates an operation to delete a log target from a frontend.

func NewLogTargetFrontendUpdate

func NewLogTargetFrontendUpdate(frontendName string, logTarget *models.LogTarget, index int) Operation

NewLogTargetFrontendUpdate creates an operation to update a log target in a frontend.

func NewMailerEntryCreate

func NewMailerEntryCreate(mailersName string, entry *models.MailerEntry) Operation

NewMailerEntryCreate creates an operation to create a mailer entry.

func NewMailerEntryDelete

func NewMailerEntryDelete(mailersName string, entry *models.MailerEntry) Operation

NewMailerEntryDelete creates an operation to delete a mailer entry.

func NewMailerEntryUpdate

func NewMailerEntryUpdate(mailersName string, entry *models.MailerEntry) Operation

NewMailerEntryUpdate creates an operation to update a mailer entry.

func NewMailersSectionCreate

func NewMailersSectionCreate(section *models.MailersSection) Operation

NewMailersSectionCreate creates an operation to create a mailers section.

func NewMailersSectionDelete

func NewMailersSectionDelete(section *models.MailersSection) Operation

NewMailersSectionDelete creates an operation to delete a mailers section.

func NewMailersSectionUpdate

func NewMailersSectionUpdate(section *models.MailersSection) Operation

NewMailersSectionUpdate creates an operation to update a mailers section.

func NewNameserverCreate

func NewNameserverCreate(resolverName string, nameserver *models.Nameserver) Operation

NewNameserverCreate creates an operation to create a nameserver in a resolver.

func NewNameserverDelete

func NewNameserverDelete(resolverName string, nameserver *models.Nameserver) Operation

NewNameserverDelete creates an operation to delete a nameserver from a resolver.

func NewNameserverUpdate

func NewNameserverUpdate(resolverName string, nameserver *models.Nameserver) Operation

NewNameserverUpdate creates an operation to update a nameserver in a resolver.

func NewPeerEntryCreate

func NewPeerEntryCreate(peerSectionName string, entry *models.PeerEntry) Operation

NewPeerEntryCreate creates an operation to create a peer entry.

func NewPeerEntryDelete

func NewPeerEntryDelete(peerSectionName string, entry *models.PeerEntry) Operation

NewPeerEntryDelete creates an operation to delete a peer entry.

func NewPeerEntryUpdate

func NewPeerEntryUpdate(peerSectionName string, entry *models.PeerEntry) Operation

NewPeerEntryUpdate creates an operation to update a peer entry.

func NewPeerSectionCreate

func NewPeerSectionCreate(section *models.PeerSection) Operation

NewPeerSectionCreate creates an operation to create a peer section.

func NewPeerSectionDelete

func NewPeerSectionDelete(section *models.PeerSection) Operation

NewPeerSectionDelete creates an operation to delete a peer section.

func NewPeerSectionUpdate

func NewPeerSectionUpdate(section *models.PeerSection) Operation

NewPeerSectionUpdate creates an operation to update a peer section. Note: This operation will fail at execution time as the HAProxy Dataplane API does not support updating peer sections directly.

func NewProgramCreate

func NewProgramCreate(program *models.Program) Operation

NewProgramCreate creates an operation to create a program section.

func NewProgramDelete

func NewProgramDelete(program *models.Program) Operation

NewProgramDelete creates an operation to delete a program section.

func NewProgramUpdate

func NewProgramUpdate(program *models.Program) Operation

NewProgramUpdate creates an operation to update a program section.

func NewQUICInitialRuleDefaultsCreate

func NewQUICInitialRuleDefaultsCreate(defaultsName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleDefaultsCreate creates an operation to create a QUIC initial rule in defaults. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewQUICInitialRuleDefaultsDelete

func NewQUICInitialRuleDefaultsDelete(defaultsName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleDefaultsDelete creates an operation to delete a QUIC initial rule from defaults. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewQUICInitialRuleDefaultsUpdate

func NewQUICInitialRuleDefaultsUpdate(defaultsName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleDefaultsUpdate creates an operation to update a QUIC initial rule in defaults. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewQUICInitialRuleFrontendCreate

func NewQUICInitialRuleFrontendCreate(frontendName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleFrontendCreate creates an operation to create a QUIC initial rule in a frontend. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewQUICInitialRuleFrontendDelete

func NewQUICInitialRuleFrontendDelete(frontendName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleFrontendDelete creates an operation to delete a QUIC initial rule from a frontend. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewQUICInitialRuleFrontendUpdate

func NewQUICInitialRuleFrontendUpdate(frontendName string, rule *models.QUICInitialRule, index int) Operation

NewQUICInitialRuleFrontendUpdate creates an operation to update a QUIC initial rule in a frontend. QUIC initial rules are only available in HAProxy DataPlane API v3.1+.

func NewResolverCreate

func NewResolverCreate(resolver *models.Resolver) Operation

NewResolverCreate creates an operation to create a resolver section.

func NewResolverDelete

func NewResolverDelete(resolver *models.Resolver) Operation

NewResolverDelete creates an operation to delete a resolver section.

func NewResolverUpdate

func NewResolverUpdate(resolver *models.Resolver) Operation

NewResolverUpdate creates an operation to update a resolver section.

func NewRingCreate

func NewRingCreate(ring *models.Ring) Operation

NewRingCreate creates an operation to create a ring section.

func NewRingDelete

func NewRingDelete(ring *models.Ring) Operation

NewRingDelete creates an operation to delete a ring section.

func NewRingUpdate

func NewRingUpdate(ring *models.Ring) Operation

NewRingUpdate creates an operation to update a ring section.

func NewServerCreate

func NewServerCreate(backendName string, server *models.Server) Operation

NewServerCreate creates an operation to create a server in a backend.

func NewServerDelete

func NewServerDelete(backendName string, server *models.Server) Operation

NewServerDelete creates an operation to delete a server from a backend.

func NewServerSwitchingRuleBackendCreate

func NewServerSwitchingRuleBackendCreate(backendName string, rule *models.ServerSwitchingRule, index int) Operation

NewServerSwitchingRuleBackendCreate creates an operation to create a server switching rule in a backend.

func NewServerSwitchingRuleBackendDelete

func NewServerSwitchingRuleBackendDelete(backendName string, rule *models.ServerSwitchingRule, index int) Operation

NewServerSwitchingRuleBackendDelete creates an operation to delete a server switching rule from a backend.

func NewServerSwitchingRuleBackendUpdate

func NewServerSwitchingRuleBackendUpdate(backendName string, rule *models.ServerSwitchingRule, index int) Operation

NewServerSwitchingRuleBackendUpdate creates an operation to update a server switching rule in a backend.

func NewServerTemplateCreate

func NewServerTemplateCreate(backendName string, serverTemplate *models.ServerTemplate) Operation

NewServerTemplateCreate creates an operation to create a server template in a backend.

func NewServerTemplateDelete

func NewServerTemplateDelete(backendName string, serverTemplate *models.ServerTemplate) Operation

NewServerTemplateDelete creates an operation to delete a server template from a backend.

func NewServerTemplateUpdate

func NewServerTemplateUpdate(backendName string, serverTemplate *models.ServerTemplate) Operation

NewServerTemplateUpdate creates an operation to update a server template in a backend.

func NewServerUpdate

func NewServerUpdate(backendName string, server *models.Server) Operation

NewServerUpdate creates an operation to update a server in a backend. Unlike other operations, server updates use a specialized type that tracks reload status for runtime-eligible operations.

func NewStickRuleBackendCreate

func NewStickRuleBackendCreate(backendName string, rule *models.StickRule, index int) Operation

NewStickRuleBackendCreate creates an operation to create a stick rule in a backend.

func NewStickRuleBackendDelete

func NewStickRuleBackendDelete(backendName string, rule *models.StickRule, index int) Operation

NewStickRuleBackendDelete creates an operation to delete a stick rule from a backend.

func NewStickRuleBackendUpdate

func NewStickRuleBackendUpdate(backendName string, rule *models.StickRule, index int) Operation

NewStickRuleBackendUpdate creates an operation to update a stick rule in a backend.

func NewTCPCheckBackendCreate

func NewTCPCheckBackendCreate(backendName string, check *models.TCPCheck, index int) Operation

NewTCPCheckBackendCreate creates an operation to create a TCP check in a backend.

func NewTCPCheckBackendDelete

func NewTCPCheckBackendDelete(backendName string, check *models.TCPCheck, index int) Operation

NewTCPCheckBackendDelete creates an operation to delete a TCP check from a backend.

func NewTCPCheckBackendUpdate

func NewTCPCheckBackendUpdate(backendName string, check *models.TCPCheck, index int) Operation

NewTCPCheckBackendUpdate creates an operation to update a TCP check in a backend.

func NewTCPRequestRuleBackendCreate

func NewTCPRequestRuleBackendCreate(backendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleBackendCreate creates an operation to create a TCP request rule in a backend.

func NewTCPRequestRuleBackendDelete

func NewTCPRequestRuleBackendDelete(backendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleBackendDelete creates an operation to delete a TCP request rule from a backend.

func NewTCPRequestRuleBackendUpdate

func NewTCPRequestRuleBackendUpdate(backendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleBackendUpdate creates an operation to update a TCP request rule in a backend.

func NewTCPRequestRuleFrontendCreate

func NewTCPRequestRuleFrontendCreate(frontendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleFrontendCreate creates an operation to create a TCP request rule in a frontend.

func NewTCPRequestRuleFrontendDelete

func NewTCPRequestRuleFrontendDelete(frontendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleFrontendDelete creates an operation to delete a TCP request rule from a frontend.

func NewTCPRequestRuleFrontendUpdate

func NewTCPRequestRuleFrontendUpdate(frontendName string, rule *models.TCPRequestRule, index int) Operation

NewTCPRequestRuleFrontendUpdate creates an operation to update a TCP request rule in a frontend.

func NewTCPResponseRuleBackendCreate

func NewTCPResponseRuleBackendCreate(backendName string, rule *models.TCPResponseRule, index int) Operation

NewTCPResponseRuleBackendCreate creates an operation to create a TCP response rule in a backend.

func NewTCPResponseRuleBackendDelete

func NewTCPResponseRuleBackendDelete(backendName string, rule *models.TCPResponseRule, index int) Operation

NewTCPResponseRuleBackendDelete creates an operation to delete a TCP response rule from a backend.

func NewTCPResponseRuleBackendUpdate

func NewTCPResponseRuleBackendUpdate(backendName string, rule *models.TCPResponseRule, index int) Operation

NewTCPResponseRuleBackendUpdate creates an operation to update a TCP response rule in a backend.

func NewTracesUpdate

func NewTracesUpdate(traces *models.Traces) Operation

NewTracesUpdate creates an operation to update the traces section. The traces section is a singleton - it can be created or replaced. Traces configuration is only available in HAProxy DataPlane API v3.1+.

func NewUserCreate

func NewUserCreate(userlistName string, user *models.User) Operation

NewUserCreate creates an operation to create a user in a userlist.

func NewUserDelete

func NewUserDelete(userlistName string, user *models.User) Operation

NewUserDelete creates an operation to delete a user from a userlist.

func NewUserUpdate

func NewUserUpdate(userlistName string, user *models.User) Operation

NewUserUpdate creates an operation to update a user in a userlist.

func NewUserlistCreate

func NewUserlistCreate(userlist *models.Userlist) Operation

NewUserlistCreate creates an operation to create a userlist section.

func NewUserlistDelete

func NewUserlistDelete(userlist *models.Userlist) Operation

NewUserlistDelete creates an operation to delete a userlist section.

func NewWAFGlobalCreate

func NewWAFGlobalCreate(wafGlobal *v32ee.WafGlobal) Operation

NewWAFGlobalCreate creates an operation to create the WAF global configuration. WAF global is a singleton section (only one per configuration).

func NewWAFGlobalDelete

func NewWAFGlobalDelete(wafGlobal *v32ee.WafGlobal) Operation

NewWAFGlobalDelete creates an operation to delete the WAF global configuration.

func NewWAFGlobalUpdate

func NewWAFGlobalUpdate(wafGlobal *v32ee.WafGlobal) Operation

NewWAFGlobalUpdate creates an operation to update the WAF global configuration.

func NewWAFProfileCreate

func NewWAFProfileCreate(profile *v32ee.WafProfile) Operation

NewWAFProfileCreate creates an operation to create a WAF profile. WAF profiles are only available in HAProxy Enterprise Edition v3.2+.

func NewWAFProfileDelete

func NewWAFProfileDelete(profile *v32ee.WafProfile) Operation

NewWAFProfileDelete creates an operation to delete a WAF profile.

func NewWAFProfileUpdate

func NewWAFProfileUpdate(profile *v32ee.WafProfile) Operation

NewWAFProfileUpdate creates an operation to update a WAF profile.

type OperationType

type OperationType int

OperationType represents the type of HAProxy configuration operation.

const (
	OperationCreate OperationType = iota
	OperationUpdate
	OperationDelete
)

type RuntimeReloadTracker

type RuntimeReloadTracker interface {
	// TriggeredReload returns true if the operation triggered a HAProxy reload
	// during its last execution. This is only meaningful for runtime-eligible
	// operations (server updates with empty transaction ID).
	TriggeredReload() bool
}

RuntimeReloadTracker is an optional interface for operations that can track whether they triggered a HAProxy reload during runtime execution. Only server update operations implement this interface since they can be executed via the runtime API without a transaction.

type ServerUpdateOp

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

ServerUpdateOp is a specialized operation for server updates that tracks whether the update triggered a HAProxy reload. This is needed because server updates can be executed via the runtime API (without transaction) and the DataPlane API returns 202 if a reload was required.

func (*ServerUpdateOp) BackendName

func (op *ServerUpdateOp) BackendName() string

BackendName returns the name of the backend containing this server. Used by the orchestrator for direct executor calls with version caching.

func (*ServerUpdateOp) Describe

func (op *ServerUpdateOp) Describe() string

func (*ServerUpdateOp) Execute

func (op *ServerUpdateOp) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

Execute performs the server update operation. When txID is empty (runtime execution), it tracks whether the operation triggered a reload.

func (*ServerUpdateOp) Priority

func (op *ServerUpdateOp) Priority() int

func (*ServerUpdateOp) Section

func (op *ServerUpdateOp) Section() string

func (*ServerUpdateOp) Server

func (op *ServerUpdateOp) Server() *models.Server

Server returns the server model being updated. Used by the orchestrator for direct executor calls with version caching.

func (*ServerUpdateOp) ServerName

func (op *ServerUpdateOp) ServerName() string

ServerName returns the name of the server being updated. Used by the orchestrator for direct executor calls with version caching.

func (*ServerUpdateOp) TriggeredReload

func (op *ServerUpdateOp) TriggeredReload() bool

TriggeredReload implements RuntimeReloadTracker interface. Returns true if the last Execute call triggered a HAProxy reload.

func (*ServerUpdateOp) Type

func (op *ServerUpdateOp) Type() OperationType

type SingletonOp

type SingletonOp[TModel any, TAPI any] struct {
	// contains filtered or unexported fields
}

SingletonOp handles operations for singleton sections like global, traces, or waf-global. Supports create, update, and delete operations for singleton resources.

func NewSingletonOp

func NewSingletonOp[TModel any, TAPI any](
	opType OperationType,
	sectionName string,
	priority int,
	model TModel,
	transformFn func(TModel) TAPI,
	executeFn ExecuteSingletonFunc[TAPI],
	describeFn func() string,
) *SingletonOp[TModel, TAPI]

NewSingletonOp creates a new singleton operation with the specified operation type.

func (*SingletonOp[TModel, TAPI]) Describe

func (op *SingletonOp[TModel, TAPI]) Describe() string

func (*SingletonOp[TModel, TAPI]) Execute

func (op *SingletonOp[TModel, TAPI]) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

func (*SingletonOp[TModel, TAPI]) Priority

func (op *SingletonOp[TModel, TAPI]) Priority() int

Priority returns the effective priority. Uses multiplier for compatibility with IndexChildOp.

func (*SingletonOp[TModel, TAPI]) Section

func (op *SingletonOp[TModel, TAPI]) Section() string

func (*SingletonOp[TModel, TAPI]) Type

func (op *SingletonOp[TModel, TAPI]) Type() OperationType

type TopLevelCRUD

type TopLevelCRUD[T any] struct {
	Create func(model T) Operation
	Update func(model T) Operation
	Delete func(model T) Operation
}

TopLevelCRUD holds pre-built Create/Update/Delete factory functions for a top-level resource.

func NewTopLevelCRUD

func NewTopLevelCRUD[T any](
	section, displayName string,
	priority int,
	nameFn func(T) string,
	createExec, updateExec, deleteExec ExecuteTopLevelFunc[T],
) TopLevelCRUD[T]

NewTopLevelCRUD creates a CRUD builder for a top-level resource (backend, frontend, etc.). The displayName is used in operation descriptions and may differ from the section name.

type TopLevelOp

type TopLevelOp[TModel any, TAPI any] struct {
	// contains filtered or unexported fields
}

TopLevelOp handles operations for top-level named resources like backend, frontend, defaults. These resources are identified by a single name and use DispatchCreate/Update/Delete.

func NewTopLevelOp

func NewTopLevelOp[TModel any, TAPI any](
	opType OperationType,
	sectionName string,
	priority int,
	model TModel,
	transformFn func(TModel) TAPI,
	nameFn func(TModel) string,
	executeFn ExecuteTopLevelFunc[TAPI],
	describeFn func() string,
) *TopLevelOp[TModel, TAPI]

NewTopLevelOp creates a new top-level operation.

func (*TopLevelOp[TModel, TAPI]) Describe

func (op *TopLevelOp[TModel, TAPI]) Describe() string

func (*TopLevelOp[TModel, TAPI]) Execute

func (op *TopLevelOp[TModel, TAPI]) Execute(ctx context.Context, c *client.DataplaneClient, txID string) error

func (*TopLevelOp[TModel, TAPI]) Priority

func (op *TopLevelOp[TModel, TAPI]) Priority() int

Priority returns the effective priority. Uses multiplier for compatibility with IndexChildOp.

func (*TopLevelOp[TModel, TAPI]) Section

func (op *TopLevelOp[TModel, TAPI]) Section() string

func (*TopLevelOp[TModel, TAPI]) Type

func (op *TopLevelOp[TModel, TAPI]) Type() OperationType

Directories

Path Synopsis
Package executors provides pre-built executor functions for HAProxy configuration operations.
Package executors provides pre-built executor functions for HAProxy configuration operations.

Jump to

Keyboard shortcuts

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