models

package
v2.3.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2018 License: Apache-2.0 Imports: 22 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PseudoZeroTime = time.Time{}.Add(time.Nanosecond)

A hack to workaround the IsZero() in timeutils.Utcify. This depends on the fact that database time has a resolution of 1-second

Functions

func GetModels

func GetModels(opts *GetModelsOptions) error

func InitializeModelSetFromJSON

func InitializeModelSetFromJSON(set IModelSet, entriesJson []jsonutils.JSONObject) error

func ModelSetMaxUpdatedAt

func ModelSetMaxUpdatedAt(set IModelSet) time.Time

func ModelSetsMaxUpdatedAtSetField

func ModelSetsMaxUpdatedAtSetField(mssmua *ModelSetsMaxUpdatedAt, keyPlural string, t time.Time)

Types

type AgentParams

type AgentParams struct {
	AgentModel           *models.LoadbalancerAgent
	KeepalivedConfigTmpl *template.Template
	HaproxyConfigTmpl    *template.Template
	Data                 map[string]interface{}
}

func NewAgentParams

func NewAgentParams(agent *models.LoadbalancerAgent) (*AgentParams, error)

func (*AgentParams) Equal

func (p *AgentParams) Equal(p2 *AgentParams) bool

func (*AgentParams) KeepalivedConfig

func (p *AgentParams) KeepalivedConfig()

func (*AgentParams) SetHaproxyParams

func (p *AgentParams) SetHaproxyParams(k string, v interface{}) map[string]interface{}

func (*AgentParams) SetVrrpParams

func (p *AgentParams) SetVrrpParams(k string, v interface{}) map[string]interface{}

type GenGobetweenConfigOptions

type GenGobetweenConfigOptions struct {
	LoadbalancersEnabled []*Loadbalancer
	AgentParams          *AgentParams

	Config *gobetween.Config
}

type GenHaproxyConfigsResult

type GenHaproxyConfigsResult struct {
	LoadbalancersEnabled []*Loadbalancer
}

type GenKeepalivedConfigOptions

type GenKeepalivedConfigOptions struct {
	LoadbalancersEnabled []*Loadbalancer
	AgentParams          *AgentParams
}

type GetModelsOptions

type GetModelsOptions struct {
	ClientSession *mcclient.ClientSession
	ModelManager  modules.Manager
	ModelSet      IModelSet

	BatchListSize int
	MinUpdatedAt  time.Time
}

type IModel

type IModel interface {
}

type IModelSet

type IModelSet interface {
	//InitializeFromJSON([]jsonutils.JSONObject) error
	ModelManager() modules.Manager
	NewModel() models.IVirtualResource
	// contains filtered or unexported methods
}

type Loadbalancer

type Loadbalancer struct {
	*models.Loadbalancer
	// contains filtered or unexported fields
}

type LoadbalancerAcl

type LoadbalancerAcl struct {
	*models.LoadbalancerAcl
}

type LoadbalancerAcls

type LoadbalancerAcls map[string]*LoadbalancerAcl

func (LoadbalancerAcls) ModelManager

func (set LoadbalancerAcls) ModelManager() modules.Manager

func (LoadbalancerAcls) NewModel

func (set LoadbalancerAcls) NewModel() models.IVirtualResource

type LoadbalancerBackend

type LoadbalancerBackend struct {
	*models.LoadbalancerBackend
}

type LoadbalancerBackendGroup

type LoadbalancerBackendGroup struct {
	*models.LoadbalancerBackendGroup
	// contains filtered or unexported fields
}

type LoadbalancerBackendGroups

type LoadbalancerBackendGroups map[string]*LoadbalancerBackendGroup

func (LoadbalancerBackendGroups) JoinBackends

func (ms LoadbalancerBackendGroups) JoinBackends(subEntries LoadbalancerBackends) bool

func (LoadbalancerBackendGroups) ModelManager

func (set LoadbalancerBackendGroups) ModelManager() modules.Manager

func (LoadbalancerBackendGroups) NewModel

type LoadbalancerBackends

type LoadbalancerBackends map[string]*LoadbalancerBackend

func (LoadbalancerBackends) ModelManager

func (set LoadbalancerBackends) ModelManager() modules.Manager

func (LoadbalancerBackends) NewModel

type LoadbalancerCertificate

type LoadbalancerCertificate struct {
	*models.LoadbalancerCertificate
}

type LoadbalancerCertificates

type LoadbalancerCertificates map[string]*LoadbalancerCertificate

func (LoadbalancerCertificates) ModelManager

func (set LoadbalancerCertificates) ModelManager() modules.Manager

func (LoadbalancerCertificates) NewModel

type LoadbalancerCorpus

type LoadbalancerCorpus struct {
	*ModelSets
	ModelSetsMaxUpdatedAt *ModelSetsMaxUpdatedAt
}

func NewEmptyLoadbalancerCorpus

func NewEmptyLoadbalancerCorpus() *LoadbalancerCorpus

func (*LoadbalancerCorpus) GenGobetweenConfigs

func (b *LoadbalancerCorpus) GenGobetweenConfigs(dir string, opts *GenGobetweenConfigOptions) error

func (*LoadbalancerCorpus) GenHaproxyConfigs

