package yamlgraph
import "github.com/purpleidea/mgmt/yamlgraph"
Package yamlgraph provides the facilities for loading a graph from a yaml file.
Index ¶
- Constants
- type Edge
- type GAPI
- func (obj *GAPI) Cli(info *gapi.Info) (*gapi.Deploy, error)
- func (obj *GAPI) Close() error
- func (obj *GAPI) Graph() (*pgraph.Graph, error)
- func (obj *GAPI) Info() *gapi.InfoResult
- func (obj *GAPI) Init(data *gapi.Data) error
- func (obj *GAPI) Next() chan gapi.Next
- type GraphConfig
- func NewGraphConfigFromFile(data []byte, debug bool, logf func(format string, v ...interface{})) (*GraphConfig, error)
- func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World, noop bool) (*pgraph.Graph, error)
- func (obj *GraphConfig) Parse(data []byte) error
- func (obj *GraphConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
- type GraphConfigData
- type Resource
- func (r *Resource) Decode(kind string) (err error)
- func (r *Resource) UnmarshalYAML(unmarshal func(interface{}) error) error
- type ResourceData
- type Resources
- type Vertex
Constants ¶
const ( // Name is the name of this frontend. Name = "yaml" // Start is the entry point filename that we use. It is arbitrary. Start = "/start.yaml" )
Types ¶
type Edge ¶
type Edge struct { Name string `yaml:"name"` From Vertex `yaml:"from"` To Vertex `yaml:"to"` Notify bool `yaml:"notify"` }
Edge is the data structure of an edge.
type GAPI ¶
type GAPI struct { InputURI string // input URI of file system containing yaml graph to use // contains filtered or unexported fields }
GAPI implements the main yamlgraph GAPI interface.
func (*GAPI) Cli ¶
Cli takes an *Info struct, and returns our deploy if activated, and if there are any validation problems, you should return an error. If there is no deploy, then you should return a nil deploy and a nil error.
func (*GAPI) Close ¶
Close shuts down the yamlgraph GAPI.
func (*GAPI) Graph ¶
Graph returns a current Graph.
func (*GAPI) Info ¶
func (obj *GAPI) Info() *gapi.InfoResult
Info returns some data about the GAPI implementation.
func (*GAPI) Init ¶
Init initializes the yamlgraph GAPI struct.
func (*GAPI) Next ¶
Next returns nil errors every time there could be a new graph.
type GraphConfig ¶
type GraphConfig struct { GraphConfigData ResList []engine.Res Debug bool Logf func(format string, v ...interface{}) }
GraphConfig is the data structure that describes a single graph to run.
func NewGraphConfigFromFile ¶
func NewGraphConfigFromFile(data []byte, debug bool, logf func(format string, v ...interface{})) (*GraphConfig, error)
NewGraphConfigFromFile takes data and returns the graph config structure.
func (*GraphConfig) NewGraphFromConfig ¶
func (obj *GraphConfig) NewGraphFromConfig(hostname string, world engine.World, noop bool) (*pgraph.Graph, error)
NewGraphFromConfig transforms a GraphConfig struct into a new graph. FIXME: remove any possibly left over, now obsolete graph diff code from here! TODO: add a timeout to replace context.TODO()
func (*GraphConfig) Parse ¶
func (obj *GraphConfig) Parse(data []byte) error
Parse parses a data stream into the graph structure.
func (*GraphConfig) UnmarshalYAML ¶
func (obj *GraphConfig) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshalls the complete graph.
type GraphConfigData ¶
type GraphConfigData struct { Graph string `yaml:"graph"` Collector []collectorResConfig `yaml:"collect"` Edges []Edge `yaml:"edges"` Comment string `yaml:"comment"` }
GraphConfigData contains the graph data for GraphConfig.
type Resource ¶
type Resource struct { ResourceData // contains filtered or unexported fields }
Resource is the object that unmarshalls resources.
func (*Resource) Decode ¶
Decode is the second stage for unmarshaling of resources (knowing their kind).
func (*Resource) UnmarshalYAML ¶
UnmarshalYAML is the first stage for unmarshaling of resources.
type ResourceData ¶
type ResourceData struct { Name string `yaml:"name"` }
ResourceData are the parameters for resource format.
type Resources ¶
Resources is the object that unmarshalls list of resources.
type Vertex ¶
Vertex is the data structure of a vertex.
Source Files ¶
- Version
- v0.0.0-20250322185616-c50a578426f1 (latest)
- Published
- Mar 22, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 4 days ago –
Tools for package owners.