Documentation ¶
Overview ¶
Package graph provides functionality to build a graph of connected nodes with a cfn.Template
Example (Get) ¶
package main import ( "fmt" "github.com/aws-cloudformation/rain/cft/graph" ) var g graph.Graph func main() { fmt.Println(g.Get(graph.Node{"Parameters", "Name"})) fmt.Println(g.Get(graph.Node{"Resources", "Bucket"})) fmt.Println(g.Get(graph.Node{"Outputs", "BucketName"})) }
Output: [] [Parameters/AWS::AccountId Parameters/Name] [Resources/Bucket]
Example (GetReverse) ¶
package main import ( "fmt" "github.com/aws-cloudformation/rain/cft/graph" ) var g graph.Graph func main() { fmt.Println(g.GetReverse(graph.Node{"Parameters", "Name"})) fmt.Println(g.GetReverse(graph.Node{"Resources", "Bucket"})) fmt.Println(g.GetReverse(graph.Node{"Outputs", "BucketName"})) }
Output: [Resources/Bucket] [Outputs/BucketArn Outputs/BucketName] []
Example (Nodes) ¶
package main import ( "fmt" "github.com/aws-cloudformation/rain/cft/graph" ) var g graph.Graph func main() { for _, node := range g.Nodes() { fmt.Println(node) } }
Output: Parameters/AWS::AccountId Parameters/Name Resources/Bucket Outputs/BucketArn Outputs/BucketName
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph represents a directed, acyclic graph with ordered nodes
func New ¶
New returns a Graph representing the connections between elements in the provided template. The type of each item in the graph is Node
func (Graph) GetReverse ¶
GetReverse returns all nodes that connect to the item that you pass in.
type Node ¶
type Node struct { // Type is the name of the top-level part of a template // that contains this Node (e.g. Resources, Parameters) Type string // Name is the name of the Node Name string }
Node represents a top-level entry in a CloudFormation template for example a resource, parameter, or output
Click to show internal directories.
Click to hide internal directories.