module

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2016 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Extension = ".hcl"

Extension is the extension used by module files

Variables

This section is empty.

Functions

func ImportGraph

func ImportGraph(main, path string) (*graph.Graph, error)

ImportGraph creates a DAG graph of the module imports for a given module. The resulting DAG graph can be used to determine the proper ordering of modules and also to detect whether we have circular imports in our modules.

func ImportGraphAsDot

func ImportGraphAsDot(main, path string, w io.Writer) error

ImportGraphAsDot creates a DOT representation of the module imports

Types

type Config

type Config struct {
	// Module path
	Path string

	// Configuration settings for the resources
	ResourceConfig *resource.Config
}

Config type contains configuration options for the module

type DiscoveredRegistry

type DiscoveredRegistry map[string]string

DiscoveredRegistry type contains discovered modules as returned by the Discover() function. Keys of the map are the module names and their values are the absolute path to the discovered module files.

func Discover

func Discover(root string) (DiscoveredRegistry, error)

Discover is used to discover valid modules in a given module path

type Import

type Import struct {
	// Name of the module that is imported
	Name string `hcl:"name"`

	// Path to the module file
	Path string `hcl:"path"`
}

Import type represents an import declaration

type LoadedRegistry

type LoadedRegistry map[string]*Module

LoadedRegistry type is a map which keys are the discovered modules from a given module path and their values are the actual loaded modules.

func DiscoverAndLoad

func DiscoverAndLoad(config *Config) (LoadedRegistry, error)

DiscoverAndLoad discovers valid modules from a given module path and attemps to load each valid module file.

type Module

type Module struct {
	// Name of the module
	Name string

	// Resources loaded from the module
	Resources []resource.Resource

	// Module imports
	Imports []Import

	// Configuration settings for the module
	Config *Config

	// Unknown keys found in the module
	UnknownKeys []string
}

Module type represents a collection of resources and module imports

func Load

func Load(name string, config *Config, r io.Reader) (*Module, error)

Load loads a module from the given HCL or JSON input

type ResourceMap

type ResourceMap map[string]resource.Resource

ResourceMap type is a map which keys are the resource ids and their values are the actual resources

func ResourceCollection

func ResourceCollection(modules []*Module) (ResourceMap, error)

ResourceCollection creates a map of the unique resources contained within the provided modules.

func (ResourceMap) DependencyGraph

func (rm ResourceMap) DependencyGraph() (*graph.Graph, error)

DependencyGraph builds a dependency graph for the resource collection

Jump to

Keyboard shortcuts

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