graph

package
v1.8.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package graph provides functionality to build a graph of connected nodes with a cfn.Template

Example (Get)
Output:

[]
[Parameters/AWS::AccountId Parameters/Name Resources/LogBucket]
[Resources/Bucket]
Example (GetReverse)
Output:

[Resources/Bucket]
[Outputs/BucketArn Outputs/BucketName]
[]
Example (Nodes)
Output:

Parameters/AWS::AccountId
Parameters/Name
Resources/LogBucket
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 Empty added in v1.7.0

func Empty() Graph

Empty returns a new, empty graph

func New

func New(t cft.Template) Graph

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) Get

func (g Graph) Get(item Node) []Node

Get returns all nodes that are connected to the item that you pass in.

func (Graph) GetReverse

func (g Graph) GetReverse(item Node) []Node

GetReverse returns all nodes that connect to the item that you pass in.

func (g *Graph) Link(item Node, links ...Node)

link creates a connection between two nodes in the graph

func (Graph) Nodes

func (g Graph) Nodes() []Node

Nodes returns all nodes of the graph, in order of their dependencies. Nodes with the fewest dependencies are at the beginning of the slice.

func (*Graph) String

func (g *Graph) String() string

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

func (Node) String

func (n Node) String() string

Jump to

Keyboard shortcuts

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