func (b *LoadbalancerCorpus) GenHaproxyConfigs(dir string, opts *AgentParams) (*GenHaproxyConfigsResult, error)

func (*LoadbalancerCorpus) GenHaproxyToplevelConfig

func (b *LoadbalancerCorpus) GenHaproxyToplevelConfig(dir string, opts *AgentParams) error

func (*LoadbalancerCorpus) GenKeepalivedConfigs

func (b *LoadbalancerCorpus) GenKeepalivedConfigs(dir string, opts *GenKeepalivedConfigOptions) error

func (*LoadbalancerCorpus) LoadDir

func (b *LoadbalancerCorpus) LoadDir(dir string) error

func (*LoadbalancerCorpus) MaxSeenUpdatedAtParams

func (b *LoadbalancerCorpus) MaxSeenUpdatedAtParams() *jsonutils.JSONDict

func (*LoadbalancerCorpus) SaveDir

func (b *LoadbalancerCorpus) SaveDir(dir string) error

func (*LoadbalancerCorpus) SyncModelSets

func (b *LoadbalancerCorpus) SyncModelSets(s *mcclient.ClientSession, batchSize int) (*ModelSetsUpdateResult, error)

type LoadbalancerListener

type LoadbalancerListener struct {
	*models.LoadbalancerListener
	// contains filtered or unexported fields
}

type LoadbalancerListenerRule

type LoadbalancerListenerRule struct {
	*models.LoadbalancerListenerRule
	// contains filtered or unexported fields
}

type LoadbalancerListenerRules

type LoadbalancerListenerRules map[string]*LoadbalancerListenerRule

func (LoadbalancerListenerRules) ModelManager

func (set LoadbalancerListenerRules) ModelManager() modules.Manager

func (LoadbalancerListenerRules) NewModel

type LoadbalancerListeners

type LoadbalancerListeners map[string]*LoadbalancerListener

func (LoadbalancerListeners) JoinCertificates

func (ms LoadbalancerListeners) JoinCertificates(subEntries LoadbalancerCertificates) bool

func (LoadbalancerListeners) JoinListenerRules

func (ms LoadbalancerListeners) JoinListenerRules(subEntries LoadbalancerListenerRules) bool

func (LoadbalancerListeners) ModelManager

func (set LoadbalancerListeners) ModelManager() modules.Manager

func (LoadbalancerListeners) NewModel

type Loadbalancers

type Loadbalancers map[string]*Loadbalancer

func (Loadbalancers) JoinBackendGroups

func (ms Loadbalancers) JoinBackendGroups(subEntries LoadbalancerBackendGroups) bool

func (Loadbalancers) JoinListeners

func (ms Loadbalancers) JoinListeners(subEntries LoadbalancerListeners) bool

func (Loadbalancers) ModelManager

func (set Loadbalancers) ModelManager() modules.Manager

func (Loadbalancers) NewModel

func (set Loadbalancers) NewModel() models.IVirtualResource

type ModelSetUpdateResult

type ModelSetUpdateResult struct {
	Changed      bool
	MaxUpdatedAt time.Time
}

func ModelSetApplyUpdates

func ModelSetApplyUpdates(aSet, bSet IModelSet) *ModelSetUpdateResult

ModelSetApplyUpdates applies bSet to aSet.

  • PendingDeleted in bSet are removed from aSet
  • Newer models in bSet are updated in aSet

type ModelSets

type ModelSets struct {
	Loadbalancers             Loadbalancers
	LoadbalancerListeners     LoadbalancerListeners
	LoadbalancerListenerRules LoadbalancerListenerRules
	LoadbalancerBackendGroups LoadbalancerBackendGroups
	LoadbalancerBackends      LoadbalancerBackends
	LoadbalancerAcls          LoadbalancerAcls
	LoadbalancerCertificates  LoadbalancerCertificates
}

func NewModelSets

func NewModelSets() *ModelSets

func (*ModelSets) ApplyUpdates

func (mss *ModelSets) ApplyUpdates(mssNews *ModelSets) *ModelSetsUpdateResult

func (*ModelSets) MaxSeenUpdatedAtParams

func (mss *ModelSets) MaxSeenUpdatedAtParams() *jsonutils.JSONDict

func (*ModelSets) ModelSetList

func (mss *ModelSets) ModelSetList() []IModelSet

type ModelSetsMaxUpdatedAt

type ModelSetsMaxUpdatedAt struct {
	Loadbalancers             time.Time
	LoadbalancerListeners     time.Time
	LoadbalancerListenerRules time.Time
	LoadbalancerBackendGroups time.Time
	LoadbalancerBackends      time.Time
	LoadbalancerAcls          time.Time
	LoadbalancerCertificates  time.Time
}

func NewModelSetsMaxUpdatedAt

func NewModelSetsMaxUpdatedAt() *ModelSetsMaxUpdatedAt

type ModelSetsUpdateResult

type ModelSetsUpdateResult struct {
	Correct               bool // all elements referenced are present
	Changed               bool // any thing changed in the corpus
	ModelSetsMaxUpdatedAt *ModelSetsMaxUpdatedAt
}

Jump to

Keyboard shortcuts

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