graph

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlastRadius

type BlastRadius struct {
	ResourceID     string   `json:"resource_id"`
	DirectImpact   []string `json:"direct_impact"`
	IndirectImpact []string `json:"indirect_impact"`
	TotalImpact    int      `json:"total_impact"`
	TotalAffected  int      `json:"total_affected"`
	MaxDepth       int      `json:"max_depth"`
}

BlastRadius represents the impact of removing a resource

type DependencyGraph

type DependencyGraph struct {
	// contains filtered or unexported fields
}

DependencyGraph represents a graph of resource dependencies

func NewDependencyGraph

func NewDependencyGraph() *DependencyGraph

NewDependencyGraph creates a new dependency graph

func (*DependencyGraph) BuildFromState

func (dg *DependencyGraph) BuildFromState(state *state.TerraformState) error

BuildFromState builds a dependency graph from a Terraform state

func (*DependencyGraph) CalculateBlastRadius

func (dg *DependencyGraph) CalculateBlastRadius(resourceID string) *BlastRadius

CalculateBlastRadius calculates the impact of removing a resource

func (*DependencyGraph) DetectCycles

func (dg *DependencyGraph) DetectCycles() [][]string

DetectCycles detects cycles in the dependency graph

func (*DependencyGraph) Edges

func (dg *DependencyGraph) Edges() map[string][]string

Edges property for compatibility

func (*DependencyGraph) GetBlastRadius

func (dg *DependencyGraph) GetBlastRadius(address string) []string

GetBlastRadius returns all resources affected by a change

func (*DependencyGraph) GetCriticalPath

func (dg *DependencyGraph) GetCriticalPath() []string

GetCriticalPath returns the longest dependency chain

func (*DependencyGraph) GetDependencies

func (dg *DependencyGraph) GetDependencies(resourceID string) []string

GetDependencies returns dependencies of a resource

func (*DependencyGraph) GetDependents

func (dg *DependencyGraph) GetDependents(address string) []string

GetDependents returns all resources that depend on this resource

func (*DependencyGraph) GetEdges

func (dg *DependencyGraph) GetEdges() []Edge

GetEdges returns all edges

func (*DependencyGraph) GetLeafNodes

func (dg *DependencyGraph) GetLeafNodes() []string

GetLeafNodes returns nodes with no dependents

func (*DependencyGraph) GetNode

func (dg *DependencyGraph) GetNode(address string) (*ResourceNode, bool)

GetNode returns a node by address

func (*DependencyGraph) GetNodes

func (dg *DependencyGraph) GetNodes() map[string]*ResourceNode

GetNodes returns all nodes

func (*DependencyGraph) GetOrphanedResources

func (dg *DependencyGraph) GetOrphanedResources() []string

GetOrphanedResources returns resources with no dependencies or dependents

func (*DependencyGraph) GetResource

func (dg *DependencyGraph) GetResource(id string) *ResourceNode

GetResource returns a resource node by ID (alias for GetNode)

func (*DependencyGraph) GetRootNodes

func (dg *DependencyGraph) GetRootNodes() []string

GetRootNodes returns nodes with no dependencies

func (*DependencyGraph) GetTransitiveDependencies

func (dg *DependencyGraph) GetTransitiveDependencies(address string) []string

GetTransitiveDependencies returns all transitive dependencies

func (*DependencyGraph) GetTransitiveDependents

func (dg *DependencyGraph) GetTransitiveDependents(address string) []string

GetTransitiveDependents returns all transitive dependents

func (*DependencyGraph) Nodes

func (dg *DependencyGraph) Nodes() map[string]*ResourceNode

Nodes property for compatibility

func (*DependencyGraph) TopologicalSort

func (dg *DependencyGraph) TopologicalSort() ([]string, error)

TopologicalSort returns nodes in topological order

type DependencyGraphBuilder

type DependencyGraphBuilder struct {
	// contains filtered or unexported fields
}

DependencyGraphBuilder builds dependency graphs from state

func NewDependencyGraphBuilder

func NewDependencyGraphBuilder(state *state.TerraformState) *DependencyGraphBuilder

NewDependencyGraphBuilder creates a new dependency graph builder

func (*DependencyGraphBuilder) Build

Build builds the dependency graph

type Edge

type Edge struct {
	From string `json:"from"`
	To   string `json:"to"`
	Type string `json:"type"` // explicit, implicit, or data
}

Edge represents a dependency relationship

type Node

type Node = ResourceNode

Node alias for ResourceNode for compatibility

type ResourceNode

type ResourceNode struct {
	Address      string                 `json:"address"`
	Type         string                 `json:"type"`
	Name         string                 `json:"name"`
	Provider     string                 `json:"provider"`
	Module       string                 `json:"module,omitempty"`
	Attributes   map[string]interface{} `json:"attributes,omitempty"`
	Dependencies []string               `json:"dependencies"`
	Dependents   []string               `json:"dependents"`
	Level        int                    `json:"level"` // Topological level
}

ResourceNode represents a node in the dependency graph

func (*ResourceNode) GetDependencies

func (n *ResourceNode) GetDependencies() []string

GetDependencies returns the dependencies of this resource

func (*ResourceNode) GetDependents

func (n *ResourceNode) GetDependents() []string

GetDependents returns the dependents of this resource

Jump to

Keyboard shortcuts

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