Documentation ¶
Index ¶
- Constants
- type Component
- type ComponentGroup
- func (cg ComponentGroup) ByGroup(tag, group string) ComponentGroup
- func (cg ComponentGroup) ByName(name string) ComponentGroup
- func (cg ComponentGroup) ByProviderID(id string) Component
- func (cg ComponentGroup) ByType(ctype string) ComponentGroup
- func (cg ComponentGroup) NameValues() []string
- func (cg ComponentGroup) TagValues(tag string) []string
- type Edge
- type GenericComponent
- func (gc *GenericComponent) Dependencies() []string
- func (gc *GenericComponent) Diff(v Component) (diff.Changelog, error)
- func (gc *GenericComponent) GetAction() string
- func (gc *GenericComponent) GetGroup() string
- func (gc *GenericComponent) GetID() string
- func (gc *GenericComponent) GetName() string
- func (gc *GenericComponent) GetProvider() string
- func (gc *GenericComponent) GetProviderID() string
- func (gc *GenericComponent) GetState() string
- func (gc *GenericComponent) GetTag(string) string
- func (gc *GenericComponent) GetTags() map[string]string
- func (gc *GenericComponent) GetType() string
- func (gc *GenericComponent) IsStateful() bool
- func (gc *GenericComponent) Rebuild(g *Graph)
- func (gc *GenericComponent) SequentialDependencies() []string
- func (gc *GenericComponent) SetAction(action string)
- func (gc *GenericComponent) SetDefaultVariables()
- func (gc *GenericComponent) SetState(state string)
- func (gc *GenericComponent) Update(v Component)
- func (gc *GenericComponent) Validate() error
- type Graph
- func (g *Graph) AddComponent(component Component) error
- func (g *Graph) Component(component string) Component
- func (g *Graph) ComponentAll(component string) Component
- func (g *Graph) Connect(source, destination string) error
- func (g *Graph) ConnectComplex(source, destination string) error
- func (g *Graph) ConnectComplexUpdate(source, destination string) error
- func (g *Graph) ConnectMutually(source, destination string) error
- func (g *Graph) Connected(source, destination string) bool
- func (g *Graph) DeleteComponent(component Component)
- func (g *Graph) Diff(og *Graph) (*Graph, error)
- func (g *Graph) DiffWithChangelog(og *Graph) (*Graph, error)
- func (g *Graph) DisconnectComponent(name string) error
- func (g *Graph) GetChanges() ComponentGroup
- func (g *Graph) GetComponents() ComponentGroup
- func (g *Graph) Graphviz() string
- func (g *Graph) HasComponent(componentID string) bool
- func (g *Graph) LengthBetween(source, destination string) int
- func (g *Graph) Load(gg map[string]interface{}) error
- func (g *Graph) Neighbours(component string) *Neighbours
- func (g *Graph) Origins(component string) *Neighbours
- func (g *Graph) SetDiffDependencies()
- func (g *Graph) SetStartFinish()
- func (g *Graph) ToJSON() ([]byte, error)
- func (g *Graph) UpdateComponent(component Component)
- type Neighbours
- type NodeStack
Constants ¶
const ( //ACTIONCREATE : action create ACTIONCREATE = "create" // ACTIONUPDATE : action update ACTIONUPDATE = "update" // ACTIONDELETE : action delete ACTIONDELETE = "delete" // ACTIONFIND : action find ACTIONFIND = "find" // ACTIONGET : action get ACTIONGET = "get" // ACTIONNONE : action none, component wont be processed ACTIONNONE = "none" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface { GetID() string // returns the ID of the component GetName() string // returns the name of the component GetProvider() string // returns the components provider GetProviderID() string // returns the components provider specific ID GetType() string // returns the type of component GetState() string // returns the state of the component. i.e. waiting, running, completed, errored SetState(string) // sets the state of the component GetAction() string // returns the action of the component, i.e. create, update, delete, get SetAction(string) // sets the action of the component GetGroup() string // returns the components group name GetTags() map[string]string // returns the tags associated with the component GetTag(string) string // returns the tag associated with the component Diff(Component) (diff.Changelog, error) // should return changelog Update(Component) // updates the values stored on the component Rebuild(*Graph) // rebuilds the internal state of the component, a component set is passed in Validate() error // validates the component's values Dependencies() []string // returns a collection of parent component id's SetDefaultVariables() // sets the default variables for a component IsStateful() bool // returns if the component is stateful. This is important to work out if a component can be skipped when deleting its dependencies (pruning). SequentialDependencies() []string // returns a list of origin components that restrict the execution of its dependents, allowing only one dependent component to be provisioned at a time (sequentially) }
Component : representation of a component
type ComponentGroup ¶
type ComponentGroup []Component
ComponentGroup holds a collection of components that can be filtered
func (ComponentGroup) ByGroup ¶
func (cg ComponentGroup) ByGroup(tag, group string) ComponentGroup
ByGroup ...
func (ComponentGroup) ByName ¶
func (cg ComponentGroup) ByName(name string) ComponentGroup
ByName ...
func (ComponentGroup) ByProviderID ¶
func (cg ComponentGroup) ByProviderID(id string) Component
ByProviderID ...
func (ComponentGroup) ByType ¶
func (cg ComponentGroup) ByType(ctype string) ComponentGroup
ByType ...
func (ComponentGroup) TagValues ¶
func (cg ComponentGroup) TagValues(tag string) []string
TagValues ...
type Edge ¶
type Edge struct { Source string `json:"source"` Destination string `json:"destination"` Length int `json:"length"` }
Edge ...
type GenericComponent ¶
type GenericComponent map[string]interface{}
GenericComponent is a representation of a component backed by a map[string]interface{}
func MapGenericComponent ¶
func MapGenericComponent(m map[string]interface{}) *GenericComponent
func (*GenericComponent) Dependencies ¶
func (gc *GenericComponent) Dependencies() []string
Dependencies : returns a list of component id's upon which the component depends
func (*GenericComponent) Diff ¶
func (gc *GenericComponent) Diff(v Component) (diff.Changelog, error)
Diff : diff's the component against another component of the same type
func (*GenericComponent) GetAction ¶
func (gc *GenericComponent) GetAction() string
GetAction : returns the action of the component
func (*GenericComponent) GetGroup ¶
func (gc *GenericComponent) GetGroup() string
GetGroup : returns the components group
func (*GenericComponent) GetID ¶
func (gc *GenericComponent) GetID() string
GetID : returns the component's ID
func (*GenericComponent) GetName ¶
func (gc *GenericComponent) GetName() string
GetName returns a components name
func (*GenericComponent) GetProvider ¶
func (gc *GenericComponent) GetProvider() string
GetProvider : returns the provider type
func (*GenericComponent) GetProviderID ¶
func (gc *GenericComponent) GetProviderID() string
GetProviderID returns a components provider id
func (*GenericComponent) GetState ¶
func (gc *GenericComponent) GetState() string
GetState : returns the state of the component
func (*GenericComponent) GetTag ¶
func (gc *GenericComponent) GetTag(string) string
GetTag returns a components tag
func (*GenericComponent) GetTags ¶
func (gc *GenericComponent) GetTags() map[string]string
GetTags returns a components tags
func (*GenericComponent) GetType ¶
func (gc *GenericComponent) GetType() string
GetType : returns the type of the component
func (*GenericComponent) IsStateful ¶
func (gc *GenericComponent) IsStateful() bool
IsStateful : returns true if the component needs to be actioned to be removed.
func (*GenericComponent) Rebuild ¶
func (gc *GenericComponent) Rebuild(g *Graph)
Rebuild : rebuilds the component's internal state, such as templated values
func (*GenericComponent) SequentialDependencies ¶
func (gc *GenericComponent) SequentialDependencies() []string
SequentialDependencies : returns a list of origin components that restrict the execution of its dependents, allowing only one dependent component to be provisioned at a time (sequentially)
func (*GenericComponent) SetAction ¶
func (gc *GenericComponent) SetAction(action string)
SetAction : Sets the action of the component
func (*GenericComponent) SetDefaultVariables ¶
func (gc *GenericComponent) SetDefaultVariables()
SetDefaultVariables : sets up the default template variables for a component
func (*GenericComponent) SetState ¶
func (gc *GenericComponent) SetState(state string)
SetState : sets the state of the component
func (*GenericComponent) Update ¶
func (gc *GenericComponent) Update(v Component)
Update : updates the provider returned values of a component
func (*GenericComponent) Validate ¶
func (gc *GenericComponent) Validate() error
Validate : validates the components values
type Graph ¶
type Graph struct { ID string `json:"id" diff:"-"` Name string `json:"name" diff:"-"` UserID int `json:"user_id" diff:"-"` Username string `json:"username" diff:"-"` Action string `json:"action" diff:"-"` Options map[string]interface{} `json:"options" diff:"-"` Components []Component `json:"components" diff:"components"` Changes []Component `json:"changes,omitempty" diff:"-"` Edges []Edge `json:"edges,omitempty" diff:"-"` Changelog diff.Changelog `json:"changelog,omitempty" diff:"-"` }
Graph ...
func (*Graph) AddComponent ¶
AddComponent adds a component to the graphs vertices if it does not already exist
func (*Graph) ComponentAll ¶
ComponentAll returns a component from either changes or components given the name matches
func (*Graph) ConnectComplex ¶
ConnectComplex adds a dependency between two vertices. If the source has more than 1 neighbouring vertex, the destination vertex will be connected to that.
func (*Graph) ConnectComplexUpdate ¶
ConnectComplexUpdate adds a dependency between two vertices. If the source has more than 1 neighbouring vertex, the destination vertex will be connected to that.
func (*Graph) ConnectMutually ¶
ConnectMutually connects two vertices to eachother
func (*Graph) DeleteComponent ¶
DeleteComponent deletes a component from the graph
func (*Graph) Diff ¶
Diff : diff two graphs, new, modified or removed components will be moved to Changes, and components will be
func (*Graph) DiffWithChangelog ¶
DiffWithChangelog : produces a new build graph and changelog
func (*Graph) DisconnectComponent ¶
DisconnectComponent removes a component from the graph. It will connect any neighbour/origin components together
func (*Graph) GetChanges ¶
func (g *Graph) GetChanges() ComponentGroup
GetChanges returns a component group that can be filtered
func (*Graph) GetComponents ¶
func (g *Graph) GetComponents() ComponentGroup
GetComponents returns a component group that can be filtered
func (*Graph) HasComponent ¶
HasComponent finds if the specified component exists
func (*Graph) LengthBetween ¶
LengthBetween returns the length between two edges
func (*Graph) Neighbours ¶
func (g *Graph) Neighbours(component string) *Neighbours
Neighbours returns all depencencies of a component
func (*Graph) Origins ¶
func (g *Graph) Origins(component string) *Neighbours
Origins returns all source components of a component
func (*Graph) SetDiffDependencies ¶
func (g *Graph) SetDiffDependencies()
SetDiffDependencies rebuilds the graph's dependencies when diffing
func (*Graph) SetStartFinish ¶
func (g *Graph) SetStartFinish()
SetStartFinish sets a start and finish point
func (*Graph) UpdateComponent ¶
UpdateComponent updates the graph
type Neighbours ¶
type Neighbours []Component
Neighbours represents a collection of dependent vertices
func (*Neighbours) Exists ¶
func (n *Neighbours) Exists(component string) bool
Exists checks if the group contains the component
func (*Neighbours) GetComponentGroup ¶
func (n *Neighbours) GetComponentGroup(group string) Component
GetComponentGroup returns the first item in a components group
func (*Neighbours) GetSequentialDependency ¶
func (n *Neighbours) GetSequentialDependency(id string) Component
GetSequentialDependency retuens the sequentially dependent component based on a given id if given
func (*Neighbours) Unique ¶
func (n *Neighbours) Unique() *Neighbours
Unique returns a new collection of Vertices that are unique